feat: emoji packs

This commit is contained in:
codytseng 2025-11-07 22:36:07 +08:00
parent 0e550d2511
commit 1e2385da3b
41 changed files with 646 additions and 59 deletions

View file

@ -0,0 +1,43 @@
import EmojiPackList from '@/components/EmojiPackList'
import NoteList from '@/components/NoteList'
import Tabs from '@/components/Tabs'
import { BIG_RELAY_URLS } from '@/constants'
import SecondaryPageLayout from '@/layouts/SecondaryPageLayout'
import { useUserTrust } from '@/providers/UserTrustProvider'
import { kinds } from 'nostr-tools'
import { forwardRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
type TTab = 'my-packs' | 'explore'
const EmojiPackSettingsPage = forwardRef(({ index }: { index?: number }, ref) => {
const { t } = useTranslation()
const { hideUntrustedNotes } = useUserTrust()
const [tab, setTab] = useState<TTab>('my-packs')
return (
<SecondaryPageLayout ref={ref} index={index} title={t('Emoji Packs')} displayScrollToTopButton>
<Tabs
value={tab}
tabs={[
{ value: 'my-packs', label: 'My Packs' },
{ value: 'explore', label: 'Explore' }
]}
onTabChange={(tab) => {
setTab(tab as TTab)
}}
/>
{tab === 'my-packs' ? (
<EmojiPackList />
) : (
<NoteList
showKinds={[kinds.Emojisets]}
subRequests={[{ urls: BIG_RELAY_URLS, filter: {} }]}
hideUntrustedNotes={hideUntrustedNotes}
/>
)}
</SecondaryPageLayout>
)
})
EmojiPackSettingsPage.displayName = 'EmojiPackSettingsPage'
export default EmojiPackSettingsPage

View file

@ -9,7 +9,6 @@ import { useContentPolicy } from '@/providers/ContentPolicyProvider'
import { useUserTrust } from '@/providers/UserTrustProvider'
import { TMediaAutoLoadPolicy } from '@/types'
import { SelectValue } from '@radix-ui/react-select'
import { ExternalLink } from 'lucide-react'
import { forwardRef, HTMLProps, useState } from 'react'
import { useTranslation } from 'react-i18next'
@ -109,22 +108,6 @@ const GeneralSettingsPage = forwardRef(({ index }: { index?: number }, ref) => {
</Label>
<Switch id="show-nsfw" checked={defaultShowNsfw} onCheckedChange={setDefaultShowNsfw} />
</SettingItem>
<SettingItem>
<div>
<a
className="flex items-center gap-1 cursor-pointer hover:underline"
href="https://emojito.meme/browse"
target="_blank"
rel="noopener noreferrer"
>
{t('Custom emoji management')}
<ExternalLink />
</a>
<div className="text-muted-foreground">
{t('After changing emojis, you may need to refresh the page')}
</div>
</div>
</SettingItem>
</div>
</SecondaryPageLayout>
)