Refactor build and start scripts in package.json; add plugin to exclude debug files from production build in vite.config.ts; remove ConnectScreen component and replace with ConnectionPlaceholder in multiple pages; update DeviceContext to auto-connect using device IP from URL; enhance locale files with new device IP labels.

This commit is contained in:
yangy
2026-05-22 15:54:11 +08:00
parent 747331c850
commit 32f15217ad
13 changed files with 199 additions and 173 deletions
+6 -12
View File
@@ -90,7 +90,7 @@ type LocaleSettings = {
deviceName: string;
firmwareVersion: string;
macAddress: string;
disconnect: string;
deviceIp: string;
};
};
};
@@ -109,7 +109,7 @@ function optionLabels(items: Array<{ index: number; label: string }> | undefined
export default function SystemPage() {
const [, setLocation] = useLocation();
const { deviceState, updateSetting, disconnect, refresh, isConnected, api } = useDevice();
const { deviceState, updateSetting, refresh, isConnected, api, ip } = useDevice();
const ds = deviceState;
// 页面加载且已连接时刷新数据
@@ -204,16 +204,10 @@ export default function SystemPage() {
<span className="flex-1 text-[16px] text-white">{ui.macAddress}</span>
<span className="ios-row-value text-[12px]">{ds?.mac ?? "—"}</span>
</div>
</div>
{/* ── 断开连接 ── */}
<div className="mt-6 mb-4">
<button
className="w-full py-4 rounded-[14px] text-[16px] font-medium transition-all duration-150 active:scale-[0.98]"
style={{ background: "rgba(239,68,68,0.1)", border: "1px solid rgba(239,68,68,0.2)", color: "#ef4444" }}
onClick={() => { disconnect(); setLocation("/"); }}>
{ui.disconnect}
</button>
<div className="ios-list-row">
<span className="flex-1 text-[16px] text-white">{ui.deviceIp ?? "设备 IP"}</span>
<span className="ios-row-value text-[12px]">{ip || "—"}</span>
</div>
</div>
</div>