Files
inbuxa-admin/src/lib/viewIcon.ts
T
jcoffey-dev e4ad5e2c1e A warmer, friendlier admin: first pass
- The INBUXA palette on warm surfaces, softer cards, buttons and inputs, and
  self-hosted Inter and Space Grotesk.
- Each section's icon sits on a colored tile, colored by what the section is
  about.
- The sidebar gets a guide line for sub-pages and a labeled Management /
  Settings / Account switch, and folds to a rail of tiles (remembered).
- Every page has a header with its section's tile.
- Fields and pages with no label of their own are spelled out in words
  (defaultCertificateId becomes Default certificate ID).
- The dashboard greets you, and its stat cards wear colored tiles.
- Unavailable live numbers are a calm note, not an error.
- The cat appears in empty lists and while loading.
- Chart colors work again: they were hex values wrapped in hsl().
2026-09-19 00:38:53 -07:00

24 lines
851 B
TypeScript

/*
* SPDX-FileCopyrightText: 2026 Coffey Labs
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { LayoutSubItem, Schema } from '@/types/schema';
function subtreeHas(items: LayoutSubItem[], viewName: string): boolean {
return items.some((it) => (it.type === 'link' ? it.viewName === viewName : subtreeHas(it.items, viewName)));
}
/** The icon of the sidebar entry a view sits under, so its page wears the same tile. */
export function iconForView(schema: Schema | null, viewName: string): string | null {
if (!schema) return null;
for (const layout of schema.layouts ?? []) {
for (const item of layout.items) {
if ('link' in item && item.link.viewName === viewName) return item.link.icon;
if ('container' in item && subtreeHas(item.container.items, viewName)) return item.container.icon;
}
}
return null;
}