import {AuthGate} from '@/components/auth-gate'
import {FeedRow} from '@/components/feed-list'
import {PagedVirtualListScreen} from '@/components/paged-virtual-list-screen'
import {useAuth} from '@/stores/auth'
import {feedList} from '@/stores/feed'

export default function FeedScreen() {
  return (
    <AuthGate>
      <FeedScreenInner />
    </AuthGate>
  )
}

function FeedScreenInner() {
  const user = useAuth((s) => s.user)
  return (
    <PagedVirtualListScreen
      resource={feedList}
      renderItem={(item) => (
        <FeedRow item={item} currentUserId={user?.id} />
      )}
      emptyMessage="No activity yet"
    />
  )
}
