|
1 | 1 | <script setup lang="ts"> |
2 | 2 | import { RouterLink, RouterView } from 'vue-router' |
3 | | -import { onMounted } from 'vue' |
| 3 | +import { computed, onMounted } from 'vue' |
4 | 4 | import AuthButton from '@/components/AuthButton.vue' |
5 | 5 | import AdminModerationPanel from '@/components/Moderation/AdminModerationPanel.vue' |
6 | 6 | import IconDiscord from '@/components/icons/IconDiscord.vue' |
7 | 7 | import IconYoutube from '@/components/icons/IconYoutube.vue' |
8 | 8 | import IconGithub from '@/components/icons/IconGithub.vue' |
9 | 9 | import { useAuth } from '@/stores/auth' |
| 10 | +import { gitCommit, gitCommitDate } from 'virtual:build-info' |
10 | 11 |
|
11 | 12 | const { initAuth } = useAuth() |
12 | 13 |
|
| 14 | +const commitUrl = computed(() => |
| 15 | + gitCommit ? `https://github.com/offstyles/offstyles-web/commit/${gitCommit}` : '' |
| 16 | +) |
| 17 | +
|
| 18 | +const commitDateLabel = computed(() => { |
| 19 | + if (!gitCommitDate) return '' |
| 20 | + const d = new Date(gitCommitDate) |
| 21 | + if (Number.isNaN(d.getTime())) return '' |
| 22 | + return d.toLocaleString(undefined, { |
| 23 | + year: 'numeric', |
| 24 | + month: 'short', |
| 25 | + day: '2-digit', |
| 26 | + hour: '2-digit', |
| 27 | + minute: '2-digit', |
| 28 | + }) |
| 29 | +}) |
| 30 | +
|
13 | 31 | onMounted(async () => { |
14 | 32 | await initAuth() |
15 | 33 | }) |
@@ -79,6 +97,18 @@ onMounted(async () => { |
79 | 97 | <div class="text-gray-500 text-sm"> |
80 | 98 | Offstyle DB © 2025 |
81 | 99 | </div> |
| 100 | + |
| 101 | + <!-- Build version --> |
| 102 | + <div v-if="gitCommit" class="text-gray-600 text-xs mt-2"> |
| 103 | + <a |
| 104 | + :href="commitUrl" |
| 105 | + target="_blank" |
| 106 | + rel="noopener noreferrer" |
| 107 | + class="font-mono hover:text-gray-400 transition-colors duration-200" |
| 108 | + :title="`Commit ${gitCommit}`" |
| 109 | + >{{ gitCommit }}</a> |
| 110 | + <span v-if="commitDateLabel"> · {{ commitDateLabel }}</span> |
| 111 | + </div> |
82 | 112 | </div> |
83 | 113 | </footer> |
84 | 114 | </template> |
|
0 commit comments