mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
The bar now needs more than the world clock being away from live: a layer that moves with the clock must be on with time to show. In Core that is weather radar, satellite or lightning with frames; a host adds layers by following them. Turning the last one off hides the bar; turning it back on brings it back. The world clock reports this as `supported` in its state. Weather products register their frames as coverage one by one, suspended or not, so the way back to live stays on screen with reduced motion. Weather refreshes and satellite catalog changes tell the clock their coverage may have changed. A coverage that throws counts as none, and the clock reads its state once per notification round.
37 lines
1.5 KiB
Vue
37 lines
1.5 KiB
Vue
<script setup>
|
|
import { computed } from 'vue';
|
|
import { storeToRefs } from 'pinia';
|
|
import { formatDate, t } from '../../../i18n/index.js';
|
|
import { useWorldTimeStore } from '../../stores/worldTime.js';
|
|
import UiButton from '../../kit/UiButton.vue';
|
|
import UiIcon from '../../kit/UiIcon.vue';
|
|
|
|
// The world time while it is away from live: what is playing, or where it
|
|
// was paused, with play and pause on the left and the way back to live on
|
|
// the right. It shows only while a layer that moves with the clock (weather
|
|
// radar, satellite or lightning, or one a host follows) is on with time to
|
|
// show; live, or with none on, the bar stays hidden.
|
|
const store = useWorldTimeStore();
|
|
const { time } = storeToRefs(store);
|
|
|
|
const DATE_TIME = Object.freeze({
|
|
dateStyle: 'medium',
|
|
timeStyle: 'medium',
|
|
timeZone: 'UTC',
|
|
});
|
|
const readout = computed(() =>
|
|
Number.isFinite(time.value.timeMs)
|
|
? `${formatDate(time.value.timeMs, DATE_TIME)} UTC`
|
|
: '',
|
|
);
|
|
</script>
|
|
|
|
<template>
|
|
<div v-if="!time.live && time.supported" id="world-timeline" role="group" :aria-label="t('World time')"
|
|
><UiButton class="world-timeline-play" :label="time.playing ? t('Pause') : t('Play')" @click="store.togglePlay()"
|
|
><UiIcon :name="time.playing ? 'pause' : 'play_arrow'" :size="20" /></UiButton
|
|
><time class="world-timeline-time" :datetime="new Date(time.timeMs).toISOString()" aria-live="off">{{ readout }}</time
|
|
><UiButton class="world-timeline-live" :label="t('Back to live')" @click="store.goLive()">{{ t('Live') }}</UiButton
|
|
></div>
|
|
</template>
|