feat(webui): in-place dashboard edit overlays + inline sidebar reorder

Rework the layout edit mode from a separate panel to in-place affordances:
- Each dashboard widget gets a semi-transparent floating overlay in edit mode:
  a "拖动" grip bar (the whole card is the drag target — forgiving +
  discoverable), an eye to show/hide, and a gear that opens the per-widget
  settings in a dialog. Hidden widgets show as re-enableable "已隐藏" ghosts;
  the bottom-right resize grip is now clearly visible.
- The sidebar nav becomes a drag-to-reorder list directly in the sidebar
  (show/hide + locked pinned items + a 完成 button); editing force-expands the
  sidebar (and disables the collapse toggle). Edit mode is a shared
  LayoutContext flag so one "编辑布局" toggle drives both the grid and the nav.
- The separate editor panel (overview-layout-editor) is removed; the gear
  opens config in a dialog instead.

Also: stat-tile typography tightened (leading-tight, smaller value, overflow
clip) so text no longer hugs the edge on small/short tiles. Verified by an
adversarial review round (no MUST-FIX).
This commit is contained in:
DrSmoothl committed 2026-06-13 21:45:41 +08:00
1 parent 056fff415c
commit a61e0a253d
9 files changed
+339 -349

No files matched your search

@@ -79,6 +79,10 @@ interface LayoutContextValue {
setPages: (patch: Partial<UiPages>) => void;
/** True once the authed config load has resolved (gates the default-route redirect). */
ready: boolean;
/** Shared "编辑布局" mode — the dashboard grid AND the sidebar read this so both
* show in-place edit affordances from a single toggle. */
editing: boolean;
setEditing: (v: boolean) => void;
}
const LayoutContext = createContext<LayoutContextValue | null>(null);
@@ -88,6 +92,7 @@ export function LayoutProvider({ children }: { children: ReactNode }) {
const [layout, setLayout] = useState<UiLayout>(DEFAULT_LAYOUT);
const [pages, setPagesState] = useState<UiPages>(DEFAULT_PAGES);
const [ready, setReady] = useState(false);
const [editing, setEditing] = useState(false);
const layoutRef = useRef(layout);
const pagesRef = useRef(pages);
// Set once the user edits, so the initial GET (which may resolve AFTER the
@@ -186,7 +191,9 @@ export function LayoutProvider({ children }: { children: ReactNode }) {
pages,
setPages,
ready,
}), [layout, setOverviewBlocks, setNavItems, resetLayout, pages, setPages, ready]);
editing,
setEditing,
}), [layout, setOverviewBlocks, setNavItems, resetLayout, pages, setPages, ready, editing]);
return <LayoutContext.Provider value={value}>{children}</LayoutContext.Provider>;
}