Dashboard status strip, "Not set up yet" list, sidebar badges and user menu

The dashboard opens with one line saying whether anything needs attention
(from the same alert report as the Alerts page) and never claims "all clear"
when some checks couldn't run. Widgets with nothing configured are listed once
under "Not set up yet" instead of one grey card each. The sidebar shows the
active alert count and open maintenance windows next to their pages (and on a
closed group), and the foot of the sidebar is one user menu holding theme,
privacy and sign-out. One shared alert poll serves the strip and the badge.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-14 23:18:31 +02:00
1 parent aab2f8cb4a
commit 7d56ad18b7
5 files changed
+369 -22

No files matched your search

+37 -1
View File
@@ -13,6 +13,7 @@ import {
type TailscaleDevicesResponse,
} from "../api/client";
import { formatAgo } from "../utils/duration";
import StatusStrip from "../components/StatusStrip";
const DNS_TYPE_COLORS: Record<string, string> = {
A: "#60a5fa",
@@ -180,7 +181,8 @@ function MiniStat({ label, value, accent }: { label: string; value: ReactNode; a
}
/** The single card shape shared by every dashboard widget — DNS, Secrets, and each integration — so they all read as one family: a label + status badge, then whatever stats/breakdown that widget has. */
function WidgetCard({ label, badge, children }: { label: string; badge?: ReactNode; children: ReactNode }) {
function WidgetCard({ label, badge, hide, children }: { label: string; badge?: ReactNode; /** Nothing is set up for this yet: it is listed under "Not set up yet" instead of taking a card. */ hide?: boolean; children: ReactNode }) {
if (hide) return null;
return (
<div className="col-md-6">
<div className="card h-100">
@@ -535,6 +537,18 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
}, {}),
).map(([type, count]) => ({ label: SECRET_TYPE_LABELS[type as SecretRecord["type"]] ?? type, count }));
// What has nothing set up yet. These get one list at the bottom instead of a grey "Not configured" card each.
const notSetUp: { label: string; to: string; what: string }[] = [];
if (dnsStats?.totalProviders === 0) notSetUp.push({ label: "DNS", to: "/dns", what: "connect a DNS provider to see zones and records" });
if (secrets !== null && totalSecrets === 0) notSetUp.push({ label: "Secrets", to: "/secrets", what: "track when a token, certificate or password expires" });
if (serverSummary?.total === 0) notSetUp.push({ label: "Servers", to: "/servers", what: "add a server and install its agent" });
if (domainList !== null && domains.length === 0) notSetUp.push({ label: "Domains", to: "/domains", what: "appear after a DNS zone is added and the daily check has run" });
if (integrations !== null) {
for (const { type, label } of WIDGETS) {
if (!integrations.some((i) => i.type === type)) notSetUp.push({ label, to: "/integrations", what: "connect it under Integrations" });
}
}
return (
<>
<div className="row row-cards mb-3">
@@ -543,6 +557,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
<p className="text-secondary">
Welcome back, {user.name ?? user.email ?? user.sub}.
</p>
<StatusStrip />
</div>
</div>
@@ -550,6 +565,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
<div className="row row-cards mb-3">
<WidgetCard
label="DNS"
hide={dnsStats?.totalProviders === 0}
badge={
!dnsStats ? undefined : dnsStats.totalProviders === 0 ? (
<span className="badge bg-secondary-lt text-secondary">Not configured</span>
@@ -597,6 +613,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
<WidgetCard
label="Secrets"
hide={secrets !== null && totalSecrets === 0}
badge={
!secrets ? undefined : totalSecrets === 0 ? (
<span className="badge bg-secondary-lt text-secondary">Not configured</span>
@@ -635,6 +652,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
<WidgetCard
label="Servers"
hide={serverSummary?.total === 0}
badge={
!serverSummary ? undefined : serverSummary.total === 0 ? (
<span className="badge bg-secondary-lt text-secondary">Not configured</span>
@@ -729,6 +747,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
<WidgetCard
label="Domains"
hide={domainList !== null && domains.length === 0}
badge={
!domainList ? undefined : domains.length === 0 ? (
<span className="badge bg-secondary-lt text-secondary">Not configured</span>
@@ -847,6 +866,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
<WidgetCard
key={type}
label={label}
hide={integrations === null || !integrations.some((i) => i.type === type)}
badge={
isLive ? (
<span className="badge bg-green-lt text-green">Connected</span>
@@ -1072,6 +1092,22 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
);
})}
</div>
{notSetUp.length > 0 && (
<div className="card mt-4">
<div className="card-header">
<h3 className="card-title">Not set up yet</h3>
</div>
<div className="list-group list-group-flush">
{notSetUp.map((n) => (
<Link key={n.label} to={n.to} className="list-group-item list-group-item-action d-flex align-items-center gap-3">
<span className="fw-medium">{n.label}</span>
<span className="text-secondary small">{n.what}</span>
</Link>
))}
</div>
</div>
)}
</>
);
}