diff --git a/app/src/pages/SystemMap.tsx b/app/src/pages/SystemMap.tsx index 5a880a4..2ae0bd4 100644 --- a/app/src/pages/SystemMap.tsx +++ b/app/src/pages/SystemMap.tsx @@ -19,6 +19,7 @@ import "@xyflow/react/dist/style.css" import { useNavigate, useSearchParams } from "react-router-dom" import { BoxSelect, + ChevronDown, ExternalLink, Globe, LayoutGrid, @@ -1310,7 +1311,26 @@ export function SystemMapPage() { ) } +const LEGEND_KEY = "castle-map-legend-open" + function Legend() { + const [open, setOpen] = useState(() => { + try { + return localStorage.getItem(LEGEND_KEY) !== "false" + } catch { + return true + } + }) + const toggle = () => + setOpen((o) => { + const next = !o + try { + localStorage.setItem(LEGEND_KEY, String(next)) + } catch { + /* storage disabled */ + } + return next + }) const items = [ { c: PROTO_COLOR.http, label: "consumes — http" }, { c: PROTO_COLOR.pg, label: "consumes — pg / db" }, @@ -1322,28 +1342,39 @@ function Legend() { { c: "#2ea043", label: "public — internet" }, ] return ( -