Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 13 additions & 18 deletions src/app.css
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
@import "tailwindcss";
@import "@kleinbem/web-config/theme";
@import "@kleinbem/web-config/base.css";
@import "@kleinbem/web-config/badges.css";

/* App-level names for web-config's tokens; without these the *-brand, bg-bg-surface and
text-text-primary utilities generate no CSS. */
@theme inline {
--color-bg-surface: var(--color-bg);
--color-bg-elevated: var(--color-surface);
--color-text-primary: var(--color-heading);
--color-border-subtle: var(--color-line);
--color-brand: var(--color-accent);
}

@custom-variant dark (&:where([data-theme="dark"], [data-theme="dark"] *, .dark, .dark *));
@source "../node_modules/@kleinbem/web-config";

/* Glassmorphism utility for modern card and navbar styling */
.glass-panel {
background: color-mix(in srgb, var(--color-bg-elevated, #18181b) 75%, transparent);
background: color-mix(in srgb, var(--color-surface, #151a21) 80%, transparent);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border: 1px solid var(--color-border-subtle, rgba(255, 255, 255, 0.08));
border: 1px solid var(--color-line, rgba(255, 255, 255, 0.08));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unlayered .glass-panel overrides Tailwind v4 border utilities: .glass-panel is declared outside any CSS @layer, so its border shorthand overrides Tailwind v4 @layer utilities classes regardless of specificity. This breaks severity border colors in AttentionPanel.svelte:25 (border-status-danger-border, border-status-warning-border) and adds unintended top/left/right borders to Header.svelte:47 (border-b). Wrap .glass-panel in @layer components.

Suggested change
border: 1px solid var(--color-line, rgba(255, 255, 255, 0.08));
@layer components {
.glass-panel {
background: color-mix(in srgb, var(--color-surface, #151a21) 80%, transparent);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border: 1px solid var(--color-line, rgba(255, 255, 255, 0.08));
}
}

}

dialog:modal {
overscroll-behavior: contain;
}

.light .glass-panel, [data-theme="light"] .glass-panel {
background: color-mix(in srgb, #ffffff 80%, transparent);
border: 1px solid var(--color-border-subtle, rgba(0, 0, 0, 0.06));
dialog::backdrop {
background: rgb(9 9 11 / 0.6);
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
overflow: hidden;
overscroll-behavior: contain;
}
17 changes: 17 additions & 0 deletions src/app.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🏠</text></svg>" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="color-scheme" content="dark light" />
<title>Foyer</title>
<!-- web-config:init (written by `web-config sync`, do not edit) -->
<script>try{const p=localStorage.getItem("fleet-theme");const m=window.matchMedia('(prefers-color-scheme: dark)').matches;const t=p==='dark'||p==='light'?p:(m?'dark':'light');document.documentElement.dataset.theme=t;document.documentElement.classList.toggle('dark',t==='dark');document.documentElement.classList.toggle('light',t==='light');}catch(e){}try{const s=localStorage.getItem("fleet-font-size");if(s==='large'||s==='larger'){document.documentElement.dataset.fontSize=s;document.documentElement.classList.add('font-size-'+s);}}catch(e){}</script>
<!-- /web-config:init -->
%sveltekit.head%
</head>
<body class="min-h-screen bg-bg text-fg antialiased transition-colors selection:bg-accent/20" data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
77 changes: 77 additions & 0 deletions src/lib/components/AttentionPanel.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<script lang="ts">
import { formatRelativeTime } from '../portal';
import type { AttentionItem, AttentionSeverity } from '../types';

const COLLAPSED_COUNT = 5;

let { items }: { items: AttentionItem[] } = $props();

let expanded = $state(false);
let visible = $derived(expanded ? items : items.slice(0, COLLAPSED_COUNT));
let worst = $derived<AttentionSeverity>(
items.some((i) => i.severity === 'critical') ? 'critical'
: items.some((i) => i.severity === 'warning') ? 'warning'
: 'info'
);

const SEVERITY = {
critical: { icon: '🔴', label: 'Critical', border: 'border-status-danger-border', text: 'text-status-danger' },
warning: { icon: '🟠', label: 'Warning', border: 'border-status-warning-border', text: 'text-status-warning' },
info: { icon: '🔵', label: 'Info', border: 'border-line', text: 'text-heading' }
} as const;
</script>

{#if items.length > 0}
<section aria-label="Needs attention" class="p-3.5 rounded-2xl glass-panel shadow-2xs border {SEVERITY[worst].border}">
<div class="flex items-center gap-2 mb-2 px-1">
<h2 class="text-xs font-semibold {SEVERITY[worst].text}">Needs attention</h2>
<span class="text-[10px] font-mono px-1.5 py-0.5 rounded bg-surface-high text-muted">{items.length}</span>
</div>

<ul class="space-y-1">
{#each visible as item (item.id)}
{@const sev = SEVERITY[item.severity]}
{@const when = formatRelativeTime(item.updatedAt)}
<li class="flex items-start gap-2.5 px-2 py-1.5 rounded-xl hover:bg-surface-high/60 transition-colors">
<span class="text-[10px] leading-5 select-none shrink-0" role="img" aria-label={sev.label}>{sev.icon}</span>
<div class="min-w-0 flex-1">
{#if item.url}
<a
href={item.url}
target="_blank"
rel="noopener noreferrer"
class="text-xs font-medium text-heading hover:text-accent hover:underline break-words"
>
{item.title}
</a>
{:else}
<span class="text-xs font-medium text-heading break-words">{item.title}</span>
{/if}
{#if item.detail}
<p class="text-[11px] text-muted font-mono line-clamp-2" title={item.detail}>{item.detail}</p>
{/if}
</div>
<div class="flex items-center gap-2 shrink-0 text-[10px] font-mono text-muted leading-5">
{#if item.source}
<span class="px-1.5 rounded bg-surface-high">{item.source}</span>
{/if}
{#if when}
<time datetime={item.updatedAt}>{when}</time>
{/if}
</div>
</li>
{/each}
</ul>

{#if items.length > COLLAPSED_COUNT}
<button
type="button"
aria-expanded={expanded}
onclick={() => (expanded = !expanded)}
class="mt-1.5 ml-2 text-[11px] font-mono text-accent hover:underline cursor-pointer"
>
{expanded ? 'Show fewer' : `Show ${items.length - COLLAPSED_COUNT} more`}
</button>
{/if}
</section>
{/if}
65 changes: 21 additions & 44 deletions src/lib/components/CategorySection.svelte
Original file line number Diff line number Diff line change
@@ -1,74 +1,51 @@
<script lang="ts">
import type { HealthStatus, LayoutDensity, ServiceCategory, ServiceItem } from '../types';
import { resolveDetail, resolveHealth } from '../data/gatus';
import { getCategoryIcon } from '../portal';
import type { EndpointDetail, HealthStatus, LayoutDensity, ServiceItem } from '../types';
import ServiceCard from './ServiceCard.svelte';
import { resolveHealth } from '../data/gatus';

let {
category,
services,
healthMap = {},
density = 'comfortable'
healthDetails = {},
density = 'comfortable',
categoryIcons
}: {
category: ServiceCategory;
category: string;
services: ServiceItem[];
healthMap?: Record<string, HealthStatus>;
healthDetails?: Record<string, EndpointDetail>;
density?: LayoutDensity;
categoryIcons?: Record<string, string>;
} = $props();

function getCategoryIcon(cat: ServiceCategory): string {
switch (cat) {
case 'Infrastructure':
return '⚡';
case 'Identity':
return '🛡️';
case 'AI':
return '🤖';
case 'AI Engineering':
return '🧬';
case 'Dev':
return '💻';
case 'Apps':
return '📱';
case 'Documents':
return '📁';
case 'Security':
return '🔒';
case 'Media':
return '📻';
default:
return '📦';
}
}

let containerClass = $derived.by(() => {
switch (density) {
case 'list':
return 'space-y-1.5 flex flex-col';
case 'compact':
return 'grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6 gap-2.5';
default:
return 'grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3.5';
}
});
let containerClass = $derived(
density === 'list'
? 'space-y-1.5 flex flex-col'
: density === 'compact'
? 'grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6 gap-2.5'
: 'grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3.5'
);
</script>

{#if services.length > 0}
<section class="space-y-3">
<div class="flex items-center gap-2">
<span class="text-sm select-none">{getCategoryIcon(category)}</span>
<h2 class="text-xs font-semibold uppercase tracking-wider text-zinc-500 dark:text-zinc-400">
<span class="text-sm select-none" aria-hidden="true">{getCategoryIcon(category, categoryIcons)}</span>
<h2 class="text-xs font-semibold uppercase tracking-wider text-muted">
{category}
</h2>
<span class="text-xs text-zinc-400 dark:text-zinc-600 font-mono">
<span class="text-xs text-muted font-mono">
({services.length})
</span>
<div class="flex-1 border-t border-zinc-200/60 dark:border-zinc-800/60 ml-2"></div>
<div class="flex-1 border-t border-line ml-2"></div>
</div>

<div class={containerClass}>
{#each services as service (service.id)}
{@const health = resolveHealth(service, healthMap)}
<ServiceCard {service} {health} {density} />
<ServiceCard {service} {health} detail={resolveDetail(service, healthDetails)} {density} />
{/each}
</div>
</section>
Expand Down
101 changes: 101 additions & 0 deletions src/lib/components/Header.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<script lang="ts">
import ThemeToggle from '@kleinbem/web-config/theme/toggle';
import type { WeatherConfig } from '../types';
import WeatherWidget from './WeatherWidget.svelte';

let {
title = 'Foyer',
badge,
subtitle,
weather,
onOpenSearch
}: {
title?: string;
badge?: string;
subtitle?: string;
weather?: WeatherConfig;
onOpenSearch: () => void;
} = $props();

let now = $state(new Date());

// Refresh at minute boundaries instead of waking every second for an HH:MM display.
$effect(() => {
let timer: ReturnType<typeof setTimeout>;
function scheduleNextMinute() {
const current = new Date();
now = current;
const delayMs = (60 - current.getSeconds()) * 1000 - current.getMilliseconds() + 50;
timer = setTimeout(scheduleNextMinute, delayMs);
}
scheduleNextMinute();
return () => clearTimeout(timer);
});

let timeStr = $derived(now.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }));
let dateStr = $derived(
now.toLocaleDateString([], { weekday: 'short', month: 'short', day: 'numeric' })
);
</script>

<svelte:document
onvisibilitychange={() => {
if (!document.hidden) now = new Date();
}}
/>

<header class="sticky top-0 z-40 w-full border-b border-line glass-panel">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 h-16 flex items-center justify-between gap-4">
<div class="flex items-center gap-3 min-w-0">
<span class="text-2xl select-none" aria-hidden="true">🏠</span>
<div class="min-w-0">
<div class="flex items-center gap-2">
<h1 class="font-bold text-base tracking-tight text-heading truncate">
{title}
</h1>
{#if badge}
<span class="text-[10px] uppercase tracking-wider px-1.5 py-0.5 font-mono font-medium rounded bg-surface-high text-muted border border-line">
{badge}
</span>
{/if}
</div>
{#if subtitle}
<p class="text-[11px] text-muted font-mono hidden sm:block truncate">
{subtitle}
</p>
{/if}
</div>
</div>

<button
type="button"
onclick={onOpenSearch}
class="flex items-center gap-2.5 px-3 py-1.5 rounded-xl border border-line bg-surface/80 hover:bg-surface-high text-muted hover:text-heading text-xs shadow-2xs transition-colors cursor-pointer max-w-xs w-full sm:w-64"
>
<svg aria-hidden="true" class="w-3.5 h-3.5 shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
</svg>
<span class="flex-1 text-left truncate">Search services...</span>
<kbd class="hidden sm:inline-block px-1.5 py-0.5 text-[10px] font-mono rounded bg-bg text-muted border border-line">
⌘K
</kbd>
</button>

<div class="flex items-center gap-3 shrink-0">
<div class="hidden md:flex flex-col text-right font-mono leading-none">
<span class="text-xs font-semibold text-heading">{timeStr}</span>
<span class="text-[10px] text-muted mt-0.5">{dateStr}</span>
</div>

{#if weather}
<div class="hidden sm:block">
<WeatherWidget config={weather} />
</div>
{/if}

<div class="pl-1 border-l border-line">
<ThemeToggle />
</div>
</div>
</div>
</header>
14 changes: 7 additions & 7 deletions src/lib/components/LayoutToggle.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
}
</script>

<div class="inline-flex items-center rounded-xl p-0.5 border border-zinc-200 dark:border-zinc-800 bg-zinc-100/80 dark:bg-zinc-800/80 text-zinc-500" role="group" aria-label="Layout density">
<div class="inline-flex items-center rounded-xl p-0.5 border border-line bg-surface text-muted" role="group" aria-label="Layout density">
<button
type="button"
aria-pressed={density === 'comfortable'}
onclick={() => setDensity('comfortable')}
class="px-2.5 py-1 text-xs font-medium rounded-lg transition-all flex items-center gap-1 cursor-pointer {density === 'comfortable' ? 'bg-white dark:bg-zinc-700 text-zinc-900 dark:text-zinc-50 shadow-2xs' : 'hover:text-zinc-800 dark:hover:text-zinc-200'}"
class="px-2.5 py-1 text-xs font-medium rounded-lg transition-colors flex items-center gap-1 cursor-pointer {density === 'comfortable' ? 'bg-surface-high text-heading shadow-2xs' : 'hover:text-heading'}"
title="Comfortable Cards"
>
<svg class="w-3.5 h-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<svg aria-hidden="true" class="w-3.5 h-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="3" y="3" width="7" height="7" rx="1.5" />
<rect x="14" y="3" width="7" height="7" rx="1.5" />
<rect x="3" y="14" width="7" height="7" rx="1.5" />
Expand All @@ -36,10 +36,10 @@
type="button"
aria-pressed={density === 'compact'}
onclick={() => setDensity('compact')}
class="px-2.5 py-1 text-xs font-medium rounded-lg transition-all flex items-center gap-1 cursor-pointer {density === 'compact' ? 'bg-white dark:bg-zinc-700 text-zinc-900 dark:text-zinc-50 shadow-2xs' : 'hover:text-zinc-800 dark:hover:text-zinc-200'}"
class="px-2.5 py-1 text-xs font-medium rounded-lg transition-colors flex items-center gap-1 cursor-pointer {density === 'compact' ? 'bg-surface-high text-heading shadow-2xs' : 'hover:text-heading'}"
title="Compact Grid"
>
<svg class="w-3.5 h-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<svg aria-hidden="true" class="w-3.5 h-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="3" y="3" width="4" height="4" rx="1" />
<rect x="10" y="3" width="4" height="4" rx="1" />
<rect x="17" y="3" width="4" height="4" rx="1" />
Expand All @@ -57,10 +57,10 @@
type="button"
aria-pressed={density === 'list'}
onclick={() => setDensity('list')}
class="px-2.5 py-1 text-xs font-medium rounded-lg transition-all flex items-center gap-1 cursor-pointer {density === 'list' ? 'bg-white dark:bg-zinc-700 text-zinc-900 dark:text-zinc-50 shadow-2xs' : 'hover:text-zinc-800 dark:hover:text-zinc-200'}"
class="px-2.5 py-1 text-xs font-medium rounded-lg transition-colors flex items-center gap-1 cursor-pointer {density === 'list' ? 'bg-surface-high text-heading shadow-2xs' : 'hover:text-heading'}"
title="Compact List"
>
<svg class="w-3.5 h-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<svg aria-hidden="true" class="w-3.5 h-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="8" y1="6" x2="21" y2="6" stroke-linecap="round" />
<line x1="8" y1="12" x2="21" y2="12" stroke-linecap="round" />
<line x1="8" y1="18" x2="21" y2="18" stroke-linecap="round" />
Expand Down
Loading