Skip to content

Commit

Permalink
make it possible to force de display of the rules from the URL
Browse files Browse the repository at this point in the history
  • Loading branch information
Ragnar-Oock committed Mar 31, 2021
1 parent 002be1f commit 23a326d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
11 changes: 8 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<TopBar :is-search-bar-docked="isSearchBarDocked" />
<main>
<RulesPage
v-if="!isLastRuleVersionAccepted"
v-if="enableRules"
:show="!isWelcomeScreenVisible"
/>

Expand Down Expand Up @@ -129,8 +129,13 @@ export default {
}),
...mapGetters([
'getPage',
'isLastRuleVersionAccepted'
])
'isLastRuleVersionAccepted',
'isForceShowRulesUp'
]),
enableRules() {
return !this.isLastRuleVersionAccepted || this.isForceShowRulesUp;
}
},
watch: {
isDarkModeOn() {
Expand Down
11 changes: 6 additions & 5 deletions src/components/RulesPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</template>

<script lang="js">
import { mapState } from 'vuex';
import { mapGetters } from 'vuex';
import { Fragment } from 'vue-fragment';
export default {
Expand All @@ -19,13 +19,14 @@ export default {
}
},
computed:{
...mapState({
lastAcceptedRuleVersion: state => state.percist.lastAcceptedRuleVersion
})
...mapGetters([
'isLastRuleVersionAccepted',
'isForceShowRulesUp'
])
},
watch:{
show(newValue) {
if (newValue && this.lastAcceptedRuleVersion < process.env.VUE_APP_RULES_VERSION) {
if (newValue && (!this.isLastRuleVersionAccepted || this.isForceShowRulesUp)) {
this.showAlert();
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/store/getters.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { getField } from 'vuex-map-fields';
import { getDiffKeys, compareKeys } from '@/helpers/methods';
import { getDefaultState } from './state';
import { getUrlPrameters } from '@/helpers/methods';


const getters = {
Expand Down Expand Up @@ -75,6 +76,7 @@ const getters = {
isSearch: state => !compareKeys(getDefaultState().searchSettings, state.searchSettings),
isLastPage: state => state.isLastPage,
isLastRuleVersionAccepted: state => state.percist.lastAcceptedRuleVersion >= process.env.VUE_APP_RULES_VERSION,
isForceShowRulesUp: () => Object.prototype.hasOwnProperty.call(getUrlPrameters(), 'showRules'),

getField
};
Expand Down

0 comments on commit 23a326d

Please sign in to comment.