xinyu-pro 0.22.2 → 0.22.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/settings/page.tsx +17 -3
- package/bin/cli.js +14 -0
- package/components/ui/ThemeSwitcher.tsx +33 -18
- package/package.json +1 -1
- package/plugins/xinyu.auto-start-and-choices.xye +0 -0
- package/version.json +1 -1
package/app/settings/page.tsx
CHANGED
|
@@ -174,8 +174,8 @@ export default function SettingsPage() {
|
|
|
174
174
|
const all = await getGameSessions();
|
|
175
175
|
setSessions(all.map((s) => ({
|
|
176
176
|
id: s.id,
|
|
177
|
-
title: s.worldSetting.title,
|
|
178
|
-
era: s.worldSetting.era,
|
|
177
|
+
title: s.worldSetting.title as string,
|
|
178
|
+
era: s.worldSetting.era as string,
|
|
179
179
|
count: s.messages.length,
|
|
180
180
|
})));
|
|
181
181
|
};
|
|
@@ -1333,7 +1333,8 @@ export default function SettingsPage() {
|
|
|
1333
1333
|
</SettingCard>
|
|
1334
1334
|
</ColumnLayout>
|
|
1335
1335
|
);
|
|
1336
|
-
|
|
1336
|
+
|
|
1337
|
+
case 'data':
|
|
1337
1338
|
return (
|
|
1338
1339
|
<ColumnLayout>
|
|
1339
1340
|
<SettingCard title="游戏记录">
|
|
@@ -1414,6 +1415,19 @@ export default function SettingsPage() {
|
|
|
1414
1415
|
}
|
|
1415
1416
|
};
|
|
1416
1417
|
|
|
1418
|
+
useEffect(() => {
|
|
1419
|
+
const tabId = localStorage.getItem('settingTabId');
|
|
1420
|
+
if (tabId && CATEGORIES.some(cat => cat.id === tabId)) {
|
|
1421
|
+
for (const cat of CATEGORIES) {
|
|
1422
|
+
if (cat.id === tabId) {
|
|
1423
|
+
setActiveCategory(cat.id);
|
|
1424
|
+
break;
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
localStorage.setItem('settingTabId', '')
|
|
1428
|
+
}
|
|
1429
|
+
});
|
|
1430
|
+
|
|
1417
1431
|
return (
|
|
1418
1432
|
<>
|
|
1419
1433
|
<div className="h-screen flex flex-col overflow-hidden" style={{ backgroundColor: 'var(--color-bg-primary)' }}>
|
package/bin/cli.js
CHANGED
|
@@ -5,6 +5,7 @@ const { join, resolve } = require('path');
|
|
|
5
5
|
const { createInterface } = require('readline');
|
|
6
6
|
const { execSync, spawn } = require('child_process');
|
|
7
7
|
const { homedir } = require('os');
|
|
8
|
+
const path = require('path');
|
|
8
9
|
|
|
9
10
|
const isWin = process.platform === 'win32';
|
|
10
11
|
const APP_DIR = __dirname.includes('node_modules') ? resolve(__dirname, '..') : process.cwd();
|
|
@@ -12,6 +13,7 @@ const XINYU_HOME = join(homedir(), '.xinyu-pro');
|
|
|
12
13
|
const RUN_DIR = XINYU_HOME;
|
|
13
14
|
|
|
14
15
|
const args = process.argv.slice(2);
|
|
16
|
+
const VERSION_FLAG = args.includes('--version');
|
|
15
17
|
const HELP_FLAG = args.includes('--help') || args.includes('-h');
|
|
16
18
|
const DEV_FLAG = args.includes('--dev');
|
|
17
19
|
const RESET_FLAG = args.includes('--reset');
|
|
@@ -44,6 +46,13 @@ function ask(question) {
|
|
|
44
46
|
});
|
|
45
47
|
}
|
|
46
48
|
|
|
49
|
+
function showVersion() {
|
|
50
|
+
const versionPath = path.join(APP_DIR, 'version.json');
|
|
51
|
+
const versionData = JSON.parse(readFileSync(versionPath, 'utf-8'));
|
|
52
|
+
console.log(`${versionData.name} ${versionData.version}`);
|
|
53
|
+
process.exit(0);
|
|
54
|
+
}
|
|
55
|
+
|
|
47
56
|
function showHelp() {
|
|
48
57
|
echo('');
|
|
49
58
|
echo(' ╔══════════════════════════════════════╗', 'bold');
|
|
@@ -244,6 +253,11 @@ async function main() {
|
|
|
244
253
|
echo(' ╚══════════════════════════════════════╝', 'bold');
|
|
245
254
|
echo('');
|
|
246
255
|
|
|
256
|
+
if (VERSION_FLAG) {
|
|
257
|
+
showVersion();
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
|
|
247
261
|
if (HELP_FLAG) {
|
|
248
262
|
showHelp();
|
|
249
263
|
return;
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { useState } from 'react';
|
|
4
4
|
import { useTheme } from './ThemeProvider';
|
|
5
|
+
import { useRouterHistory } from '@/lib/router-history';
|
|
5
6
|
|
|
6
7
|
export function ThemeSwitcher({ buttonStyle = {} }: { buttonStyle?: React.CSSProperties }) {
|
|
7
8
|
const { config, activeTheme, setActiveThemeId } = useTheme();
|
|
8
9
|
const [isOpen, setIsOpen] = useState(false);
|
|
10
|
+
const { navigate } = useRouterHistory();
|
|
9
11
|
|
|
10
12
|
return (
|
|
11
13
|
<div className="relative">
|
|
@@ -20,10 +22,14 @@ export function ThemeSwitcher({ buttonStyle = {} }: { buttonStyle?: React.CSSPro
|
|
|
20
22
|
}}
|
|
21
23
|
title="切换主题"
|
|
22
24
|
>
|
|
23
|
-
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
{ activeTheme.isDark ?
|
|
26
|
+
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
27
|
+
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />
|
|
28
|
+
</svg> :
|
|
29
|
+
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
|
30
|
+
<circle cx="12" cy="12" r="5" />
|
|
31
|
+
<path d="M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42" />
|
|
32
|
+
</svg> }
|
|
27
33
|
<span className="text-sm hidden sm:inline">{activeTheme.name}</span>
|
|
28
34
|
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
|
29
35
|
<path d="M6 9l6 6 6-6" />
|
|
@@ -43,19 +49,31 @@ export function ThemeSwitcher({ buttonStyle = {} }: { buttonStyle?: React.CSSPro
|
|
|
43
49
|
boxShadow: '0 4px 24px var(--color-shadow)',
|
|
44
50
|
}}
|
|
45
51
|
>
|
|
46
|
-
<div className="p-2">
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
<div className="p-2 flex flex-col gap-2">
|
|
53
|
+
<div className="flex justify-between items-center">
|
|
54
|
+
<p
|
|
55
|
+
className="text-xs font-medium px-3 py-1"
|
|
56
|
+
style={{ color: 'var(--color-text-muted)' }}
|
|
57
|
+
>
|
|
58
|
+
主题
|
|
59
|
+
</p>
|
|
60
|
+
<button
|
|
61
|
+
className="text-xs font-medium px-3 py-1 border rounded-md transition-colors"
|
|
62
|
+
style={{ color: 'var(--color-text-muted)', borderColor: 'var(--color-border)' }}
|
|
63
|
+
onClick={() => {
|
|
64
|
+
setIsOpen(false);
|
|
65
|
+
localStorage.setItem('settingTabId', 'theme');
|
|
66
|
+
navigate('/settings');
|
|
67
|
+
}}
|
|
68
|
+
>
|
|
69
|
+
更多
|
|
70
|
+
</button>
|
|
71
|
+
</div>
|
|
72
|
+
{([...config.presets, ...config.importedThemes]).map((theme) => (
|
|
54
73
|
<button
|
|
55
74
|
key={theme.id}
|
|
56
75
|
onClick={() => {
|
|
57
76
|
setActiveThemeId(theme.id);
|
|
58
|
-
setIsOpen(false);
|
|
59
77
|
}}
|
|
60
78
|
className="w-full flex items-center gap-3 px-3 py-2 rounded-md text-left transition-colors"
|
|
61
79
|
style={{
|
|
@@ -80,9 +98,6 @@ export function ThemeSwitcher({ buttonStyle = {} }: { buttonStyle?: React.CSSPro
|
|
|
80
98
|
</div>
|
|
81
99
|
<div>
|
|
82
100
|
<div className="text-sm font-medium">{theme.name}</div>
|
|
83
|
-
<div className="text-xs" style={{ color: 'var(--color-text-muted)' }}>
|
|
84
|
-
{theme.description}
|
|
85
|
-
</div>
|
|
86
101
|
</div>
|
|
87
102
|
{activeTheme.id === theme.id && (
|
|
88
103
|
<svg className="ml-auto" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
|
@@ -92,7 +107,7 @@ export function ThemeSwitcher({ buttonStyle = {} }: { buttonStyle?: React.CSSPro
|
|
|
92
107
|
</button>
|
|
93
108
|
))}
|
|
94
109
|
|
|
95
|
-
{config.customTheme && (
|
|
110
|
+
{/* {config.customTheme && (
|
|
96
111
|
<>
|
|
97
112
|
<div className="my-1 border-t" style={{ borderColor: 'var(--color-border)' }} />
|
|
98
113
|
<button
|
|
@@ -130,7 +145,7 @@ export function ThemeSwitcher({ buttonStyle = {} }: { buttonStyle?: React.CSSPro
|
|
|
130
145
|
)}
|
|
131
146
|
</button>
|
|
132
147
|
</>
|
|
133
|
-
)}
|
|
148
|
+
)} */}
|
|
134
149
|
</div>
|
|
135
150
|
</div>
|
|
136
151
|
</>
|
package/package.json
CHANGED
|
Binary file
|
package/version.json
CHANGED