Skip to content

Commit cf18f58

Browse files
committed
Merge #620: Add demo warning banner
562dd29 fix: [#621] using a linked package isntead of NPM regsitry (Jose Celano) 92a3d48 feat: [#619] add demo warning banner (Jose Celano) Pull request description: Add demo warning banner. The text can be overridden in the Index configuration: ``` [website.demo] warning = """ ⚠️ Please be aware: This demo resets all data weekly. Torrents not complying with our Usage Policies will be removed immediately without notice. We encourage the responsible use of this software in compliance with all legal requirements. """ ``` See torrust/torrust-index#730 ACKs for top commit: josecelano: ACK 562dd29 Tree-SHA512: 113c59e13dc5537f96dea3dac21fbae6f0ecc663c1d451db90f8c300c774e5c6f2868da191d4094ce229573b499ce9619df94e5f791da3ac047a4f3311542a8f
2 parents c9f84f7 + 562dd29 commit cf18f58

File tree

3 files changed

+51
-9
lines changed

3 files changed

+51
-9
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>

package-lock.json

Lines changed: 4 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)