import {useLocalSearchParams} from 'expo-router'

import {ModalListScreen} from '@/components/modal-list-screen'
import {UserList} from '@/components/user-list'
import {usePagedListScreen} from '@/hooks/use-paged-list-screen'
import {profileFriends} from '@/stores/profile'

export default function ProfileFriendsScreen() {
  const {userId} = useLocalSearchParams<{userId: string}>()
  const {items, loading, loadingMore, screenProps} =
    usePagedListScreen(profileFriends, userId)

  return (
    <ModalListScreen title="Friends" {...screenProps}>
      <UserList
        users={items}
        loading={loading}
        loadingMore={loadingMore}
        emptyMessage="No friends yet"
      />
    </ModalListScreen>
  )
}
