-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathglobal-bottom.vue
More file actions
49 lines (43 loc) · 1.9 KB
/
Copy pathglobal-bottom.vue
File metadata and controls
49 lines (43 loc) · 1.9 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
40
41
42
43
44
45
46
47
48
49
<script setup lang="ts">
import { computed } from 'vue'
import { useSlideContext } from '@slidev/client'
/*
* Read nav through the injected slide context, not the global useNav():
* in print/export mode every slide is wrapped with a local context whose
* nav points at THAT slide — useNav() would report slide 1 for all pages.
*/
const { $slidev } = useSlideContext()
const frontmatter = computed(
() =>
($slidev.nav.currentSlideRoute?.meta?.slide?.frontmatter ?? {}) as Record<string, unknown>,
)
/* Full-bleed layouts carry no footer; any slide can opt out via hideFooter.
* cover / section-cover stay clear so the mandatory "AI generated" label is
* undisturbed (docs/authoring-guide.md). Provenance chrome lives here, not on covers. */
const hideFooter = computed(() => {
if (frontmatter.value.hideFooter === true)
return true
const layout = String(frontmatter.value.layout ?? '')
return ['cover', 'section-cover'].includes(layout)
})
const deckTitle = computed(() => $slidev.configs.title ?? '')
const page = computed(() => $slidev.nav.currentPage)
const total = computed(() => $slidev.nav.total)
const progress = computed(() => (total.value ? (page.value / total.value) * 100 : 0))
/* Build-time stamp from vite.config.mjs / release.yml (US-P-FOOT). */
const provenance = computed(() => {
const version = String(import.meta.env.VITE_WORKSHOP_VERSION || 'dev')
const sha = String(import.meta.env.VITE_WORKSHOP_SHA || 'unversioned')
return `${version} · ${sha}`
})
</script>
<template>
<template v-if="!hideFooter">
<div class="kw-global-footer" aria-hidden="true">{{ deckTitle }}</div>
<div class="kw-global-right" aria-hidden="true">
<div class="kw-global-provenance">{{ provenance }}</div>
<div class="kw-global-page">{{ page }} / {{ total }}</div>
</div>
</template>
<div class="kw-global-progress" :style="{ width: `${progress}%` }" aria-hidden="true" />
</template>