Merge origin/master into feat/portable-characters

This commit is contained in:
Дмитрий committed 2026-10-09 14:41:53 +05:00
commit 65ace578f7
60 files changed
+1563 -112

No files matched your search

+21 -1
View File
@@ -1,7 +1,8 @@
import { useCallback, useEffect, useState } from "react";
import { listen } from "@tauri-apps/api/event";
import { Loader2, ShieldCheck } from "lucide-react";
import { api, asUiError, type BackupKind, type RecoveryPoint, type UiError } from "@/lib/api";
import { open } from "@tauri-apps/plugin-dialog";
import { api, asUiError, type BackupKind, type BackupLocation, type RecoveryPoint, type UiError } from "@/lib/api";
import { Button } from "@/components/ui/button";
import { Card } from "@/components/ui/card";
import { useHuman, useI18n, type Key, type Locale } from "@/i18n";
@@ -45,9 +46,11 @@ export function BackupsPage({ serverId }: { serverId: string }) {
const [notice, setNotice] = useState<string | null>(null);
const [restoring, setRestoring] = useState<RecoveryPoint | null>(null);
const [running, setRunning] = useState(false);
const [location, setLocation] = useState<BackupLocation | null>(null);
const load = useCallback(async () => {
setPoints(await api.backups(serverId));
setLocation(await api.backupLocation(serverId));
const s = await api.status(serverId);
setRunning(s.observed.world.state !== "stopped" || s.observed.auth.state !== "stopped");
}, [serverId]);
@@ -113,6 +116,23 @@ export function BackupsPage({ serverId }: { serverId: string }) {
</div>
</Card>
{location && (
<Card className="mt-4 p-5">
<p className="font-medium">{t("bk.folder")}</p>
<p className="selectable mt-1 break-all text-sm text-muted">{location.path}{location.is_default ? ` (${t("bk.folderDefault")})` : ""}</p>
<p className="mt-1 text-xs text-muted">{t("bk.folderNote")}</p>
<div className="mt-3 flex flex-wrap gap-2">
<Button size="sm" disabled={!!busy} onClick={() => void run("folder", async () => {
const dir = await open({ directory: true, multiple: false, title: t("bk.folder") });
if (typeof dir === "string") { await api.setBackupLocation(serverId, dir); return t("bk.folderChanged"); }
})}>{t("bk.folderChange")}</Button>
{!location.is_default && (
<Button size="sm" variant="ghost" disabled={!!busy} onClick={() => void run("folder", async () => { await api.setBackupLocation(serverId, null); return t("bk.folderChanged"); })}>{t("bk.folderReset")}</Button>
)}
</div>
</Card>
)}
{notice && <p className="mt-3 text-sm text-ok" role="status">{notice}</p>}
{error && (
<Card className="mt-4 border-bad/40 p-4" role="alert">
+8
View File
@@ -6,6 +6,7 @@ import { ClientDialog, type ClientDialogMode } from "@/screens/ClientDialog";
import { Button } from "@/components/ui/button";
import { Card } from "@/components/ui/card";
import { useHuman, useT } from "@/i18n";
import { useStartAfterUpdate } from "@/lib/updatePrefs";
export function ClientCard({ serverId, remote = false }: { serverId: string; remote?: boolean }) {
const t = useT();
@@ -16,6 +17,7 @@ export function ClientCard({ serverId, remote = false }: { serverId: string; rem
const [busy, setBusy] = useState(false);
const [status, setStatus] = useState<ClientStatus | null>(null);
const [dialog, setDialog] = useState<ClientDialogMode | null>(null);
const [playAfter, setPlayAfter] = useStartAfterUpdate("client", serverId);
const refresh = () => {
void api.clientStatus(serverId).then(setStatus).catch(() => setStatus(null));
@@ -86,6 +88,12 @@ export function ClientCard({ serverId, remote = false }: { serverId: string; rem
<dt className="text-muted">{t("client.otherAddons")}</dt>
<dd>{t("client.leftAsIs", { n: info.other_addons })}</dd>
</dl>
{!remote && (
<label className="mt-4 flex cursor-pointer items-center gap-2 text-sm">
<input type="checkbox" checked={playAfter} onChange={(e) => setPlayAfter(e.target.checked)} className="h-4 w-4 accent-[#c9a24a]" />
<span>{t("client.startAfter")}</span>
</label>
)}
<div className="mt-4 flex flex-wrap gap-2">
{!remote && !pointsLocal && (
<Button size="sm" disabled={busy} onClick={() => void run(async () => { await api.setRealmlist(serverId, "127.0.0.1"); return t("client.pointedNote"); })}>
+1 -1
View File
@@ -103,7 +103,7 @@ export function ConsolePage({ serverId }: { serverId: string }) {
</Button>
</div>
<div ref={box} className="selectable mt-3 min-h-64 flex-1 overflow-auto rounded-card border border-line bg-black/40 p-3 font-mono text-xs leading-5" role="log" aria-live="off">
<div ref={box} className="selectable relative mt-3 min-h-64 flex-1 overflow-auto rounded-card border border-line bg-black/40 p-3 font-mono text-xs leading-5" role="log" aria-live="off">
{missing ? <p className="text-muted">{missing}</p> : lines.length === 0 ? <p className="text-muted">{t("con.empty")}</p> : lines.map((l, i) => (
<div key={i} className={cn("whitespace-pre-wrap break-all", TONE[l.level])}>
{l.level !== "info" && <span className="sr-only">{l.level}: </span>}
+109
View File
@@ -0,0 +1,109 @@
import { useCallback, useEffect, useState } from "react";
import { listen } from "@tauri-apps/api/event";
import { Loader2 } from "lucide-react";
import { api, asUiError, type DashboardStatus, type UiError } from "@/lib/api";
import { Button } from "@/components/ui/button";
import { Card } from "@/components/ui/card";
import { useHuman, useT } from "@/i18n";
/** SQUID's bot dashboard: installed from the release that matches the bots, started on a free port, shown here. */
export function DashboardPage({ serverId }: { serverId: string }) {
const t = useT();
const human = useHuman();
const [status, setStatus] = useState<DashboardStatus | null>(null);
const [busy, setBusy] = useState<"install" | "start" | "stop" | null>(null);
const [step, setStep] = useState<string | null>(null);
const [error, setError] = useState<UiError | null>(null);
const load = useCallback(async () => {
try { setStatus(await api.dashboardStatus(serverId)); } catch (e) { setError(asUiError(e)); }
}, [serverId]);
useEffect(() => {
void load();
const un = listen<string>("dashboard-progress", (e) => setStep(e.payload));
return () => { void un.then((f) => f()); };
}, [load]);
async function run(kind: "install" | "start" | "stop", fn: () => Promise<DashboardStatus>) {
setBusy(kind); setError(null); setStep(null);
try { setStatus(await fn()); } catch (e) { setError(asUiError(e)); await load(); }
finally { setBusy(null); setStep(null); }
}
const install = () => run("install", () => api.dashboardInstall(serverId));
return (
<div className="flex h-full max-w-6xl flex-col">
<h1 className="text-2xl font-semibold">{t("dash.title")}</h1>
<p className="mt-1 text-muted">{t("dash.intro")}</p>
{!status && !error && <p className="mt-6 text-muted">{t("overview.checking")}</p>}
{status && (
<Card className="mt-5 p-5">
{!status.installed ? (
<>
<p className="font-medium">{t("dash.notInstalled")}</p>
<p className="mt-1 text-sm text-muted">{status.squid_tag ? t("dash.willInstall", { v: status.squid_tag }) : t("dash.noSquid")}</p>
<Button className="mt-4" variant="primary" disabled={!!busy || !status.squid_tag} onClick={() => void install()}>
{busy === "install" && <Loader2 className="h-4 w-4 animate-spin" aria-hidden />}
{t("dash.install")}
</Button>
</>
) : (
<>
<p className="text-sm text-muted">
{t("dash.versions", { dash: status.tag ?? "?", bots: status.squid_tag ?? "?" })}
{" · "}
<span className={status.running ? "text-ok" : "text-muted"}>{status.running ? t("dash.running") : t("dash.stopped")}</span>
</p>
{!status.matches && status.squid_tag && (
<p className="mt-2 text-sm text-warn">{t("dash.mismatch", { bots: status.squid_tag })}</p>
)}
<div className="mt-4 flex flex-wrap items-center gap-2">
{status.running ? (
<>
<Button size="sm" variant="secondary" disabled={!!busy} onClick={() => void run("stop", () => api.dashboardStop(serverId))}>
{busy === "stop" && <Loader2 className="h-4 w-4 animate-spin" aria-hidden />}
{t("dash.stop")}
</Button>
<Button size="sm" variant="ghost" onClick={() => void api.dashboardOpen(serverId).catch((e) => setError(asUiError(e)))}>{t("dash.openBrowser")}</Button>
</>
) : (
<Button size="sm" variant="primary" disabled={!!busy} onClick={() => void run("start", () => api.dashboardStart(serverId))}>
{busy === "start" && <Loader2 className="h-4 w-4 animate-spin" aria-hidden />}
{t("dash.start")}
</Button>
)}
{!status.matches && status.squid_tag && (
<Button size="sm" disabled={!!busy} onClick={() => void install()}>
{busy === "install" && <Loader2 className="h-4 w-4 animate-spin" aria-hidden />}
{t("dash.update")}
</Button>
)}
</div>
</>
)}
{busy === "install" && <p className="mt-3 text-sm text-muted" role="status">{step ?? t("bk.working")}</p>}
</Card>
)}
{error && (
<Card className="mt-4 border-bad/40 p-4" role="alert">
<p className="selectable whitespace-pre-wrap break-words text-sm text-bad">{error.human.code === "unknown" ? error.technical : human(error.human).message}</p>
<button className="mt-1 cursor-pointer text-xs text-muted underline" onClick={() => void navigator.clipboard.writeText(error.technical)}>{t("common.copyError")}</button>
</Card>
)}
{status?.running && (
<iframe
key={status.url}
title={t("dash.title")}
src={status.url}
className="mt-4 min-h-[480px] w-full flex-1 rounded-card border border-line bg-black/30"
/>
)}
</div>
);
}
+8 -3
View File
@@ -158,9 +158,14 @@ export function InstallServer(props: { canCancel: boolean; onCancel: () => void;
<p className="font-medium text-bad">{error.human.code === "unknown" ? t("install.failedTitle") : human(error.human).title}</p>
<p className="mt-1 text-sm text-muted">{error.human.code === "unknown" ? error.technical : human(error.human).message}</p>
<p className="mt-1 text-sm text-muted">{t("install.nothingInstalled")}</p>
<button className="mt-2 cursor-pointer text-xs text-muted underline" onClick={() => setShowDetails((v) => !v)}>
{showDetails ? t("install.hideTech") : t("install.showTech")}
</button>
<div className="mt-2 flex items-center gap-4">
<button className="cursor-pointer text-xs text-muted underline" onClick={() => setShowDetails((v) => !v)}>
{showDetails ? t("install.hideTech") : t("install.showTech")}
</button>
<button className="cursor-pointer text-xs text-muted underline" onClick={() => void navigator.clipboard.writeText(error.technical)}>
{t("common.copyError")}
</button>
</div>
{showDetails && <pre className="mt-2 max-h-40 overflow-auto whitespace-pre-wrap rounded bg-black/40 p-2 text-xs">{error.technical}</pre>}
</Card>
)}
+37 -3
View File
@@ -68,6 +68,19 @@ export function Overview({ server, companions = true, onForget, onOpenUpdates, o
const t = useT();
const human = useHuman();
const [status, setStatus] = useState<StatusView | null>(null);
// With both worlds started together, each realm gets its own card; the first realm owns the database and auth.
const [realms, setRealms] = useState<{ first: string; second: string } | null>(null);
const bothWorlds = !!status?.observed.secondary_world;
useEffect(() => {
if (!bothWorlds) { setRealms(null); return; }
let alive = true;
void api.realmProfiles(server.id).then((r) => {
if (!alive) return;
const name = (m: "coa" | "wildcard") => (m === "coa" ? "Conquest of Azeroth" : "Wildcard");
setRealms({ first: name(r.active), second: name(r.active === "coa" ? "wildcard" : "coa") });
}).catch(() => { if (alive) setRealms(null); });
return () => { alive = false; };
}, [bothWorlds, server.id]);
const [action, setAction] = useState<Action>(null);
const [realmBusy, setRealmBusy] = useState(false);
const [failure, setFailure] = useState<Failure | null>(null);
@@ -220,7 +233,7 @@ export function Overview({ server, companions = true, onForget, onOpenUpdates, o
<RealmPicker serverId={server.id} running={anyUp} disabled={transitioning || upd.applying} onBusy={setRealmBusy} onChanged={() => { onRealmChanged(); void poll(); }} />
<Card className="mt-6 p-7">
<div className="mb-1 text-xs font-medium uppercase tracking-[0.14em] text-muted">{t("overview.server")}</div>
<div className="mb-1 text-xs font-medium uppercase tracking-[0.14em] text-muted">{realms ? `${realms.first} · ${t("overview.server")}` : t("overview.server")}</div>
<div className={cn("flex items-center gap-3 text-3xl font-semibold", tone)} role="status" aria-live="polite">
<span
aria-hidden
@@ -239,7 +252,6 @@ export function Overview({ server, companions = true, onForget, onOpenUpdates, o
<Row label={t("overview.database")} s={mysql} />
<Row label={t("overview.auth")} s={auth} />
<Row label={t("overview.world")} s={world} />
{secondary_world && <Row label={t("realm.secondWorld")} s={secondary_world} />}
</div>
<dl className="mt-4 grid grid-cols-2 gap-4 text-sm">
@@ -301,7 +313,7 @@ export function Overview({ server, companions = true, onForget, onOpenUpdates, o
{t("btn.stopSmall")}
</Button>
)}
<div className="ml-auto flex items-center gap-3">
<div className="ml-auto flex max-w-full flex-wrap items-center justify-end gap-3">
{client && <RealmlistMenu serverId={server.id} />}
{client && jobBusy ? (
<div
@@ -402,6 +414,28 @@ export function Overview({ server, companions = true, onForget, onOpenUpdates, o
)}
</Card>
{secondary_world && (
<Card className="mt-4 p-7">
<div className="mb-1 text-xs font-medium uppercase tracking-[0.14em] text-muted">{realms ? `${realms.second} · ${t("overview.server")}` : t("realm.secondWorld")}</div>
<div
className={cn("flex items-center gap-3 text-3xl font-semibold", secondary_world.state === "running" ? "text-ok" : secondary_world.state === "starting" || transitioning ? "text-warn" : "text-muted")}
role="status"
aria-live="polite"
>
<span aria-hidden className={cn("h-3 w-3 rounded-full", secondary_world.state === "running" ? "bg-ok" : secondary_world.state === "starting" || transitioning ? "bg-warn" : "bg-muted/50")} />
{secondary_world.state === "running" ? t("status.online") : secondary_world.state === "starting" ? t("status.starting") : t("status.offline")}
</div>
<div className="mt-5 divide-y divide-line border-y border-line">
<Row label={t("overview.world")} s={secondary_world} />
</div>
<dl className="mt-4 text-sm">
<dt className="text-muted">{t("overview.uptime")}</dt>
<dd className="mt-0.5 text-lg">{secondary_world.state === "running" ? formatUptime(secondary_world.uptime_secs) : "—"}</dd>
</dl>
<p className="mt-3 text-xs text-muted">{t("realm.bothRunning")}</p>
</Card>
)}
{conflict && !anyUp && (
<Card className="mt-4 border-warn/40 p-4" role="alert">
<p className="font-medium text-warn">{t("overview.portTitle")}</p>
+4 -4
View File
@@ -34,15 +34,15 @@ export function RealmPicker({ serverId, running, disabled, onChanged, onBusy }:
<div className="flex flex-wrap items-center gap-3">
<Layers className="h-5 w-5 text-gold" aria-hidden />
<label htmlFor="realm-profile" className="font-medium">{t("realm.profileLabel")}</label>
<select id="realm-profile" value={selected} disabled={!view || disabled || busy} onChange={e => setSelected(e.target.value as RealmMode)} className="min-w-52 rounded-md border border-line bg-card-2 px-3 py-2 text-ink">
{view?.simultaneous ? <span className="text-sm text-muted">Conquest of Azeroth + Wildcard</span> : <select id="realm-profile" value={selected} disabled={!view || disabled || busy} onChange={e => setSelected(e.target.value as RealmMode)} className="min-w-52 rounded-md border border-line bg-card-2 px-3 py-2 text-ink">
<option value="coa">Conquest of Azeroth</option>
<option value="wildcard" disabled={!view?.supported && !view?.wildcard_created}>Wildcard · Darkmoon</option>
</select>
{view && (selected !== view.active || view.recovery_pending) && <Button size="sm" disabled={disabled || busy} onClick={() => void select()}>
</select>}
{view && !view.simultaneous && (selected !== view.active || view.recovery_pending) && <Button size="sm" disabled={disabled || busy} onClick={() => void select()}>
{busy && <Loader2 className="h-4 w-4 animate-spin" aria-hidden />}
{busy ? t("realm.switching") : selected === "wildcard" && !view.wildcard_created ? t("realm.create") : running ? t("realm.restart") : t("realm.select")}
</Button>}
{view && <span className="ml-auto text-xs text-muted">{t("realm.active", { name: view.active === "coa" ? "CoA" : "Wildcard" })}</span>}
{view && !view.simultaneous && <span className="ml-auto text-xs text-muted">{t("realm.active", { name: view.active === "coa" ? "CoA" : "Wildcard" })}</span>}
</div>
<p className="mt-3 text-sm text-muted">{t(view?.simultaneous ? "realm.bothRunning" : "realm.separate")}</p>
{selected === "wildcard" && <p className="mt-2 text-sm text-warn">{t("realm.modules")}</p>}
+39
View File
@@ -0,0 +1,39 @@
import { useEffect, useState } from "react";
import { api, asUiError } from "@/lib/api";
import { Button } from "@/components/ui/button";
import { Card } from "@/components/ui/card";
import { useT } from "@/i18n";
/** Takes a server out of the Manager's list. Nothing on disk is deleted, so the folder can be added again later. */
export function RemoveServerCard({ serverId, path, onForget }: { serverId: string; path: string; onForget: () => Promise<void> }) {
const t = useT();
const [running, setRunning] = useState(false);
const [error, setError] = useState<string | null>(null);
const [busy, setBusy] = useState(false);
useEffect(() => {
let active = true;
void api.status(serverId).then((s) => {
if (!active) return;
const all = [s.observed.mysql, s.observed.auth, s.observed.world, ...(s.observed.secondary_world ? [s.observed.secondary_world] : [])];
setRunning(all.some((x) => x.state === "running" || x.state === "starting" || x.state === "stopping"));
}).catch(() => { /* an unreadable status must not hide the button */ });
return () => { active = false; };
}, [serverId]);
async function remove() {
if (!window.confirm(t("remove.confirm", { path }))) return;
setBusy(true); setError(null);
try { await onForget(); }
catch (e) { setError(asUiError(e).technical); setBusy(false); }
}
return <Card className="mt-6 p-6">
<h2 className="font-semibold">{t("remove.title")}</h2>
<p className="mt-2 text-sm text-muted">{t("remove.text")}</p>
<p className="selectable mt-1 break-all text-sm text-muted">{path}</p>
<Button className="mt-4" disabled={busy || running} onClick={() => void remove()}>{t("remove.button")}</Button>
{running && <p className="mt-2 text-sm text-warn">{t("remove.stopFirst")}</p>}
{error && <p className="mt-3 text-sm text-bad" role="alert">{error}</p>}
</Card>;
}
+7 -1
View File
@@ -10,7 +10,7 @@ export function RepairCard({ serverId }: { serverId: string }) {
const job = useRepair(serverId);
const [checking, setChecking] = useState(false);
const [database, setDatabase] = useState<DatabaseCheck[] | null>(null);
const [files, setFiles] = useState<{ path: string; kind: string }[] | null>(null);
const [files, setFiles] = useState<{ path: string; kind: "missing" | "changed" | string }[] | null>(null);
const [error, setError] = useState<string | null>(null);
async function check() {
clearRepairResult(serverId);
@@ -36,6 +36,12 @@ export function RepairCard({ serverId }: { serverId: string }) {
{job.result.error && <p className="mt-2 text-bad">{job.result.error}</p>}
</div>}
{files && !job.result && <p className="mt-3 text-sm">{t("repair.fileCount", { n: files.length })}</p>}
{files && !job.result && files.length > 0 && (
<ul className="selectable mt-2 max-h-52 overflow-auto text-sm text-muted">
{files.slice(0, 200).map((f) => <li key={f.path}><span className={f.kind === "missing" ? "text-bad" : "text-warn"}>{t(f.kind === "missing" ? "repair.fileMissing" : "repair.fileChanged")}</span> {f.path}</li>)}
{files.length > 200 && <li>…</li>}
</ul>
)}
{checks?.map(c => {
const pending = c.migrations.filter(m => m.status !== "applied");
return <div key={c.realm} className="mt-4 border-t border-line pt-3 text-sm">
+23 -5
View File
@@ -9,6 +9,8 @@ import { Card } from "@/components/ui/card";
import { ClientCard } from "@/screens/ClientCard";
import { DiagnosticsCard } from "@/screens/DiagnosticsCard";
import { AboutCard } from "@/screens/AboutCard";
import { RemoveServerCard } from "@/screens/RemoveServerCard";
import { useStartAfterUpdate } from "@/lib/updatePrefs";
import { hasKey, useHuman, useI18n, type Key } from "@/i18n";
import { LanguagePicker } from "@/components/LanguagePicker";
import { RealmStartupSettings } from "@/screens/RealmStartupSettings";
@@ -19,7 +21,7 @@ function mb(bytes: number) {
return bytes >= 1 << 20 ? `${(bytes / (1 << 20)).toFixed(1)} MB` : `${Math.max(1, Math.round(bytes / 1024))} KB`;
}
export function SettingsHome({ serverId, serverName }: { serverId: string; serverName: string }) {
export function SettingsHome({ serverId, serverName = "", path, onForget }: { serverId: string; serverName?: string; path: string; onForget: () => Promise<void> }) {
const { t } = useI18n();
const upd = useServerUpdate(serverId);
const human = useHuman();
@@ -38,6 +40,7 @@ export function SettingsHome({ serverId, serverName }: { serverId: string; serve
const [choices, setChoices] = useState<Record<string, "keep" | "replace">>({});
const [advanced, setAdvanced] = useState(false);
const [source, setSource] = useState("");
const [startAfter, setStartAfter] = useStartAfterUpdate("server", serverId);
useEffect(() => {
let active = true;
@@ -179,6 +182,10 @@ export function SettingsHome({ serverId, serverName }: { serverId: string; serve
<Card className="mt-6 p-6">
<h2 className="font-semibold">{t("upd.title")}</h2>
<p className="mt-1 text-sm text-muted">{t("upd.text")}</p>
<label className="mt-3 flex cursor-pointer items-center gap-2 text-sm">
<input type="checkbox" checked={startAfter} onChange={(e) => setStartAfter(e.target.checked)} className="h-4 w-4 accent-[#c9a24a]" />
<span>{t("upd.startAfter")}</span>
</label>
<div className="mt-4 flex items-center gap-3">
<Button variant="primary" disabled={!!busy} onClick={() => void check()}>
@@ -199,9 +206,18 @@ export function SettingsHome({ serverId, serverName }: { serverId: string; serve
{done && pendingChecked && !pendingStateError && <p className="mt-4 text-sm text-ok" role="status">{done}</p>}
{error && (
<p className="mt-4 text-sm text-bad" role="alert">
{error.human.code === "unknown" ? error.technical : human(error.human).message}
</p>
<div className="mt-4" role="alert">
<p className="selectable whitespace-pre-wrap break-words text-sm text-bad">
{error.human.code === "unknown" ? error.technical : human(error.human).message}
</p>
<button className="mt-1 cursor-pointer text-xs text-muted underline" onClick={() => void navigator.clipboard.writeText(error.technical)}>
{t("common.copyError")}
</button>
</div>
)}
{preview?.database_check_error && (
<p className="selectable mt-4 break-words text-sm text-warn" role="status">{t("upd.dbUnchecked", { why: preview.database_check_error })}</p>
)}
{preview && isUpdateCurrent(preview) && (
@@ -216,7 +232,7 @@ export function SettingsHome({ serverId, serverName }: { serverId: string; serve
{preview.from_version ? t("upd.availableFrom", { to: preview.to_version, from: preview.from_version }) : t("upd.available", { to: preview.to_version })}
</p>
<p className="mt-1 text-sm text-muted">
{(preview.pending_migrations ?? preview.migrations) > 0
{!preview.database_check_error && (preview.pending_migrations ?? preview.migrations) > 0
? t("upd.summaryDb", { size: mb(preview.download_bytes), files: preview.items.filter((i) => i.action !== "skip").length, db: preview.pending_migrations ?? preview.migrations })
: t("upd.summary", { size: mb(preview.download_bytes), files: preview.items.filter((i) => i.action !== "skip").length })}
</p>
@@ -262,6 +278,8 @@ export function SettingsHome({ serverId, serverName }: { serverId: string; serve
</div>
)}
</Card>
<RemoveServerCard serverId={serverId} path={path} onForget={onForget} />
</div>
);
}
+9 -5
View File
@@ -1,5 +1,5 @@
import { useCallback, useEffect, useState } from "react";
import { Archive, Bot, Bug, Gauge, Globe, Puzzle, Server, Settings, Swords, Terminal, Users, type LucideIcon } from "lucide-react";
import { Archive, BarChart3, Bot, Bug, Gauge, Globe, Puzzle, Server, Settings, Swords, Terminal, Users, type LucideIcon } from "lucide-react";
import { api, type ServerSummary } from "@/lib/api";
import { useT, type Key } from "@/i18n";
import logo from "@/assets/logo.png";
@@ -15,15 +15,17 @@ import { ReportPage } from "@/screens/ReportPage";
import { ModulesPage } from "@/screens/ModulesPage";
import { ConsolePage } from "@/screens/ConsolePage";
import { PortablePage } from "@/screens/PortablePage";
import { DashboardPage } from "@/screens/DashboardPage";
import { Button } from "@/components/ui/button";
import { startServerUpdatePolling, useServerUpdate } from "@/lib/serverUpdate";
import { startClientPolling } from "@/lib/clientUpdate";
type Page = "overview" | "bots" | "server" | "modules" | "players" | "characters" | "friends" | "backups" | "console" | "report" | "settings";
type Page = "overview" | "bots" | "dashboard" | "server" | "modules" | "players" | "characters" | "friends" | "backups" | "console" | "report" | "settings";
const NAV: { id: Page; label: Key; icon: LucideIcon; question: Key }[] = [
{ id: "overview", label: "nav.overview", icon: Gauge, question: "q.overview" },
{ id: "bots", label: "nav.bots", icon: Bot, question: "q.bots" },
{ id: "dashboard", label: "nav.dashboard", icon: BarChart3, question: "q.dashboard" },
{ id: "server", label: "nav.server", icon: Server, question: "q.server" },
{ id: "modules", label: "nav.modules", icon: Puzzle, question: "q.modules" },
{ id: "players", label: "nav.players", icon: Users, question: "q.players" },
@@ -86,7 +88,7 @@ export function Shell(props: {
{t("app.name")}
</div>
<ul className="flex flex-col gap-0.5">
{NAV.filter((n) => !hiddenPages.includes(n.id)).map(({ id, label, icon: Icon }) => (
{NAV.filter((n) => !hiddenPages.includes(n.id) && (n.id !== "dashboard" || botModule === "playerbots")).map(({ id, label, icon: Icon }) => (
<li key={id}>
<button
onClick={() => setPage(id)}
@@ -127,11 +129,13 @@ export function Shell(props: {
</div>
</nav>
<main className="h-full flex-1 overflow-y-auto px-10 py-8">
<main className="relative h-full flex-1 overflow-y-auto px-10 py-8">
{page === "overview" ? (
<Overview key={server.id} server={server} companions={botModule === "companions" && !hiddenPages.includes("bots")} onForget={() => props.onForget(server.id)} onOpenUpdates={() => setPage("settings")} onRealmChanged={reloadModules} onReport={() => setPage("report")} />
) : page === "bots" || page === "server" ? (
<SettingsPage key={`${server.id}-${page}-${botModule}`} serverId={server.id} scope={page} botModule={botModule} title={t(current.label)} question={t(current.question)} />
) : page === "dashboard" ? (
<DashboardPage key={server.id} serverId={server.id} />
) : page === "console" ? (
<ConsolePage key={server.id} serverId={server.id} />
) : page === "modules" ? (
@@ -141,7 +145,7 @@ export function Shell(props: {
) : page === "friends" ? (
<FriendsPage key={server.id} serverId={server.id} />
) : page === "settings" ? (
<SettingsHome key={server.id} serverId={server.id} serverName={server.name} />
<SettingsHome key={server.id} serverId={server.id} serverName={server.name} path={server.path} onForget={() => props.onForget(server.id)} />
) : page === "characters" ? (
<PortablePage key="characters" />
) : page === "players" ? (