feat(client): 改进启动窗口、维护交互与操作图标
- feat(client): 增加无边框动画启动窗口,加载完成后恢复主窗口 - feat(ui): 为操作按钮引入本地 Material Symbols Rounded 图标 - fix(maintenance): 移除烧录前无效的原生确认框,保留页面检查与后端校验 - fix(maintenance): 统一板卡示意风格并修正装甲板比例和图传右侧 USB 接线 - docs: 按 humanizer-zh 润色项目文档并将写作约定纳入 AGENTS.md 验证:前端构建、Tauri 主机编译与启动配置测试通过;维护流程 4 项测试通过;目录回归 4 项通过。已检查浏览器受影响页面与 Windows 原生启动窗口切换。 未执行设备烧录、板上运行或多显示器与高 DPI 验证。
This commit is contained in:
52 files changed
+965
-440
No files matched your search
@@ -8,6 +8,7 @@ import { paintCrosshair, paintGrid, type Geometry } from "../lib/reticle";
|
||||
import type { ConfigView, CrosshairConfig, HudView, Snapshot, TeamHealthDto } from "../lib/types";
|
||||
import { Button, Field, Select, Slider, Switch } from "./controls";
|
||||
import { HealthBar } from "./HealthBar";
|
||||
import { Icon, type IconName } from "./Icon";
|
||||
|
||||
interface Props {
|
||||
snapshot: Snapshot;
|
||||
@@ -27,6 +28,10 @@ interface Props {
|
||||
|
||||
const SAVE_DEBOUNCE_MS = 350;
|
||||
interface Category { id: string; label: string; en: string; hint: string; preview?: boolean }
|
||||
const CATEGORY_ICONS: Record<string, IconName> = {
|
||||
general: "settings", devices: "devices", reticle: "target", calibration: "calibration",
|
||||
grid: "grid", health: "health", feedback: "feedback", slots: "splitView", media: "camera", security: "lock",
|
||||
};
|
||||
|
||||
export function SettingsPanel({ snapshot, hud, onHud, calibrating, onCalibrating, onClose,
|
||||
closing = false, connected = true, onExitComplete, onNeedsUnlock, onError, onInfo, onConfig }: Props) {
|
||||
@@ -244,14 +249,14 @@ export function SettingsPanel({ snapshot, hud, onHud, calibrating, onCalibrating
|
||||
<div className="settings__span"><ChangePassword onDone={onInfo} onError={onError} /></div>
|
||||
<div className="settings__danger settings__span">
|
||||
<div><strong>清空本机配置</strong><p>原配置备份为 .bak,之后需重启程序。</p></div>
|
||||
<Button variant="danger" onClick={() => {
|
||||
<Button icon="delete" variant="danger" onClick={() => {
|
||||
if (!window.confirm("清空配置并重启设置流程?旧配置将备份为 .bak,操作后需重启程序。")) return;
|
||||
void api.clearConfig().then(onInfo, err => { const text = err instanceof Error ? err.message : String(err); if (text.includes("密码")) onNeedsUnlock(text); else onError(text); });
|
||||
}}>清空配置</Button>
|
||||
</div>
|
||||
<div className="settings__danger settings__span">
|
||||
<div><strong>退出客户端</strong><p>正在进行的录制会先结束并保存。</p></div>
|
||||
<Button variant="danger" onClick={() => {
|
||||
<Button icon="logout" variant="danger" onClick={() => {
|
||||
if (!window.confirm("退出程序?正在进行的录制将先结束并保存。")) return;
|
||||
void api.quit().catch(err => { const text = err instanceof Error ? err.message : String(err); if (text.includes("密码")) onNeedsUnlock(text); else onError(text); });
|
||||
}}>退出程序</Button>
|
||||
@@ -265,16 +270,16 @@ export function SettingsPanel({ snapshot, hud, onHud, calibrating, onCalibrating
|
||||
<header className="settings__head">
|
||||
<div><span className="label">{isTeam ? "OPERATOR" : "REFEREE"} / CONFIGURATION</span><h1>设置</h1></div>
|
||||
<div className="settings__head-actions">
|
||||
{isTeam && snapshot.unlocked && <Button variant="ghost" disabled={closing} onClick={() => { void api.lock().then(() => { onInfo("已重新上锁。"); onClose(); }); }} title="锁定设置,修改时需重新输入密码">上锁</Button>}
|
||||
<button ref={closeButton} type="button" className="btn btn--ghost settings__back" disabled={closing} onClick={onClose}><kbd>ESC</kbd> 返回</button>
|
||||
{isTeam && snapshot.unlocked && <Button icon="lock" variant="ghost" disabled={closing} onClick={() => { void api.lock().then(() => { onInfo("已重新上锁。"); onClose(); }); }} title="锁定设置,修改时需重新输入密码">上锁</Button>}
|
||||
<button ref={closeButton} type="button" className="btn btn--ghost settings__back" disabled={closing} onClick={onClose}><Icon name="back" />返回 <kbd>ESC</kbd></button>
|
||||
</div>
|
||||
</header>
|
||||
{locked && <div className="settings__locked"><span>修改设置前请先输入密码解锁。</span><button type="button" className="btn btn--ghost" onClick={() => onNeedsUnlock("修改设置需要密码")}>解锁设置</button></div>}
|
||||
{locked && <div className="settings__locked"><span>修改设置前请先输入密码解锁。</span><button type="button" className="btn btn--ghost" onClick={() => onNeedsUnlock("修改设置需要密码")}><Icon name="unlock" />解锁设置</button></div>}
|
||||
<div className="settings__main">
|
||||
<nav className="settings__nav" role="tablist" aria-orientation="vertical" aria-label="设置分类">
|
||||
{categories.map((category, index) => <button key={category.id} id={`settings-tab-${category.id}`} type="button" role="tab" aria-selected={selected === category.id} aria-controls="settings-page" tabIndex={selected === category.id ? 0 : -1}
|
||||
className={`settings__tab${selected === category.id ? " is-active" : ""}`} disabled={closing} onClick={() => switchCategory(category.id)} onKeyDown={event => navigate(event, index)}>
|
||||
<span className="settings__tab-index num">{String(index + 1).padStart(2, "0")}</span><span><strong>{category.label}</strong><small>{category.en}</small></span><span className="settings__tab-arrow" aria-hidden="true">›</span>
|
||||
<Icon name={CATEGORY_ICONS[category.id]} /><span><strong>{category.label}</strong><small>{category.en}</small></span><span className="settings__tab-arrow" aria-hidden="true"><Icon name="chevron" /></span>
|
||||
</button>)}
|
||||
</nav>
|
||||
<div className="settings__viewport">
|
||||
@@ -469,7 +474,7 @@ function Calibration({
|
||||
</Field>
|
||||
|
||||
<div className="sect__row">
|
||||
<Button variant="ghost" onClick={() => onChange(0, 0)}>
|
||||
<Button icon="reset" variant="ghost" onClick={() => onChange(0, 0)}>
|
||||
偏移归零
|
||||
</Button>
|
||||
</div>
|
||||
@@ -518,6 +523,7 @@ function ChangePassword({
|
||||
))}
|
||||
</span>
|
||||
<Button
|
||||
icon="key"
|
||||
disabled={busy || fresh.length < 4}
|
||||
onClick={() => {
|
||||
setBusy(true);
|
||||
|
||||
Reference in new issue
Block a user