Skip to content

Commit 86a66ec

Browse files
committed
feat(demo): add demo mode notice in sidebar with tooltip information
1 parent 29b8ab3 commit 86a66ec

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

src/components/layouts/Sidebar.vue

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="sidebar padding flex-column">
3-
<div v-if="isTestnet" class="testnet-notice flex-row">
3+
<div v-if="isTestnet" class="environment-notice flex-row">
44
<StreetconeIcon/>
55
<span class="nq-label">{{ $t('PoS Testnet') }}</span>
66
<div class="flex-grow"></div>
@@ -20,6 +20,26 @@
2020
</Tooltip>
2121
</div>
2222

23+
<div v-if="isDemoEnabled" class="environment-notice demo-notice flex-row">
24+
<StreetconeIcon/>
25+
<span class="nq-label">{{ $t('Demo mode') }}</span>
26+
<div class="flex-grow"></div>
27+
<Tooltip preferredPosition="bottom left"
28+
:container="$parent"
29+
theme="inverse"
30+
:styles="{ transform: 'translate(0.5rem, 2rem)' }"
31+
ref="demoTooltip"
32+
>
33+
<template #trigger>
34+
<InfoCircleIcon/>
35+
</template>
36+
<template #default>
37+
<p>{{ $t('Experience the Nimiq Wallet risk-free.' ) }}</p>
38+
<p>{{ $t('Explore and learn how it all works, safely and without real assets.') }}</p>
39+
</template>
40+
</Tooltip>
41+
</div>
42+
2343
<header class="logo" @click="resetState">
2444
<span class="nq-icon nimiq-logo"></span>
2545
<span class="logo-wordmark">Nimiq</span>
@@ -193,6 +213,7 @@ import { defineComponent, ref, computed } from '@vue/composition-api';
193213
import { SwapAsset } from '@nimiq/fastspot-api';
194214
import { GearIcon, Tooltip, InfoCircleIcon } from '@nimiq/vue-components';
195215
import { RouteName, useRouter } from '@/router';
216+
import { checkIfDemoIsActive } from '@/lib/Demo';
196217
import AnnouncementBox from '../AnnouncementBox.vue';
197218
import AccountMenu from '../AccountMenu.vue';
198219
import PriceChart, { TimeRange } from '../PriceChart.vue';
@@ -359,6 +380,8 @@ export default defineComponent({
359380
: null;
360381
});
361382
383+
const isDemoEnabled = checkIfDemoIsActive();
384+
362385
return {
363386
CryptoCurrency,
364387
navigateTo,
@@ -385,6 +408,7 @@ export default defineComponent({
385408
openSellModal,
386409
nimSellOptions,
387410
activeCurrency,
411+
isDemoEnabled,
388412
};
389413
},
390414
components: {
@@ -424,7 +448,7 @@ $balance-distribution-display-breakpoint: 450px;
424448
padding-bottom: max(var(--padding-bottom), env(safe-area-inset-bottom));
425449
}
426450
427-
.testnet-notice {
451+
.environment-notice {
428452
align-items: center;
429453
width: calc(100% + calc(2 * var(--padding-sides)));
430454
margin: calc(-1 * var(--padding-top)) calc(-1 * var(--padding-sides)) var(--padding-top);

0 commit comments

Comments
 (0)