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
@@ -29,6 +29,8 @@ import { ErrorNotice } from "../components/Notice";
|
||||
import { WidgetSkeleton } from "../components/Skeleton";
|
||||
import { TYPE_GROUPS, TYPE_LABELS, TYPE_PAGES } from "../utils/integrationTypes";
|
||||
import type { Agenda, Heartbeat } from "../api/client";
|
||||
import BrandIcon from "../components/BrandIcon";
|
||||
import { kindOfLabel } from "../utils/brands";
|
||||
|
||||
const DNS_TYPE_COLORS: Record<string, string> = {
|
||||
A: "#60a5fa",
|
||||
@@ -211,6 +213,7 @@ function WidgetCard({ label, badge, hide, children }: { label: string; badge?: R
|
||||
// rest follow the order they chose — a card nobody has placed goes last, in the order it was drawn.
|
||||
const hidden = layout.hidden.includes(label);
|
||||
const problem = problemOf(badge);
|
||||
const kind = kindOfLabel(label);
|
||||
if (hidden && !editing) return null;
|
||||
return (
|
||||
<div className="col-md-6" data-card={label} style={{ order: (layout.order[label] ?? UNPLACED) - (problemsFirst && !editing ? (problem === "bad" ? 2_000_000 : problem === "warn" ? 1_000_000 : 0) : 0) }}>
|
||||
@@ -232,7 +235,10 @@ function WidgetCard({ label, badge, hide, children }: { label: string; badge?: R
|
||||
)}
|
||||
<div className="card-body">
|
||||
<div className="d-flex align-items-center mb-2">
|
||||
<div className="subheader">{label}</div>
|
||||
<div className="subheader d-flex align-items-center gap-1">
|
||||
{kind && <BrandIcon kind={kind} size={14} />}
|
||||
{label}
|
||||
</div>
|
||||
{badge && <div className="ms-auto">{badge}</div>}
|
||||
</div>
|
||||
{children}
|
||||
|
||||
@@ -26,6 +26,7 @@ import { ErrorNotice } from "../components/Notice";
|
||||
import { toast } from "../utils/toast";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { EmptyRow, LoadingRow } from "../components/EmptyState";
|
||||
import { BrandTag } from "../components/BrandIcon";
|
||||
|
||||
const PROVIDER_LABELS: Record<DnsProviderType, string> = {
|
||||
cloudflare: "Cloudflare",
|
||||
@@ -38,12 +39,6 @@ const PROVIDER_LABELS: Record<DnsProviderType, string> = {
|
||||
|
||||
const emptyRecordForm: DnsRecordInput = { type: "A", name: "", content: "", ttl: 3600, priority: undefined, proxied: undefined };
|
||||
|
||||
function providerBadgeStyle(colors: Record<string, string>, providerType: DnsProviderType): CSSProperties {
|
||||
const color = colors[providerType];
|
||||
if (!color) return {};
|
||||
return { backgroundColor: `${color}22`, color, border: `1px solid ${color}55` };
|
||||
}
|
||||
|
||||
const dnsTabs = (view: "records" | "domains") => (
|
||||
<ViewTabs
|
||||
label="DNS view"
|
||||
@@ -405,9 +400,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
|
||||
<tr key={p.id}>
|
||||
<td>{p.name}</td>
|
||||
<td>
|
||||
<span className="badge" style={providerBadgeStyle(providerColors, p.providerType)}>
|
||||
{PROVIDER_LABELS[p.providerType]}
|
||||
</span>
|
||||
<BrandTag kind={p.providerType} label={PROVIDER_LABELS[p.providerType]} custom={providerColors[p.providerType]} />
|
||||
</td>
|
||||
<td>
|
||||
<button
|
||||
|
||||
@@ -21,6 +21,7 @@ import { hostOf, integrationRow, integrationStatus, type IntegrationRow } from "
|
||||
import { useSortable } from "../hooks/useSortable";
|
||||
import SortableTh from "../components/SortableTh";
|
||||
import PageIntro from "../components/PageIntro";
|
||||
import { BrandTag } from "../components/BrandIcon";
|
||||
|
||||
function HealthBadge({ i }: { i: IntegrationSummary }) {
|
||||
const status = integrationStatus(i);
|
||||
@@ -54,12 +55,6 @@ function rememberLayout(layout: "cards" | "table") {
|
||||
}
|
||||
}
|
||||
|
||||
function typeBadgeStyle(colors: Record<string, string>, type: IntegrationType): CSSProperties {
|
||||
const color = colors[type];
|
||||
if (!color) return {};
|
||||
return { backgroundColor: `${color}22`, color, border: `1px solid ${color}55` };
|
||||
}
|
||||
|
||||
const integrationTabs = (view: "list" | "calls") => (
|
||||
<ViewTabs
|
||||
label="Integrations view"
|
||||
@@ -347,9 +342,7 @@ function IntegrationsList({ user, tabs }: { user: CurrentUser; tabs: ReactNode }
|
||||
<tr key={i.id}>
|
||||
<td className="fw-bold text-nowrap">{i.name}</td>
|
||||
<td>
|
||||
<span className="badge" style={typeBadgeStyle(integrationColors, i.type)}>
|
||||
{TYPE_LABELS[i.type]}
|
||||
</span>
|
||||
<BrandTag kind={i.type} custom={integrationColors[i.type]} />
|
||||
</td>
|
||||
<td className="text-secondary">{groupOfType(i.type).label}</td>
|
||||
<td className="text-secondary">{hostOf(i.baseUrl) || "no web address"}</td>
|
||||
@@ -389,9 +382,7 @@ function IntegrationsList({ user, tabs }: { user: CurrentUser; tabs: ReactNode }
|
||||
<div className="fw-bold text-truncate">{i.name}</div>
|
||||
<div className="text-secondary small text-truncate">{hostOf(i.baseUrl) || "no web address"}</div>
|
||||
</div>
|
||||
<span className="badge flex-shrink-0" style={typeBadgeStyle(integrationColors, i.type)}>
|
||||
{TYPE_LABELS[i.type]}
|
||||
</span>
|
||||
<BrandTag kind={i.type} custom={integrationColors[i.type]} className="flex-shrink-0" />
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<HealthBadge i={i} />
|
||||
|
||||
@@ -26,12 +26,7 @@ import EmptyState, { EmptyRow, LoadingRow } from "../components/EmptyState";
|
||||
import BulkBar from "../components/BulkBar";
|
||||
import { RunsOnBulkDrawer, SilenceBulkDrawer, TagBulkDrawer } from "../components/BulkDrawers";
|
||||
import { doBulk, plural } from "../utils/bulk";
|
||||
|
||||
function typeBadgeStyle(colors: Record<string, string>, type: string): CSSProperties {
|
||||
const color = colors[type];
|
||||
if (!color) return {};
|
||||
return { backgroundColor: `${color}22`, color, border: `1px solid ${color}55` };
|
||||
}
|
||||
import { BrandTag } from "../components/BrandIcon";
|
||||
|
||||
|
||||
export default function Servers({ user }: { user: CurrentUser }) {
|
||||
@@ -235,9 +230,7 @@ export default function Servers({ user }: { user: CurrentUser }) {
|
||||
<div className="text-secondary small">{s.hostname ?? "no hostname reported"}</div>
|
||||
</div>
|
||||
{s.proxmoxIntegrationId ? (
|
||||
<span className="badge" style={typeBadgeStyle(integrationColors, "proxmox")}>
|
||||
Proxmox
|
||||
</span>
|
||||
<BrandTag kind="proxmox" custom={integrationColors.proxmox} />
|
||||
) : s.lastSeenAt ? (
|
||||
agentState(s, agentLatest) === "behind" ? (
|
||||
<span className="badge bg-yellow-lt text-yellow" title="Its agent is older than the one this Homelab Manager would install now. Run its install command again to update it.">
|
||||
|
||||
@@ -3,6 +3,8 @@ import { TYPE_LABELS } from "../../utils/integrationTypes";
|
||||
import { api } from "../../api/client";
|
||||
import { ErrorNotice } from "../../components/Notice";
|
||||
import { PageSkeleton } from "../../components/Skeleton";
|
||||
import { BrandTag } from "../../components/BrandIcon";
|
||||
import { brandOf, isHexColor } from "../../utils/brands";
|
||||
|
||||
const PROVIDER_NAMES: Record<string, string> = {
|
||||
cloudflare: "Cloudflare",
|
||||
@@ -13,31 +15,38 @@ const PROVIDER_NAMES: Record<string, string> = {
|
||||
technitium: "Technitium",
|
||||
};
|
||||
|
||||
/**
|
||||
* One row for each kind: its tag as it looks now (its brand colour and logo, or the colour chosen here), a colour to choose instead, and — once one is chosen — a way back to the brand's.
|
||||
* "Back to the brand's" is saved as an empty colour: the settings are merged key by key, so a key cannot be taken away, only given nothing.
|
||||
*/
|
||||
function ColorList({
|
||||
names,
|
||||
colors,
|
||||
onChange,
|
||||
onReset,
|
||||
}: {
|
||||
names: Record<string, string>;
|
||||
colors: Record<string, string>;
|
||||
onChange: (id: string, color: string) => void;
|
||||
onReset: (id: string) => void;
|
||||
}) {
|
||||
return (
|
||||
<div className="d-flex flex-column gap-2">
|
||||
{Object.entries(names).map(([id, name]) => {
|
||||
const color = colors[id] ?? "#6366f1";
|
||||
const custom = isHexColor(colors[id]) ? colors[id] : null;
|
||||
const color = custom ?? brandOf(id)?.color ?? "#6366f1";
|
||||
return (
|
||||
<div key={id} className="d-flex align-items-center gap-2">
|
||||
<span className="badge" style={{ backgroundColor: `${color}22`, color, border: `1px solid ${color}55`, minWidth: 110 }}>
|
||||
{name}
|
||||
<div key={id} className="d-flex align-items-center gap-2 flex-wrap">
|
||||
<span style={{ minWidth: 170 }}>
|
||||
<BrandTag kind={id} label={name} custom={custom} />
|
||||
</span>
|
||||
<input
|
||||
type="color"
|
||||
value={color}
|
||||
className="form-control form-control-color"
|
||||
onChange={(e) => onChange(id, e.target.value)}
|
||||
/>
|
||||
<span className="text-secondary small">{color}</span>
|
||||
<input type="color" value={color} className="form-control form-control-color" aria-label={`Colour for ${name}`} onChange={(e) => onChange(id, e.target.value)} />
|
||||
<span className="text-secondary small">{custom ? color : brandOf(id) ? `${color} — the brand's` : color}</span>
|
||||
{custom && brandOf(id) && (
|
||||
<button type="button" className="btn btn-sm btn-link p-0" onClick={() => onReset(id)}>
|
||||
Use the brand’s
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
@@ -105,11 +114,12 @@ export default function BadgeSettings() {
|
||||
<h3 className="card-title">DNS provider badge colors</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<p className="text-secondary">Customize the color of each DNS provider's badge throughout the app.</p>
|
||||
<p className="text-secondary">Each provider's badge is in its brand's colour, with its logo where there is one. Choose another colour for any of them to use that throughout the app instead.</p>
|
||||
<ColorList
|
||||
names={PROVIDER_NAMES}
|
||||
colors={providerColors}
|
||||
onChange={(id, color) => setProviderColors((c) => ({ ...c, [id]: color }))}
|
||||
onReset={(id) => setProviderColors((c) => ({ ...c, [id]: "" }))}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -121,11 +131,12 @@ export default function BadgeSettings() {
|
||||
<h3 className="card-title">Integration badge colors</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<p className="text-secondary">Customize the color of each integration type's badge throughout the app.</p>
|
||||
<p className="text-secondary">Each kind's badge is in its brand's colour, with its logo where there is one (a few have an approximate colour: the brand has no open logo). Choose another colour for any of them to use that throughout the app instead.</p>
|
||||
<ColorList
|
||||
names={TYPE_LABELS}
|
||||
colors={integrationColors}
|
||||
onChange={(id, color) => setIntegrationColors((c) => ({ ...c, [id]: color }))}
|
||||
onReset={(id) => setIntegrationColors((c) => ({ ...c, [id]: "" }))}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useEffect, useState } from "react";
|
||||
import { api, type AppSettings, type DateFormat, type TimeFormat } from "../../api/client";
|
||||
import { setDateTimeSettings } from "../../utils/date";
|
||||
import { setPageSize } from "../../utils/pageSize";
|
||||
import { getMenuIcons, setMenuIcons } from "../../utils/menuIcons";
|
||||
import { MENU_CHANGED } from "../../hooks/useMenuHiding";
|
||||
import { PAGE_KINDS, unusedPages } from "../../utils/navVisibility";
|
||||
import { NAV, isGroup } from "../../layout/nav";
|
||||
@@ -25,6 +26,8 @@ export default function DisplaySettings() {
|
||||
const [timeFormat, setTimeFormatState] = useState<TimeFormat>("24h");
|
||||
const [pageSize, setPageSizeState] = useState(20);
|
||||
const [hideUnusedPages, setHideUnusedPages] = useState(false);
|
||||
// Per browser, not saved with the other settings: it takes effect at once.
|
||||
const [menuIcons, setMenuIconsState] = useState(getMenuIcons());
|
||||
// The kinds of integration that have been added, to say which pages the setting would leave out.
|
||||
const [added, setAdded] = useState<string[] | null>(null);
|
||||
const [saving, setSaving] = useState(false);
|
||||
@@ -159,6 +162,19 @@ export default function DisplaySettings() {
|
||||
<h3 className="card-title">Menu</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<label className="form-check mb-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
className="form-check-input"
|
||||
checked={menuIcons}
|
||||
onChange={(e) => {
|
||||
setMenuIcons(e.target.checked);
|
||||
setMenuIconsState(e.target.checked);
|
||||
}}
|
||||
/>
|
||||
<span className="form-check-label">Show an icon before each page in the menu</span>
|
||||
<span className="form-hint d-block">The logo of the system for an integration’s page, the page’s own icon for the rest. Only for this browser, and it applies at once.</span>
|
||||
</label>
|
||||
<label className="form-check">
|
||||
<input type="checkbox" className="form-check-input" checked={hideUnusedPages} onChange={(e) => setHideUnusedPages(e.target.checked)} />
|
||||
<span className="form-check-label">Hide the pages of integrations I have not added</span>
|
||||
|
||||
Reference in new issue
Block a user