Skip to content

Commit 604b730

Browse files
committed
--wip-- [skip ci]
1 parent 38dcc70 commit 604b730

File tree

110 files changed

+5874
-3488
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+5874
-3488
lines changed

frontend/app.vue

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,15 @@ useHead(
77
htmlAttrs: { lang: locale.value },
88
},
99
)
10-
useWindowSizeProvider()
1110
useBcToastProvider()
12-
13-
const { latestState } = storeToRefs(useLatestStateStore())
14-
const exchangeRates = computed(() => latestState.value?.exchange_rates ?? [])
15-
const exchangeRateLengthOnTestNetworks = 1
16-
if (exchangeRates.value.length === exchangeRateLengthOnTestNetworks) {
17-
const { selectedCurrencyMain } = useCurrency()
18-
selectedCurrencyMain.value = exchangeRates.value[0].code as CurrencyCode
19-
}
2011
</script>
2112

2213
<template>
23-
<div class="min-h-full">
24-
<BcDataWrapper>
25-
<NuxtLoadingIndicator color="var(--primary-color)" />
26-
<NuxtPage />
27-
<DynamicDialog />
28-
<Toast />
29-
</BcDataWrapper>
30-
</div>
14+
<NuxtLoadingIndicator color="var(--primary-color)" />
15+
<NuxtPage />
16+
<DynamicDialog />
17+
<Toast />
18+
<BcCookieModal />
3119
</template>
3220

3321
<style lang="scss"></style>

frontend/components/BcLayout.vue

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<script setup lang="ts"></script>
2+
3+
<template>
4+
<div class="page">
5+
<header>
6+
<slot name="header" />
7+
</header>
8+
<slot name="banner" />
9+
<main class="content">
10+
<slot />
11+
</main>
12+
<footer>
13+
<TheFooter />
14+
</footer>
15+
</div>
16+
</template>
17+
18+
<style lang="scss" scoped>
19+
.page {
20+
display: flex;
21+
flex-direction: column;
22+
justify-content: space-between;
23+
height: 100vh;
24+
}
25+
26+
.content {
27+
max-width: var(--content-width);
28+
margin: var(--padding) auto
29+
}
30+
</style>

frontend/components/bc/header/MainHeader.vue renamed to frontend/components/BcNavigation.vue

Lines changed: 29 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
<script setup lang="ts">
2-
import type { BcHeaderMegaMenu } from '#build/components'
3-
import { useLatestStateStore } from '~/stores/useLatestStateStore'
2+
import type { BcNavigationMenu } from '#build/components'
43
import {
54
mobileHeaderThreshold, smallHeaderThreshold,
65
} from '~/types/header'
76
8-
defineProps<{
9-
isHomePage: boolean,
10-
minimalist: boolean,
11-
}>()
12-
const latestStateStore = useLatestStateStore()
13-
const { latestState } = storeToRefs(latestStateStore)
147
const {
158
getEpochFromSlot,
169
networkInfo,
10+
secondsPerSlot,
1711
} = useNetwork()
12+
13+
const { counter } = useInterval(secondsPerSlot)
14+
15+
// Todo: decide if this is an antipattern or we should rather use watcher with callOnce
16+
useApi('/api/latest-state', {
17+
watch: [ counter ],
18+
})
19+
1820
const {
1921
doLogout,
2022
isLoggedIn,
@@ -32,12 +34,13 @@ const { promoCode } = usePromoCode()
3234
const isSmallScreen = computed(() => width.value < smallHeaderThreshold)
3335
const isMobileScreen = computed(() => width.value < mobileHeaderThreshold)
3436
35-
const showInDevelopment = Boolean(useRuntimeConfig().public.showInDevelopment)
37+
const config = useRuntimeConfig()
38+
const showInDevelopment = Boolean(config.public.showInDevelopment)
3639
const hideInDevelopmentClass = showInDevelopment
3740
? ''
3841
: 'hide-because-it-is-unfinished' // TODO: once the searchbar is enabled in production, delete this line
3942
40-
const megaMenu = ref<null | typeof BcHeaderMegaMenu>(null)
43+
const megaMenu = ref<null | typeof BcNavigationMenu>(null)
4144
4245
const hasExchangeRates = computed(() => exchangeRates.value.length > 1)
4346
@@ -55,11 +58,8 @@ const currentRate = computed(() => {
5558
})
5659
})
5760
58-
const currentEpoch = computed(() =>
59-
latestState.value?.current_slot !== undefined
60-
? getEpochFromSlot(latestState.value.current_slot)
61-
: undefined,
62-
)
61+
const currentSlot = useCurrentSlot()
62+
const currentEpoch = computed(() => getEpochFromSlot(currentSlot.value))
6363
6464
const toggleMegaMenu = (evt: Event) => {
6565
megaMenu.value?.toggleMegaMenu(evt)
@@ -70,7 +70,7 @@ const isMobileMegaMenuOpen = computed(() => megaMenu.value?.isMobileMenuOpen)
7070
type UserMenuItem = { command: () => Promise<void>, label: string }
7171
const userMenu: UserMenuItem[] = [
7272
{
73-
command: async () => { await navigateTo('/user/settings') },
73+
command: async () => { await navigateTo(`${v1Domain}/user/settings`, { external: true }) },
7474
label: $t('header.settings'),
7575
},
7676
{
@@ -81,41 +81,31 @@ const userMenu: UserMenuItem[] = [
8181
const handleUserMenuSelect = async (value: UserMenuItem) => {
8282
await value.command?.()
8383
}
84+
const v1Domain = useV1Domain()
8485
</script>
8586

8687
<template>
8788
<div
88-
v-if="minimalist"
89-
class="minimalist"
90-
>
91-
<div class="top-background" />
92-
<div class="rows">
93-
<BcHeaderLogo layout-adaptability="low" />
94-
</div>
95-
</div>
96-
97-
<div
98-
v-else
9989
class="complete"
10090
:class="hideInDevelopmentClass"
10191
>
10292
<div class="top-background" />
10393
<div class="rows">
10494
<div class="grid-cell blockchain-info">
105-
<span v-if="latestState?.current_slot"><span>{{ $t("header.slot") }}</span>:
95+
<span v-if="currentSlot"><span>{{ $t("header.slot") }}</span>:
10696
<BcLink
107-
:to="`/slot/${latestState.current_slot}`"
97+
:to="`${v1Domain}/slot/${currentSlot}`"
10898
:disabled="!showInDevelopment || null"
10999
>
110100
<BcFormatNumber
111101
class="bold"
112-
:value="latestState.current_slot"
102+
:value="currentSlot"
113103
/>
114104
</BcLink>
115105
</span>
116-
<span v-if="currentEpoch !== undefined"><span>{{ $t("header.epoch") }}</span>:
106+
<span v-if="currentEpoch"><span>{{ $t("header.epoch") }}</span>:
117107
<BcLink
118-
:to="`/epoch/${currentEpoch}`"
108+
:to="`${v1Domain}/epoch/${currentEpoch}`"
119109
:disabled="!showInDevelopment || null"
120110
>
121111
<BcFormatNumber
@@ -191,7 +181,7 @@ const handleUserMenuSelect = async (value: UserMenuItem) => {
191181
</div>
192182

193183
<div class="grid-cell explorer-info">
194-
<BcHeaderLogo layout-adaptability="high" />
184+
<BcNavigationLogo layout-adaptability="high" />
195185
<span class="variant">
196186
v2 beta |
197187
<span class="mobile">{{ networkInfo.shortName }}</span>
@@ -200,7 +190,7 @@ const handleUserMenuSelect = async (value: UserMenuItem) => {
200190
</div>
201191

202192
<div class="grid-cell mega-menu">
203-
<BcHeaderMegaMenu ref="megaMenu" />
193+
<BcNavigationMenu ref="megaMenu" />
204194
<div
205195
v-if="isMobileMegaMenuOpen"
206196
class="decoration"
@@ -217,7 +207,11 @@ const handleUserMenuSelect = async (value: UserMenuItem) => {
217207
$mobileHeaderThreshold: 600px;
218208
$smallHeaderThreshold: 1024px;
219209
220-
@mixin common {
210+
.complete {
211+
top: -1px; // needed for some reason to perfectly match Figma
212+
border-bottom: 1px solid var(--container-border-color);
213+
background-color: var(--container-background);
214+
221215
position: relative;
222216
display: flex;
223217
width: 100%;
@@ -231,23 +225,7 @@ $smallHeaderThreshold: 1024px;
231225
.rows {
232226
width: var(--content-width);
233227
}
234-
}
235-
236-
.minimalist {
237-
color: var(--header-top-font-color);
238-
@include common();
239-
@media (max-width: $mobileHeaderThreshold) {
240-
.top-background {
241-
height: 36px;
242-
}
243-
}
244-
}
245228
246-
.complete {
247-
top: -1px; // needed for some reason to perfectly match Figma
248-
border-bottom: 1px solid var(--container-border-color);
249-
background-color: var(--container-background);
250-
@include common();
251229
&.hide-because-it-is-unfinished {
252230
// TODO: once the searchbar is enabled in production, delete this block (because border-bottom is always needed, due to the fact that the lower header is always visible (it contains the search bar when the screeen is narrow, otherwise the logo and mega menu))
253231
@media (max-width: $smallHeaderThreshold) {
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<script setup lang="ts">
2+
</script>
3+
4+
<template>
5+
<div
6+
class="minimalist"
7+
>
8+
<div class="top-background" />
9+
<div class="rows">
10+
<BcNavigationLogo layout-adaptability="low" />
11+
</div>
12+
</div>
13+
</template>
14+
15+
<style scoped lang="scss">
16+
$mobileHeaderThreshold: 600px;
17+
18+
.minimalist {
19+
color: var(--header-top-font-color);
20+
position: relative;
21+
display: flex;
22+
width: 100%;
23+
justify-content: center;
24+
.top-background {
25+
position: absolute;
26+
width: 100%;
27+
height: var(--navbar-height);
28+
background-color: var(--dark-blue);
29+
}
30+
.rows {
31+
width: var(--content-width);
32+
}
33+
@media (max-width: $mobileHeaderThreshold) {
34+
.top-background {
35+
height: 36px;
36+
}
37+
}
38+
}
39+
</style>

frontend/components/bc/header/BcHeaderMegaMenu.vue renamed to frontend/components/BcNavigationMenu.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const isMobile = computed(() => width.value < mobileHeaderThreshold)
2323
2424
const { has } = useFeatureFlag()
2525
26+
const v1Domain = useV1Domain()
2627
const items = computed(() => {
2728
let list: MenuItem[] = []
2829
@@ -46,7 +47,7 @@ const items = computed(() => {
4647
if (isLoggedIn.value) {
4748
list.push({
4849
command: async () => {
49-
await navigateTo('../user/settings')
50+
await navigateTo(`${v1Domain}/user/settings`, { external: true })
5051
},
5152
label: $t('header.settings'),
5253
})

0 commit comments

Comments
 (0)