c71e782dc0
- CommandPalette + useCommandPalette: ⌘K opens a search-and-jump panel over real tenants/partners + fixture flags + nav + actions. Arrow keys + Enter navigate, Escape/backdrop close. Recents are intentionally omitted for now; add when there's something to recent over. - Impersonation stub: useImpersonation + ImpersonationModal + ImpersonationBanner. Modal opens from tenant detail and from the palette. Banner stays at the top of the shell until exited. No real OBO token is minted — wiring OAuth Token Exchange is tracked as a follow-up. - IncidentModal + useIncidentModal: opened from the Overview and Infrastructure incident banners, renders the mock INCIDENT data with metrics, timeline and draft composer. - TweaksPanel + useTweaks: floating bottom-right panel for theme (dark/light), density (comfy/compact), env badge (prod/staging/dev). Saved to localStorage. - Theme/density apply via [data-theme] + [data-density] overrides in tokens.css. Topbar env badge now reads from useTweaks instead of a prop. - Layout wires ⌘K + ⌘[ at the document level and mounts the palette + modals + banner + tweaks panel once for all pages.
153 lines
4.5 KiB
Vue
153 lines
4.5 KiB
Vue
<script setup lang="ts">
|
|
// Floating cosmetic-tweaks panel. Lives in the bottom-right corner. Lets the
|
|
// operator flip theme/density/env without touching settings pages. All three
|
|
// are pure-cosmetic — env in particular is just a colored chip in the topbar,
|
|
// not a real environment switch.
|
|
|
|
const { state, setTheme, setDensity, setEnv } = useTweaks()
|
|
const open = ref(false)
|
|
</script>
|
|
|
|
<template>
|
|
<div class="tweaks-root">
|
|
<button class="trigger" :class="{ on: open }" type="button" :title="open ? 'Close tweaks' : 'Open tweaks'" @click="open = !open">
|
|
<UiIcon :name="open ? 'x' : 'shield'" :size="14" />
|
|
</button>
|
|
|
|
<Transition name="tweaks">
|
|
<div v-if="open" class="panel" role="dialog" aria-label="Cosmetic tweaks">
|
|
<header>
|
|
<Eyebrow>Tweaks</Eyebrow>
|
|
<button class="x" type="button" aria-label="Close" @click="open = false">
|
|
<UiIcon name="x" :size="11" />
|
|
</button>
|
|
</header>
|
|
|
|
<section>
|
|
<label class="row-label">Theme</label>
|
|
<div class="seg">
|
|
<button :class="{ on: state.theme === 'dark' }" type="button" @click="setTheme('dark')">Dark</button>
|
|
<button :class="{ on: state.theme === 'light' }" type="button" @click="setTheme('light')">Light</button>
|
|
</div>
|
|
</section>
|
|
|
|
<section>
|
|
<label class="row-label">Density</label>
|
|
<div class="seg">
|
|
<button :class="{ on: state.density === 'comfy' }" type="button" @click="setDensity('comfy')">Comfy</button>
|
|
<button :class="{ on: state.density === 'compact' }" type="button" @click="setDensity('compact')">Compact</button>
|
|
</div>
|
|
</section>
|
|
|
|
<section>
|
|
<label class="row-label">Env badge</label>
|
|
<div class="seg three">
|
|
<button :class="{ on: state.env === 'prod' }" type="button" @click="setEnv('prod')">PROD</button>
|
|
<button :class="{ on: state.env === 'staging' }" type="button" @click="setEnv('staging')">STAGING</button>
|
|
<button :class="{ on: state.env === 'dev' }" type="button" @click="setEnv('dev')">DEV</button>
|
|
</div>
|
|
</section>
|
|
|
|
<footer>
|
|
<Mono dim>// cosmetic only — saved to localStorage</Mono>
|
|
</footer>
|
|
</div>
|
|
</Transition>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.tweaks-root {
|
|
position: fixed;
|
|
right: 16px;
|
|
bottom: 16px;
|
|
z-index: 50;
|
|
}
|
|
|
|
.trigger {
|
|
width: 34px;
|
|
height: 34px;
|
|
border-radius: 999px;
|
|
border: 1px solid var(--border);
|
|
background: var(--surface);
|
|
color: var(--text-dim);
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
cursor: pointer;
|
|
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
|
|
}
|
|
.trigger:hover { color: var(--text); border-color: var(--border-hi); }
|
|
.trigger.on { background: var(--text); color: var(--bg); border-color: var(--text); }
|
|
|
|
.panel {
|
|
position: absolute;
|
|
right: 0;
|
|
bottom: 44px;
|
|
width: 260px;
|
|
background: var(--elevated);
|
|
border: 1px solid var(--border);
|
|
border-radius: 10px;
|
|
padding: 12px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 12px;
|
|
box-shadow: 0 16px 48px rgba(0, 0, 0, 0.32);
|
|
}
|
|
|
|
header { display: flex; justify-content: space-between; align-items: center; }
|
|
.x {
|
|
width: 22px;
|
|
height: 22px;
|
|
border: 0;
|
|
background: transparent;
|
|
color: var(--text-mute);
|
|
border-radius: 6px;
|
|
cursor: pointer;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
.x:hover { background: var(--surface); color: var(--text); }
|
|
|
|
section { display: flex; flex-direction: column; gap: 6px; }
|
|
.row-label {
|
|
font-family: var(--font-mono);
|
|
font-size: 10px;
|
|
letter-spacing: 0.12em;
|
|
text-transform: uppercase;
|
|
color: var(--text-mute);
|
|
font-weight: 500;
|
|
}
|
|
|
|
.seg {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
gap: 4px;
|
|
padding: 3px;
|
|
background: var(--surface);
|
|
border: 1px solid var(--border);
|
|
border-radius: 7px;
|
|
}
|
|
.seg.three { grid-template-columns: 1fr 1fr 1fr; }
|
|
.seg button {
|
|
appearance: none;
|
|
border: 0;
|
|
background: transparent;
|
|
color: var(--text-dim);
|
|
font-family: inherit;
|
|
font-size: 12px;
|
|
font-weight: 500;
|
|
padding: 6px 8px;
|
|
border-radius: 5px;
|
|
cursor: pointer;
|
|
}
|
|
.seg button:hover { color: var(--text); }
|
|
.seg button.on { background: var(--text); color: var(--bg); }
|
|
|
|
footer { padding-top: 4px; border-top: 1px dashed var(--border); }
|
|
|
|
.tweaks-enter-active, .tweaks-leave-active { transition: opacity 0.12s, transform 0.12s; }
|
|
.tweaks-enter-from, .tweaks-leave-to { opacity: 0; transform: translateY(4px); }
|
|
</style>
|