Skip to content

Commit 92a3d48

Browse files
committed
feat: [#619] add demo warning banner
1 parent c9f84f7 commit 92a3d48

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

app.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<template>
22
<div class="flex flex-col" style="min-height: 100vh;">
3+
<DemoBanner />
4+
35
<Notifications />
46

57
<NavigationBar />
@@ -21,6 +23,7 @@
2123
<script setup lang="ts">
2224
import { getCategories, getSettings, getTags, getUser, onBeforeMount, onMounted } from "#imports";
2325
import Notifications from "~/components/Notifications.vue";
26+
import DemoBanner from "~/components/demo/Banner.vue";
2427
2528
onBeforeMount(() => {
2629
getUser();

components/demo/Banner.vue

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<template>
2+
<div v-if="isDemoMode" class="demo-banner">
3+
{{ warning }}<NuxtLink to="/terms">
4+
Read our terms.</NuxtLink>
5+
</div>
6+
</template>
7+
8+
<script setup lang="ts">
9+
import { type PublicSettings } from "torrust-index-types-lib";
10+
11+
const settings = useSettings();
12+
const isDemoMode = ref(false);
13+
const warning = ref("");
14+
15+
onMounted(() => {
16+
isDemoMode.value = false;
17+
});
18+
19+
watch(
20+
() => settings.value,
21+
(newSettings) => {
22+
if (newSettings?.website?.demo?.warning) {
23+
isDemoMode.value = true;
24+
warning.value = newSettings?.website?.demo?.warning;
25+
}
26+
},
27+
{ immediate: true }
28+
);
29+
30+
</script>
31+
32+
<style scoped>
33+
.demo-banner {
34+
background-color: #f5b14a;
35+
color: #000;
36+
width: 100%;
37+
padding: 10px;
38+
text-align: center;
39+
/*position: fixed;*/
40+
top: 0;
41+
left: 0;
42+
z-index: 1000;
43+
}
44+
</style>

0 commit comments

Comments
 (0)