swarm-ui: repoint the HivesPage comments at HivesCard and pin the nav filter and lazy roster
This commit is contained in:
parent
70917b7dd0
commit
209a286d7c
2 changed files with 63 additions and 18 deletions
|
|
@ -36,7 +36,7 @@ import { SettingsMenu } from "@hive/shared/settings-menu.js";
|
|||
import { HideDebugSetting } from "@hive/shared/hide-debug-setting.js";
|
||||
import { useApplyThemeOverride } from "@hive/shared/theme-apply.js";
|
||||
import { useApplyMotionOverride } from "@hive/shared/motion-apply.js";
|
||||
import { isFullBleedRoute } from "./routes.js";
|
||||
import { isFullBleedRoute, visibleNavItems } from "./routes.js";
|
||||
import { useDynamicTabs } from "./useDynamicTabs.js";
|
||||
import { useSwarmName } from "./useSwarmName.js";
|
||||
import "./Shell.css";
|
||||
|
|
@ -212,9 +212,7 @@ export function Shell({ children }: { children: ComponentChildren }) {
|
|||
// The components tab is a developer page: it goes while "hide developer
|
||||
// details" is on. The page itself still answers at `/components`.
|
||||
const hideDeveloper = useHideDebug();
|
||||
const navItems = hideDeveloper
|
||||
? NAV_ITEMS.filter((item) => item.href !== "/components")
|
||||
: NAV_ITEMS;
|
||||
const navItems = visibleNavItems(NAV_ITEMS, hideDeveloper);
|
||||
|
||||
// Applied once here, not inside `SettingsMenu` — every route mounts
|
||||
// through this one `<Shell>`, so the override takes effect regardless
|
||||
|
|
|
|||
|
|
@ -15,3 +15,15 @@ const FULL_BLEED_ROUTE_PATTERN =
|
|||
export function isFullBleedRoute(location: string): boolean {
|
||||
return location === "/" || FULL_BLEED_ROUTE_PATTERN.test(location);
|
||||
}
|
||||
|
||||
// Routes that only a developer needs. "hide developer details" takes their
|
||||
// tabs out of the nav; the pages themselves still answer at their paths.
|
||||
const DEVELOPER_ROUTES = ["/components"];
|
||||
|
||||
export function visibleNavItems<T extends { href: string }>(
|
||||
items: readonly T[],
|
||||
hideDeveloper: boolean,
|
||||
): readonly T[] {
|
||||
if (!hideDeveloper) return items;
|
||||
return items.filter((item) => !DEVELOPER_ROUTES.includes(item.href));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue