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 removing the redundant usage of ion-footer and declared the footer in the app file(#ew8pb0) #2

Merged
merged 4 commits into from
Oct 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions changelogs/unreleased/-ew8pb0.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: 'Improved: code by removing the redundant usage of ion-footer and declared
the footer in the app file, also removed the requested tab'
ticket_id: "#ew8pb0"
merge_request: 2
author: Yash Maheshwari
type: fixed
28 changes: 24 additions & 4 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,21 +1,35 @@
<template>
<ion-app>
<ion-router-outlet />
<ion-page>
<ion-content :fullscreen="true">
<ion-router-outlet />
</ion-content>
<ion-footer v-if="showFooter">
<ion-toolbar>
<tab-bar />
</ion-toolbar>
</ion-footer>
</ion-page>
</ion-app>
</template>

<script lang="ts">
import { IonApp, IonRouterOutlet } from '@ionic/vue';
import { IonApp, IonRouterOutlet, IonPage, IonFooter, IonToolbar, IonContent } from '@ionic/vue';
import { defineComponent } from 'vue';
import { loadingController } from '@ionic/vue';
import emitter from "@/event-bus"

import TabBar from "./components/TabBar.vue"

export default defineComponent({
name: 'App',
components: {
IonApp,
IonRouterOutlet
IonRouterOutlet,
IonPage,
IonFooter,
IonToolbar,
TabBar,
IonContent
},
data() {
return {
Expand Down Expand Up @@ -46,5 +60,11 @@ export default defineComponent({
emitter.off('presentLoader', this.presentLoader);
emitter.off('dismissLoader', this.dismissLoader);
},
computed: {
showFooter () {
if (['/settings', '/search', '/upload'].includes(this.$route.path)) return true
return false
}
}
});
</script>
4 changes: 0 additions & 4 deletions src/components/TabBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
<ion-icon :icon="search" />
<ion-label>{{ $t("Search") }}</ion-label>
</ion-tab-button>
<ion-tab-button tab="requested" href="/requested">
<ion-icon :icon="list" />
<ion-label>{{ $t("Requested") }}</ion-label>
</ion-tab-button>
<ion-tab-button tab="upload" href="/upload">
<ion-icon :icon="cloudUpload" />
<ion-label>{{ $t("Upload") }}</ion-label>
Expand Down
1 change: 0 additions & 1 deletion src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"Logout": "Logout",
"Product not found": "Product not found",
"Remove": "Remove",
"Requested": "Requested",
"Save":"Save",
"Scan": "Scan",
"Search": "Search",
Expand Down
10 changes: 0 additions & 10 deletions src/views/Search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,10 @@
</ion-col>
</ion-row>
</ion-grid>

<ion-footer :translucent="true">
<ion-toolbar>
<tab-bar />
</ion-toolbar>
</ion-footer>
</ion-page>
</template>

<script lang="ts">
import TabBar from '@/components/TabBar.vue'
import {
IonPage,
IonHeader,
Expand All @@ -52,7 +45,6 @@ import {
IonGrid,
IonRow,
IonCol,
IonFooter,
IonInfiniteScroll,
IonInfiniteScrollContent,
IonList,
Expand All @@ -79,12 +71,10 @@ export default defineComponent({
IonGrid,
IonRow,
IonCol,
IonFooter,
IonInfiniteScroll,
IonInfiniteScrollContent,
IonList,
IonListHeader,
TabBar,
ProductListItem
},
data (){
Expand Down
5 changes: 3 additions & 2 deletions src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</template>

<script lang="ts">
import { alertController, IonButton, IonContent, IonHeader,IonIcon, IonItem, IonLabel, IonPage, IonSelect, IonSelectOption, IonTitle, IonToolbar } from '@ionic/vue';
import { alertController, IonButton, IonContent, IonHeader,IonIcon, IonItem, IonLabel, IonPage, IonSelect, IonSelectOption, IonTitle, IonToolbar, IonList } from '@ionic/vue';
import { defineComponent } from 'vue';
import { ellipsisVertical, personCircleOutline, storefrontOutline} from 'ionicons/icons'
import { mapGetters, useStore } from 'vuex';
Expand All @@ -48,7 +48,8 @@ export default defineComponent({
IonSelect,
IonSelectOption,
IonTitle,
IonToolbar
IonToolbar,
IonList
},
computed: {
...mapGetters({
Expand Down
20 changes: 8 additions & 12 deletions src/views/Upload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,12 @@
</ion-item>
<ion-button fill="clear" @click="removeItem(product.sku)">{{ $t( "Remove" ) }}</ion-button>
</ion-card>
<ion-fab vertical="bottom" horizontal="end" slot="fixed">
<ion-fab id="upload-button" vertical="bottom" horizontal="end" slot="fixed">
<ion-fab-button @click="upload()">
<ion-icon :icon="cloudUploadOutline" />
</ion-fab-button>
</ion-fab>
</ion-content>

<ion-footer :translucent="true">
<ion-toolbar>
<tab-bar />
</ion-toolbar>
</ion-footer>
</ion-page>
</template>

Expand All @@ -62,12 +56,10 @@ import {
IonThumbnail,
IonTitle,
IonToolbar,
IonFooter
} from '@ionic/vue';
import { defineComponent } from 'vue';
import { colorPaletteOutline, resize, cloudUploadOutline } from 'ionicons/icons';
import { mapGetters, useStore } from 'vuex';
import TabBar from '@/components/TabBar.vue'
import { useRouter } from 'vue-router';

export default defineComponent({
Expand All @@ -87,9 +79,7 @@ export default defineComponent({
IonPage,
IonThumbnail,
IonTitle,
IonToolbar,
IonFooter,
TabBar
IonToolbar
},
computed: {
...mapGetters({
Expand Down Expand Up @@ -129,3 +119,9 @@ export default defineComponent({
},
});
</script>

<style scoped>
#upload-button {
bottom: 70px;
}
</style>