Brand colours and logos for integrations and DNS providers
Kind tags (Integrations, Servers, DNS) are in the brand's colour with its logo (Simple Icons, CC0), kept readable on both themes; the dashboard cards, the kind picker and the menu show the logos too, with a per-browser switch for the menu icons. Settings -> Display -> Badge colours shows the brand defaults and Use the brand's goes back to them. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9937ab2202
commit
d69962528e
18 files changed
+546
-49
No files matched your search
@@ -133,6 +133,9 @@ export default function SidebarNav({
|
||||
const subRow = (leaf: NavLeaf) => (
|
||||
<div className="nav-row" key={leaf.to}>
|
||||
<NavLink to={leaf.to} className={({ isActive }) => `dropdown-item d-flex align-items-center ${isActive ? "active" : ""}`} onClick={onNavigate}>
|
||||
<span className="menu-item-icon" aria-hidden="true">
|
||||
{leaf.icon}
|
||||
</span>
|
||||
{leaf.label}
|
||||
{badgeOf(leaf.to)}
|
||||
</NavLink>
|
||||
|
||||
+17
-2
@@ -65,7 +65,8 @@ import {
|
||||
IconReportAnalytics,
|
||||
} from "@tabler/icons-react";
|
||||
import type { CurrentUser } from "../api/client";
|
||||
import { isPageHidden } from "../utils/navVisibility";
|
||||
import { isPageHidden, PAGE_KINDS, pagePath } from "../utils/navVisibility";
|
||||
import BrandIcon, { hasLogo } from "../components/BrandIcon";
|
||||
|
||||
// The menu: what pages there are, how they are grouped, and which role is needed to see each. Used by the sidebar, the command
|
||||
// palette, the keyboard shortcuts and the breadcrumbs, so they always agree.
|
||||
@@ -91,7 +92,7 @@ export type NavEntry = NavLeaf | NavGroup;
|
||||
|
||||
export const isGroup = (entry: NavEntry): entry is NavGroup => "items" in entry;
|
||||
|
||||
export const NAV: NavEntry[] = [
|
||||
const PLAIN_NAV: NavEntry[] = [
|
||||
{ to: "/", label: "Dashboard", icon: <IconLayoutDashboard size={20} /> },
|
||||
{ to: "/alerts", label: "Alerts", icon: <IconAlertTriangle size={20} /> },
|
||||
{ to: "/my-work", label: "My work", icon: <IconChecklist size={20} />, minRole: "operator" },
|
||||
@@ -223,6 +224,20 @@ export const NAV: NavEntry[] = [
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
* The menu, with the logo of an integration where a page is about one kind of integration and the icon set has its logo (Proxmox, Jellyfin, Grafana …) in place of the generic icon. The logo takes
|
||||
* the colour of the menu's text, like every other icon in it, so it does not turn the menu into a row of colours; the brand colours are in the tags on the Integrations page.
|
||||
*/
|
||||
function withLogos(entries: NavEntry[]): NavEntry[] {
|
||||
const logo = (leaf: NavLeaf): NavLeaf => {
|
||||
const kinds = PAGE_KINDS[pagePath(leaf.to)];
|
||||
return kinds?.length === 1 && hasLogo(kinds[0]) ? { ...leaf, icon: <BrandIcon kind={kinds[0]} size={20} mono /> } : leaf;
|
||||
};
|
||||
return entries.map((e) => (isGroup(e) ? { ...e, items: e.items.map(logo) } : logo(e)));
|
||||
}
|
||||
|
||||
export const NAV: NavEntry[] = withLogos(PLAIN_NAV);
|
||||
|
||||
const roleRank: Record<CurrentUser["role"], number> = { viewer: 0, operator: 1, admin: 2 };
|
||||
|
||||
/** What this role can see: pages it isn't allowed are dropped, so are pages of integrations nobody has added when the Display setting says to leave those out, an emptied group disappears, and a group down to one page becomes that page's own link. */
|
||||
|
||||
Reference in new issue
Block a user