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
38 changes: 33 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,22 @@ 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should match id with id. Let me know if missed something here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sir updated indentation of code.

}
},
watch:{
$route (to) {
Expand Down