Skip to content

Commit

Permalink
refactor: add getters for tstore access
Browse files Browse the repository at this point in the history
feeding the consistency hobgoblin
  • Loading branch information
alee committed Oct 27, 2023
1 parent e68cfed commit 7e73a78
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
18 changes: 10 additions & 8 deletions client/src/components/global/Footer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,12 @@ [email protected]
<b-link :to="solo" title="Solo Mode">Solo Mode</b-link>
</li>
<li>
<b-link
v-if="$tstore.state.isFreePlayEnabled"
:to="freePlayLobby"
title="Port of Mars Free Play"
<b-link v-if="isFreePlayEnabled" :to="freePlayLobby" title="Port of Mars Free Play"
>Free Play</b-link
>
</li>
<li>
<b-link
v-if="$tstore.state.isFreePlayEnabled"
:to="tournamentDashboard"
title="Join Mars Madness"
<b-link v-if="isTournamentEnabled" :to="tournamentDashboard" title="Join Mars Madness"
>Join Mars Madness</b-link
>
</li>
Expand Down Expand Up @@ -132,6 +126,14 @@ export default class Footer extends Vue {
get constants() {
return Constants;
}

get isTournamentEnabled() {
return this.$tstore.state.isTournamentEnabled;
}

get isFreePlayEnabled() {
return this.$tstore.state.isFreePlayEnabled;
}
}
</script>

Expand Down
14 changes: 11 additions & 3 deletions client/src/components/global/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
Solo Mode
</b-nav-item>
<b-nav-item
v-if="$tstore.state.isFreePlayEnabled"
v-if="isFreePlayEnabled"
class="mx-2 text-nowrap"
:to="freePlayLobby"
exact-active-class="active"
Expand All @@ -54,7 +54,7 @@
Free Play
</b-nav-item>
<b-nav-item
v-if="$tstore.state.isTournamentEnabled"
v-if="isTournamentEnabled"
class="mx-2 text-nowrap"
link-classes="btn btn-success text-white"
:to="tournamentDashboard"
Expand Down Expand Up @@ -147,7 +147,7 @@ export default class Navbar extends Vue {
mounted() {
console.log("route name: ", this.$route.name);
console.log("route.name = login", this.$route.name == this.login.name);
console.log("route.name = login ?", this.$route.name == this.login.name);
}
get constants() {
Expand All @@ -166,6 +166,14 @@ export default class Navbar extends Vue {
return this.$tstore.getters.isAdmin;
}
get isTournamentEnabled() {
return this.$tstore.state.isTournamentEnabled;
}
get isFreePlayEnabled() {
return this.$tstore.state.isFreePlayEnabled;
}
get isInGame() {
if (_.isNil(this.$route.name)) {
return false;
Expand Down

0 comments on commit 7e73a78

Please sign in to comment.