import { toRelaySettings } from '@/lib/link' import { simplifyUrl } from '@/lib/url' import { SecondaryPageLink } from '@/PageManager' import { useFeed } from '@/providers/FeedProvider' import { useNostr } from '@/providers/NostrProvider' import { useRelaySets } from '@/providers/RelaySetsProvider' import { Circle, CircleCheck } from 'lucide-react' import { useTranslation } from 'react-i18next' import RelaySetCard from '../RelaySetCard' export default function FeedSwitcher({ close }: { close?: () => void }) { const { t } = useTranslation() const { feedType, switchFeed, activeRelaySetId, temporaryRelayUrls } = useFeed() const { pubkey } = useNostr() const { relaySets } = useRelaySets() return (
{pubkey && ( { if (!pubkey) return switchFeed('following', { pubkey }) close?.() }} /> )}
{t('relay sets')}
close?.()} > {t('edit')}
{temporaryRelayUrls.length > 0 && ( { switchFeed('temporary') close?.() }} /> )} {relaySets .filter((set) => set.relayUrls.length > 0) .map((set) => ( { if (!select) return switchFeed('relays', { activeRelaySetId: set.id }) close?.() }} /> ))}
) } function FeedSwitcherItem({ itemName, isActive, temporary = false, onClick }: { itemName: string isActive: boolean temporary?: boolean onClick: () => void }) { return (
{itemName}
) } function FeedToggle({ isActive }: { isActive: boolean }) { return isActive ? ( ) : ( ) }