feat(operator): design system port + persistent shell (O.4)

Operator portal now wears its real chrome instead of placeholder spans.
Sidebar + topbar + page header all rendered against the carbon palette
from tokens.css.

Components ported from the source design (operator-app.jsx,
platform-ui.jsx, operator-screens.jsx) as Vue 3 SFCs in
apps/operator/components/:

  Foundation: NodeMark (copied from portal), UiIcon (expanded to 31 icons
  covering sidebar/topbar/sort/arrows)

  Primitives: Card (3 surface variants), UiButton (primary / secondary /
  ghost / dark / danger × sm / md / lg), DataTable (header + rows),
  Badge (7 tones), Avatar (deterministic palette by name hash), Mono,
  Eyebrow, StatusDot, PageHeader (with actions slot)

  Shell: OpSidebar (collapsible 232<->56px, 12 nav items in 4 sections,
  active-row highlight from route, badge slot, brand + user footer);
  OpTopbar (env badge with prod/staging/dev variants, palette trigger
  stub for the ⌘K work in O.8, on-call pill, bell, avatar)

Layouts: layouts/default.vue wires sidebar + topbar + slot; layouts/blank.vue
is used by the login page (definePageMeta layout:'blank'). app.vue now
wraps NuxtPage in NuxtLayout (the missing piece — without it Nuxt warns
"Your project has layouts but the <NuxtLayout /> component has not been
used" and renders nothing chrome-wise).

Composable composables/useSidebar.ts holds the collapsed state shared
between OpSidebar's toggle button and layouts/default.vue's ⌘[ keyboard
shortcut.

Verified in the browser:
  - Sidebar renders all 12 nav links with section dividers, env badge shows
    PROD, PageHeader resolves to the user's display name from
    useOidcAuth().user
  - Collapse toggle flips sidebar width 232↔56; nav rows become icon-only
  - Smoke test on the placeholder home still returns 409 for the seeded
    test-partner (token forwarding survives the layout refactor)

Gotcha documented in the plan: Vite 7.3 added a strict
server.allowedHosts check that returns plaintext 403 for any host header
that isn't the dev origin. The customer portal pre-dates this Vite
version; operator needs allowedHosts: ['operator.dezky.local'] in
nuxt.config.ts under vite.server.

Pages/index.vue replaces the bare HTML placeholder from O.3 with the
new PageHeader + Card primitives — same smoke-test functionality, much
better visual fidelity.

Real screen content (Tenants, Partners, Infrastructure, etc.) lands in
O.5+. This commit is the chrome, the smoke test, and the verification
that the design system primitives compose correctly.
This commit is contained in:
Ronni Baslund
2026-05-24 07:32:08 +02:00
parent 55b1c133e3
commit 8e6f73a921
20 changed files with 1002 additions and 209 deletions
+148
View File
@@ -0,0 +1,148 @@
<script setup lang="ts">
type Env = 'prod' | 'staging' | 'dev'
withDefaults(
defineProps<{ env?: Env; oncall?: boolean }>(),
{ env: 'prod', oncall: true },
)
const { user } = useOidcAuth()
const ENVS = {
prod: { label: 'PROD', fg: 'var(--text)', bg: 'rgba(244,243,238,0.08)', border: 'rgba(244,243,238,0.15)' },
staging: { label: 'STAGING', fg: '#FFC872', bg: 'rgba(232,154,31,0.16)', border: 'rgba(232,154,31,0.36)' },
dev: { label: 'DEV', fg: '#D4AAFF', bg: 'rgba(159,98,212,0.18)', border: 'rgba(159,98,212,0.36)' },
} as const
function openPalette() {
// ⌘K palette lands in O.8 — this is the trigger surface.
// eslint-disable-next-line no-console
console.log('[palette] open requested')
}
</script>
<template>
<header>
<span class="env" :style="{ color: ENVS[env].fg, background: ENVS[env].bg, borderColor: ENVS[env].border }">
<span class="env-dot" />
{{ ENVS[env].label }}
</span>
<button class="palette" @click="openPalette">
<UiIcon name="search" :size="13" stroke="var(--text-mute)" />
<span class="palette-hint">Search tenants, users, tickets or execute action</span>
<span class="kbd">K</span>
</button>
<span class="spacer" />
<span class="oncall" :class="{ active: oncall }">
<StatusDot :color="oncall ? 'var(--accent)' : 'var(--text-mute)'" :size="6" :glow="false" />
<Mono :dim="!oncall">{{ oncall ? 'on-call · Mikkel' : 'no active page' }}</Mono>
</span>
<button class="icon-btn" title="Notifications">
<UiIcon name="bell" :size="14" />
<span class="icon-btn-dot" />
</button>
<Avatar :name="user?.userInfo?.name || user?.userName || '?'" :size="26" />
</header>
</template>
<style scoped>
header {
height: 52px;
flex-shrink: 0;
display: flex;
align-items: center;
gap: 12px;
padding: 0 16px;
background: var(--bg);
border-bottom: 1px solid var(--border);
}
.env {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 4px 10px;
border: 1px solid;
border-radius: 4px;
font-family: var(--font-mono);
font-size: 10px;
font-weight: 700;
letter-spacing: 0.16em;
}
.env-dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; opacity: 0.7; }
.palette {
flex: 1;
min-width: 0;
max-width: 540px;
display: flex;
align-items: center;
gap: 10px;
height: 32px;
padding: 0 12px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: 5px;
cursor: text;
color: var(--text-mute);
font-family: inherit;
font-size: 12px;
text-align: left;
}
.palette-hint { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kbd {
font-family: var(--font-mono);
font-size: 10px;
padding: 2px 6px;
background: var(--bg);
border: 1px solid var(--border);
border-radius: 3px;
color: var(--text-mute);
flex-shrink: 0;
}
.spacer { flex: 0 0 auto; }
.oncall {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 4px 10px;
border: 1px solid var(--border);
border-radius: 4px;
white-space: nowrap;
flex-shrink: 0;
}
.oncall.active { background: rgba(212, 255, 58, 0.1); border-color: rgba(212, 255, 58, 0.3); }
.icon-btn {
position: relative;
height: 32px;
width: 32px;
border-radius: 5px;
background: var(--surface);
border: 1px solid var(--border);
display: inline-flex;
align-items: center;
justify-content: center;
color: var(--text);
cursor: pointer;
}
.icon-btn-dot {
position: absolute;
top: 6px;
right: 7px;
width: 6px;
height: 6px;
border-radius: 999px;
background: var(--bad);
border: 1.5px solid var(--bg);
}
</style>