import {useLocalSearchParams} from 'expo-router'

import {ModalListScreen} from '@/components/modal-list-screen'
import {TrailList} from '@/components/trail-list'
import {usePagedListScreen} from '@/hooks/use-paged-list-screen'
import {profileTrails} from '@/stores/profile'

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

  return (
    <ModalListScreen title="Trails" {...screenProps}>
      <TrailList
        trails={items}
        loading={loading}
        loadingMore={loadingMore}
        emptyMessage="No trails yet"
      />
    </ModalListScreen>
  )
}
