- proxy Go /api/stream through Nitro; drive /stage, /live, /plan and /forecast from scenario events - fall back to 5 s polling after SSE failures or heartbeat silence; show Live/Polling/Offline - authenticate /control and POST /api/scenario in Nitro with server-side control credentials - add big-screen stage with local QR and a no-login phone recommendation view - add SSE unit tests and a live smoke test; refresh README/Makefile
38 lines
1.0 KiB
Vue
38 lines
1.0 KiB
Vue
<script setup lang="ts">
|
|
import { LIVE_COLORS, LIVE_LABELS, liveAge } from '#shared/live'
|
|
import type { LiveConnection } from '#shared/live'
|
|
|
|
const props = withDefaults(
|
|
defineProps<{
|
|
status: LiveConnection
|
|
lastEventAt?: string
|
|
compact?: boolean
|
|
}>(),
|
|
{ lastEventAt: '', compact: false },
|
|
)
|
|
|
|
const color = computed(() => LIVE_COLORS[props.status])
|
|
const label = computed(() => LIVE_LABELS[props.status])
|
|
const age = computed(() => (props.lastEventAt ? liveAge(props.lastEventAt) : ''))
|
|
</script>
|
|
|
|
<template>
|
|
<span class="live-status" role="status" aria-live="polite" :title="lastEventAt ? `Last event ${age}` : undefined">
|
|
<OnyxBadge :color="color" :density="compact ? 'compact' : 'default'">{{ label }}</OnyxBadge>
|
|
<span v-if="lastEventAt && !compact" class="live-status__age">{{ age }}</span>
|
|
</span>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.live-status {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.35rem;
|
|
}
|
|
|
|
.live-status__age {
|
|
color: var(--onyx-color-text-icons-neutral-soft);
|
|
font-size: 0.7rem;
|
|
}
|
|
</style>
|