feat(client): 改进启动窗口、维护交互与操作图标
构建客户端 / 检查(类型 + 单元测试) (push) Canceled after 0s
构建客户端 / Linux x64(deb + AppImage) (push) Canceled after 0s
构建客户端 / Windows x64(NSIS 安装包) (push) Canceled after 0s
构建客户端 / macOS 通用(.app + .dmg) (push) Canceled after 0s

- 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:
sloray committed 2026-10-24 00:36:38 +08:00
1 parent f7ca246b68
commit 235fb1c73b
52 files changed
+965 -440

No files matched your search

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@@ -0,0 +1,6 @@
Google Material Symbols Rounded
Copyright Google LLC
Source: https://github.com/google/material-design-icons/tree/master/symbols/web
Licensed under the Apache License, Version 2.0 (see LICENSE).
The SVG path data is packaged locally in client/src/assets/material-symbols/paths.ts.
Original viewBox: 0 -960 960 960; 24 px, weight 400, fill 0.
+8 -2
View File
@@ -30,6 +30,7 @@ mod firmware_build;
mod recording;
mod server;
mod state;
mod startup;
use std::error::Error;
use std::path::PathBuf;
@@ -310,8 +311,11 @@ fn run() -> Result<(), Box<dyn Error>> {
.plugin(tauri_plugin_dialog::init())
.manage(Arc::clone(&state))
.manage(latency_recorder)
.manage(startup::StartupState::default())
.manage(Arc::new(maintenance::MaintenanceState::default()))
.invoke_handler(tauri::generate_handler![
startup::finish_startup,
startup::cancel_startup,
maintenance::maintenance_list_ports,
maintenance::maintenance_load_bundle,
maintenance::maintenance_probe,
@@ -375,7 +379,8 @@ fn run() -> Result<(), Box<dyn Error>> {
}
let state = window.state::<Arc<AppState>>();
if state.config().role.needs_password() && !state.is_unlocked() {
if window.state::<startup::StartupState>().finished()
&& state.config().role.needs_password() && !state.is_unlocked() {
api.prevent_close();
state.push(server::WireMsg::ConfirmQuit);
}
@@ -392,7 +397,8 @@ fn run() -> Result<(), Box<dyn Error>> {
}
let state = app.state::<Arc<AppState>>();
if state.config().role.needs_password() && !state.is_unlocked() {
if app.state::<startup::StartupState>().finished()
&& state.config().role.needs_password() && !state.is_unlocked() {
api.prevent_exit();
state.push(server::WireMsg::ConfirmQuit);
return;
+75
View File
@@ -0,0 +1,75 @@
//! 同一个窗口先显示无边框启动卡片,准备完成后恢复桌面窗口。
use std::sync::atomic::{AtomicBool, Ordering};
use tauri::{LogicalSize, Manager, State, WebviewWindow};
#[derive(Default)]
pub struct StartupState {
finished: AtomicBool,
}
impl StartupState {
pub fn finished(&self) -> bool {
self.finished.load(Ordering::Acquire)
}
}
#[tauri::command]
pub fn finish_startup(window: WebviewWindow, state: State<'_, StartupState>) -> Result<(), String> {
if state.finished() {
return Ok(());
}
// 隐藏期间恢复边框和尺寸,避免启动卡片随最大化过程被拉伸。
window.hide().map_err(|err| err.to_string())?;
let result = (|| -> tauri::Result<()> {
window.set_fullscreen(false)?;
window.set_decorations(true)?;
window.set_resizable(true)?;
window.set_min_size(Some(LogicalSize::new(900.0, 600.0)))?;
window.set_size(LogicalSize::new(1440.0, 900.0))?;
window.center()?;
Ok(())
})();
// 即使窗口设置失败,也要重新显示错误和重试入口。
let shown = window.show();
result.and(shown).map_err(|err| err.to_string())?;
// 显示后再请求最大化,避免 Windows 隐藏窗口只更新最大化标志。
window.maximize().map_err(|err| err.to_string())?;
state.finished.store(true, Ordering::Release);
let _ = window.set_focus();
Ok(())
}
#[tauri::command]
pub fn cancel_startup(window: WebviewWindow, state: State<'_, StartupState>) -> Result<(), String> {
if state.finished() {
return Err("启动已完成,请从主界面退出。".into());
}
if window
.state::<std::sync::Arc<crate::maintenance::MaintenanceState>>()
.is_busy()
{
return Err("固件维护正在进行,请等待完成。".into());
}
window.app_handle().exit(0);
Ok(())
}
#[cfg(test)]
mod tests {
#[test]
fn initial_window_is_a_compact_frameless_splash() {
let config: serde_json::Value =
serde_json::from_str(include_str!("../tauri.conf.json")).unwrap();
let window = &config["app"]["windows"][0];
assert_eq!(window["label"], "main");
assert_eq!(window["decorations"], false);
assert_eq!(window["maximized"], false);
assert_eq!(window["resizable"], false);
assert_eq!(window["center"], true);
assert!(window["width"].as_u64().unwrap() <= 700);
assert!(window["height"].as_u64().unwrap() <= 500);
}
}
+6 -6
View File
@@ -14,12 +14,12 @@
{
"label": "main",
"title": "RMIC::2026",
"width": 1440,
"height": 900,
"minWidth": 900,
"minHeight": 600,
"maximized": true,
"resizable": true,
"width": 640,
"height": 420,
"center": true,
"decorations": false,
"maximized": false,
"resizable": false,
"fullscreen": false
}
],
+41 -10
View File
@@ -20,8 +20,10 @@
import { useCallback, useEffect, useRef, useState } from "react";
import { getCurrentWindow } from "@tauri-apps/api/window";
import { invoke } from "@tauri-apps/api/core";
import { Boot } from "./components/Boot";
import { Icon } from "./components/Icon";
import { SetupPassword, RolePicker } from "./components/Gate";
import { CommStrip, TopBar } from "./components/TopBar";
import { Toasts, type ToastItem } from "./components/Toasts";
@@ -58,8 +60,9 @@ export default function App() {
const [maintenance, setMaintenance] = useState(() => import.meta.env.DEV && !("__TAURI_INTERNALS__" in window) && new URLSearchParams(location.search).get("preview") === "maintenance");
const [operatorMenu, setOperatorMenu] = useState(false);
const [toasts, setToasts] = useState<ToastItem[]>([]);
const [bootGone, setBootGone] = useState(false);
const fullscreen = useFullscreen();
const fullscreen = useFullscreen(bootGone);
const hudInitialised = useRef(false);
// ---- 提示队列 ----
@@ -94,7 +97,6 @@ export default function App() {
const [fontsReady, setFontsReady] = useState(false);
const [minElapsed, setMinElapsed] = useState(false);
const [bootGone, setBootGone] = useState(false);
const [bootLeaving, setBootLeaving] = useState(false);
useEffect(() => {
@@ -123,30 +125,55 @@ export default function App() {
const milestones = [
{ key: "fonts", label: "加载字体", code: "HARMONYOS · JETBRAINS", done: fontsReady },
{ key: "channel", label: "连接本机服务", code: "LOCAL IPC", done: url !== null || !!fatal },
{ key: "snapshot", label: "读取运行状态", code: "SNAPSHOT 200ms", done: snapshot !== null || !!fatal },
{ key: "channel", label: "连接本机服务", code: "LOCAL IPC", done: url !== null },
{ key: "snapshot", label: "读取运行状态", code: "SNAPSHOT 200ms", done: snapshot !== null },
];
const sequenceDone = milestones.every((item) => item.done);
const progress =
(fontsReady ? 0.32 : 0) + (url !== null || fatal ? 0.24 : 0) + (snapshot !== null || fatal ? 0.44 : 0);
(fontsReady ? 0.32 : 0) + (url !== null ? 0.24 : 0) + (snapshot !== null ? 0.44 : 0);
// 两个 effect 而不是一个,是有原因的:把"开始淡出"和"淡出之后卸载"写进同一个 effect
// 时,`setBootLeaving(true)` 会让它自己重跑,React 在重跑之前先调用上一次的清理函数,
// 于是那个 `setTimeout` 在设置的同一帧里就被 `clearTimeout` 掉了——启动页永远停在那里
// 半透明地盖着整个界面。拆成两段之后,第二段只在 `bootLeaving` 变真时启动。
useEffect(() => {
if (!sequenceDone || !minElapsed) return;
if (!sequenceDone || !minElapsed || fatal) return;
setBootLeaving(true);
}, [sequenceDone, minElapsed]);
}, [sequenceDone, minElapsed, fatal]);
useEffect(() => {
if (!bootLeaving) return;
const timer = window.setTimeout(() => setBootGone(true), BOOT_EXIT_MS);
return () => window.clearTimeout(timer);
let cancelled = false;
const timer = window.setTimeout(() => {
const finish = "__TAURI_INTERNALS__" in window ? invoke("finish_startup") : Promise.resolve();
void finish.then(() => {
if (!cancelled) setBootGone(true);
}, (error) => {
if (!cancelled) {
setBootLeaving(false);
setFatal(`无法打开主窗口:${String(error)}`);
}
});
}, BOOT_EXIT_MS);
return () => { cancelled = true; window.clearTimeout(timer); };
}, [bootLeaving]);
// 服务已连接但没有首份快照时,保留可重试的启动页,避免无限等待。
useEffect(() => {
if (snapshot || fatal || bootGone) return;
const timer = window.setTimeout(() => setFatal("等待本机服务超时,请重试;若仍无法启动,请查看客户端日志。"), 15000);
return () => window.clearTimeout(timer);
}, [snapshot, fatal, bootGone]);
const retryStartup = () => {
setFatal(null);
setBootLeaving(false);
setUrl(null);
void api.streamInfo().then(stream => setUrl(stream.url), error => setFatal(String(error)));
};
// ---- 通道 ----
useEffect(() => {
@@ -336,6 +363,10 @@ export default function App() {
progress={progress}
fatal={fatal}
leaving={bootLeaving}
onRetry={retryStartup}
onCancel={"__TAURI_INTERNALS__" in window ? () => {
void invoke("cancel_startup").catch(error => setFatal(String(error)));
} : undefined}
/>
);
}
@@ -459,7 +490,7 @@ export default function App() {
拖动画面调整瞄准点,完成后点击“结束校准”。
</span>
<button type="button" className="btn btn--ghost" onClick={() => setCalibrating(false)}>
结束校准
<Icon name="check" />结束校准
</button>
</div>
)}
@@ -0,0 +1,51 @@
// Google Material Symbols Rounded, 24 px / weight 400. Apache-2.0.
// Source: https://github.com/google/material-design-icons/tree/master/symbols/web
// License and attribution ship in client/public/licenses/material-symbols/.
export const materialPaths = {
close: ["M480-424 284-228q-11 11-28 11t-28-11q-11-11-11-28t11-28l196-196-196-196q-11-11-11-28t11-28q11-11 28-11t28 11l196 196 196-196q11-11 28-11t28 11q11 11 11 28t-11 28L536-480l196 196q11 11 11 28t-11 28q-11 11-28 11t-28-11L480-424Z"],
back: ["m313-440 196 196q12 12 11.5 28T508-188q-12 11-28 11.5T452-188L188-452q-6-6-8.5-13t-2.5-15q0-8 2.5-15t8.5-13l264-264q11-11 27.5-11t28.5 11q12 12 12 28.5T508-715L313-520h447q17 0 28.5 11.5T800-480q0 17-11.5 28.5T760-440H313Z"],
next: ["M647-440H200q-17 0-28.5-11.5T160-480q0-17 11.5-28.5T200-520h447L451-716q-12-12-11.5-28t12.5-28q12-11 28-11.5t28 11.5l264 264q6 6 8.5 13t2.5 15q0 8-2.5 15t-8.5 13L508-188q-11 11-27.5 11T452-188q-12-12-12-28.5t12-28.5l195-195Z"],
check: ["m382-354 339-339q12-12 28-12t28 12q12 12 12 28.5T777-636L410-268q-12 12-28 12t-28-12L182-440q-12-12-11.5-28.5T183-497q12-12 28.5-12t28.5 12l142 143Z"],
settings: ["M433-80q-27 0-46.5-18T363-142l-9-66q-13-5-24.5-12T307-235l-62 26q-25 11-50 2t-39-32l-47-82q-14-23-8-49t27-43l53-40q-1-7-1-13.5v-27q0-6.5 1-13.5l-53-40q-21-17-27-43t8-49l47-82q14-23 39-32t50 2l62 26q11-8 23-15t24-12l9-66q4-26 23.5-44t46.5-18h94q27 0 46.5 18t23.5 44l9 66q13 5 24.5 12t22.5 15l62-26q25-11 50-2t39 32l47 82q14 23 8 49t-27 43l-53 40q1 7 1 13.5v27q0 6.5-2 13.5l53 40q21 17 27 43t-8 49l-48 82q-14 23-39 32t-50-2l-60-26q-11 8-23 15t-24 12l-9 66q-4 26-23.5 44T527-80h-94Zm7-80h79l14-106q31-8 57.5-23.5T639-327l99 41 39-68-86-65q5-14 7-29.5t2-31.5q0-16-2-31.5t-7-29.5l86-65-39-68-99 42q-22-23-48.5-38.5T533-694l-13-106h-79l-14 106q-31 8-57.5 23.5T321-633l-99-41-39 68 86 64q-5 15-7 30t-2 32q0 16 2 31t7 30l-86 65 39 68 99-42q22 23 48.5 38.5T427-266l13 106Zm42-180q58 0 99-41t41-99q0-58-41-99t-99-41q-59 0-99.5 41T342-480q0 58 40.5 99t99.5 41Zm-2-140Z"],
fullscreen: ["M200-200h80q17 0 28.5 11.5T320-160q0 17-11.5 28.5T280-120H160q-17 0-28.5-11.5T120-160v-120q0-17 11.5-28.5T160-320q17 0 28.5 11.5T200-280v80Zm560 0v-80q0-17 11.5-28.5T800-320q17 0 28.5 11.5T840-280v120q0 17-11.5 28.5T800-120H680q-17 0-28.5-11.5T640-160q0-17 11.5-28.5T680-200h80ZM200-760v80q0 17-11.5 28.5T160-640q-17 0-28.5-11.5T120-680v-120q0-17 11.5-28.5T160-840h120q17 0 28.5 11.5T320-800q0 17-11.5 28.5T280-760h-80Zm560 0h-80q-17 0-28.5-11.5T640-800q0-17 11.5-28.5T680-840h120q17 0 28.5 11.5T840-800v120q0 17-11.5 28.5T800-640q-17 0-28.5-11.5T760-680v-80Z"],
fullscreenExit: ["M240-240h-80q-17 0-28.5-11.5T120-280q0-17 11.5-28.5T160-320h120q17 0 28.5 11.5T320-280v120q0 17-11.5 28.5T280-120q-17 0-28.5-11.5T240-160v-80Zm480 0v80q0 17-11.5 28.5T680-120q-17 0-28.5-11.5T640-160v-120q0-17 11.5-28.5T680-320h120q17 0 28.5 11.5T840-280q0 17-11.5 28.5T800-240h-80ZM240-720v-80q0-17 11.5-28.5T280-840q17 0 28.5 11.5T320-800v120q0 17-11.5 28.5T280-640H160q-17 0-28.5-11.5T120-680q0-17 11.5-28.5T160-720h80Zm480 0h80q17 0 28.5 11.5T840-680q0 17-11.5 28.5T800-640H680q-17 0-28.5-11.5T640-680v-120q0-17 11.5-28.5T680-840q17 0 28.5 11.5T720-800v80Z"],
refresh: ["M480-160q-134 0-227-93t-93-227q0-134 93-227t227-93q69 0 132 28.5T720-690v-70q0-17 11.5-28.5T760-800q17 0 28.5 11.5T800-760v200q0 17-11.5 28.5T760-520H560q-17 0-28.5-11.5T520-560q0-17 11.5-28.5T560-600h128q-32-56-87.5-88T480-720q-100 0-170 70t-70 170q0 100 70 170t170 70q68 0 124.5-34.5T692-367q8-14 22.5-19.5t29.5-.5q16 5 23 21t-1 30q-41 80-117 128t-169 48Z"],
firmware: ["M360-400v-160q0-17 11.5-28.5T400-600h160q17 0 28.5 11.5T600-560v160q0 17-11.5 28.5T560-360H400q-17 0-28.5-11.5T360-400Zm80-40h80v-80h-80v80Zm-80 280v-40h-80q-33 0-56.5-23.5T200-280v-80h-40q-17 0-28.5-11.5T120-400q0-17 11.5-28.5T160-440h40v-80h-40q-17 0-28.5-11.5T120-560q0-17 11.5-28.5T160-600h40v-80q0-33 23.5-56.5T280-760h80v-40q0-17 11.5-28.5T400-840q17 0 28.5 11.5T440-800v40h80v-40q0-17 11.5-28.5T560-840q17 0 28.5 11.5T600-800v40h80q33 0 56.5 23.5T760-680v80h40q17 0 28.5 11.5T840-560q0 17-11.5 28.5T800-520h-40v80h40q17 0 28.5 11.5T840-400q0 17-11.5 28.5T800-360h-40v80q0 33-23.5 56.5T680-200h-80v40q0 17-11.5 28.5T560-120q-17 0-28.5-11.5T520-160v-40h-80v40q0 17-11.5 28.5T400-120q-17 0-28.5-11.5T360-160Zm320-120v-400H280v400h400ZM480-480Z"],
usb: ["M480-80q-33 0-56.5-23.5T400-160q0-21 11-39t29-29v-92H320q-33 0-56.5-23.5T240-400v-92q-18-9-29-27t-11-41q0-33 23.5-56.5T280-640q33 0 56.5 23.5T360-560q0 23-11 40t-29 28v92h120v-320h-40q-12 0-18-11t2-21l80-107q6-8 16-8t16 8l80 107q8 10 2 21t-18 11h-40v320h120v-80h-20q-8 0-14-6t-6-14v-120q0-8 6-14t14-6h120q8 0 14 6t6 14v120q0 8-6 14t-14 6h-20v80q0 33-23.5 56.5T640-320H520v92q19 10 29.5 28t10.5 40q0 33-23.5 56.5T480-80Z"],
camera: ["M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h480q33 0 56.5 23.5T720-720v180l126-126q10-10 22-5t12 19v344q0 14-12 19t-22-5L720-420v180q0 33-23.5 56.5T640-160H160Zm0-80h480v-480H160v480Zm0 0v-480 480Z"],
armor: ["M480-84q-7 0-13-1t-12-3q-135-45-215-166.5T160-516v-189q0-25 14.5-45t37.5-29l240-90q14-5 28-5t28 5l240 90q23 9 37.5 29t14.5 45v189q0 140-80 261.5T505-88q-6 2-12 3t-13 1Zm0-80q104-33 172-132t68-220v-189l-240-90-240 90v189q0 121 68 220t172 132Zm0-316Z"],
folder: ["M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h207q16 0 30.5 6t25.5 17l57 57h360q17 0 28.5 11.5T880-680q0 17-11.5 28.5T840-640H447l-80-80H160v480l79-263q8-26 29.5-41.5T316-560h516q41 0 64.5 32.5T909-457l-72 240q-8 26-29.5 41.5T760-160H160Zm84-80h516l72-240H316l-72 240Zm-84-262v-218 218Zm84 262 72-240-72 240Z"],
file: ["M360-240h240q17 0 28.5-11.5T640-280q0-17-11.5-28.5T600-320H360q-17 0-28.5 11.5T320-280q0 17 11.5 28.5T360-240Zm0-160h240q17 0 28.5-11.5T640-440q0-17-11.5-28.5T600-480H360q-17 0-28.5 11.5T320-440q0 17 11.5 28.5T360-400ZM240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h287q16 0 30.5 6t25.5 17l194 194q11 11 17 25.5t6 30.5v447q0 33-23.5 56.5T720-80H240Zm280-560v-160H240v640h480v-440H560q-17 0-28.5-11.5T520-640ZM240-800v200-200 640-640Z"],
download: ["M480-337q-8 0-15-2.5t-13-8.5L308-492q-12-12-11.5-28t11.5-28q12-12 28.5-12.5T365-549l75 75v-286q0-17 11.5-28.5T480-800q17 0 28.5 11.5T520-760v286l75-75q12-12 28.5-11.5T652-548q11 12 11.5 28T652-492L508-348q-6 6-13 8.5t-15 2.5ZM240-160q-33 0-56.5-23.5T160-240v-80q0-17 11.5-28.5T200-360q17 0 28.5 11.5T240-320v80h480v-80q0-17 11.5-28.5T760-360q17 0 28.5 11.5T800-320v80q0 33-23.5 56.5T720-160H240Z"],
upload: ["M240-160q-33 0-56.5-23.5T160-240v-80q0-17 11.5-28.5T200-360q17 0 28.5 11.5T240-320v80h480v-80q0-17 11.5-28.5T760-360q17 0 28.5 11.5T800-320v80q0 33-23.5 56.5T720-160H240Zm200-486-75 75q-12 12-28.5 11.5T308-572q-11-12-11.5-28t11.5-28l144-144q6-6 13-8.5t15-2.5q8 0 15 2.5t13 8.5l144 144q12 12 11.5 28T652-572q-12 12-28.5 12.5T595-571l-75-75v286q0 17-11.5 28.5T480-320q-17 0-28.5-11.5T440-360v-286Z"],
build: ["M360-360q-100 0-170-70t-70-170q0-20 3-40t11-38q5-10 12.5-15t16.5-7q9-2 18.5.5T199-689l105 105 72-72-105-105q-8-8-10.5-17.5T260-797q2-9 7-16.5t15-12.5q18-8 38-11t40-3q100 0 170 70t70 170q0 23-4 43.5T584-516l202 200q29 29 29 71t-29 71q-29 29-71 29t-71-30L444-376q-20 8-40.5 12t-43.5 4Zm0-80q26 0 52-8t47-25l243 243q5 5 13.5 4.5T729-231q5-5 5-13.5t-5-13.5L486-500q18-20 26-46.5t8-53.5q0-60-38.5-104.5T386-758l74 74q12 12 12 28t-12 28L332-500q-12 12-28 12t-28-12l-74-74q9 57 53.5 95.5T360-440Zm109-51Z"],
search: ["M380-320q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l224 224q11 11 11 28t-11 28q-11 11-28 11t-28-11L532-372q-30 24-69 38t-83 14Zm0-80q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z"],
info: ["M480-280q17 0 28.5-11.5T520-320v-160q0-17-11.5-28.5T480-520q-17 0-28.5 11.5T440-480v160q0 17 11.5 28.5T480-280Zm0-320q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm0 520q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"],
play: ["M320-273v-414q0-17 12-28.5t28-11.5q5 0 10.5 1.5T381-721l326 207q9 6 13.5 15t4.5 19q0 10-4.5 19T707-446L381-239q-5 3-10.5 4.5T360-233q-16 0-28-11.5T320-273Zm80-207Zm0 134 210-134-210-134v268Z"],
pause: ["M600-200q-33 0-56.5-23.5T520-280v-400q0-33 23.5-56.5T600-760h80q33 0 56.5 23.5T760-680v400q0 33-23.5 56.5T680-200h-80Zm-320 0q-33 0-56.5-23.5T200-280v-400q0-33 23.5-56.5T280-760h80q33 0 56.5 23.5T440-680v400q0 33-23.5 56.5T360-200h-80Zm320-80h80v-400h-80v400Zm-320 0h80v-400h-80v400Zm0-400v400-400Zm320 0v400-400Z"],
stop: ["M240-320v-320q0-33 23.5-56.5T320-720h320q33 0 56.5 23.5T720-640v320q0 33-23.5 56.5T640-240H320q-33 0-56.5-23.5T240-320Zm80 0h320v-320H320v320Zm160-160Z"],
record: ["M480-480Zm0 280q-116 0-198-82t-82-198q0-116 82-198t198-82q116 0 198 82t82 198q0 116-82 198t-198 82Zm0-80q83 0 141.5-58.5T680-480q0-83-58.5-141.5T480-680q-83 0-141.5 58.5T280-480q0 83 58.5 141.5T480-280Z"],
image: ["M480-260q75 0 127.5-52.5T660-440q0-75-52.5-127.5T480-620q-75 0-127.5 52.5T300-440q0 75 52.5 127.5T480-260Zm0-80q-42 0-71-29t-29-71q0-42 29-71t71-29q42 0 71 29t29 71q0 42-29 71t-71 29ZM160-120q-33 0-56.5-23.5T80-200v-480q0-33 23.5-56.5T160-760h126l50-54q11-12 26.5-19t32.5-7h170q17 0 32.5 7t26.5 19l50 54h126q33 0 56.5 23.5T880-680v480q0 33-23.5 56.5T800-120H160Zm0-80h640v-480H638l-73-80H395l-73 80H160v480Zm320-240Z"],
timer: ["M400-840q-17 0-28.5-11.5T360-880q0-17 11.5-28.5T400-920h160q17 0 28.5 11.5T600-880q0 17-11.5 28.5T560-840H400Zm80 440q17 0 28.5-11.5T520-440v-160q0-17-11.5-28.5T480-640q-17 0-28.5 11.5T440-600v160q0 17 11.5 28.5T480-400Zm0 320q-74 0-139.5-28.5T226-186q-49-49-77.5-114.5T120-440q0-74 28.5-139.5T226-694q49-49 114.5-77.5T480-800q62 0 119 20t107 58l28-28q11-11 28-11t28 11q11 11 11 28t-11 28l-28 28q38 50 58 107t20 119q0 74-28.5 139.5T734-186q-49 49-114.5 77.5T480-80Zm0-80q116 0 198-82t82-198q0-116-82-198t-198-82q-116 0-198 82t-82 198q0 116 82 198t198 82Zm0-280Z"],
reset: ["M393-132q-103-29-168-113.5T160-440q0-57 19-108.5t54-94.5q11-12 27-12.5t29 12.5q11 11 11.5 27T290-586q-24 31-37 68t-13 78q0 81 47.5 144.5T410-209q13 4 21.5 15t8.5 24q0 20-14 31.5t-33 6.5Zm174 0q-19 5-33-7t-14-32q0-12 8.5-23t21.5-15q75-24 122.5-87T720-440q0-100-70-170t-170-70h-3l16 16q11 11 11 28t-11 28q-11 11-28 11t-28-11l-84-84q-6-6-8.5-13t-2.5-15q0-8 2.5-15t8.5-13l84-84q11-11 28-11t28 11q11 11 11 28t-11 28l-16 16h3q134 0 227 93t93 227q0 109-65 194T567-132Z"],
lock: ["M240-80q-33 0-56.5-23.5T160-160v-400q0-33 23.5-56.5T240-640h40v-80q0-83 58.5-141.5T480-920q83 0 141.5 58.5T680-720v80h40q33 0 56.5 23.5T800-560v400q0 33-23.5 56.5T720-80H240Zm0-80h480v-400H240v400Zm240-120q33 0 56.5-23.5T560-360q0-33-23.5-56.5T480-440q-33 0-56.5 23.5T400-360q0 33 23.5 56.5T480-280ZM360-640h240v-80q0-50-35-85t-85-35q-50 0-85 35t-35 85v80ZM240-160v-400 400Z"],
unlock: ["M240-80q-33 0-56.5-23.5T160-160v-400q0-33 23.5-56.5T240-640h360v-80q0-50-35-85t-85-35q-42 0-73.5 25.5T364-751q-4 14-16.5 22.5T320-720q-17 0-28.5-11t-8.5-26q14-69 69-116t128-47q83 0 141.5 58.5T680-720v80h40q33 0 56.5 23.5T800-560v400q0 33-23.5 56.5T720-80H240Zm0-80h480v-400H240v400Zm240-120q33 0 56.5-23.5T560-360q0-33-23.5-56.5T480-440q-33 0-56.5 23.5T400-360q0 33 23.5 56.5T480-280ZM240-160v-400 400Z"],
key: ["M280-400q-33 0-56.5-23.5T200-480q0-33 23.5-56.5T280-560q33 0 56.5 23.5T360-480q0 33-23.5 56.5T280-400Zm0 160q-100 0-170-70T40-480q0-100 70-170t170-70q67 0 121.5 33t86.5 87h335q8 0 15.5 3t13.5 9l80 80q6 6 8.5 13t2.5 15q0 8-2.5 15t-8.5 13L805-325q-5 5-12 8t-14 4q-7 1-14-1t-13-7l-52-39-57 43q-5 4-11 6t-12 2q-6 0-12.5-2t-11.5-6l-61-43h-47q-32 54-86.5 87T280-240Zm0-80q56 0 98.5-34t56.5-86h125l58 41v.5-.5l82-61 71 55 75-75h-.5.5l-40-40v-.5.5H435q-14-52-56.5-86T280-640q-66 0-113 47t-47 113q0 66 47 113t113 47Z"],
logout: ["M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h240q17 0 28.5 11.5T480-800q0 17-11.5 28.5T440-760H200v560h240q17 0 28.5 11.5T480-160q0 17-11.5 28.5T440-120H200Zm487-320H400q-17 0-28.5-11.5T360-480q0-17 11.5-28.5T400-520h287l-75-75q-11-11-11-27t11-28q11-12 28-12.5t29 11.5l143 143q12 12 12 28t-12 28L669-309q-12 12-28.5 11.5T612-310q-11-12-10.5-28.5T613-366l74-74Z"],
target: ["M440-82v-40q-125-14-214.5-103.5T122-440H82q-17 0-28.5-11.5T42-480q0-17 11.5-28.5T82-520h40q14-125 103.5-214.5T440-838v-40q0-17 11.5-28.5T480-918q17 0 28.5 11.5T520-878v40q125 14 214.5 103.5T838-520h40q17 0 28.5 11.5T918-480q0 17-11.5 28.5T878-440h-40q-14 125-103.5 214.5T520-122v40q0 17-11.5 28.5T480-42q-17 0-28.5-11.5T440-82Zm40-118q116 0 198-82t82-198q0-116-82-198t-198-82q-116 0-198 82t-82 198q0 116 82 198t198 82Zm0-120q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 66-47 113t-113 47Zm0-80q33 0 56.5-23.5T560-480q0-33-23.5-56.5T480-560q-33 0-56.5 23.5T400-480q0 33 23.5 56.5T480-400Zm0-80Z"],
grid: ["M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133ZM200-413h133v-134H200v134Zm213 0h134v-134H413v134Zm214 0h133v-134H627v134ZM200-627h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133Z"],
health: ["M480-147q-14 0-28.5-5T426-168l-69-63q-106-97-191.5-192.5T80-634q0-94 63-157t157-63q53 0 100 22.5t80 61.5q33-39 80-61.5T660-854q94 0 157 63t63 157q0 115-85 211T602-230l-68 62q-11 11-25.5 16t-28.5 5Zm-38-543q-29-41-62-62.5T300-774q-60 0-100 40t-40 100q0 52 37 110.5T285.5-410q51.5 55 106 103t88.5 79q34-31 88.5-79t106-103Q726-465 763-523.5T800-634q0-60-40-100t-100-40q-47 0-80 21.5T518-690q-7 10-17 15t-21 5q-11 0-21-5t-17-15Zm38 189Z"],
feedback: ["M200-200q-17 0-28.5-11.5T160-240q0-17 11.5-28.5T200-280h40v-280q0-83 50-147.5T420-792v-28q0-25 17.5-42.5T480-880q25 0 42.5 17.5T540-820v28q80 20 130 84.5T720-560v280h40q17 0 28.5 11.5T800-240q0 17-11.5 28.5T760-200H200Zm280-300Zm0 420q-33 0-56.5-23.5T400-160h160q0 33-23.5 56.5T480-80ZM320-280h320v-280q0-66-47-113t-113-47q-66 0-113 47t-47 113v280Z"],
devices: ["M140-160q-25 0-42.5-17.5T80-220q0-25 17.5-42.5T140-280h20v-440q0-33 23.5-56.5T240-800h560q17 0 28.5 11.5T840-760q0 17-11.5 28.5T800-720H240v440h180q25 0 42.5 17.5T480-220q0 25-17.5 42.5T420-160H140Zm460 0q-17 0-28.5-11.5T560-200v-400q0-17 11.5-28.5T600-640h240q17 0 28.5 11.5T880-600v400q0 17-11.5 28.5T840-160H600Zm40-120h160v-280H640v280Zm0 0h160-160Z"],
splitView: ["M200-520q-33 0-56.5-23.5T120-600v-160q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v160q0 33-23.5 56.5T760-520H200Zm0-80h560v-160H200v160Zm0 480q-33 0-56.5-23.5T120-200v-160q0-33 23.5-56.5T200-440h560q33 0 56.5 23.5T840-360v160q0 33-23.5 56.5T760-120H200Zm0-80h560v-160H200v160Zm0-400v-160 160Zm0 400v-160 160Z"],
wifi: ["M480-120q-42 0-71-29t-29-71q0-42 29-71t71-29q42 0 71 29t29 71q0 42-29 71t-71 29Zm0-440q75 0 142.5 24T745-470q20 15 20.5 39.5T748-388q-17 17-42 17.5T661-384q-38-26-84-41t-97-15q-51 0-97 15t-84 41q-20 14-45 13t-42-18q-17-18-17-42.5t20-39.5q55-42 122.5-65.5T480-560Zm0-240q125 0 235.5 41T914-643q20 17 21 42t-17 43q-17 17-42 17.5T831-556q-72-59-161.5-91.5T480-680q-100 0-189.5 32.5T129-556q-20 16-45 15.5T42-558q-18-18-17-43t21-42q88-75 198.5-116T480-800Z"],
log: ["M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160Zm0-80h640v-400H160v400Zm187-200-76-76q-12-12-11.5-28t12.5-28q12-11 28-11.5t28 11.5l104 104q12 12 12 28t-12 28L328-308q-11 11-27.5 11.5T272-308q-11-11-11-28t11-28l75-76Zm173 160q-17 0-28.5-11.5T480-320q0-17 11.5-28.5T520-360h160q17 0 28.5 11.5T720-320q0 17-11.5 28.5T680-280H520Z"],
checkCircle: ["m424-408-86-86q-11-11-28-11t-28 11q-11 11-11 28t11 28l114 114q12 12 28 12t28-12l226-226q11-11 11-28t-11-28q-11-11-28-11t-28 11L424-408Zm56 328q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"],
warning: ["M109-120q-11 0-20-5.5T75-140q-5-9-5.5-19.5T75-180l370-640q6-10 15.5-15t19.5-5q10 0 19.5 5t15.5 15l370 640q6 10 5.5 20.5T885-140q-5 9-14 14.5t-20 5.5H109Zm69-80h604L480-720 178-200Zm302-40q17 0 28.5-11.5T520-280q0-17-11.5-28.5T480-320q-17 0-28.5 11.5T440-280q0 17 11.5 28.5T480-240Zm0-120q17 0 28.5-11.5T520-400v-120q0-17-11.5-28.5T480-560q-17 0-28.5 11.5T440-520v120q0 17 11.5 28.5T480-360Zm0-100Z"],
delete: ["M280-120q-33 0-56.5-23.5T200-200v-520q-17 0-28.5-11.5T160-760q0-17 11.5-28.5T200-800h160q0-17 11.5-28.5T400-840h160q17 0 28.5 11.5T600-800h160q17 0 28.5 11.5T800-760q0 17-11.5 28.5T760-720v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM400-280q17 0 28.5-11.5T440-320v-280q0-17-11.5-28.5T400-640q-17 0-28.5 11.5T360-600v280q0 17 11.5 28.5T400-280Zm160 0q17 0 28.5-11.5T600-320v-280q0-17-11.5-28.5T560-640q-17 0-28.5 11.5T520-600v280q0 17 11.5 28.5T560-280ZM280-720v520-520Z"],
chevron: ["M504-480 348-636q-11-11-11-28t11-28q11-11 28-11t28 11l184 184q6 6 8.5 13t2.5 15q0 8-2.5 15t-8.5 13L404-268q-11 11-28 11t-28-11q-11-11-11-28t11-28l156-156Z"],
sports: ["M440-200q-100 0-170-70t-70-170q0-11 1-22t3-22q-5 2-12 3t-12 1q-42 0-71-29t-29-71q0-42 27.5-71t69.5-29q33 0 59.5 18.5T274-614q33-30 75.5-48t90.5-18h400q17 0 28.5 11.5T880-640v80q0 17-11.5 28.5T840-520H680v80q0 100-70 170t-170 70ZM180-540q17 0 28.5-11.5T220-580q0-17-11.5-28.5T180-620q-17 0-28.5 11.5T140-580q0 17 11.5 28.5T180-540Zm260 240q58 0 99-41t41-99q0-58-41-99t-99-41q-58 0-99 41t-41 99q0 58 41 99t99 41Zm0-60q33 0 56.5-23.5T520-440q0-33-23.5-56.5T440-520q-33 0-56.5 23.5T360-440q0 33 23.5 56.5T440-360Zm0-80Z"],
gamepad: ["M182-200q-51 0-79-35.5T82-322l42-300q9-60 53.5-99T282-760h396q60 0 104.5 39t53.5 99l42 300q7 51-21 86.5T778-200q-21 0-39-7.5T706-230l-90-90H344l-90 90q-15 15-33 22.5t-39 7.5Zm16-86 114-114h336l114 114q2 2 16 6 11 0 17.5-6.5T800-304l-44-308q-4-29-26-48.5T678-680H282q-30 0-52 19.5T204-612l-44 308q-2 11 4.5 17.5T182-280q2 0 16-6Zm482-154q17 0 28.5-11.5T720-480q0-17-11.5-28.5T680-520q-17 0-28.5 11.5T640-480q0 17 11.5 28.5T680-440Zm-80-120q17 0 28.5-11.5T640-600q0-17-11.5-28.5T600-640q-17 0-28.5 11.5T560-600q0 17 11.5 28.5T600-560Zm-120 80Zm-170-30v40q0 13 8.5 21.5T340-440q13 0 21.5-8.5T370-470v-40h40q13 0 21.5-8.5T440-540q0-13-8.5-21.5T410-570h-40v-40q0-13-8.5-21.5T340-640q-13 0-21.5 8.5T310-610v40h-40q-13 0-21.5 8.5T240-540q0 13 8.5 21.5T270-510h40Z"],
reconnect: ["M240-478q0 45 17 87.5t53 78.5l10 10v-58q0-17 11.5-28.5T360-400q17 0 28.5 11.5T400-360v160q0 17-11.5 28.5T360-160H200q-17 0-28.5-11.5T160-200q0-17 11.5-28.5T200-240h70l-16-14q-52-46-73-105t-21-119q0-94 48-170.5T337-766q14-8 29.5-1t20.5 23q5 15-.5 30T367-691q-58 32-92.5 88.5T240-478Zm480-4q0-45-17-87.5T650-648l-10-10v58q0 17-11.5 28.5T600-560q-17 0-28.5-11.5T560-600v-160q0-17 11.5-28.5T600-800h160q17 0 28.5 11.5T800-760q0 17-11.5 28.5T760-720h-70l16 14q49 49 71.5 106.5T800-482q0 94-48 170.5T623-194q-14 8-29.5 1T573-216q-5-15 .5-30t19.5-23q58-32 92.5-88.5T720-482Z"],
calibration: ["M479-359q-50 0-85-35t-35-85q0-50 35-85t85-35q50 0 85 35t35 85q0 50-35 85t-85 35Zm-57 222-85-85q-12-12-11.5-28.5T338-279q12-12 28.5-12t28.5 12l85 86 85-85q11-11 28-11t28 11q11 11 11 28t-11 28l-85 85q-12 12-27 18t-30 6q-15 0-30-6t-27-18ZM221-337l-85-85q-12-12-18-27t-6-30q0-15 6-30t18-27l85-85q12-12 28.5-12t28.5 12q12 12 12 28.5T278-564l-86 86 85 85q11 11 11 28t-11 28q-11 11-28 11t-28-11Zm116-401 85-85q12-12 27-18t30-6q15 0 30 6t27 18l85 85q12 12 12 28t-12 28q-12 12-28.5 12T564-682l-86-85-85 85q-11 11-28 11t-28-11q-11-11-11-28t11-28Zm344 343 85-85-85-85q-11-11-11-28t11-28q11-11 28-11t28 11l85 85q12 12 18 27t6 30q0 15-6 30t-18 27l-85 85q-12 12-28 11.5T681-338q-12-12-12-28.5t12-28.5Z"],
} as const;
+4 -3
View File
@@ -1,5 +1,6 @@
import { useState } from "react";
import { Button } from "./controls";
import { Icon } from "./Icon";
import { maintenanceApi, selectMaintenanceDirectory, type ArmorBuildRequest, type BundleInfo } from "../lib/maintenance";
export function ArmorBuildPanel({ disabled, onBusy, onBuilt, onError }: {
@@ -25,7 +26,7 @@ export function ArmorBuildPanel({ disabled, onBusy, onBuilt, onError }: {
const ready = request.repoPath && request.targetDir && request.ssid && Number.isInteger(request.threshold) && request.threshold >= 0 && request.threshold <= 4095;
if (building) return <div className="mnt-build__body"><div className="mnt-build__team">ESP32-C3 / 通用固件 / 阈值 {request.threshold}</div><p className="mnt-hint">编译和打包完成后,会自动加载固件包供检查。此步骤不会烧录设备。</p></div>;
return <div className="mnt-build">
<nav className="mnt-tabs" aria-label="编译参数"><button className={tab === "network" ? "is-active" : ""} onClick={() => setTab("network")}>01 / 连接参数</button><button className={tab === "environment" ? "is-active" : ""} onClick={() => setTab("environment")}>02 / 构建环境</button></nav>
<nav className="mnt-tabs" aria-label="编译参数"><button className={tab === "network" ? "is-active" : ""} onClick={() => setTab("network")}><Icon name="wifi" />01 / 连接参数</button><button className={tab === "environment" ? "is-active" : ""} onClick={() => setTab("environment")}><Icon name="build" />02 / 构建环境</button></nav>
<div className="mnt-build__body">
{tab === "network" ? <>
<div className="mnt-build__team">通用固件 / 红蓝共用</div>
@@ -37,12 +38,12 @@ export function ArmorBuildPanel({ disabled, onBusy, onBuilt, onError }: {
<p className="mnt-hint">在客户端选择队伍后,装甲板会切换灯色。仅对局进行中允许扣血,其他阶段受击只闪灯。Wi-Fi 名称和密码会编入镜像,不改写 .env。</p>
</> : <>
<div className="mnt-build__fields">
{([["repoPath", "项目源码根目录", "选择含 armor/ 的项目根目录"], ["targetDir", "独立构建输出目录", "Windows 建议 C:\\c3vt(最多 10 字符)"], ["idfPath", "已有 ESP-IDF(可选)", "留空下载 v6.0.1"]] as const).map(([key, label, placeholder]) => <label key={key}><span>{label}</span><div className="mnt-row"><input className="input" value={request[key]} placeholder={placeholder} disabled={disabled} onChange={event => patch({ [key]: event.target.value })} /><Button disabled={disabled} onClick={() => void directory(key, label)}>浏览</Button></div></label>)}
{([["repoPath", "项目源码根目录", "选择含 armor/ 的项目根目录"], ["targetDir", "独立构建输出目录", "Windows 建议 C:\\c3vt(最多 10 字符)"], ["idfPath", "已有 ESP-IDF(可选)", "留空下载 v6.0.1"]] as const).map(([key, label, placeholder]) => <label key={key}><span>{label}</span><div className="mnt-row"><input className="input" value={request[key]} placeholder={placeholder} disabled={disabled} onChange={event => patch({ [key]: event.target.value })} /><Button icon="folder" disabled={disabled} onClick={() => void directory(key, label)}>浏览</Button></div></label>)}
<label><span>构建网络代理(可选,仅本次编译)</span><input className="input" value={request.proxyUrl} placeholder="http://127.0.0.1:端口;留空沿用进程环境" disabled={disabled} onChange={event => patch({ proxyUrl: event.target.value })} /></label>
</div>
<p className="mnt-hint">需要 Rust esp-1.97.0.0、ldproxy、Python、CMake 和 Ninja。代理仅用于 Git/Python 下载,仍会校验证书。</p>
</>}
<div className="mnt-task__actions">{tab === "network" ? <Button variant="primary" onClick={() => setTab("environment")}>下一步:构建环境</Button> : <><Button variant="primary" disabled={disabled || !ready} onClick={() => void build()}>{building ? "正在编译…" : "编译并加载固件包"}</Button><Button variant="ghost" disabled={disabled} onClick={() => setTab("network")}>上一步</Button></>}</div>
<div className="mnt-task__actions">{tab === "network" ? <Button icon="next" variant="primary" onClick={() => setTab("environment")}>下一步:构建环境</Button> : <><Button icon="build" variant="primary" disabled={disabled || !ready} onClick={() => void build()}>{building ? "正在编译…" : "编译并加载固件包"}</Button><Button icon="back" variant="ghost" disabled={disabled} onClick={() => setTab("network")}>上一步</Button></>}</div>
</div>
</div>;
}
+22 -28
View File
@@ -1,25 +1,8 @@
/**
* 启动序列。
*
* # 它不是假的过场
*
* 每一行都对应一件**真的还没做完的事**:字体、后端通道、首份快照、身份判定。后端没起来时
* 它就停在那儿,而不是假装走到 100% 再放你进去。指南里说序列动画应当"看起来像在载入信息,
* 而不是立刻跳出来"——那是视觉要求;这里额外满足了"不许骗人"这个更硬的要求。
*
* # 为什么要等字体
*
* 中文是整个界面的主要字形,它由 82 个 unicode-range 分片按需下载。首帧如果先画成系统
* 黑体、两百毫秒后再跳成 HarmonyOS,整块布局会跟着重排一次——启动时这一个抖动比多等
* 一瞬难看得多。所以这里等 `document.fonts.ready`。
*
* # 布局
*
* 左侧是系统标记与版本,中间是逐行亮起的自检,底部一条真实进度。整屏用切角框住,
* 四角有定位括号:这是"终端在做开机自检"的画面,不是"加载中的转圈"。
*/
/** 无边框启动卡片:进度来自字体、服务连接与首份状态,保留扫描和逐项完成动效。 */
import { BrandMark } from "./BrandMark";
import { Icon } from "./Icon";
import { VERSION_LABEL } from "../lib/version";
interface Milestone {
key: string;
@@ -37,24 +20,33 @@ interface Props {
fatal?: string | null;
/** 淡出中。 */
leaving?: boolean;
onRetry?: () => void;
onCancel?: () => void;
preview?: boolean;
}
export function Boot({ milestones, progress, fatal, leaving = false }: Props) {
export function Boot({ milestones, progress, fatal, leaving = false, onRetry, onCancel, preview = false }: Props) {
return (
<div className={`boot${leaving ? " is-leaving" : ""}`}>
<div className={`boot${leaving ? " is-leaving" : ""}`} aria-label="启动加载">
<div className="boot__card">
<div className="boot__grid" aria-hidden="true" />
<div className="boot__scan" aria-hidden="true" />
<div className="boot__frame plate corners">
<div className="boot__frame">
<div className="boot__eyebrow label">
<span>{preview ? "合成预览 · 启动动画" : "SIMBA ROBOTICS"}</span>
<span className="num">{VERSION_LABEL}</span>
{onCancel && <button type="button" className="boot__close" onClick={onCancel} title="退出启动" aria-label="退出启动"><Icon name="close" /></button>}
</div>
<header className="boot__head">
<span className="boot__mark" aria-hidden="true">
<BrandMark size={30} />
<BrandMark size={44} />
</span>
<div className="boot__titles">
<span className="boot__name">
RMIC<span className="boot__slash">::</span>2026
</span>
<span className="boot__sub label">裁判系统客户端 · SIMBA ROBOTICS</span>
<span className="boot__sub label">裁判系统客户端</span>
</div>
</header>
@@ -70,16 +62,17 @@ export function Boot({ milestones, progress, fatal, leaving = false }: Props) {
</ul>
{fatal ? (
<div className="boot__fatal">
<div className="boot__fatal" role="alert">
<span className="boot__fatal-title">启动失败</span>
<p className="boot__fatal-text">{fatal}</p>
<p className="boot__fatal-hint">
端口可能被其他客户端占用。请关闭正在运行的客户端,再重新启动。
请按上面的原因检查后重试,或退出后重新启动客户端。
</p>
{onRetry && <button type="button" className="btn btn--ghost boot__retry" onClick={onRetry}><Icon name="refresh" />重新加载</button>}
</div>
) : (
<div className="boot__foot">
<div className="boot__bar">
<div className="boot__bar" role="progressbar" aria-label="启动进度" aria-valuemin={0} aria-valuemax={100} aria-valuenow={Math.round(Math.max(0, Math.min(1, progress)) * 100)}>
<span
className="boot__bar-fill"
style={{ width: `${Math.round(Math.max(0, Math.min(1, progress)) * 100)}%` }}
@@ -97,6 +90,7 @@ export function Boot({ milestones, progress, fatal, leaving = false }: Props) {
</div>
)}
</div>
</div>
</div>
);
}
+24
View File
@@ -0,0 +1,24 @@
/** 浏览器中的合成启动预览,不参与原生启动状态判断。 */
import { useEffect, useState } from "react";
import { Boot } from "./Boot";
export function BootPreview({ failed }: { failed: boolean }) {
const [step, setStep] = useState(0);
useEffect(() => {
const timer = window.setInterval(() => setStep(current => (current + 1) % 5), 1000);
return () => window.clearInterval(timer);
}, []);
const completed = failed ? 1 : Math.min(step, 3);
return <Boot
preview
milestones={[
{ key: "fonts", label: "加载字体", code: "HARMONYOS · JETBRAINS", done: completed >= 1 },
{ key: "channel", label: "连接本机服务", code: "LOCAL IPC", done: completed >= 2 },
{ key: "snapshot", label: "读取运行状态", code: "SNAPSHOT 200ms", done: completed >= 3 },
]}
progress={[0, 0.32, 0.56, 1][completed]}
fatal={failed ? "合成错误:本机服务未响应。" : null}
onRetry={() => { location.search = "?preview=boot"; }}
onCancel={() => { location.search = "?preview=first-run"; }}
/>;
}
+29 -26
View File
@@ -1,32 +1,33 @@
/** 参照裸板绘制;状态只表示 USB 识别与任务进度,不推断实际灯色或外设连接。 */
/** 接线示意,不按元件实物着色;状态仅表示 USB 识别与维护进度。 */
function ArmorBoard() {
return <g className="device-diagram__board device-diagram__armor">
<path className="device-diagram__pcb" d="M288 83h134l16 18v30h7v98h-7v41l-15 13H288l-16-13v-41h-7v-98h7v-30Z" />
{[291, 419].flatMap(x => [105, 263].map(y => <circle className="device-diagram__hole" key={`${x}-${y}`} cx={x} cy={y} r="5" />))}
<path className="device-diagram__trace" d="M305 110h22v24h16v37m62-61h-21v24h-17v37m-62-28h15m69 0h16m-100 38h12m75 0h13m-100 38h12m75 0h13M313 248v15h25m43-15v15h25" />
{[286, 404].flatMap(x => [126, 164, 202].map(y => <g key={`${x}-${y}`}><rect className="device-diagram__pixel" x={x} y={y} width="20" height="20" rx="2" /><circle className="device-diagram__diode" cx={x + 10} cy={y + 10} r="4" /></g>))}
<rect className="device-diagram__shield" x="320" y="177" width="70" height="72" rx="3" />
<text x="355" y="207" textAnchor="middle">ESP32-C3</text><text className="device-diagram__sublabel" x="355" y="223" textAnchor="middle">MINI-1</text>
{[316, 394].flatMap(x => [183, 196, 209, 222, 235].map(y => <rect className="device-diagram__smd" key={`${x}-${y}`} x={x} y={y} width="3" height="6" />))}
{[335, 355, 375].map(x => <g key={x}><circle className="device-diagram__pad" cx={x} cy="151" r="3" /><path className="device-diagram__trace" d={`M${x} 154v14`} /></g>)}
<circle className="device-diagram__pad" cx="388" cy="174" r="4" />
<rect className="device-diagram__usb" x="342" y="269" width="26" height="18" rx="4" /><path d="M347 281h16" />
<path className="device-diagram__pcb" d="M273 82h164l18 18v160l-18 18H273l-18-18V100Z" />
{[273, 437].flatMap(x => [100, 260].map(y => <circle className="device-diagram__mount" key={`${x}-${y}`} cx={x} cy={y} r="3" />))}
{[282, 428].flatMap(x => [132, 180, 228].map(y => <rect className="device-diagram__module" key={`${x}-${y}`} x={x - 10} y={y - 10} width="20" height="20" rx="3" />))}
<rect className="device-diagram__module" x="317" y="139" width="76" height="82" rx="4" />
<path className="device-diagram__symbol" d="m355 155 14 5v12c0 10-14 17-14 17s-14-7-14-17v-12Z" />
<text x="355" y="207" textAnchor="middle">ESP32-C3</text>
<path className="device-diagram__detail" d="M301 180h16m76 0h16m-54 41v37" />
<rect className="device-diagram__usb is-connected" x="339" y="267" width="32" height="20" rx="4" />
<path className="device-diagram__socket" d="M346 280h18" />
</g>;
}
function CameraBoard() {
return <g className="device-diagram__board device-diagram__camera">
<rect className="device-diagram__pcb" x="309" y="88" width="92" height="195" rx="6" />
{[310, 400].flatMap(x => Array.from({ length: 14 }, (_, i) => <circle className="device-diagram__pad" key={`${x}-${i}`} cx={x} cy={103 + i * 11} r="2.2" />))}
<rect className="device-diagram__shield" x="323" y="105" width="64" height="55" rx="2" />
<text className="device-diagram__sublabel" x="355" y="141" textAnchor="middle">ESP32-S3</text><text className="device-diagram__sublabel" x="355" y="153" textAnchor="middle">WROOM</text>
<path className="device-diagram__ribbon" d="M338 100v73h34v-73" /><rect className="device-diagram__connector" x="332" y="168" width="46" height="12" rx="1" />
<rect className="device-diagram__lens-base" x="327" y="62" width="56" height="51" rx="7" /><circle className="device-diagram__lens" cx="355" cy="87" r="21" /><circle className="device-diagram__glass" cx="355" cy="87" r="12" /><path className="device-diagram__lens-shine" d="M349 81q6-5 12 0" />
<text className="device-diagram__sublabel" x="355" y="202" textAnchor="middle">OV5640</text>
<rect className="device-diagram__chip" x="346" y="213" width="18" height="18" rx="1" />
{[324, 374].map(x => <g key={x}><rect className="device-diagram__button" x={x} y="242" width="12" height="12" rx="1" /><circle cx={x + 6} cy="248" r="3" /></g>)}
{[319, 361].map(x => <g key={x}><rect className="device-diagram__usb" x={x} y="267" width="30" height="19" rx="4" /><path d={`M${x + 5} 280h20`} /></g>)}
<path className="device-diagram__trace" d="M325 216h13v17h-12m58-17h-12v17h12" />
<rect className="device-diagram__pcb" x="303" y="82" width="104" height="196" rx="8" />
{[315, 395].flatMap(x => [100, 258].map(y => <circle className="device-diagram__mount" key={`${x}-${y}`} cx={x} cy={y} r="3" />))}
<rect className="device-diagram__module" x="322" y="101" width="66" height="62" rx="5" />
<circle className="device-diagram__symbol" cx="355" cy="132" r="20" />
<circle className="device-diagram__detail" cx="355" cy="132" r="9" />
<path className="device-diagram__detail" d="M355 163v18" />
<rect className="device-diagram__module" x="322" y="181" width="66" height="49" rx="4" />
<text x="355" y="210" textAnchor="middle">ESP32-S3</text>
<path className="device-diagram__detail" d="M355 230v15h27v22" />
<rect className="device-diagram__usb" x="313" y="267" width="30" height="20" rx="4" />
<path className="device-diagram__socket" d="M319 280h18" />
<rect className="device-diagram__usb is-connected" x="367" y="267" width="30" height="20" rx="4" />
<path className="device-diagram__socket" d="M373 280h18" />
</g>;
}
@@ -41,12 +42,14 @@ export function DeviceDiagram({ kind, identified, portAvailable, active, failed,
chip: string;
}) {
const circumference = 2 * Math.PI * 132;
return <svg className={`device-diagram${identified || complete ? " is-identified" : ""}${active ? " is-active" : ""}${failed ? " is-failed" : ""}${complete ? " is-complete" : ""}`} viewBox="0 0 580 360" role="img" aria-label={`${kind === "armor" ? "装甲板主板" : kind === "camera" ? "图传板" : "目标设备"}:${complete ? "任务已完成" : failed ? "任务未完成" : identified ? "USB 已识别" : portAvailable ? "有串口,尚未读取" : "等待 USB 连接"}`}>
// 图传板两个接口中使用右侧 USB;装甲板使用底部中央接口。
const usbX = kind === "camera" ? 382 : 355;
return <svg className={`device-diagram${identified || complete ? " is-identified" : ""}${active ? " is-active" : ""}${failed ? " is-failed" : ""}${complete ? " is-complete" : ""}`} viewBox="0 0 580 360" preserveAspectRatio="xMidYMid meet" role="img" aria-label={`${kind === "armor" ? "装甲板主板" : kind === "camera" ? "图传板,接入右侧 USB 口" : "目标设备"}:${complete ? "任务已完成" : failed ? "任务未完成" : identified ? "USB 已识别" : portAvailable ? "有串口,尚未读取" : "等待 USB 连接"}`}>
<circle className="device-diagram__orbit" cx="355" cy="180" r="132" />
<g transform="rotate(-90 355 180)">{(active || complete || ratio !== null) && <circle className={`device-diagram__progress${active && ratio === null ? " is-indeterminate" : ""}`} cx="355" cy="180" r="132" strokeDasharray={circumference} strokeDashoffset={circumference * (1 - (complete ? 1 : ratio ?? .12))} />}</g>
<g className="device-diagram__computer"><rect x="28" y="142" width="82" height="58" rx="4" /><path d="M69 201v14m-24 0h48m-44-45 10 8-10 8m18 0h19" /><circle className="device-diagram__led" cx="98" cy="153" r="3" /></g>
<path className={`device-diagram__cable${portAvailable ? " is-present" : ""}`} d={`M112 171h40q18 0 18 18v92q0 18 18 18h${kind === "camera" ? 127 : 147}q19 0 19-13`} />
{kind === "armor" ? <ArmorBoard /> : kind === "camera" ? <CameraBoard /> : <g className="device-diagram__board"><rect className="device-diagram__pcb" x="290" y="112" width="130" height="158" rx="8" /><text x="355" y="186" textAnchor="middle">USB</text><text className="device-diagram__sublabel" x="355" y="207" textAnchor="middle">选择维护对象</text><rect className="device-diagram__usb" x="342" y="269" width="26" height="18" rx="4" /></g>}
<text className="device-diagram__caption" x="69" y="245" textAnchor="middle">CLIENT / USB</text><text className="device-diagram__caption" x="355" y="335" textAnchor="middle">{kind === "armor" ? "装甲板 · ESP32-C3 · 六灯珠" : kind === "camera" ? "图传板 · ESP32-S3 · OV5640" : chip || "选择维护对象"}</text>
<path className={`device-diagram__cable${portAvailable ? " is-present" : ""}`} d={`M112 171h38q20 0 20 20v97q0 20 20 20h${usbX - 208}q18 0 18-18v-4`} />
{kind === "armor" ? <ArmorBoard /> : kind === "camera" ? <CameraBoard /> : <g className="device-diagram__board"><rect className="device-diagram__pcb" x="290" y="112" width="130" height="166" rx="8" /><text x="355" y="186" textAnchor="middle">USB</text><text className="device-diagram__sublabel" x="355" y="207" textAnchor="middle">选择维护对象</text><rect className="device-diagram__usb is-connected" x="339" y="267" width="32" height="20" rx="4" /></g>}
<text className="device-diagram__caption" x="69" y="245" textAnchor="middle">CLIENT / USB</text><text className="device-diagram__caption" x="355" y="340" textAnchor="middle">{kind === "armor" ? "装甲板 · ESP32-C3" : kind === "camera" ? "图传板 · 右侧 USB 接入" : chip || "选择维护对象"}</text>
</svg>;
}
+2 -1
View File
@@ -1,4 +1,5 @@
import { useEffect, useRef, useState, type ReactNode } from "react";
import { Icon } from "./Icon";
/** 原生模态框负责焦点约束与关闭后的焦点恢复。 */
export function Dialog({ title, children, onClose, className = "", closeDisabled = false }: {
@@ -37,7 +38,7 @@ export function Dialog({ title, children, onClose, className = "", closeDisabled
return <dialog ref={ref} className={`ui-dialog ${className}${closing ? " is-closing" : ""}`} aria-label={title} inert={closing}
onKeyDown={event => { if (event.key === "Escape") event.stopPropagation(); }}
onCancel={event => { event.preventDefault(); requestClose(); }}>
<header className="ui-dialog__head"><h2>{title}</h2><button type="button" className="btn btn--quiet" onClick={requestClose} disabled={closeDisabled || closing} aria-label="关闭">关闭 <kbd>ESC</kbd></button></header>
<header className="ui-dialog__head"><h2>{title}</h2><button type="button" className="btn btn--quiet" onClick={requestClose} disabled={closeDisabled || closing} aria-label="关闭"><Icon name="close" />关闭 <kbd>ESC</kbd></button></header>
{typeof children === "function" ? children(requestClose) : children}
</dialog>;
}
+6 -6
View File
@@ -20,6 +20,7 @@ import { useEffect, useRef, useState } from "react";
import { api } from "../lib/ipc";
import { pushNote } from "../lib/store";
import type { Role } from "../lib/types";
import { Icon } from "./Icon";
const MODULES: {
role: Role;
@@ -94,6 +95,7 @@ export function RolePicker({ onOpenMaintenance }: { onOpenMaintenance?: () => vo
>
<span className="module__index num">{module.index}</span>
<span className="module__name">
<Icon name={module.role === "team" ? "gamepad" : "sports"} />
{module.cn}
<span className="module__en label">{module.en}</span>
</span>
@@ -109,9 +111,7 @@ export function RolePicker({ onOpenMaintenance }: { onOpenMaintenance?: () => vo
<span className="module__cta">
{busy === module.role ? "正在切换…" : "使用此模式"}
<span className="module__arrow" aria-hidden="true">
→
</span>
<Icon name="next" className="module__arrow" />
</span>
<span className="module__corners" aria-hidden="true" />
@@ -123,7 +123,7 @@ export function RolePicker({ onOpenMaintenance }: { onOpenMaintenance?: () => vo
{onOpenMaintenance && (
<button type="button" className="gate__maintenance" onClick={onOpenMaintenance} disabled={busy !== null}>
打开固件维护
<Icon name="firmware" />打开固件维护
</button>
)}
</div>
@@ -235,7 +235,7 @@ export function SetupPassword({ onOpenMaintenance }: { onOpenMaintenance?: () =>
onClick={() => void submit()}
disabled={busy || first.length < 4}
>
{busy ? "保存中…" : "设置密码并继续"}
<Icon name="key" />{busy ? "保存中…" : "设置密码并继续"}
<span className="btn__key">⏎</span>
</button>
</div>
@@ -247,7 +247,7 @@ export function SetupPassword({ onOpenMaintenance }: { onOpenMaintenance?: () =>
{onOpenMaintenance && (
<button type="button" className="gate__maintenance" onClick={onOpenMaintenance} disabled={busy}>
打开固件维护
<Icon name="firmware" />打开固件维护
</button>
)}
</div>
+11
View File
@@ -0,0 +1,11 @@
import { materialPaths } from "../assets/material-symbols/paths";
export type IconName = keyof typeof materialPaths;
/** Local Material Symbols Rounded. The surrounding control supplies its accessible name. */
export function Icon({ name, className = "" }: { name: IconName; className?: string }) {
return <svg className={`icon${className ? ` ${className}` : ""}`} viewBox="0 -960 960 960"
width="20" height="20" fill="currentColor" aria-hidden="true" focusable="false">
{materialPaths[name].map((path, index) => <path key={index} d={path} />)}
</svg>;
}
+5 -4
View File
@@ -1,5 +1,6 @@
import { useEffect, useMemo, useRef, useState } from "react";
import { Dialog } from "./Dialog";
import { Icon } from "./Icon";
import { api } from "../lib/ipc";
import { useAppStore } from "../lib/store";
import { MATCH_PHASE, matchTime, projectMatch } from "../lib/match-time";
@@ -96,17 +97,17 @@ export function RefereeMatchControl({ snapshot, onError }: { snapshot: Snapshot;
<div className="match-control__identity"><span className="label">MATCH CONTROL</span><span>{snapshot.demo ? "本机演示 · 合成计时" : "裁判计时 / 局域网同步"}</span>{!snapshot.demo && <small className={snapshot.matchClock.syncError ? "is-error" : ""}>{snapshot.matchClock.syncError ?? "仅对局进行中扣血;准备与暂停时只闪灯"}</small>}</div>
<Readout clock={clock} names={snapshot.config.teamNames} />
<div className="match-control__actions">
{clock.phase === "idle" || clock.phase === "finished" ? <button className="btn btn--primary" disabled={busy} onClick={() => void run({ type: "prepare" })}>开始 3 分钟准备</button> : clock.phase === "ready" ? <div className="match-control__start"><label>开赛倒计时 <input aria-label="开赛倒计时秒数" type="number" min="1" max="60" step="1" value={seconds} onChange={e => setSeconds(Number(e.target.value))} /> 秒</label><button className="btn btn--primary" disabled={busy || !Number.isInteger(seconds) || seconds < 1 || seconds > 60} onClick={() => void run({ type: "countdown", seconds })}>确认开赛</button></div> : clock.phase === "paused" ? <button className="btn btn--primary" disabled={busy} onClick={() => void run({ type: "resume" })}>恢复{clock.resumePhase === "preparation" ? "准备" : clock.resumePhase === "ready" ? "待开赛阶段" : clock.resumePhase === "countdown" ? "倒计时" : "对局"}</button> : <span className="match-control__hint">{clock.phase === "preparation" ? "准备结束后等待裁判确认开赛" : clock.phase === "countdown" ? "请选手就位" : "计时到零结束本局"}</span>}
<div className="match-control__buttons"><button className="btn" disabled={busy || !active} onClick={() => openPause("player")}>选手暂停</button><button className="btn" disabled={busy || !active} onClick={() => openPause("official")}>官方暂停</button>{active || clock.phase === "paused" ? <button className="btn btn--quiet" disabled={busy} onClick={() => setDialog("end")}>结束本局</button> : clock.phase === "finished" && <button className="btn btn--quiet" disabled={busy} onClick={() => void run({ type: "reset" })}>清除计时</button>}</div>
{clock.phase === "idle" || clock.phase === "finished" ? <button className="btn btn--primary" disabled={busy} onClick={() => void run({ type: "prepare" })}><Icon name="timer" />开始 3 分钟准备</button> : clock.phase === "ready" ? <div className="match-control__start"><label>开赛倒计时 <input aria-label="开赛倒计时秒数" type="number" min="1" max="60" step="1" value={seconds} onChange={e => setSeconds(Number(e.target.value))} /> 秒</label><button className="btn btn--primary" disabled={busy || !Number.isInteger(seconds) || seconds < 1 || seconds > 60} onClick={() => void run({ type: "countdown", seconds })}><Icon name="play" />确认开赛</button></div> : clock.phase === "paused" ? <button className="btn btn--primary" disabled={busy} onClick={() => void run({ type: "resume" })}><Icon name="play" />恢复{clock.resumePhase === "preparation" ? "准备" : clock.resumePhase === "ready" ? "待开赛阶段" : clock.resumePhase === "countdown" ? "倒计时" : "对局"}</button> : <span className="match-control__hint">{clock.phase === "preparation" ? "准备结束后等待裁判确认开赛" : clock.phase === "countdown" ? "请选手就位" : "计时到零结束本局"}</span>}
<div className="match-control__buttons"><button className="btn" disabled={busy || !active} onClick={() => openPause("player")}><Icon name="pause" />选手暂停</button><button className="btn" disabled={busy || !active} onClick={() => openPause("official")}><Icon name="pause" />官方暂停</button>{active || clock.phase === "paused" ? <button className="btn btn--quiet" disabled={busy} onClick={() => setDialog("end")}><Icon name="stop" />结束本局</button> : clock.phase === "finished" && <button className="btn btn--quiet" disabled={busy} onClick={() => void run({ type: "reset" })}><Icon name="reset" />清除计时</button>}</div>
</div>
{dialog && <Dialog title={dialog === "end" ? "结束本局计时" : dialog === "player" ? "选手技术暂停" : "官方技术暂停"} closeDisabled={busy} onClose={() => setDialog(null)} className="match-dialog">
{close => <div className="match-dialog__body">{dialog === "end" ? <><p>结束当前计时并同步到选手端,同时停止装甲板扣血。比赛结果由裁判判定。</p><button className="btn btn--primary" disabled={busy} onClick={() => void run({ type: "end" }, close)}>确认结束本局</button></> : <>
{close => <div className="match-dialog__body">{dialog === "end" ? <><p>结束当前计时并同步到选手端,同时停止装甲板扣血。比赛结果由裁判判定。</p><button className="btn btn--primary" disabled={busy} onClick={() => void run({ type: "end" }, close)}><Icon name="stop" />确认结束本局</button></> : <>
<p>{dialog === "player" ? "选手技术暂停为 5 分钟,须先获得主裁判批准。时间到后,等待裁判恢复比赛。" : "官方暂停显示已用时,由裁判手动恢复。规则页未规定固定时限。"}</p>
{dialog === "player" && <label>申请队伍<select value={team} onChange={e => setTeam(Number(e.target.value))}>{snapshot.config.teamNames.map((name, i) => <option key={i} value={i}>{name}</option>)}</select></label>}
<label>暂停原因<input data-initial-focus value={reason} onChange={e => setReason(e.target.value)} maxLength={192} placeholder="例如:图传中断,需要检查接线" /></label>
<small>最多 192 个 UTF-8 字节,约 64 个汉字。</small>
{dialog === "player" && <label className="match-dialog__approval"><input type="checkbox" checked={approved} onChange={e => setApproved(e.target.checked)} />已获得主裁判批准</label>}
<button className="btn btn--primary" disabled={busy || !reasonValid || (dialog === "player" && !approved)} onClick={() => void run(dialog === "player" ? { type: "pausePlayer", team, reason, approved } : { type: "pauseOfficial", reason }, close)}>开始{dialog === "player" ? "5 分钟暂停" : "官方暂停"}</button>
<button className="btn btn--primary" disabled={busy || !reasonValid || (dialog === "player" && !approved)} onClick={() => void run(dialog === "player" ? { type: "pausePlayer", team, reason, approved } : { type: "pauseOfficial", reason }, close)}><Icon name="pause" />开始{dialog === "player" ? "5 分钟暂停" : "官方暂停"}</button>
</>}</div>}
</Dialog>}
</section>;
+10 -9
View File
@@ -20,6 +20,7 @@ import { convertFileSrc } from "@tauri-apps/api/core";
import { api } from "../lib/ipc";
import { bytes, since } from "../lib/format";
import type { MediaFileDto, Snapshot } from "../lib/types";
import { Icon } from "./Icon";
interface Props {
snapshot: Snapshot;
@@ -77,7 +78,7 @@ export function MediaPanel({ snapshot, onError, onInfo }: Props) {
);
}}
>
<span className="media__rec-glyph" aria-hidden="true" />
<Icon name="record" />
录制全部在线画面
</button>
@@ -89,7 +90,7 @@ export function MediaPanel({ snapshot, onError, onInfo }: Props) {
guard(api.stopRecording([]));
}}
>
停止全部录制
<Icon name="stop" />停止全部录制
</button>
<span className="media__divider" aria-hidden="true" />
@@ -108,7 +109,7 @@ export function MediaPanel({ snapshot, onError, onInfo }: Props) {
);
}}
>
截图
<Icon name="image" />截图
<span className="num media__cam">0x{camera.toString(16).toUpperCase().padStart(8, "0")}</span>
</button>
))}
@@ -124,7 +125,7 @@ export function MediaPanel({ snapshot, onError, onInfo }: Props) {
.catch((err) => onError(err instanceof Error ? err.message : String(err)));
}}
>
打开录制目录
<Icon name="folder" />打开录制目录
</button>
</div>
@@ -158,7 +159,7 @@ export function MediaPanel({ snapshot, onError, onInfo }: Props) {
guard(api.stopRecording([recording.camera]));
}}
>
停止
<Icon name="stop" />停止
</button>
</div>
))}
@@ -202,7 +203,7 @@ export function MediaPanel({ snapshot, onError, onInfo }: Props) {
}
}}
>
{file.kind === "video" ? "播放" : "打开"}
<Icon name={file.kind === "video" ? "play" : "image"} />{file.kind === "video" ? "播放" : "打开"}
</button>
<button
type="button"
@@ -213,7 +214,7 @@ export function MediaPanel({ snapshot, onError, onInfo }: Props) {
.catch((err) => onError(err instanceof Error ? err.message : String(err)));
}}
>
在文件夹中显示
<Icon name="folder" />在文件夹中显示
</button>
</span>
</div>
@@ -228,7 +229,7 @@ export function MediaPanel({ snapshot, onError, onInfo }: Props) {
<span className="playback__name num">{playing.name}</span>
<span className="playback__spacer" />
<button type="button" className="btn btn--quiet" onClick={() => setPlaying(null)}>
关闭
<Icon name="close" />关闭
</button>
</div>
@@ -243,7 +244,7 @@ export function MediaPanel({ snapshot, onError, onInfo }: Props) {
className="btn btn--primary"
onClick={() => void api.openFile(playing.path).catch(() => undefined)}
>
用系统播放器打开
<Icon name="play" />用系统播放器打开
</button>
</div>
) : (
+8 -7
View File
@@ -2,6 +2,7 @@ import { Dialog } from "./Dialog";
import { useState } from "react";
import { api } from "../lib/ipc";
import type { Snapshot } from "../lib/types";
import { Icon } from "./Icon";
export function OperatorMenu({ snapshot, fullscreen, onClose, onSettings, onMaintenance, onFullscreen, onQuit }: {
snapshot: Snapshot;
@@ -18,19 +19,19 @@ export function OperatorMenu({ snapshot, fullscreen, onClose, onSettings, onMain
<p>当前来源:{snapshot.matchClock.source ?? "尚未收到"}。重新连接后,将接收下一份裁判计时广播。请确认局域网中只有一个正式裁判端。</p>
<p>裁判端重启后,请在这里重新连接。网络短暂中断时,同一裁判会话会自动恢复。</p>
{error && <p role="alert">{error}</p>}
<button className="btn btn--primary" onClick={() => { void api.releaseMatchSource().then(() => setReconnect(false)).catch(e => setError(String(e))); }}>确认重新接收</button>
<button className="btn btn--primary" onClick={() => { void api.releaseMatchSource().then(() => setReconnect(false)).catch(e => setError(String(e))); }}><Icon name="reconnect" />确认重新接收</button>
</div></Dialog>;
return <Dialog title="操作菜单" className="operator-menu" onClose={onClose}>
{close => (
<div className="operator-menu__body">
<div className="operator-menu__identity"><span className="label">RMIC :: 2026 / OPERATOR</span><h1>操作菜单<span>MENU</span></h1><p>打开菜单后,图传和受击上报仍会继续。</p>{snapshot.demo && <span className="tag tag--warn">预览 / 合成数据</span>}</div>
<nav className="operator-menu__actions" aria-label="操作菜单">
<button data-initial-focus onClick={close}><span>继续操作</span><kbd>ESC</kbd></button>
<button onClick={onSettings}><span>画面与设备设置</span><small>准星 · 图传绑定 · 装甲板</small></button>
<button onClick={onMaintenance}><span>固件维护</span><small>编译与 USB 烧录</small></button>
<button onClick={() => { setError(""); setReconnect(true); }}><span>重新接收裁判计时</span><small>{snapshot.matchClock.source ?? "等待裁判广播"}</small></button>
<button onClick={onFullscreen}><span>{fullscreen ? "退出全屏" : "全屏显示"}</span><kbd>F11</kbd></button>
<button onClick={onQuit}><span>退出客户端</span><small>{snapshot.unlocked ? "退出程序" : "需要密码"}</small></button>
<button data-initial-focus onClick={close}><span><Icon name="play" />继续操作</span><kbd>ESC</kbd></button>
<button onClick={onSettings}><span><Icon name="settings" />画面与设备设置</span><small>准星 · 图传绑定 · 装甲板</small></button>
<button onClick={onMaintenance}><span><Icon name="firmware" />固件维护</span><small>编译与 USB 烧录</small></button>
<button onClick={() => { setError(""); setReconnect(true); }}><span><Icon name="reconnect" />重新接收裁判计时</span><small>{snapshot.matchClock.source ?? "等待裁判广播"}</small></button>
<button onClick={onFullscreen}><span><Icon name={fullscreen ? "fullscreenExit" : "fullscreen"} />{fullscreen ? "退出全屏" : "全屏显示"}</span><kbd>F11</kbd></button>
<button onClick={onQuit}><span><Icon name="logout" />退出客户端</span><small>{snapshot.unlocked ? "退出程序" : "需要密码"}</small></button>
</nav>
</div>
)}
+13 -7
View File
@@ -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);
+7 -4
View File
@@ -17,6 +17,7 @@ import type { ReactNode } from "react";
import { dismissNote, pushNote, useAppStore } from "../lib/store";
import type { Snapshot } from "../lib/types";
import { Icon } from "./Icon";
interface Props {
snapshot: Snapshot;
@@ -70,7 +71,7 @@ export function TopBar({
)
}
>
演示 · 合成数据
<Icon name="info" />演示 · 合成数据
</button>
)}
@@ -103,7 +104,7 @@ export function TopBar({
{onOpenMaintenance && (
<button type="button" className="btn btn--quiet" onClick={onOpenMaintenance}>
固件
<Icon name="firmware" />固件
</button>
)}
@@ -113,11 +114,12 @@ export function TopBar({
onClick={onToggleFullscreen}
title="F11 / Alt+Enter"
>
<Icon name={fullscreen ? "fullscreenExit" : "fullscreen"} />
{fullscreen ? "退出全屏" : "全屏"}
</button>
<button type="button" className="btn btn--ghost topbar__settings" onClick={onOpenSettings}>
设置
<Icon name="settings" />设置
<span className="topbar__kbd">⌘,</span>
</button>
</div>
@@ -146,8 +148,9 @@ export function CommStrip() {
className="comm__close"
onClick={() => dismissNote(notes.length - 1)}
title="收起"
aria-label="收起通知"
>
✕
<Icon name="close" />
</button>
</div>
);
+3 -2
View File
@@ -14,6 +14,7 @@
import { useEffect, useRef, useState } from "react";
import { api } from "../lib/ipc";
import { Icon } from "./Icon";
interface Props {
/** 为什么需要密码:显示在标题下。 */
@@ -123,7 +124,7 @@ export function UnlockDialog({ reason, onUnlocked, onCancel }: Props) {
<div className="lock__actions">
<button type="button" className="btn btn--ghost" onClick={onCancel}>
取消
<Icon name="close" />取消
</button>
<button
type="button"
@@ -131,7 +132,7 @@ export function UnlockDialog({ reason, onUnlocked, onCancel }: Props) {
onClick={() => void submit()}
disabled={busy || password.length === 0}
>
{busy ? "校验中…" : "解锁"}
<Icon name="unlock" />{busy ? "校验中…" : "解锁"}
<span className="btn__key">⏎</span>
</button>
</div>
+2 -1
View File
@@ -36,6 +36,7 @@ import {
} from "../lib/reticle";
import type { CrosshairConfig, GridConfig, HitFeedbackConfig } from "../lib/types";
import type { FrameInfo } from "../lib/stream";
import { Icon } from "./Icon";
export interface ViewTransform {
zoom: number;
@@ -334,7 +335,7 @@ export function VideoSurface({
onPointerDown={(event) => event.stopPropagation()}
title="重置缩放与平移(也可双击画面)"
>
<span className="vsurface__reset-key">⤢</span>
<Icon name="reset" />
复位
</button>
)}
+4
View File
@@ -5,6 +5,7 @@
*/
import type { ChangeEvent, ReactNode } from "react";
import { Icon, type IconName } from "./Icon";
export function Section({
title,
@@ -156,6 +157,7 @@ export function Select<T extends string | number>({
}
export function Button({
icon,
children,
onClick,
variant = "default",
@@ -167,6 +169,7 @@ export function Button({
variant?: "default" | "primary" | "danger" | "ghost";
disabled?: boolean;
title?: string;
icon?: IconName;
}) {
return (
<button
@@ -176,6 +179,7 @@ export function Button({
disabled={disabled}
title={title}
>
{icon && <Icon name={icon} />}
{children}
</button>
);
+7 -5
View File
@@ -22,11 +22,12 @@ function hasTauri(): boolean {
return typeof window !== "undefined" && "__TAURI_INTERNALS__" in window;
}
export function useFullscreen() {
export function useFullscreen(enabled = true) {
const [fullscreen, setFullscreen] = useState(false);
const lastToggle = useRef(0);
const toggle = useCallback(async () => {
if (!enabled) return;
const now = Date.now();
if (now - lastToggle.current < 400) return;
lastToggle.current = now;
@@ -44,10 +45,10 @@ export function useFullscreen() {
} catch {
// 窗口在切换途中被销毁之类。界面不应该为此报错。
}
}, []);
}, [enabled]);
useEffect(() => {
if (!hasTauri()) return;
if (!enabled || !hasTauri()) return;
try {
void getCurrentWindow()
@@ -57,9 +58,10 @@ export function useFullscreen() {
} catch {
// 同上:没有窗口也要能跑。
}
}, []);
}, [enabled]);
useEffect(() => {
if (!enabled) return;
const onKeyDown = (event: KeyboardEvent) => {
const target = event.target as HTMLElement | null;
const tag = target?.tagName;
@@ -80,7 +82,7 @@ export function useFullscreen() {
window.addEventListener("keydown", onKeyDown);
return () => window.removeEventListener("keydown", onKeyDown);
}, [toggle]);
}, [toggle, enabled]);
return { fullscreen, toggle };
}
+2 -2
View File
@@ -11,11 +11,11 @@ export const BUILD = {
minor: 3,
patch: 0,
/** git 提交数,单调递增。 */
build: 41,
build: 42,
/** 线路协议版本。与固件自报的那个数直接比对。 */
protocol: 1,
/** 生成时的提交日期(`YYYY-MM-DD`)。 */
date: "2026-10-22",
date: "2026-10-24",
} as const;
/** `"0.2.0+57"` —— 界面上放得下的那一行。 */
+9 -2
View File
@@ -1,6 +1,7 @@
import { createRoot } from "react-dom/client";
import App from "./App";
import { BootPreview } from "./components/BootPreview";
import { LatencyPage } from './pages/LatencyPage';
import { invoke } from '@tauri-apps/api/core';
import "./styles/index.css";
@@ -16,5 +17,11 @@ if (!container) {
// 短暂地建两份——排查起来的噪音大于它带来的收益。生产构建的行为与这里一致。
const root=createRoot(container);
if('__TAURI_INTERNALS__' in window) {
void invoke<boolean>('latency_enabled').then(enabled=>root.render(enabled?<LatencyPage/>:<App/>),()=>root.render(<App/>));
} else root.render(<App/>);
void invoke<boolean>('latency_enabled').then(async enabled => {
if (enabled) await invoke('finish_startup');
root.render(enabled ? <LatencyPage/> : <App/>);
}).catch(() => root.render(<App/>));
} else {
const preview = import.meta.env.DEV ? new URLSearchParams(location.search).get("preview") : null;
root.render(preview === "boot" || preview === "boot-error" ? <BootPreview failed={preview === "boot-error"} /> : <App/>);
}
+51 -45
View File
@@ -5,6 +5,7 @@ import { Button } from "../components/controls";
import { ArmorBuildPanel } from "../components/ArmorBuildPanel";
import { DeviceDiagram } from "../components/DeviceDiagram";
import { Dialog } from "../components/Dialog";
import { Icon } from "../components/Icon";
import { api } from "../lib/ipc";
import { maintenanceMismatch } from "../lib/maintenance-safety";
import {
@@ -15,12 +16,14 @@ import {
type Busy = null | "ports" | "probe" | "bundle" | "plan" | "flash" | "restore" | "build";
type ViewStep = "device" | "bundle" | "confirm" | "result";
type RestoreRequest = { port: string; backupDir: string; kind: "camera" | "armor" };
const BUSY_TEXT = { ports: "刷新串口", probe: "读取设备", bundle: "校验固件", plan: "核对计划", flash: "烧录与回读", restore: "恢复备份", build: "编译装甲板" } as const;
function message(err: unknown): string { return err instanceof Error ? err.message : String(err); }
export function MaintenancePage({ onClose, fullscreen, onToggleFullscreen }: { onClose: () => void; fullscreen: boolean; onToggleFullscreen: () => void }) {
const [viewStep, setViewStep] = useState<ViewStep>("device");
const [modal, setModal] = useState<"build" | "details" | null>(null);
const [modal, setModal] = useState<"build" | "details" | "restore" | null>(null);
const [restoreRequest, setRestoreRequest] = useState<RestoreRequest | null>(null);
const [detailsTab, setDetailsTab] = useState<"log" | "data">("log");
const [ports, setPorts] = useState<PortInfo[]>([]);
const [port, setPort] = useState("");
@@ -234,19 +237,9 @@ export function MaintenancePage({ onClose, fullscreen, onToggleFullscreen }: { o
}, [port, bundle, appendLog]);
const startFlash = useCallback(async () => {
if (!port || !bundle || !plan || !confirmedTarget || (plan.mode === "armor-install" && !confirmedOverwrite)) return;
const confirmed = window.confirm(
`${port} · ${plan.device.chip} · MAC ${plan.device.mac}\n${plan.bundle.name} ${plan.bundle.version}\n` +
(plan.mode === "armor-install" ?
`${plan.bundle.armorTeam == null ? "通用固件(客户端选择队伍)" : `旧版固定队伍${plan.bundle.armorTeam === 0 ? "一(红)" : "二(蓝)"}`} · 阈值 ${plan.bundle.armorThreshold}\n\n` +
`将先完整备份 4 MB Flash,再覆盖 Bootloader、App 和分区表;迁移旧布局时会清除原配置。旧 App 会被覆盖;恢复必须使用完整备份。\n烧录期间请勿断电或拔线。继续?` :
`将把 App 写入 ${formatOffset(plan.targetOffset)}(${formatBytes(plan.appSize)}),` +
`整段回读通过后才切换分区表。\n\n` +
`旧 App 保留在 ${formatOffset(plan.currentFactoryOffset)}。${backupApp ? "会先备份旧 App。" : "本次不另存旧 App 备份。"}\n` +
`烧录期间设备会复位,视频流会中断。继续?`),
);
if (!confirmed) return;
if (busy || !port || !bundle || !plan?.canFlash || !confirmedTarget || (plan.mode === "armor-install" && !confirmedOverwrite)) return;
if (maintenanceMismatch(firmwareKind, expectedTeam, device, bundle)) return;
// 设备、覆盖与备份信息已在当前步骤确认,直接交给后端重新校验计划并执行。
setBusy("flash");
setError(null);
@@ -275,7 +268,7 @@ export function MaintenancePage({ onClose, fullscreen, onToggleFullscreen }: { o
setPlan(null); setDevice(null);
setBusy(null);
}
}, [port, bundle, plan, backupApp, appendLog, confirmedTarget, confirmedOverwrite]);
}, [port, bundle, plan, backupApp, appendLog, confirmedTarget, confirmedOverwrite, busy, firmwareKind, expectedTeam, device]);
const cancelFlash = useCallback(async () => {
try {
@@ -287,28 +280,27 @@ export function MaintenancePage({ onClose, fullscreen, onToggleFullscreen }: { o
}, [appendLog, busy]);
const restoreTable = useCallback(async () => {
if (!port || !report?.backupDir) return;
if (!window.confirm(report.mode === "armor-install"
? "将向同一 MAC 的装甲板恢复完整 4 MB Flash,覆盖当前固件及设置。恢复期间请勿断电或拔线。继续?"
: "将把备份分区表写回 0x8000,设备会复位到旧 App。继续?")) return;
if (busy || !restoreRequest?.port || !restoreRequest.backupDir) return;
const request = restoreRequest;
setModal(null);
setRestoreRequest(null);
setBusy("restore");
setProgress(null);
setError(null);
try {
const result = await maintenanceApi.restoreTable(port, report.backupDir, report.mode === "armor-install" ? "armor" : "camera");
const result = await maintenanceApi.restoreTable(request.port, request.backupDir, request.kind);
appendLog(result);
setReport(null);
setPlan(null);
await probePort(port);
await probePort(request.port);
} catch (err) {
setError(message(err));
appendLog(`恢复失败:${message(err)}`);
} finally {
setBusy(null);
}
}, [port, report, appendLog, probePort]);
}, [busy, restoreRequest, appendLog, probePort]);
const revealBackup = useCallback(() => {
if (!report?.backupDir) return;
@@ -320,9 +312,9 @@ export function MaintenancePage({ onClose, fullscreen, onToggleFullscreen }: { o
setBusy("restore"); setProgress(null); setError(null);
try {
const path = await selectMaintenanceDirectory("选择含 armor-backup.json 与 flash-old.bin 的完整备份目录");
if (!path || !window.confirm(`将向 ${port} 恢复完整 Flash,覆盖当前固件和设置。后端会核对备份哈希、芯片和 MAC。恢复期间请勿断电或拔线。继续?`)) return;
appendLog(await maintenanceApi.restoreTable(port, path, "armor"));
setDevice(null); setPlan(null); setReport(null); setProgress(null);
if (!path) return;
setRestoreRequest({ port, backupDir: path, kind: "armor" });
setModal("restore");
} catch (err) { setError(message(err)); appendLog(`恢复失败:${message(err)}`); }
finally { setBusy(null); }
};
@@ -366,8 +358,8 @@ export function MaintenancePage({ onClose, fullscreen, onToggleFullscreen }: { o
<div><span className="label mnt-kicker">RMIC / DEVICE SERVICE</span><h1>固件维护</h1></div>
<div className="mnt-head__actions">
{preview && <span className="tag tag--warn">预览 · 合成数据 / 无 USB 操作</span>}
<Button variant="ghost" onClick={onToggleFullscreen}>{fullscreen ? "退出全屏" : "全屏"}</Button>
<Button variant="ghost" disabled={anyBusy} onClick={onClose}>返回 <kbd>ESC</kbd></Button>
<Button icon={fullscreen ? "fullscreenExit" : "fullscreen"} variant="ghost" onClick={onToggleFullscreen}>{fullscreen ? "退出全屏" : "全屏"}</Button>
<Button icon="back" variant="ghost" disabled={anyBusy} onClick={onClose}>返回 <kbd>ESC</kbd></Button>
</div>
</header>
@@ -392,25 +384,25 @@ export function MaintenancePage({ onClose, fullscreen, onToggleFullscreen }: { o
{viewStep === "device" && <>
<div className="mnt-task__title"><span className="label">01 / CONNECT</span><h2>连接哪一种设备?</h2></div>
<div className="mnt-kind" role="group" aria-label="维护对象">
<button className={firmwareKind === "camera" ? "is-selected" : ""} disabled={anyBusy} onClick={() => { setFirmwareKind("camera"); setPlan(null); setReport(null); setProgress(null); }} aria-pressed={firmwareKind === "camera"}>图传板<small>ESP32-S3</small></button>
<button className={firmwareKind === "armor" ? "is-selected" : ""} disabled={anyBusy} onClick={() => { setFirmwareKind("armor"); setPlan(null); setReport(null); setProgress(null); }} aria-pressed={firmwareKind === "armor"}>装甲板主板<small>ESP32-C3</small></button>
<button className={firmwareKind === "camera" ? "is-selected" : ""} disabled={anyBusy} onClick={() => { setFirmwareKind("camera"); setPlan(null); setReport(null); setProgress(null); }} aria-pressed={firmwareKind === "camera"}><Icon name="camera" />图传板<small>ESP32-S3</small></button>
<button className={firmwareKind === "armor" ? "is-selected" : ""} disabled={anyBusy} onClick={() => { setFirmwareKind("armor"); setPlan(null); setReport(null); setProgress(null); }} aria-pressed={firmwareKind === "armor"}><Icon name="armor" />装甲板主板<small>ESP32-C3</small></button>
</div>
<div className={`mnt-connection-fields${firmwareKind === "armor" && bundle?.armorTeam != null ? " has-team" : ""}`}>
{firmwareKind === "armor" && bundle?.armorTeam != null && <label className="mnt-field"><span>旧版固件目标队伍</span><select className="select" value={expectedTeam} disabled={anyBusy} onChange={event => { setExpectedTeam(event.target.value); setPlan(null); }}><option value="">选择这块板的队伍</option><option value="0">队伍一(红,0)</option><option value="1">队伍二(蓝,1)</option></select></label>}
<label className="mnt-field"><span>USB 串口</span><div className="mnt-row"><select className="select" value={port} disabled={anyBusy} onChange={event => { setPort(event.target.value); setDevice(null); setPlan(null); setReport(null); setProgress(null); }}>{ports.length === 0 && <option value="">未发现串口</option>}{ports.map(entry => <option key={entry.portName} value={entry.portName}>{entry.portName} · {entry.label}</option>)}</select><Button disabled={anyBusy} onClick={() => void refreshPorts(false)}>刷新</Button></div></label>
<label className="mnt-field"><span>USB 串口</span><div className="mnt-row"><select className="select" value={port} disabled={anyBusy} onChange={event => { setPort(event.target.value); setDevice(null); setPlan(null); setReport(null); setProgress(null); }}>{ports.length === 0 && <option value="">未发现串口</option>}{ports.map(entry => <option key={entry.portName} value={entry.portName}>{entry.portName} · {entry.label}</option>)}</select><Button icon="refresh" disabled={anyBusy} onClick={() => void refreshPorts(false)}>刷新</Button></div></label>
</div>
<p className="mnt-hint">请只连接要维护的主板。读取设备信息时,主板会复位。</p>
<div className="mnt-task__actions"><Button variant="primary" disabled={anyBusy || !port || !firmwareKind} onClick={() => void probePort(port)}>读取设备并继续</Button><Button variant="ghost" disabled={anyBusy || !firmwareKind} onClick={() => setViewStep("bundle")}>准备固件包</Button></div>
{firmwareKind === "armor" && <Button variant="ghost" disabled={anyBusy || !port} onClick={() => void restoreFromDirectory()}>恢复完整备份</Button>}
<p className="mnt-hint">请只连接要维护的主板。{firmwareKind === "camera" && "图传板接入右侧 USB 口。"}读取设备信息时,主板会复位。</p>
<div className="mnt-task__actions"><Button icon="usb" variant="primary" disabled={anyBusy || !port || !firmwareKind} onClick={() => void probePort(port)}>读取设备并继续</Button><Button icon="firmware" variant="ghost" disabled={anyBusy || !firmwareKind} onClick={() => setViewStep("bundle")}>准备固件包</Button></div>
{firmwareKind === "armor" && <Button icon="reset" variant="ghost" disabled={anyBusy || !port} onClick={() => void restoreFromDirectory()}>恢复完整备份</Button>}
</>}
{viewStep === "bundle" && <>
<div className="mnt-task__title"><span className="label">02 / FIRMWARE</span><h2>选择对应固件</h2></div>
<div className="mnt-package"><span className="mnt-package__symbol" aria-hidden="true">↓</span><strong>{bundle ? `${bundle.name} ${bundle.version}` : "选择固件 ZIP"}</strong><span>{bundle ? `${bundle.chip.toUpperCase()} · ${formatBytes(bundle.appSize)}` : firmwareKind === "armor" ? "ESP32-C3 / 装甲板固件" : "ESP32-S3 / 图传固件"}</span>{bundle?.firmwareKind === "armor" && <b>{bundle.armorTeam == null ? "通用固件 / 客户端选择队伍" : `旧版固定队伍${bundle.armorTeam === 0 ? "一(红)" : "二(蓝)"}`} · 阈值 {bundle.armorThreshold}</b>}<Button disabled={anyBusy} onClick={() => void chooseBundle("zip")}>{bundle ? "更换 ZIP" : "选择 ZIP"}</Button></div>
<div className="mnt-package"><span className="mnt-package__symbol"><Icon name="firmware" /></span><strong>{bundle ? `${bundle.name} ${bundle.version}` : "选择固件 ZIP"}</strong><span>{bundle ? `${bundle.chip.toUpperCase()} · ${formatBytes(bundle.appSize)}` : firmwareKind === "armor" ? "ESP32-C3 / 装甲板固件" : "ESP32-S3 / 图传固件"}</span>{bundle?.firmwareKind === "armor" && <b>{bundle.armorTeam == null ? "通用固件 / 客户端选择队伍" : `旧版固定队伍${bundle.armorTeam === 0 ? "一(红)" : "二(蓝)"}`} · 阈值 {bundle.armorThreshold}</b>}<Button icon="file" disabled={anyBusy} onClick={() => void chooseBundle("zip")}>{bundle ? "更换 ZIP" : "选择 ZIP"}</Button></div>
{bundle?.firmwareKind === "armor" && bundle.armorTeam != null && <label className="mnt-field"><span>旧版包:核对实物队伍</span><select className="select" value={expectedTeam} disabled={anyBusy} onChange={event => { setExpectedTeam(event.target.value); setPlan(null); }}><option value="">请选择</option><option value="0">队伍一(红)</option><option value="1">队伍二(蓝)</option></select></label>}
<div className="mnt-row mnt-secondary">{firmwareKind === "armor" && <Button variant="ghost" disabled={anyBusy} onClick={() => setModal("build")}>从源码编译</Button>}<Button variant="ghost" disabled={anyBusy} onClick={() => void chooseBundle("dir")}>选择目录包</Button></div>
<div className="mnt-row mnt-secondary">{firmwareKind === "armor" && <Button icon="build" variant="ghost" disabled={anyBusy} onClick={() => setModal("build")}>从源码编译</Button>}<Button icon="folder" variant="ghost" disabled={anyBusy} onClick={() => void chooseBundle("dir")}>选择目录包</Button></div>
{mismatch && <p className="mnt-note warn" role="alert">{mismatch}</p>}
<div className="mnt-task__actions"><Button variant="primary" disabled={!device || !bundle || anyBusy || !!mismatch || securityEnabled} onClick={() => void makePlan()}>核对固件并继续</Button><Button variant="ghost" disabled={anyBusy} onClick={() => setViewStep("device")}>上一步</Button></div>
<div className="mnt-task__actions"><Button icon="check" variant="primary" disabled={!device || !bundle || anyBusy || !!mismatch || securityEnabled} onClick={() => void makePlan()}>核对固件并继续</Button><Button icon="back" variant="ghost" disabled={anyBusy} onClick={() => setViewStep("device")}>上一步</Button></div>
{securityEnabled && <p className="mnt-note warn">设备启用了安全启动或加密,不能使用此流程。</p>}
</>}
@@ -421,32 +413,46 @@ export function MaintenancePage({ onClose, fullscreen, onToggleFullscreen }: { o
<div className="mnt-running"><span className="label">CURRENT PHASE</span><h3>{progress?.phase ?? "准备设备"}</h3><p>{progress?.message ?? "正在核对设备与准备备份"}</p><span className="mnt-hint">左侧显示当前进度,操作结束后会显示结果。</span></div>
</> : plan ? <>
<div className="mnt-confirmation"><strong className="num">{plan.device.port} / {plan.device.chip.toUpperCase()}</strong><span className="num">MAC {plan.device.mac ?? "未知"}</span><span>{plan.bundle.name} {plan.bundle.version}</span>{plan.mode === "armor-install" && <b>{plan.bundle.armorTeam == null ? "通用固件 / 客户端选择队伍" : `旧版固定队伍${plan.bundle.armorTeam === 0 ? "一(红)" : "二(蓝)"}`} · 阈值 {plan.bundle.armorThreshold}</b>}</div>
<ul className="mnt-warnings">{plan.warnings.map(warning => <li key={warning}>{warning}</li>)}</ul>
<ul className="mnt-warnings">
{plan.mode !== "armor-install" && <>
<li>App 写入 {formatOffset(plan.targetOffset)}({formatBytes(plan.appSize)}),整段回读通过后才切换分区表。旧 App 保留在 {formatOffset(plan.currentFactoryOffset)}。</li>
<li>{backupApp ? "会先备份旧 App。" : "本次不另存旧 App 备份。"}</li>
</>}
{plan.warnings.map(warning => <li key={warning}>{warning}</li>)}
<li>设备会复位,视频流会中断。烧录期间请勿断电或拔线。</li>
</ul>
{plan.mode !== "armor-install" && <label className="mnt-check"><input type="checkbox" checked={backupApp} disabled={anyBusy} onChange={event => setBackupApp(event.target.checked)} />备份旧 App</label>}
<label className="mnt-check"><input type="checkbox" checked={confirmedTarget} disabled={anyBusy} onChange={event => setConfirmedTarget(event.target.checked)} />已核对实物、串口、MAC、固件用途{plan.bundle.armorTeam != null ? "与队伍" : ""}</label>
{plan.mode === "armor-install" && <label className="mnt-check"><input type="checkbox" checked={confirmedOverwrite} disabled={anyBusy} onChange={event => setConfirmedOverwrite(event.target.checked)} />确认覆盖旧固件,恢复需用此板的完整备份</label>}
{mismatch && <p className="mnt-note warn" role="alert">{mismatch}</p>}
<div className="mnt-task__actions"><Button variant="primary" disabled={!plan.canFlash || anyBusy || !!mismatch || !confirmedTarget || plan.mode === "armor-install" && !confirmedOverwrite} onClick={() => void startFlash()}>开始烧录</Button>{busy === "flash" ? <Button variant="danger" onClick={() => void cancelFlash()}>请求取消</Button> : <Button variant="ghost" disabled={anyBusy} onClick={() => setViewStep("bundle")}>上一步</Button>}</div>
</> : <><p className="mnt-hint">计划已失效,请重新读取设备。</p><Button disabled={anyBusy} onClick={() => setViewStep("device")}>返回连接</Button></>}
<div className="mnt-task__actions"><Button icon="download" variant="primary" disabled={!plan.canFlash || anyBusy || !!mismatch || !confirmedTarget || plan.mode === "armor-install" && !confirmedOverwrite} onClick={() => void startFlash()}>开始烧录</Button>{busy === "flash" ? <Button icon="stop" variant="danger" onClick={() => void cancelFlash()}>请求取消</Button> : <Button icon="back" variant="ghost" disabled={anyBusy} onClick={() => setViewStep("bundle")}>上一步</Button>}</div>
</> : <><p className="mnt-hint">计划已失效,请重新读取设备。</p><Button icon="back" disabled={anyBusy} onClick={() => setViewStep("device")}>返回连接</Button></>}
</>}
{viewStep === "result" && report && <>
<div className="mnt-task__title"><span className="label">04 / RESULT</span><h2>{report.ok ? "回读校验通过" : "需要处理"}</h2></div>
<div className={`mnt-result${report.ok ? " is-ok" : " is-failed"}`}><span className="mnt-result__mark">{report.ok ? "✓" : "!"}</span><strong>{report.bundleName} {report.bundleVersion}</strong><p>{report.error ?? report.note ?? "请检查设备启动、灯色与上报。"}</p></div>
<div className={`mnt-result${report.ok ? " is-ok" : " is-failed"}`}><span className="mnt-result__mark"><Icon name={report.ok ? "check" : "warning"} /></span><strong>{report.bundleName} {report.bundleVersion}</strong><p>{report.error ?? report.note ?? "请检查设备启动、灯色与上报。"}</p></div>
<div className="mnt-verifications"><span>App <b>{report.appVerified ? "一致" : "未通过"}</b></span><span>分区表 <b>{report.tableVerified ? "一致" : "未通过"}</b></span>{report.mode === "armor-install" && <span>Bootloader <b>{report.bootloaderVerified ? "一致" : "未通过"}</b></span>}<span>启动标志 <b>{report.bootOk === true ? "已捕获" : report.bootOk === false ? "异常" : "未确认"}</b></span></div>
<div className="mnt-task__actions"><Button onClick={revealBackup}>打开备份</Button>{report.needsRollback && <Button variant="danger" disabled={anyBusy} onClick={() => void restoreTable()}>{report.mode === "armor-install" ? "恢复完整备份" : "恢复旧分区表"}</Button>}<Button variant="ghost" disabled={anyBusy} onClick={() => { setViewStep("device"); setDevice(null); setPlan(null); setReport(null); setProgress(null); if (firmwareKind === "armor") setExpectedTeam(""); }}>更新另一块板</Button></div>
<div className="mnt-task__actions"><Button icon="folder" onClick={revealBackup}>打开备份</Button>{report.needsRollback && <Button icon="reset" variant="danger" disabled={anyBusy} onClick={() => { setRestoreRequest({ port, backupDir: report.backupDir, kind: report.mode === "armor-install" ? "armor" : "camera" }); setModal("restore"); }}>{report.mode === "armor-install" ? "恢复完整备份" : "恢复旧分区表"}</Button>}<Button icon="devices" variant="ghost" disabled={anyBusy} onClick={() => { setViewStep("device"); setDevice(null); setPlan(null); setReport(null); setProgress(null); if (firmwareKind === "armor") setExpectedTeam(""); }}>更新另一块板</Button></div>
</>}
</div>
</section>
</div>
<footer className="mnt-foot"><span>{busy ? `正在${BUSY_TEXT[busy]} · 请勿拔线` : "USB 固件维护 / ESP32-S3 · ESP32-C3"}</span><div>{(busy === "flash" || busy === "build") && <Button variant="danger" onClick={() => void cancelFlash()}>请求取消</Button>}<Button variant="ghost" onClick={() => setModal("details")}>诊断 / 日志 {logs.length > 0 ? `(${logs.length})` : ""}</Button></div></footer>
<footer className="mnt-foot"><span>{busy ? `正在${BUSY_TEXT[busy]} · 请勿拔线` : "USB 固件维护 / ESP32-S3 · ESP32-C3"}</span><div>{(busy === "flash" || busy === "build") && <Button icon="stop" variant="danger" onClick={() => void cancelFlash()}>请求取消</Button>}<Button icon="log" variant="ghost" onClick={() => setModal("details")}>诊断 / 日志 {logs.length > 0 ? `(${logs.length})` : ""}</Button></div></footer>
{modal === "restore" && restoreRequest && <Dialog title={restoreRequest.kind === "armor" ? "恢复完整备份" : "恢复旧分区表"} className="mnt-restore-dialog" onClose={() => { setModal(null); setRestoreRequest(null); }} closeDisabled={anyBusy}>
{close => <div className="mnt-restore">
<div className="mnt-confirmation"><strong>{restoreRequest.port} · {restoreRequest.kind === "armor" ? "ESP32-C3 装甲板" : "ESP32-S3 图传板"}</strong><span className="num">{restoreRequest.backupDir}</span></div>
<p>{restoreRequest.kind === "armor" ? "将恢复完整 4 MB Flash,覆盖当前固件和设置。恢复期间不支持取消。" : "将把旧分区表写回 0x8000,设备会复位到旧 App。"}执行前会核对备份与设备身份,请保持供电和 USB 连接。</p>
<div className="mnt-task__actions"><Button icon="back" variant="ghost" onClick={close}>返回检查</Button><Button icon="reset" variant="danger" disabled={anyBusy} onClick={() => void restoreTable()}>确认恢复</Button></div>
</div>}
</Dialog>}
{modal === "build" && <Dialog title="编译装甲板固件" className="mnt-build-dialog" onClose={() => setModal(null)} closeDisabled={anyBusy}>
<ArmorBuildPanel disabled={anyBusy} onBusy={value => { setBusy(value ? "build" : null); if (value) { setBundle(null); setPlan(null); setReport(null); setProgress(null); setError(null); } }} onBuilt={info => { setBundle(info); setModal(null); appendLog(`已生成固件:${info.sourcePath}`); }} onError={value => { setError(value); appendLog(value); }} />
{busy === "build" && <div className="mnt-build-status"><p>正在编译,SDK 首次下载可能需要较长时间。</p><pre>{logs.at(-1) ?? "等待编译器输出"}</pre><Button variant="danger" onClick={() => void cancelFlash()}>取消编译</Button></div>}
{busy === "build" && <div className="mnt-build-status"><p>正在编译,SDK 首次下载可能需要较长时间。</p><pre>{logs.at(-1) ?? "等待编译器输出"}</pre><Button icon="stop" variant="danger" onClick={() => void cancelFlash()}>取消编译</Button></div>}
{error && <p className="mnt-error" role="alert">{error}</p>}
</Dialog>}
{modal === "details" && <Dialog title="诊断与日志" className="mnt-details" onClose={() => setModal(null)}><div className="mnt-tabs"><button className={detailsTab === "log" ? "is-active" : ""} onClick={() => setDetailsTab("log")}>运行日志</button><button className={detailsTab === "data" ? "is-active" : ""} onClick={() => setDetailsTab("data")}>设备 / 计划 / 报告</button></div><div className="mnt-details__scroll" role={detailsTab === "log" ? "log" : undefined}>{detailsTab === "log" ? <>{logs.map((line, index) => <pre key={index}>{line}</pre>)}{logs.length === 0 && <p>尚未执行操作</p>}<div ref={logEnd} /></> : <pre>{JSON.stringify({ device, bundle, plan, report }, null, 2)}</pre>}</div></Dialog>}
{modal === "details" && <Dialog title="诊断与日志" className="mnt-details" onClose={() => setModal(null)}><div className="mnt-tabs"><button className={detailsTab === "log" ? "is-active" : ""} onClick={() => setDetailsTab("log")}><Icon name="log" />运行日志</button><button className={detailsTab === "data" ? "is-active" : ""} onClick={() => setDetailsTab("data")}><Icon name="info" />设备 / 计划 / 报告</button></div><div className="mnt-details__scroll" role={detailsTab === "log" ? "log" : undefined}>{detailsTab === "log" ? <>{logs.map((line, index) => <pre key={index}>{line}</pre>)}{logs.length === 0 && <p>尚未执行操作</p>}<div ref={logEnd} /></> : <pre>{JSON.stringify({ device, bundle, plan, report }, null, 2)}</pre>}</div></Dialog>}
</main>;
}
+5 -4
View File
@@ -37,6 +37,7 @@ import { HitFlash } from "../components/HitFlash";
import { MatchBanner } from "../components/MatchBanner";
import { RefereeMatchControl } from "../components/MatchClock";
import { MediaPanel } from "../components/MediaPanel";
import { Icon } from "../components/Icon";
import { StatusBar, Stat } from "../components/StatusBar";
import { TeamNameEditor } from "../components/TeamNameEditor";
import { IDENTITY_VIEW, VideoSurface, type ViewTransform } from "../components/VideoSurface";
@@ -362,7 +363,7 @@ export function RefereePage({ snapshot, hud, onOpenSettings, onError, onInfo }:
className="seg__item"
onClick={() => setTab("armor")}
>
装甲板
<Icon name="armor" />装甲板
<span className="ref__count num">{snapshot.armorBoards.length}</span>
</button>
<button
@@ -372,7 +373,7 @@ export function RefereePage({ snapshot, hud, onOpenSettings, onError, onInfo }:
className="seg__item"
onClick={() => setTab("media")}
>
录制与回放
<Icon name="camera" />录制与回放
{snapshot.recordings.length > 0 && (
<span className="ref__count ref__count--live num">
{snapshot.recordings.length}
@@ -415,11 +416,11 @@ export function RefereePage({ snapshot, hud, onOpenSettings, onError, onInfo }:
.catch((err) => onError(err instanceof Error ? err.message : String(err)))
}
>
刷新
<Icon name="refresh" />刷新
</button>
<button type="button" className="btn btn--ghost" onClick={onOpenSettings}>
设置
<Icon name="settings" />设置
</button>
</div>
+49 -19
View File
@@ -517,11 +517,20 @@
z-index: var(--z-boot);
display: grid;
place-items: center;
background: radial-gradient(ellipse at 50% 42%, #0d1620 0%, var(--void) 62%);
background: var(--void);
overflow: hidden;
animation: boot-in var(--d-4) var(--e-out) both;
}
.boot__card {
position: relative;
width: min(640px, 100vw);
height: min(420px, 100vh);
overflow: auto;
background: radial-gradient(ellipse at 80% 0%, var(--panel-3), var(--deep) 72%);
border-top: 2px solid var(--primary);
}
.boot.is-leaving {
animation: boot-out var(--dur-medium3) var(--m3-emphasized-accelerate) forwards;
pointer-events: none;
@@ -578,24 +587,44 @@
}
}
/* .corners 的括号默认贴在元素边缘,而 .plate 的 1px 边也画在那儿——两者重合,
括号等于看不见。往里让 3px,让它真的读成"四角定位标记"。 */
.boot__frame.corners::after {
inset: 3px;
--c: var(--line-3);
--l: 18px;
}
.boot__frame {
--plate-bg: rgba(8, 12, 20, 0.88);
--plate-line: var(--line-3);
position: relative;
z-index: 1;
width: min(660px, 90vw);
padding: var(--s6) var(--s6) var(--s5);
width: 100%;
min-height: 100%;
display: flex;
flex-direction: column;
padding: var(--s5) var(--s6);
animation: boot-frame-in var(--d-5) var(--e-out) both;
}
.boot__eyebrow {
display: flex;
align-items: center;
gap: var(--s3);
color: var(--ink-3);
margin-bottom: var(--s6);
}
.boot__eyebrow > .num { margin-left: auto; }
.boot__close {
display: inline-flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
margin: -6px -8px -6px 0;
color: var(--ink-2);
}
.boot__close:hover { background: var(--panel-3); color: var(--ink); }
.boot__retry { margin-top: var(--s3); }
@media (prefers-reduced-motion: reduce) {
.boot__scan::before { animation: none; }
}
@keyframes boot-frame-in {
from {
opacity: 0;
@@ -607,7 +636,7 @@
display: flex;
align-items: center;
gap: var(--s3);
padding-bottom: var(--s3);
padding-bottom: var(--s5);
}
.boot__mark {
@@ -624,7 +653,7 @@
.boot__name {
font-family: var(--font-mono);
font-size: var(--fs-22);
font-size: var(--fs-28);
font-weight: 700;
letter-spacing: 0.04em;
}
@@ -634,7 +663,7 @@
}
.boot__sub {
color: var(--ink-4);
color: var(--ink-2);
}
.boot__log {
@@ -643,7 +672,7 @@
list-style: none;
display: flex;
flex-direction: column;
gap: 7px;
gap: 12px;
border-top: 1px solid var(--line);
}
@@ -652,7 +681,7 @@
align-items: center;
gap: var(--s2);
font-size: var(--fs-11);
color: var(--ink-4);
color: var(--ink-3);
transition: color var(--d-3) var(--e-out);
}
@@ -711,6 +740,7 @@
}
.boot__foot {
margin-top: auto;
padding-top: var(--s2);
border-top: 1px solid var(--line);
}
@@ -1219,4 +1249,4 @@
margin-top: var(--s1);
padding-top: var(--s3);
border-top: 1px solid var(--line);
}
}
+18
View File
@@ -0,0 +1,18 @@
/* Material Symbols Rounded use the same optical size and inherit control colors. */
.icon { display: inline-block; width: 20px; height: 20px; flex: 0 0 20px; vertical-align: middle; pointer-events: none; }
.btn > .icon { width: 18px; height: 18px; flex-basis: 18px; }
.btn--lg > .icon { width: 20px; height: 20px; flex-basis: 20px; }
.seg__item > .icon, .tag--button > .icon { width: 16px; height: 16px; flex-basis: 16px; }
.gate__maintenance { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.module__cta .icon { margin-left: auto; color: var(--primary-hi); }
.module__name > .icon { width: 24px; height: 24px; flex-basis: 24px; align-self: center; }
.operator-menu__actions button > span { display: flex; align-items: center; gap: 12px; }
.operator-menu__actions button > span .icon { color: var(--ink-3); }
.operator-menu__actions button:first-child > span .icon { color: var(--primary); }
.operator-menu__actions button > small { margin-left: 32px; }
.settings__tab > .icon { color: var(--ink-3); }
.settings__tab.is-active > .icon { color: var(--primary-hi); }
.settings__tab-arrow .icon { width: 16px; height: 16px; }
.mnt-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.comm__close { display: inline-flex; align-items: center; justify-content: center; }
.vsurface__reset .icon { width: 16px; height: 16px; flex-basis: 16px; }
+1
View File
@@ -24,3 +24,4 @@
@import "./maintenance.css";
@import "./operator.css";
@import "./match.css";
@import "./icons.css";
+18 -22
View File
@@ -15,9 +15,8 @@
.mnt-link i { width: 5px; height: 5px; background: currentColor; }
.mnt-link.is-live { color: var(--ok); }
.device-diagram { flex: 1; min-height: 0; width: 100%; max-height: 370px; overflow: visible; color: var(--ink-4); }
.device-diagram rect, .device-diagram circle, .device-diagram path { fill: none; stroke: currentColor; stroke-width: 1.4; transition: stroke var(--dur-short4) var(--m3-standard), fill var(--dur-short4) var(--m3-standard), opacity var(--dur-short4) var(--m3-standard); }
.device-diagram rect, .device-diagram circle, .device-diagram path { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; transition: stroke var(--dur-short4) var(--m3-standard), fill var(--dur-short4) var(--m3-standard), opacity var(--dur-short4) var(--m3-standard); }
.device-diagram .device-diagram__orbit { stroke: var(--line-2); stroke-dasharray: 3 9; stroke-width: 1; }
.device-diagram .device-diagram__chip { fill: var(--deep); stroke: var(--ink-3); }
.device-diagram text { fill: var(--ink-2); stroke: none; font: 11px var(--font-mono); }
.device-diagram .device-diagram__sublabel { font-size: 8px; fill: var(--ink-3); letter-spacing: .12em; }
.device-diagram .device-diagram__caption { font-size: 10px; fill: var(--ink-3); letter-spacing: .1em; }
@@ -28,25 +27,16 @@
.device-diagram.is-identified .device-diagram__led { fill: var(--ok); }
.device-diagram.is-identified .device-diagram__pcb { stroke: var(--ink-2); }
.device-diagram .device-diagram__progress { stroke: var(--ink); stroke-width: 3; transition: stroke-dashoffset var(--dur-short4) linear, stroke var(--dur-short4) var(--m3-standard); }
.device-diagram .device-diagram__pcb { fill: #15252e; stroke: #617783; stroke-width: 1.5; }
.device-diagram .device-diagram__camera .device-diagram__pcb { fill: #181e24; }
.device-diagram .device-diagram__hole { fill: var(--void); stroke: #8a9a94; stroke-width: 2.5; }
.device-diagram .device-diagram__trace { stroke: #688783; stroke-width: .8; opacity: .7; }
.device-diagram .device-diagram__pad { fill: #3a3430; stroke: #a58d63; stroke-width: 1; }
.device-diagram .device-diagram__pixel { fill: #c8ccc6; stroke: #879991; }
.device-diagram .device-diagram__diode { fill: #a9b39a; stroke: #697b68; stroke-width: .8; }
.device-diagram .device-diagram__shield { fill: #647078; stroke: #a3afb3; }
.device-diagram .device-diagram__board text { fill: #dce4e5; font-size: 10px; }
.device-diagram .device-diagram__board .device-diagram__sublabel { font-size: 7px; }
.device-diagram .device-diagram__smd { fill: #a6a293; stroke: #514a41; stroke-width: .6; }
.device-diagram .device-diagram__usb { fill: #78868b; stroke: #b8c3c5; }
.device-diagram .device-diagram__ribbon { fill: #a46b36; stroke: #d29a56; stroke-width: 1; }
.device-diagram .device-diagram__connector { fill: #d3ccac; stroke: #988e6c; }
.device-diagram .device-diagram__lens-base { fill: #262d34; stroke: #6c7b85; }
.device-diagram .device-diagram__lens { fill: #101820; stroke: #6e7c89; stroke-width: 3; }
.device-diagram .device-diagram__glass { fill: #243e58; stroke: #547da1; }
.device-diagram .device-diagram__lens-shine { stroke: #96bddc; stroke-width: 1.5; }
.device-diagram .device-diagram__button { fill: #718083; stroke: #9ca9ab; }
.device-diagram .device-diagram__pcb { fill: var(--panel); stroke: var(--line-3); }
.device-diagram .device-diagram__mount { fill: var(--deep); stroke: var(--line-3); }
.device-diagram .device-diagram__module { fill: var(--panel-2); stroke: var(--ink-3); }
.device-diagram .device-diagram__symbol { stroke: var(--ink-2); stroke-width: 2; }
.device-diagram .device-diagram__detail { stroke: var(--line-3); }
.device-diagram .device-diagram__board text { fill: var(--ink-2); font-size: 10px; }
.device-diagram .device-diagram__board .device-diagram__sublabel { font-size: 9px; }
.device-diagram .device-diagram__usb { fill: var(--panel-2); stroke: var(--line-3); }
.device-diagram .device-diagram__usb.is-connected { fill: var(--panel-3); stroke: var(--ink-2); }
.device-diagram .device-diagram__socket { stroke: var(--ink-3); }
.device-diagram.is-complete .device-diagram__progress { stroke: var(--ok); }
.device-diagram.is-failed .device-diagram__progress, .device-diagram.is-failed .device-diagram__pcb { stroke: var(--error); }
.device-diagram__progress.is-indeterminate { transform-origin: 355px 180px; animation: device-wait 3s linear infinite; }
@@ -78,6 +68,7 @@
.mnt-kind button:active:not(:disabled) { background: var(--panel-3); }
.mnt-nav button:focus-visible, .mnt-kind button:focus-visible, .mnt-tabs button:focus-visible { outline: 2px solid var(--primary); outline-offset: -3px; }
.mnt-kind button small { display: block; margin-top: 6px; font: 10px var(--font-mono); color: var(--ink-4); }
.mnt-kind button > .icon { width: 21px; height: 21px; vertical-align: -5px; margin-right: 8px; }
.mnt-kind button.is-selected { border-color: var(--primary-line); background: var(--primary-soft); color: var(--ink); }
.mnt-field, .mnt-build__fields label { display: flex; flex-direction: column; gap: 7px; font-size: 11px; color: var(--ink-3); min-width: 0; }
.mnt-field .select { width: 100%; min-width: 0; }
@@ -92,6 +83,7 @@
.mnt-error { flex: none; margin: 10px 20px 0; padding: 10px 12px; color: var(--error); border-left: 2px solid var(--error); background: var(--error-soft); font-size: 11px; max-height: 90px; overflow: auto; user-select: text; overflow-wrap: anywhere; }
.mnt-package { display: flex; align-items: center; flex-direction: column; gap: 10px; padding: 25px 20px; border: 1px dashed var(--line-3); background: var(--deep); text-align: center; }
.mnt-package__symbol { font-size: 27px; color: var(--ink-2); line-height: 1; margin-bottom: 2px; }
.mnt-package__symbol > .icon { width: 28px; height: 28px; }
.mnt-package strong { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; max-width: 100%; max-height: 3.4em; overflow: auto; }
.mnt-package > span:not(.mnt-package__symbol) { font: 10px var(--font-mono); color: var(--ink-4); }
.mnt-package b { color: var(--ink-2); font-size: 11px; font-weight: 400; }
@@ -111,6 +103,7 @@
.mnt-result { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; font-size: 12px; min-height: 0; flex-shrink: 1; }
.mnt-result > strong { flex: none; max-width: 100%; max-height: 3.4em; overflow: auto; overflow-wrap: anywhere; }
.mnt-result__mark { width: 60px; height: 60px; flex: none; border: 1px solid var(--ok-line); border-radius: 50%; display: grid; place-items: center; font: 32px var(--font-mono); color: var(--ok); }
.mnt-result__mark > .icon { width: 32px; height: 32px; }
.mnt-result.is-failed .mnt-result__mark { color: var(--error); border-color: var(--error-line); }
.mnt-result p { color: var(--ink-3); line-height: 1.8; overflow-wrap: anywhere; max-width: 100%; max-height: 5.4em; min-height: 1.8em; overflow: auto; }
.mnt-verifications { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 11px; }
@@ -119,7 +112,10 @@
.mnt-foot { height: 48px; border-top: 1px solid var(--line-2); display: flex; align-items: center; justify-content: space-between; color: var(--ink-4); font-size: 10px; flex: none; }
.mnt-foot > div { display: flex; align-items: center; gap: 12px; }
.mnt-tabs { display: flex; border-bottom: 1px solid var(--line-2); padding: 0 24px; flex: none; }
.mnt-tabs button { padding: 14px 18px; border-bottom: 2px solid transparent; color: var(--ink-4); font-size: 11px; transition: color var(--dur-short3) var(--m3-standard), border-color var(--dur-short3) var(--m3-standard); }
.mnt-tabs button { display: inline-flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 2px solid transparent; color: var(--ink-4); font-size: 11px; transition: color var(--dur-short3) var(--m3-standard), border-color var(--dur-short3) var(--m3-standard); }
.ui-dialog.mnt-restore-dialog { width: min(520px, calc(100vw - 40px)); }
.mnt-restore { display: flex; flex-direction: column; gap: 20px; padding: 24px; }
.mnt-restore > p { color: var(--ink-2); font-size: 12px; line-height: 1.8; }
.mnt-tabs button.is-active { color: var(--ink); border-color: var(--primary); }
.mnt-build__body { padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.mnt-build__team { border-left: 2px solid var(--primary); padding: 10px 16px; color: var(--ink-2); background: var(--primary-soft); }