Skip to content

Commit

Permalink
Adds switch between periodic and main BCD
Browse files Browse the repository at this point in the history
  • Loading branch information
GusevPM committed Sep 1, 2023
1 parent 3b30a1c commit 57fb680
Showing 1 changed file with 38 additions and 5 deletions.
43 changes: 38 additions & 5 deletions src/components/MainHeaderDescriptive.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@
</RouterLink>
</div>
<div>
<v-btn text small :to="{ name: 'search' }" class="text--secondary" active-class="bg-before-transparent" v-if="searchService.created()">
<v-btn v-if="!isSandbox"
@click="bcdModeRedirect"
text
small
class="text--secondary"
active-class="bg-before-transparent"
> {{ bcdInMainMode ? 'Periodic BCD' : 'Main BCD' }}
</v-btn>
<v-btn v-if="searchService.created()" text small :to="{ name: 'search' }" class="text--secondary" active-class="bg-before-transparent">
Search
</v-btn>
<v-btn text small :to="{ path: networksPath }" class="text--secondary" active-class="bg-before-transparent">
Expand Down Expand Up @@ -36,7 +44,13 @@ import ConnectWallet from "@/components/ConnectWallet";
export default {
name: "MainHeaderDescriptive",
components: {ConnectWallet, ThemeSwitcher, SearchBox, SocialsList, Bookmarks},
components: {
ConnectWallet,
ThemeSwitcher,
SearchBox,
SocialsList,
Bookmarks
},
props: {
noSearch: Boolean,
network: String,
Expand All @@ -51,16 +65,35 @@ export default {
isDarkTheme() {
return this.$vuetify.theme.dark;
},
isSandbox() {
return this.config.sandbox_mode;
},
networksPath() {
if (this.config.sandbox_mode) {
if (this.isSandbox) {
return `/${this.$route.params.network || 'sandboxnet'}/`
}
if ('mainnet' in this.config.networks) {
return `/${this.$route.params.network || 'mainnet'}/`
}
return `/${this.$route.params.network || this.config.networks[0]}/`
}
},
bcdInMainMode() {
if (window.location.hostname.startsWith('teztnets')) {
return false;
} else {
return true;
}
},
},
methods: {
bcdModeRedirect() {
if (this.bcdInMainMode) {
window.location.href = 'https://teztnets.better-call.dev/';
} else {
window.location.href = 'https://better-call.dev/';
}
},
}
}
</script>

Expand Down Expand Up @@ -107,4 +140,4 @@ export default {
height: 2.5rem !important;
}
}
</style>
</style>

0 comments on commit 57fb680

Please sign in to comment.