Files
librodrome/app/components/home/HomeConsole.vue
T
YvvandClaude Opus 5.5 e9fce4be8f design : accueil en trois variantes (console, parcours, établi) + couleur par axe
- typo : Bricolage Grotesque (titres) + Atkinson Hyperlegible (texte),
  Syne gardée pour le logo seul ; une seule source de polices (Bunny)
- palettes : teinte propre à chaque axe dans les 4 ambiances ;
  pages d'axe en axis-scope, cartes sans bordure (canon design)
- accueil : console des trois curseurs (tablist clavier), boîte à outils,
  bloc format éditorial + événement + reproduction ; ?v=a|b|c|0
- numérique : carte LPK ; bouquet rendu avec statut et légende
- messages : sans bordure, deux colonnes en grand écran

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:15:46 +02:00

473 lines
11 KiB
Vue

<template>
<div class="console" :class="{ 'console--ready': ready, 'console--compact': compact }">
<div class="console-board">
<!-- Scale: from « je subis » to « je m'affranchis » (evenement.yml) -->
<div class="console-scale" aria-hidden="true">
<span>je m'affranchis</span>
<span class="console-ticks"><i v-for="n in 5" :key="n" /></span>
<span>je subis</span>
</div>
<div
class="console-faders"
role="tablist"
aria-label="Les trois axes de l'autonomie"
@keydown="onKeydown"
>
<button
v-for="(axis, i) in axes"
:id="`fader-${uid}-${axis.key}`"
:key="axis.key"
ref="tabs"
type="button"
role="tab"
class="fader"
:class="{ 'fader--active': axis.key === active }"
:style="{ '--hue': `var(${axis.hue})`, '--level': level(axis.key), '--i': i }"
:aria-selected="axis.key === active"
:aria-controls="`panel-${uid}`"
:tabindex="axis.key === active ? 0 : -1"
@click="select(axis.key)"
>
<span class="fader-track" aria-hidden="true">
<span class="fader-fill" />
<span class="fader-cap" />
</span>
<span class="fader-name">{{ axis.short }}</span>
<span class="fader-lever">{{ axis.lever }}</span>
</button>
</div>
</div>
<div
v-if="current"
:id="`panel-${uid}`"
role="tabpanel"
class="console-panel"
:style="{ '--hue': `var(${current.hue})` }"
:aria-labelledby="`fader-${uid}-${current.key}`"
>
<Transition name="panel" mode="out-in">
<div :key="current.key" class="panel-inner">
<p class="panel-upstream">
<span class="panel-upstream-label">{{ upstreamLabel }}</span>
{{ current.lever }}
</p>
<h2 class="panel-title">{{ current.title }}</h2>
<p v-if="current.promise" class="panel-promise">{{ current.promise }}</p>
<ul class="panel-tools">
<li v-for="tool in current.items" :key="tool.label">
<NuxtLink v-if="tool.to" :to="tool.to" class="panel-tool">
<span class="panel-tool-name">{{ tool.label }}</span>
<span v-if="tool.presentation" class="panel-tool-app">{{ tool.presentation.title }}</span>
<span v-if="tool.gestation" class="panel-tool-state">en gestation</span>
</NuxtLink>
</li>
</ul>
<p v-if="current.key === 'numerique' && stacks?.length" class="panel-stacks">
<span class="panel-stacks-label">{{ stacksLabel }}</span>
<span v-for="s in stacks.slice(0, maxStacks)" :key="s.name" class="panel-stack">{{ s.name }}</span>
<NuxtLink v-if="stacks.length > maxStacks && stacksTo" :to="stacksTo" class="panel-stacks-more">
+{{ stacks.length - maxStacks }}
</NuxtLink>
</p>
<NuxtLink :to="current.to" class="panel-more">
Voir l'axe {{ current.short }}
<span class="i-lucide-arrow-right h-4 w-4" aria-hidden="true" />
</NuxtLink>
</div>
</Transition>
</div>
</div>
</template>
<script setup lang="ts">
import type { AxisKey, HomeAxis, HomeStack } from '~/composables/useHomeData'
const props = withDefaults(defineProps<{
axes: HomeAxis[]
upstreamLabel?: string
stacks?: HomeStack[]
stacksLabel?: string
stacksTo?: string
maxStacks?: number
compact?: boolean
}>(), {
maxStacks: 8,
upstreamLabel: 'en amont',
stacksLabel: 'En service',
compact: false,
})
const active = defineModel<AxisKey>({ default: 'numerique' })
const uid = useId()
const tabs = ref<HTMLButtonElement[]>([])
const ready = ref(false)
const current = computed(() => props.axes.find(a => a.key === active.value) ?? props.axes[0])
// Faders rise from « je subis » once mounted; the selected one is pushed to the top.
function level(key: AxisKey) {
if (!ready.value) return 0
return key === active.value ? 0.94 : 0.3
}
function select(key: AxisKey) {
active.value = key
}
function onKeydown(e: KeyboardEvent) {
const keys = ['ArrowRight', 'ArrowLeft', 'ArrowUp', 'ArrowDown', 'Home', 'End']
if (!keys.includes(e.key)) return
e.preventDefault()
const idx = props.axes.findIndex(a => a.key === active.value)
const last = props.axes.length - 1
let next = idx
if (e.key === 'ArrowRight' || e.key === 'ArrowUp') next = idx === last ? 0 : idx + 1
if (e.key === 'ArrowLeft' || e.key === 'ArrowDown') next = idx === 0 ? last : idx - 1
if (e.key === 'Home') next = 0
if (e.key === 'End') next = last
active.value = props.axes[next]!.key
nextTick(() => tabs.value[next]?.focus())
}
onMounted(() => {
requestAnimationFrame(() => { ready.value = true })
})
</script>
<style scoped>
.console {
--track-h: 11rem;
--cap-h: 1.25rem;
display: grid;
gap: 1.25rem;
}
.console--compact {
--track-h: 8rem;
}
/* ── Board ── */
.console-board {
display: grid;
grid-template-columns: auto 1fr;
gap: 0.75rem;
padding: 1.25rem 1.25rem 1rem;
border-radius: 16px;
background: hsl(var(--color-surface));
box-shadow:
inset 0 1px 0 hsl(var(--color-text) / 0.04),
0 18px 40px -24px hsl(var(--color-text) / 0.35);
}
.console-scale {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: flex-end;
height: var(--track-h);
font-family: var(--font-mono);
font-size: 0.62rem;
line-height: 1.2;
color: hsl(var(--color-text) / 0.45);
text-align: right;
white-space: nowrap;
}
.console-ticks {
display: flex;
flex-direction: column;
gap: calc(var(--track-h) / 9);
align-items: flex-end;
}
.console-ticks i {
display: block;
width: 0.5rem;
height: 1px;
background: hsl(var(--color-text) / 0.2);
}
.console-faders {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 0.5rem;
}
/* ── Fader ── */
.fader {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.5rem;
padding: 0 0.25rem 0.25rem;
border-radius: 12px;
cursor: pointer;
transition: background 0.2s ease;
}
.fader:hover {
background: hsl(var(--hue) / 0.06);
}
.fader:focus-visible {
outline: 2px solid hsl(var(--hue));
outline-offset: 2px;
}
.fader-track {
position: relative;
width: 0.5rem;
height: var(--track-h);
border-radius: 999px;
background: hsl(var(--color-text) / 0.1);
}
.fader-fill {
position: absolute;
inset: auto 0 0 0;
height: calc(var(--level) * (var(--track-h) - var(--cap-h)) + var(--cap-h) / 2);
border-radius: inherit;
background: hsl(var(--hue) / 0.45);
}
.fader--active .fader-fill {
background: hsl(var(--hue));
}
.fader-cap {
position: absolute;
left: 50%;
bottom: 0;
width: 2.6rem;
height: var(--cap-h);
margin-left: -1.3rem;
border-radius: 6px;
background: hsl(var(--color-bg));
box-shadow:
0 1px 0 hsl(var(--color-text) / 0.08),
0 4px 10px -2px hsl(var(--color-text) / 0.3);
transform: translateY(calc(-1 * var(--level) * (var(--track-h) - var(--cap-h))));
}
/* Cap groove */
.fader-cap::after {
content: '';
position: absolute;
left: 0.45rem;
right: 0.45rem;
top: 50%;
height: 2px;
margin-top: -1px;
border-radius: 2px;
background: hsl(var(--hue));
}
.console--ready .fader-fill,
.console--ready .fader-cap {
transition:
height 0.7s var(--ease-out-expo),
transform 0.7s var(--ease-out-expo);
}
/* Orchestrated first rise: one fader after the other */
.console--ready .fader-fill,
.console--ready .fader-cap {
transition-delay: calc(var(--i) * 90ms);
}
.fader-name {
font-family: var(--font-display);
font-weight: 700;
font-size: 0.95rem;
letter-spacing: -0.01em;
color: hsl(var(--color-text) / 0.6);
}
.fader--active .fader-name {
color: hsl(var(--hue));
}
.fader-lever {
font-family: var(--font-mono);
font-size: 0.64rem;
line-height: 1.25;
text-align: center;
color: hsl(var(--color-text) / 0.45);
}
/* ── Panel ── */
.console-panel {
position: relative;
padding: 1.25rem 1.4rem 1.2rem;
border-radius: 16px;
background: hsl(var(--hue) / 0.08);
}
.panel-upstream {
margin: 0 0 0.35rem;
font-family: var(--font-mono);
font-size: 0.72rem;
color: hsl(var(--hue));
}
.panel-upstream-label {
color: hsl(var(--color-text) / 0.45);
}
.panel-upstream-label::after {
content: ' ↑ ';
}
.panel-title {
margin: 0;
font-family: var(--font-display);
font-weight: 800;
font-size: clamp(1.35rem, 2.6vw, 1.7rem);
letter-spacing: -0.025em;
line-height: 1.1;
color: hsl(var(--color-text));
}
.panel-promise {
margin: 0.5rem 0 0;
font-size: 0.98rem;
line-height: 1.5;
color: hsl(var(--color-text) / 0.78);
}
.panel-tools {
list-style: none;
margin: 0.9rem 0 0;
padding: 0;
display: flex;
flex-wrap: wrap;
gap: 0.4rem;
}
.panel-tool {
display: inline-flex;
align-items: baseline;
gap: 0.4rem;
padding: 0.4rem 0.8rem;
border-radius: 20px;
background: hsl(var(--color-bg) / 0.7);
font-size: 0.85rem;
color: hsl(var(--color-text));
transition: transform 0.1s ease, background 0.2s ease;
}
.panel-tool:hover {
transform: translateY(-1px);
background: hsl(var(--color-bg));
}
.panel-tool:active {
transform: translateY(0);
}
.panel-tool-name {
font-weight: 700;
}
.panel-tool-app {
font-family: var(--font-mono);
font-size: 0.7rem;
color: hsl(var(--hue));
}
.panel-tool-state {
font-family: var(--font-mono);
font-size: 0.65rem;
color: hsl(var(--color-text) / 0.45);
}
.panel-stacks {
display: flex;
flex-wrap: wrap;
align-items: baseline;
gap: 0.25rem 0.6rem;
margin: 0.9rem 0 0;
font-size: 0.8rem;
color: hsl(var(--color-text) / 0.7);
}
.panel-stacks-label {
font-family: var(--font-mono);
font-size: 0.68rem;
color: hsl(var(--color-text) / 0.45);
}
.panel-stacks-more {
font-family: var(--font-mono);
font-size: 0.72rem;
color: hsl(var(--hue));
}
.panel-stack::before {
content: '';
display: inline-block;
width: 0.4rem;
height: 0.4rem;
margin-right: 0.3rem;
border-radius: 50%;
background: hsl(var(--hue));
vertical-align: 0.05em;
}
.panel-more {
display: inline-flex;
align-items: center;
gap: 0.35rem;
margin-top: 1rem;
font-family: var(--font-display);
font-weight: 700;
font-size: 0.92rem;
color: hsl(var(--hue));
}
.panel-more:hover span {
transform: translateX(2px);
}
.panel-more span {
transition: transform 0.12s ease;
}
.panel-enter-active,
.panel-leave-active {
transition: opacity 0.18s ease, transform 0.18s ease;
}
.panel-enter-from {
opacity: 0;
transform: translateY(6px);
}
.panel-leave-to {
opacity: 0;
transform: translateY(-4px);
}
@media (max-width: 480px) {
.console { --track-h: 8.5rem; }
.console-board { padding: 1rem 0.75rem 0.75rem; gap: 0.4rem; }
.console-scale { white-space: normal; max-width: 3.4rem; font-size: 0.56rem; }
.fader-cap { width: 2.2rem; margin-left: -1.1rem; }
.fader-name { font-size: 0.85rem; }
}
@media (prefers-reduced-motion: reduce) {
.console--ready .fader-fill,
.console--ready .fader-cap,
.panel-enter-active,
.panel-leave-active {
transition: none;
}
}
</style>