-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<script setup lang="ts"> | ||
import { warn } from 'vue' | ||
const { public: { maintenanceTS } } = useRuntimeConfig() | ||
const { tick } = useInterval(60) | ||
const { t: $t } = useI18n() | ||
const maintenanceLabel = computed(() => { | ||
if (!maintenanceTS) { | ||
return | ||
} | ||
const parsed = typeof maintenanceTS === 'number' ? maintenanceTS : parseInt(maintenanceTS) | ||
if (isNaN(parsed)) { | ||
warn('NUXT_PUBLIC_MAINTENANCE_TS is not convertible to an integer, a unix ts is expected') | ||
return undefined | ||
} else if (parsed === 0) { | ||
return | ||
} | ||
const ts = new Date(parsed * 1000).getTime() | ||
if (ts > tick.value) { | ||
return $t('maintenance.planned', { date: formatTsToAbsolute(ts / 1000, $t('locales.date'), true) }) | ||
} else { | ||
return $t('maintenance.ongoing') | ||
} | ||
}) | ||
</script> | ||
<template> | ||
<div v-if="maintenanceLabel" class="maintenance-banner"> | ||
{{ maintenanceLabel }} | ||
</div> | ||
</template> | ||
|
||
<style lang="scss" scoped> | ||
.maintenance-banner{ | ||
width: 100%; | ||
padding: var(--padding-large); | ||
background-color: var(--grey-4); | ||
//color: var(--container-color); | ||
text-align: center; | ||
} | ||
.dark-mode { | ||
.maintenance-banner{ | ||
background-color: var(--very-dark-grey); | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters