Hide redundant account NSFW controls on NSFW nodes

Hop-State: A_06FP9K52MYKP328EHYDE018
Hop-Proposal: R_06FP9K42QBKY7ZFP7NX001R
Hop-Task: T_06FP9JMAC3NYKCMJFBPQSM0
Hop-Attempt: AT_06FP9JMAC20R8XKDE9B6M7R
This commit is contained in:
2026-07-15 01:02:40 -07:00
committed by Hop
parent f435e62220
commit be3425994f
4 changed files with 74 additions and 16 deletions
+36 -1
View File
@@ -5,6 +5,8 @@ import Link from 'next/link';
import { ArrowLeftIcon } from '@/components/Icons';
import { Eye, EyeOff, AlertTriangle, Check } from 'lucide-react';
import { useAuth } from '@/lib/contexts/AuthContext';
import { useRuntimeConfig } from '@/lib/contexts/ConfigContext';
import { shouldExposeAccountNsfwSettings } from '@/lib/nsfw/settings-visibility';
interface NsfwSettings {
nsfwEnabled: boolean;
@@ -14,6 +16,7 @@ interface NsfwSettings {
export default function ContentSettingsPage() {
const { isIdentityUnlocked, signUserAction, setShowUnlockPrompt } = useAuth();
const { config, isLoading: configLoading } = useRuntimeConfig();
const [settings, setSettings] = useState<NsfwSettings | null>(null);
const [loading, setLoading] = useState(true);
const [saving, setSaving] = useState(false);
@@ -162,7 +165,7 @@ export default function ContentSettingsPage() {
}
};
if (loading) {
if (loading || configLoading) {
return (
<div style={{ maxWidth: '600px', margin: '0 auto', padding: '24px 16px 64px' }}>
<div style={{ textAlign: 'center', padding: '48px', color: 'var(--foreground-tertiary)' }}>
@@ -172,6 +175,38 @@ export default function ContentSettingsPage() {
);
}
if (!shouldExposeAccountNsfwSettings(config?.isNsfw ?? false)) {
return (
<div style={{ maxWidth: '600px', margin: '0 auto', padding: '24px 16px 64px' }}>
<header style={{
display: 'flex',
alignItems: 'center',
gap: '16px',
marginBottom: '32px',
}}>
<Link href="/settings" style={{ color: 'var(--foreground)' }}>
<ArrowLeftIcon />
</Link>
<div>
<h1 style={{ fontSize: '24px', fontWeight: 700 }}>Content Settings</h1>
<p style={{ color: 'var(--foreground-tertiary)', fontSize: '14px' }}>
Content visibility is managed by this node
</p>
</div>
</header>
<div className="card" style={{ padding: '20px' }}>
<div style={{ fontWeight: 600, marginBottom: '8px' }}>
NSFW content is enabled on this node
</div>
<div style={{ color: 'var(--foreground-secondary)', fontSize: '14px', lineHeight: 1.6 }}>
This node is designated NSFW, so NSFW viewing and account sensitivity are handled at the node level. Theres nothing to configure for this account.
</div>
</div>
</div>
);
}
return (
<div style={{ maxWidth: '600px', margin: '0 auto', padding: '24px 16px 64px' }}>
<header style={{
+23 -15
View File
@@ -3,8 +3,14 @@
import Link from 'next/link';
import { Rocket, Shield, Bell, Eye, UserX, HardDrive } from 'lucide-react';
import { useRuntimeConfig } from '@/lib/contexts/ConfigContext';
import { shouldExposeAccountNsfwSettings } from '@/lib/nsfw/settings-visibility';
export default function SettingsPage() {
const { config, isLoading: configLoading } = useRuntimeConfig();
const showContentSettings = !configLoading
&& shouldExposeAccountNsfwSettings(config?.isNsfw ?? false);
return (
<>
<header style={{
@@ -43,21 +49,23 @@ export default function SettingsPage() {
</Link>
<Link href="/settings/content" className="card" style={{
display: 'block',
padding: '20px',
textDecoration: 'none',
color: 'var(--foreground)',
transition: 'border-color 0.15s ease',
}}>
<div style={{ fontWeight: 600, marginBottom: '8px', display: 'flex', alignItems: 'center', gap: '8px' }}>
<Eye size={18} />
Content Settings
</div>
<div style={{ color: 'var(--foreground-secondary)', fontSize: '14px' }}>
NSFW preferences and content visibility
</div>
</Link>
{showContentSettings && (
<Link href="/settings/content" className="card" style={{
display: 'block',
padding: '20px',
textDecoration: 'none',
color: 'var(--foreground)',
transition: 'border-color 0.15s ease',
}}>
<div style={{ fontWeight: 600, marginBottom: '8px', display: 'flex', alignItems: 'center', gap: '8px' }}>
<Eye size={18} />
Content Settings
</div>
<div style={{ color: 'var(--foreground-secondary)', fontSize: '14px' }}>
NSFW preferences and content visibility
</div>
</Link>
)}
<Link href="/settings/privacy" className="card" style={{
display: 'block',