Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved code by displaying current shop, instance and time-zone at the bottom of menu(#28u2peg) #57

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
37 changes: 32 additions & 5 deletions src/components/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,35 @@
</ion-menu-toggle>
</ion-list>
</ion-content>

<ion-footer>
<ion-toolbar>
<ion-item lines="none">
<ion-label class="ion-text-wrap">
<p class="overline">{{ instanceUrl }}</p>
{{ brandName }}
</ion-label>
<ion-note slot="end">{{ userProfile?.userTimeZone }}</ion-note>
</ion-item>
</ion-toolbar>
</ion-footer>
</ion-menu>
</template>

<script lang="ts">
import {
IonContent,
IonFooter,
IonIcon,
IonHeader,
IonItem,
IonLabel,
IonList,
IonTitle,
IonToolbar,
IonMenu,
IonMenuToggle,
IonNote,
IonTitle,
IonToolbar
} from "@ionic/vue";
import { defineComponent, ref } from "vue";
import { mapGetters } from "vuex";
Expand All @@ -49,15 +63,17 @@ export default defineComponent({
name: "Menu",
components: {
IonContent,
IonFooter,
IonHeader,
IonIcon,
IonItem,
IonTitle,
IonLabel,
IonList,
IonToolbar,
IonMenu,
IonMenuToggle,
IonNote,
IonToolbar,
},
created() {
// When open any specific page it should show that page selected
Expand All @@ -66,10 +82,21 @@ export default defineComponent({
return page.url === this.$router.currentRoute.value.path;
})
},
data() {
return {
brands : JSON.parse(process.env?.VUE_APP_BRANDS),
}
},
computed: {
...mapGetters({
isUserAuthenticated: 'user/isUserAuthenticated'
})
isUserAuthenticated: 'user/isUserAuthenticated',
userProfile: 'user/getUserProfile',
instanceUrl: 'user/getInstanceUrl',
selectedBrand: 'user/getSelectedBrand'
}),
brandName() {
return (this as any).brands.find((brand: any) => brand.id === (this as any).selectedBrand)?.name;
}
},
watch:{
$route (to) {
Expand Down
2 changes: 2 additions & 0 deletions src/views/settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import {
IonButtons,
IonContent,
IonHeader,
IonIcon,
IonItem,
IonLabel,
IonMenuButton,
Expand All @@ -63,6 +64,7 @@ export default defineComponent({
IonButtons,
IonContent,
IonHeader,
IonIcon,
IonItem,
IonLabel,
IonMenuButton,
Expand Down