import ImageWithLightbox from '@/components/ImageWithLightbox' import NormalFeed from '@/components/NormalFeed' import ProfileList from '@/components/ProfileList' import { Skeleton } from '@/components/ui/skeleton' import { useFetchEvent } from '@/hooks/useFetchEvent' import SecondaryPageLayout from '@/layouts/SecondaryPageLayout' import { getFollowPackInfoFromEvent } from '@/lib/event-metadata' import { cn } from '@/lib/utils' import { useNostr } from '@/providers/NostrProvider' import client from '@/services/client.service' import { TFeedSubRequest } from '@/types' import { forwardRef, useEffect, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' const FollowPackPage = forwardRef(({ id, index }: { id?: string; index?: number }, ref) => { const { t } = useTranslation() const [tab, setTab] = useState<'users' | 'feed'>('users') const { event, isFetching } = useFetchEvent(id) const { title, description, image, pubkeys } = useMemo(() => { if (!event) return { title: '', description: '', image: '', pubkeys: [] } return getFollowPackInfoFromEvent(event) }, [event]) if (isFetching) { return ( ) } if (!event) { return ( {t('Follow pack not found')} ) } return ( {/* Header */} {image && ( )} {title} {t('n users', { count: pubkeys.length })} {description && ( {description} )} setTab('users')} className={cn( 'px-3 py-1.5 text-sm font-medium rounded-l-lg transition-colors', tab === 'users' ? 'bg-background text-foreground shadow-sm' : 'text-muted-foreground hover:text-foreground' )} > {t('Users')} setTab('feed')} className={cn( 'px-3 py-1.5 text-sm font-medium rounded-r-lg transition-colors', tab === 'feed' ? 'bg-background text-foreground shadow-sm' : 'text-muted-foreground hover:text-foreground' )} > {t('Feed')} {/* Content */} {tab === 'users' && } {tab === 'feed' && pubkeys.length > 0 && } ) }) FollowPackPage.displayName = 'FollowPackPage' export default FollowPackPage function Feed({ pubkeys }: { pubkeys: string[] }) { const { pubkey: myPubkey } = useNostr() const [subRequests, setSubRequests] = useState([]) useEffect(() => { client.generateSubRequestsForPubkeys(pubkeys, myPubkey).then(setSubRequests) }, [pubkeys, myPubkey]) return }
{description}