feat: hide untrusted content button

This commit is contained in:
codytseng
2025-06-09 01:08:50 +08:00
parent 5913cc3b88
commit 963051e70d
12 changed files with 177 additions and 57 deletions

View File

@@ -1,3 +1,4 @@
import HideUntrustedContentButton from '@/components/HideUntrustedContentButton'
import NotificationList from '@/components/NotificationList'
import PrimaryPageLayout from '@/layouts/PrimaryPageLayout'
import { usePrimaryPage } from '@/PageManager'
@@ -35,9 +36,12 @@ function NotificationListPageTitlebar() {
const { t } = useTranslation()
return (
<div className="flex gap-2 items-center h-full pl-3">
<Bell />
<div className="text-lg font-semibold">{t('Notifications')}</div>
<div className="flex gap-2 items-center justify-between h-full pl-3">
<div className="flex items-center gap-2">
<Bell />
<div className="text-lg font-semibold">{t('Notifications')}</div>
</div>
<HideUntrustedContentButton type="notifications" size="titlebar-icon" />
</div>
)
}

View File

@@ -6,7 +6,6 @@ import SecondaryPageLayout from '@/layouts/SecondaryPageLayout'
import { cn } from '@/lib/utils'
import { useAutoplay } from '@/providers/AutoplayProvider'
import { useTheme } from '@/providers/ThemeProvider'
import { useUserTrust } from '@/providers/UserTrustProvider'
import { SelectValue } from '@radix-ui/react-select'
import { forwardRef, HTMLProps, useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -16,8 +15,6 @@ const GeneralSettingsPage = forwardRef(({ index }: { index?: number }, ref) => {
const [language, setLanguage] = useState<TLanguage>(i18n.language as TLanguage)
const { themeSetting, setThemeSetting } = useTheme()
const { autoplay, setAutoplay } = useAutoplay()
const { enabled: hideUntrustedEventsEnabled, updateEnabled: updateHideUntrustedEventsEnabled } =
useUserTrust()
const handleLanguageChange = (value: TLanguage) => {
i18n.changeLanguage(value)
@@ -66,19 +63,6 @@ const GeneralSettingsPage = forwardRef(({ index }: { index?: number }, ref) => {
</Label>
<Switch id="autoplay" checked={autoplay} onCheckedChange={setAutoplay} />
</SettingItem>
<SettingItem>
<Label htmlFor="hide-untrusted-events" className="text-base font-normal">
{t('Hide content from untrusted users')}
<div className="text-muted-foreground">
{t('Only show content from your followed users and the users they follow')}
</div>
</Label>
<Switch
id="hide-untrusted-events"
checked={hideUntrustedEventsEnabled}
onCheckedChange={updateHideUntrustedEventsEnabled}
/>
</SettingItem>
</div>
</SecondaryPageLayout>
)