2020-09-15 11:10:16 +00:00
|
|
|
<template>
|
|
|
|
<Page actionBarHidden="true">
|
|
|
|
<RadSideDrawer
|
|
|
|
ref="drawer"
|
|
|
|
allowEdgeSwipe="true"
|
2020-10-14 19:32:32 +00:00
|
|
|
drawerContentSize="270"
|
2020-09-15 11:10:16 +00:00
|
|
|
showOverNavigation="true"
|
|
|
|
gesturesEnabled="true"
|
|
|
|
drawerTransition="RevealTransition"
|
|
|
|
>
|
|
|
|
<GridLayout
|
|
|
|
rows="auto, auto, *, auto, auto"
|
|
|
|
columns="*"
|
|
|
|
~drawerContent
|
|
|
|
padding="8"
|
2020-10-14 19:32:32 +00:00
|
|
|
class="sd"
|
2020-09-15 11:10:16 +00:00
|
|
|
>
|
|
|
|
<StackLayout row="0">
|
|
|
|
<StackLayout
|
2020-10-14 19:32:32 +00:00
|
|
|
@tap="localNavigation('EnRecipes', 'EnRecipes', true, false)"
|
2020-09-15 11:10:16 +00:00
|
|
|
orientation="horizontal"
|
2020-10-14 19:32:32 +00:00
|
|
|
class="sd-item orkm"
|
2020-09-15 11:10:16 +00:00
|
|
|
:class="{
|
2020-10-14 19:32:32 +00:00
|
|
|
'selected-sd-item':
|
|
|
|
currentComponent === 'EnRecipes' &&
|
2020-09-15 11:10:16 +00:00
|
|
|
!filterFavorites &&
|
|
|
|
!selectedCategory,
|
|
|
|
}"
|
|
|
|
>
|
|
|
|
<Label class="bx" :text="icon.home" margin="0 24 0 0" />
|
2020-10-14 19:32:32 +00:00
|
|
|
<Label verticalAlignment="center" text="Home" />
|
2020-09-15 11:10:16 +00:00
|
|
|
</StackLayout>
|
|
|
|
<StackLayout
|
2020-10-14 19:32:32 +00:00
|
|
|
@tap="localNavigation('Favorites', 'Favorites', true, false)"
|
2020-09-15 11:10:16 +00:00
|
|
|
orientation="horizontal"
|
2020-10-14 19:32:32 +00:00
|
|
|
class="sd-item orkm"
|
|
|
|
:class="{
|
|
|
|
'selected-sd-item':
|
|
|
|
currentComponent === 'EnRecipes' && filterFavorites,
|
|
|
|
}"
|
2020-09-15 11:10:16 +00:00
|
|
|
>
|
|
|
|
<Label class="bx" :text="icon.heart" margin="0 24 0 0" />
|
2020-10-14 19:32:32 +00:00
|
|
|
<Label verticalAlignment="center" text="Favorites" />
|
2020-09-15 11:10:16 +00:00
|
|
|
</StackLayout>
|
|
|
|
</StackLayout>
|
|
|
|
<StackLayout
|
|
|
|
orientation="horizontal"
|
|
|
|
row="1"
|
2020-10-14 19:32:32 +00:00
|
|
|
class="sd-group-header orkr"
|
2020-09-15 11:10:16 +00:00
|
|
|
>
|
|
|
|
<Label text="Categories" />
|
|
|
|
</StackLayout>
|
2020-10-14 19:32:32 +00:00
|
|
|
<ScrollView row="2" scrollBarIndicatorVisible="false">
|
2020-09-15 11:10:16 +00:00
|
|
|
<StackLayout>
|
|
|
|
<StackLayout
|
2020-10-14 19:32:32 +00:00
|
|
|
@tap="localNavigation(item, item, false, true)"
|
2020-09-15 11:10:16 +00:00
|
|
|
v-for="(item, index) in categories"
|
|
|
|
:key="index"
|
|
|
|
orientation="horizontal"
|
2020-10-14 19:32:32 +00:00
|
|
|
class="sd-item orkm"
|
2020-09-15 18:04:33 +00:00
|
|
|
:class="{
|
2020-10-14 19:32:32 +00:00
|
|
|
'selected-sd-item':
|
|
|
|
currentComponent === 'EnRecipes' && selectedCategory == item,
|
2020-09-15 18:04:33 +00:00
|
|
|
}"
|
2020-09-15 11:10:16 +00:00
|
|
|
>
|
|
|
|
<Label class="bx" :text="icon.label" margin="0 24 0 0" />
|
2020-10-14 19:32:32 +00:00
|
|
|
<Label verticalAlignment="center" :text="item" />
|
2020-09-15 11:10:16 +00:00
|
|
|
</StackLayout>
|
|
|
|
</StackLayout>
|
|
|
|
</ScrollView>
|
|
|
|
|
|
|
|
<StackLayout row="3" class="hr m-10"></StackLayout>
|
|
|
|
<StackLayout row="4">
|
|
|
|
<StackLayout
|
2020-10-14 19:32:32 +00:00
|
|
|
@tap="navigateTo(item.component, item.title)"
|
2020-09-15 11:10:16 +00:00
|
|
|
v-for="(item, index) in bottommenu"
|
|
|
|
:key="index"
|
|
|
|
orientation="horizontal"
|
2020-10-14 19:32:32 +00:00
|
|
|
class="sd-item orkm"
|
2020-09-15 18:04:33 +00:00
|
|
|
:class="{
|
2020-10-14 19:32:32 +00:00
|
|
|
'selected-sd-item': currentComponent == item.title,
|
2020-09-15 18:04:33 +00:00
|
|
|
}"
|
2020-09-15 11:10:16 +00:00
|
|
|
>
|
2020-10-14 19:32:32 +00:00
|
|
|
<Label class="bx" :text="icon[item.icon]" margin="0 24 0 0" />
|
|
|
|
<Label verticalAlignment="center" :text="item.title" />
|
2020-09-15 11:10:16 +00:00
|
|
|
</StackLayout>
|
|
|
|
</StackLayout>
|
|
|
|
</GridLayout>
|
|
|
|
|
|
|
|
<GridLayout ~mainContent rows="*" columns="*">
|
2020-10-14 19:32:32 +00:00
|
|
|
<Frame id="main-frame">
|
|
|
|
<!-- Home -->
|
|
|
|
<EnRecipes
|
|
|
|
:selectedCategory="selectedCategory"
|
|
|
|
:filterFavorites="filterFavorites"
|
|
|
|
:title="title"
|
|
|
|
:showDrawer="showDrawer"
|
|
|
|
/>
|
2020-09-15 11:10:16 +00:00
|
|
|
</Frame>
|
|
|
|
</GridLayout>
|
|
|
|
</RadSideDrawer>
|
|
|
|
</Page>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import * as utils from "tns-core-modules/utils/utils"
|
|
|
|
import { isAndroid } from "tns-core-modules/platform"
|
|
|
|
import * as application from "tns-core-modules/application"
|
|
|
|
|
2020-10-14 19:32:32 +00:00
|
|
|
import EnRecipes from "./EnRecipes.vue"
|
|
|
|
import Settings from "./Settings.vue"
|
|
|
|
import About from "./About.vue"
|
2020-09-15 11:10:16 +00:00
|
|
|
|
2020-10-14 19:32:32 +00:00
|
|
|
import { mapState } from "vuex"
|
2020-09-15 11:10:16 +00:00
|
|
|
|
|
|
|
let page
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
EnRecipes,
|
|
|
|
Settings,
|
|
|
|
About,
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
title: "EnRecipes",
|
|
|
|
selectedCategory: null,
|
|
|
|
filterFavorites: false,
|
|
|
|
searchQuery: "",
|
|
|
|
showSearch: false,
|
2020-10-14 19:32:32 +00:00
|
|
|
currentComponent: "EnRecipes",
|
2020-09-15 11:10:16 +00:00
|
|
|
bottommenu: [
|
|
|
|
{
|
|
|
|
title: "Settings",
|
2020-10-14 19:32:32 +00:00
|
|
|
component: Settings,
|
|
|
|
icon: "cog",
|
2020-09-15 11:10:16 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: "About",
|
2020-10-14 19:32:32 +00:00
|
|
|
component: About,
|
|
|
|
icon: "info",
|
2020-09-15 11:10:16 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
2020-10-14 19:32:32 +00:00
|
|
|
...mapState(["recipes", "icon"]),
|
2020-09-15 11:10:16 +00:00
|
|
|
categories() {
|
|
|
|
let arr = this.recipes.map((e) => {
|
|
|
|
return e.category
|
|
|
|
})
|
|
|
|
return [...new Set(arr)]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
2020-09-15 18:04:33 +00:00
|
|
|
highlight(args) {
|
|
|
|
let temp = args.object.className
|
|
|
|
args.object.className = `${temp} option-highlight`
|
|
|
|
setTimeout(() => {
|
|
|
|
args.object.className = temp
|
|
|
|
}, 100)
|
|
|
|
},
|
2020-10-14 19:32:32 +00:00
|
|
|
|
|
|
|
// Navigation
|
2020-09-15 11:10:16 +00:00
|
|
|
setSelectedCategory(e) {
|
|
|
|
this.selectedCategory = e.item
|
|
|
|
this.closeDrawer()
|
|
|
|
},
|
|
|
|
removeBackEvent() {
|
|
|
|
application.android.off(
|
|
|
|
application.AndroidApplication.activityBackPressedEvent,
|
|
|
|
this.backEvent
|
|
|
|
)
|
|
|
|
},
|
|
|
|
backEvent(args) {
|
2020-10-14 19:32:32 +00:00
|
|
|
args.cancel = true
|
|
|
|
if (this.$refs.drawer.nativeView.getIsOpen()) this.closeDrawer()
|
|
|
|
else if (this.currentComponent !== "EnRecipes") {
|
|
|
|
this.$navigateBack({ frame: "main-frame" })
|
2020-09-15 11:10:16 +00:00
|
|
|
this.currentComponent = "EnRecipes"
|
2020-10-14 19:32:32 +00:00
|
|
|
} else if (this.filterFavorites || this.selectedCategory) {
|
2020-09-15 11:10:16 +00:00
|
|
|
this.title = "EnRecipes"
|
2020-10-14 19:32:32 +00:00
|
|
|
this.filterFavorites = false
|
|
|
|
this.selectedCategory = null
|
2020-09-15 11:10:16 +00:00
|
|
|
this.removeBackEvent()
|
|
|
|
}
|
|
|
|
},
|
2020-10-14 19:32:32 +00:00
|
|
|
localNavigation(to, title, filter, filterCategory) {
|
|
|
|
// navigateBackToHome
|
2020-09-15 11:10:16 +00:00
|
|
|
application.android.on(
|
|
|
|
application.AndroidApplication.activityBackPressedEvent,
|
|
|
|
this.backEvent
|
|
|
|
)
|
2020-10-14 19:32:32 +00:00
|
|
|
if (this.currentComponent !== "EnRecipes") {
|
|
|
|
this.currentComponent = "EnRecipes"
|
|
|
|
this.$navigateBack({ frame: "main-frame" })
|
|
|
|
}
|
2020-09-15 11:10:16 +00:00
|
|
|
this.filterFavorites = false
|
|
|
|
this.selectedCategory = null
|
2020-10-14 19:32:32 +00:00
|
|
|
this.title = title
|
|
|
|
console.log(title)
|
2020-09-15 11:10:16 +00:00
|
|
|
if (filter) {
|
2020-10-14 19:32:32 +00:00
|
|
|
if (to === "Favorites") this.filterFavorites = true
|
|
|
|
} else if (filterCategory) this.selectedCategory = to
|
|
|
|
if (!this.filterFavorites && !this.selectedCategory)
|
|
|
|
this.removeBackEvent()
|
|
|
|
this.closeDrawer()
|
|
|
|
},
|
|
|
|
navigateTo(to, title) {
|
|
|
|
this.currentComponent = title
|
|
|
|
this.$navigateTo(to, {
|
|
|
|
frame: "main-frame",
|
|
|
|
// transition: {
|
|
|
|
// name: "slide",
|
|
|
|
// duration: 250,
|
|
|
|
// curve: "easeIn",
|
|
|
|
// },
|
|
|
|
props: {
|
|
|
|
highlight: this.highlight,
|
|
|
|
viewIsScrolled: this.viewIsScrolled,
|
|
|
|
showDrawer: this.showDrawer,
|
|
|
|
title,
|
|
|
|
},
|
|
|
|
backstackVisible: false,
|
|
|
|
})
|
2020-09-15 11:10:16 +00:00
|
|
|
this.closeDrawer()
|
|
|
|
},
|
2020-10-14 19:32:32 +00:00
|
|
|
showDrawer() {
|
|
|
|
this.$refs.drawer.nativeView.showDrawer()
|
|
|
|
},
|
2020-09-15 11:10:16 +00:00
|
|
|
closeDrawer() {
|
2020-10-14 19:32:32 +00:00
|
|
|
this.$refs.drawer.nativeView.closeDrawer()
|
2020-09-15 11:10:16 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
2020-10-14 19:32:32 +00:00
|
|
|
.noResults {
|
|
|
|
width: 100%;
|
|
|
|
padding: 16;
|
2020-09-15 11:10:16 +00:00
|
|
|
font-size: 16;
|
2020-10-14 19:32:32 +00:00
|
|
|
line-height: 8;
|
2020-09-15 11:10:16 +00:00
|
|
|
}
|
2020-10-14 19:32:32 +00:00
|
|
|
.swipe-item {
|
|
|
|
margin: 0 8;
|
|
|
|
background: #ff7043;
|
|
|
|
color: #fff;
|
|
|
|
height: 128;
|
|
|
|
border-radius: 6;
|
2020-09-15 11:10:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#btnFabContainer {
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
}
|
2020-10-14 19:32:32 +00:00
|
|
|
.btnFab {
|
2020-09-15 11:10:16 +00:00
|
|
|
width: 56;
|
|
|
|
height: 56;
|
|
|
|
padding: 16;
|
|
|
|
background-color: #ff7043;
|
2020-10-14 19:32:32 +00:00
|
|
|
color: #fff;
|
2020-09-15 11:10:16 +00:00
|
|
|
border-radius: 28;
|
|
|
|
text-align: center;
|
|
|
|
}
|
2020-10-14 19:32:32 +00:00
|
|
|
// prettier-ignore
|
|
|
|
Button {
|
|
|
|
color: #ff7043;
|
|
|
|
}
|
2020-09-15 11:10:16 +00:00
|
|
|
</style>
|