feat(settings): drop the assistant/device/data/app entries (TODO 16, 17)

This commit is contained in:
xiaohan.yuan committed 2026-10-17 08:18:54 +08:00
1 parent bde041c12d
commit 401926d7eb
3 files changed
+228 -12

No files matched your search

+22 -3
View File
@@ -3,6 +3,7 @@ import { useSettingsStore } from '../stores/settings'
import ModelSettingsPanel from './ModelSettingsPanel'
import SourceSettingsNavigation from './SourceSettingsNavigation'
import { useSharedTheme } from '../useSharedTheme'
import { SOURCE_WINDOWS_SETTINGS_TABS } from './SourceSettingsNavigation'
import './settings-shell-source.css'
interface Props {
@@ -12,15 +13,33 @@ interface Props {
nativeWindow?: boolean
}
/**
* 用户指定的移除项(TODO 16/17):助理、设备连接、数据管理、应用管理。
* 原版 5.8.3 设置导航是 16 项(REA `ev_2309de12a003fca2c863a223cbda5bccad36b3af73e29bc309fdaed94745cf9e`,
* 8-9-13:111/145/179/213/247 · 323/357/391/425/459/493 · 569/603/637 · 694/728),
* 这里按用户要求只移除上述四项,其余保留(未接入的仍按原样显示为禁用+「暂未接入」)。
*/
const REMOVED_SETTINGS_TABS: readonly string[] = ['claw', 'deviceConnections', 'dataManagement', 'buddyApps']
/** 设置页可见导航(12 项)。 */
export const VISIBLE_SETTINGS_TABS = SOURCE_WINDOWS_SETTINGS_TABS.filter((tab) => !REMOVED_SETTINGS_TABS.includes(tab))
/** 旧导航/深链接可能指向已移除入口:回退到模型设置,避免落到空白页。 */
function normalizeSection(value: string | null | undefined): string {
if (!value) return 'model'
const normalized = value === 'models' ? 'model' : value
return REMOVED_SETTINGS_TABS.includes(normalized) ? 'model' : normalized
}
export default function SettingsDialog({ theme, onThemeChange, onClose, nativeWindow = false }: Props): React.JSX.Element {
const settings = useSettingsStore()
const [section, setSection] = useState(new URLSearchParams(location.search).get('section') ?? 'model')
const [section, setSection] = useState(() => normalizeSection(new URLSearchParams(location.search).get('section')))
const [createRequest, setCreateRequest] = useState(() => new URLSearchParams(location.search).get('action') === 'new' ? 1 : 0)
const [error, setError] = useState('')
useEffect(() => {
if (!nativeWindow) return
return window.ycode.app.onSettingsNavigate?.((next, action) => {
setError(''); setSection(next === 'models' ? 'model' : next)
setError(''); setSection(normalizeSection(next))
if (action === 'new') setCreateRequest(value => value + 1)
})
}, [nativeWindow])
@@ -32,7 +51,7 @@ export default function SettingsDialog({ theme, onThemeChange, onClose, nativeWi
return () => window.removeEventListener('keydown', escape)
}, [onClose])
const modal = <section className={`settings-modal${nativeWindow ? ' settings-modal--window' : ''}`} role="dialog" aria-label="设置" aria-modal={!nativeWindow}>
<div className="settings-modal__nav"><SourceSettingsNavigation activeTab={section} supportedTabs={['models', 'appearance']}
<div className="settings-modal__nav"><SourceSettingsNavigation activeTab={section} supportedTabs={['models', 'appearance']} visibleTabs={VISIBLE_SETTINGS_TABS}
onTabChange={(id) => { setError(''); setSection(id === 'models' ? 'model' : id) }} onUnavailable={() => setError('该设置尚未接入')} /></div>
<div className="settings-modal__content"><div className="settings-modal__panel">
{error && <p role="alert">{error}</p>}