Skip to content

Commit b1a25e5

Browse files
committed
feat: 移动端增加常规设置和 MCP 设置
1 parent feb027e commit b1a25e5

File tree

4 files changed

+70
-12
lines changed

4 files changed

+70
-12
lines changed

src/app/mobile/setting/components/setting-tab.tsx

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,18 @@ export function SettingTab() {
1010
const t = useTranslations('settings')
1111
const notMobilePages = ['about', 'file', 'shortcuts']
1212

13-
// Add translations to the config
14-
const config = baseConfig.filter(item => typeof item !== 'string').map(item => ({
15-
...item,
16-
title: t(`${item.anchor}.title`)
17-
})).filter(item => !notMobilePages.includes(item.anchor))
13+
// Add translations to the config, keep separators
14+
const config = baseConfig.map(item => {
15+
if (typeof item === 'string') return item
16+
return {
17+
...item,
18+
title: t(`${item.anchor}.title`)
19+
}
20+
}).filter(item => {
21+
// 过滤掉不支持的移动端页面,但保留分隔符
22+
if (typeof item === 'string') return true
23+
return !notMobilePages.includes(item.anchor)
24+
})
1825

1926
function handleNavigation(anchor: string) {
2027
router.push(`/mobile/setting/pages/${anchor}`)
@@ -23,10 +30,19 @@ export function SettingTab() {
2330
return (
2431
<ul className="flex flex-col w-full">
2532
{
26-
config.map(item => {
33+
config.map((item, index) => {
34+
// 如果是分隔符字符串,渲染分隔线
35+
if (typeof item === 'string') {
36+
return (
37+
<li key={`separator-${index}`}>
38+
<div className="h-0.5 bg-muted my-2" />
39+
</li>
40+
)
41+
}
42+
2743
return (
2844
<li
29-
className="flex items-center gap-2 p-4 border-b last:border-b-0 w-full justify-between"
45+
className="flex items-center gap-2 p-4 w-full justify-between active:bg-accent"
3046
key={item.anchor}
3147
onClick={() => handleNavigation(item.anchor)}
3248
>

src/app/mobile/setting/page.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
'use client'
2-
3-
import { LanguageSwitch } from "@/components/language-switch"
42
import { SettingTab } from "./components/setting-tab"
5-
import { ModeToggle } from "@/components/mode-toggle"
63
import Updater from "@/app/core/setting/about/updater"
74
import UploadStore from "@/app/core/setting/components/upload-store"
85

96
export default function Setting() {
107
return <div id="mobile-setting" className="flex w-full h-full overflow-y-auto flex-col">
118
<div className="h-12 flex items-center justify-between p-2 border-b overflow-hidden">
129
<div className="flex items-center gap-2">
13-
<LanguageSwitch />
14-
<ModeToggle />
1510
</div>
1611
<div className="flex items-center gap-2">
1712
<UploadStore />
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'use client'
2+
3+
import { useTranslations } from 'next-intl'
4+
import { InterfaceSettings } from '@/app/core/setting/general/interface-settings'
5+
6+
export default function GeneralSettingsPage() {
7+
const t = useTranslations('settings.general')
8+
9+
return (
10+
<div>
11+
<div className="mb-6">
12+
<h1 className="text-2xl font-bold mb-2">{t('title')}</h1>
13+
<p className="text-sm text-muted-foreground">{t('desc')}</p>
14+
</div>
15+
<InterfaceSettings />
16+
</div>
17+
)
18+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
'use client'
2+
3+
import { useEffect } from 'react'
4+
import { useTranslations } from 'next-intl'
5+
import { GlobalSettings } from '@/app/core/setting/mcp/global-settings'
6+
import { ServerList } from '@/app/core/setting/mcp/server-list'
7+
import { useMcpStore } from '@/stores/mcp'
8+
9+
export default function McpSettingPage() {
10+
const t = useTranslations('settings.mcp')
11+
const { initMcpData } = useMcpStore()
12+
13+
useEffect(() => {
14+
initMcpData()
15+
}, [])
16+
17+
return (
18+
<div>
19+
<div className="mb-6">
20+
<h1 className="text-2xl font-bold mb-2">{t('title')}</h1>
21+
<p className="text-sm text-muted-foreground">{t('desc')}</p>
22+
</div>
23+
<div className="space-y-6">
24+
<GlobalSettings />
25+
<ServerList />
26+
</div>
27+
</div>
28+
)
29+
}

0 commit comments

Comments
 (0)