mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 04:20:45 +08:00
Persist board/panel layouts server-side, open each board outside the network shell so workbench reloads do not refresh walls, and fix mapped-baseline chart overlay plus fullscreen fit. Co-authored-by: Cursor <cursoragent@cursor.com>
42 lines
1.5 KiB
TypeScript
42 lines
1.5 KiB
TypeScript
import { useI18n } from "../i18n";
|
|
import { WorkbenchCardIcon } from "../components/WorkbenchCardIcon";
|
|
import { modulesInSection, type WorkbenchSection } from "../config/modules";
|
|
import { openOrFocusModule } from "../utils/moduleWindows";
|
|
import { useAuth } from "../auth/AuthContext";
|
|
|
|
const SECTIONS: WorkbenchSection[] = ["monitoring", "operations", "system"];
|
|
|
|
export function WorkbenchPage() {
|
|
const { t } = useI18n();
|
|
const { isAdmin } = useAuth();
|
|
|
|
return (
|
|
<div className="workbench">
|
|
{SECTIONS.map((section) => (
|
|
<section key={section} className="wb-section">
|
|
<h2 className="wb-section__title">{t(`workbench.${section}`)}</h2>
|
|
<div className="wb-grid">
|
|
{modulesInSection(section)
|
|
.filter((mod) => !mod.workbenchHidden)
|
|
.filter((mod) => !mod.adminOnly || isAdmin)
|
|
.map((mod) => (
|
|
<button
|
|
key={mod.moduleId}
|
|
type="button"
|
|
className="wb-card"
|
|
title={t("workbench.openModule")}
|
|
onClick={() => openOrFocusModule({ moduleId: mod.moduleId, path: mod.path })}
|
|
>
|
|
<WorkbenchCardIcon tone={mod.iconTone} />
|
|
<span className="wb-card__text">
|
|
<span className="wb-card__label">{t(mod.labelKey)}</span>
|
|
{mod.descKey ? <span className="wb-card__desc">{t(mod.descKey)}</span> : null}
|
|
</span>
|
|
</button>
|
|
))}
|
|
</div>
|
|
</section>
|
|
))}
|
|
</div>
|
|
);
|
|
}
|