-
-
Notifications
You must be signed in to change notification settings - Fork 433
Expand file tree
/
Copy pathBuildEnvironment.vue
More file actions
39 lines (35 loc) · 1.31 KB
/
BuildEnvironment.vue
File metadata and controls
39 lines (35 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<script setup lang="ts">
import type { BuildInfo } from '#shared/types'
const { footer = false, buildInfo: buildInfoProp } = defineProps<{
footer?: boolean
buildInfo?: BuildInfo
}>()
const appConfig = useAppConfig()
const buildInfo = computed(() => buildInfoProp || appConfig.buildInfo)
const buildTime = computed(() => new Date(buildInfo.value.time))
</script>
<template>
<div
class="font-mono text-xs text-fg-muted flex items-center gap-2 motion-safe:animate-fade-in motion-safe:animate-fill-both"
:class="footer ? 'hidden sm:flex sm:justify-start' : 'mb-8 justify-center'"
style="animation-delay: 0.05s"
>
<i18n-t keypath="built_at" scope="global">
<DateTime :datetime="buildTime" year="numeric" month="short" day="numeric" />
</i18n-t>
<span>·</span>
<LinkBase
v-if="buildInfo.env === 'release'"
:to="`https://github.com/npmx-dev/npmx.dev/releases/tag/v${buildInfo.version}`"
>
v{{ buildInfo.version }}
</LinkBase>
<span v-else class="tracking-wider">{{ buildInfo.env }}</span>
<template v-if="buildInfo.commit && buildInfo.branch !== 'release'">
<span>·</span>
<LinkBase :to="`https://github.com/npmx-dev/npmx.dev/commit/${buildInfo.commit}`">
{{ buildInfo.shortCommit }}
</LinkBase>
</template>
</div>
</template>