import { RefreshButton } from '@/components/RefreshButton'
import SecondaryPageLayout from '@/layouts/SecondaryPageLayout'
import { usePrimaryNoteView } from '@/contexts/primary-note-view-context'
import { usePrimaryPage } from '@/contexts/primary-page-context'
import { cn } from '@/lib/utils'
import {
useSmartBookmarkListNavigation,
useSmartFollowingListNavigation,
useSmartInterestListNavigation,
useSmartMuteListNavigation,
useSmartNotificationThreadFollowListNavigation,
useSmartNotificationThreadMuteListNavigation,
useSmartPinListNavigation,
useSmartSettingsNavigation,
useSmartUserEmojiListNavigation
} from '@/PageManager'
import {
toBookmarksList,
toEmojiSetsSettings,
toFollowSetsSettings,
toFollowingList,
toInterestsList,
toMuteList,
toNotificationThreadFollowList,
toNotificationThreadMuteList,
toPinsList,
toUserEmojiList
} from '@/lib/link'
import { useNostr } from '@/providers/NostrProvider'
import { Bookmark, Bell, BellOff, ChevronRight, Hash, Pin, Smile, Sticker, Users, VolumeX } from 'lucide-react'
import { forwardRef, HTMLProps, useCallback, useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
/**
* Hub for Nostr “personal lists” (mute list, follows, NIP-51 bookmarks, pins, interest topics, NIP-30 emoji list & sets) — not the same as NIP-B0 web bookmarks.
*/
const PersonalListsSettingsPage = forwardRef(
({ index, hideTitlebar = false }: { index?: number; hideTitlebar?: boolean }, ref) => {
const { t } = useTranslation()
const { pubkey } = useNostr()
const { navigate: navigatePrimary } = usePrimaryPage()
const { navigateToSettings } = useSmartSettingsNavigation()
const { navigateToMuteList } = useSmartMuteListNavigation()
const { navigateToFollowingList } = useSmartFollowingListNavigation()
const { navigateToBookmarkList } = useSmartBookmarkListNavigation()
const { navigateToNotificationThreadFollowList } = useSmartNotificationThreadFollowListNavigation()
const { navigateToNotificationThreadMuteList } = useSmartNotificationThreadMuteListNavigation()
const { navigateToPinList } = useSmartPinListNavigation()
const { navigateToInterestList } = useSmartInterestListNavigation()
const { navigateToUserEmojiList } = useSmartUserEmojiListNavigation()
const { registerPrimaryPanelRefresh } = usePrimaryNoteView()
const [contentKey, setContentKey] = useState(0)
const bump = useCallback(() => setContentKey((k) => k + 1), [])
useEffect(() => {
if (!hideTitlebar) {
registerPrimaryPanelRefresh(null)
return
}
registerPrimaryPanelRefresh(bump)
return () => registerPrimaryPanelRefresh(null)
}, [hideTitlebar, registerPrimaryPanelRefresh, bump])
return (
{t('Personal lists hub intro')}