diff --git a/app/app.scss b/app/app.scss
index 397d2dc6..2052cb7f 100644
--- a/app/app.scss
+++ b/app/app.scss
@@ -56,10 +56,10 @@ Page {
background: $gray1;
}
.combination,
- .group-info,
.overviewItem,
.recipeItem,
- .textCard {
+ .textCard,
+ .titleContainer {
background: white;
}
TextField.combinationToken {
@@ -71,6 +71,7 @@ Page {
.time .bx {
color: $gray8;
}
+ .group-info,
.option .bx,
.option .info {
color: $gray7;
@@ -109,10 +110,6 @@ Page {
color: $gray1;
background: $gray9;
}
- // TabView {
- // tab-background-color: $gray9;
- // selected-tab-text-color: $gray1;
- // }
MDButton,
MDRipple {
ripple-color: rgba($gray4, 0.1);
@@ -128,18 +125,17 @@ Page {
.overviewItem,
.recipeItem,
.textCard,
+ .titleContainer,
TextField.combinationToken {
background: $gray8;
}
- .group-info {
- background: #111;
- }
.sd-group-header,
.sd-item,
.tag,
.time .bx {
color: $gray3;
}
+ .group-info,
.option .bx,
.option .info {
color: $gray5;
@@ -233,9 +229,6 @@ ActionBar {
MDButton.bx {
padding: 0;
margin: 0;
- &.flip {
- transform: scaleX(-1);
- }
}
.title {
padding-left: 12;
@@ -347,6 +340,19 @@ MDButton {
vertical-alignment: center;
}
}
+ .searchAll {
+ font-size: 14;
+ width: auto;
+ height: auto;
+ min-width: 0;
+ padding: 12;
+ border-radius: 4;
+ letter-spacing: 0;
+ // text-transform: none;
+ margin: 16;
+ color: $orange;
+ horizontal-alignment: center;
+ }
}
// -----------------------------
// Recipe Items
@@ -421,7 +427,7 @@ RadListView {
text-align: center;
padding: 16;
line-height: 6;
- margin-top: 8;
+ // margin-top: 8;
border-radius: 4;
}
.main-container {
@@ -449,7 +455,7 @@ RadListView {
width: 100%;
border-radius: 4;
.appIcon {
- height: 96;
+ height: 104;
}
}
// -----------------------------
@@ -512,6 +518,10 @@ RadListView {
.ingredient {
font-family: 'Orkney-Regular';
margin: 0 0 0 4;
+ color: blue;
+ }
+ .red {
+ color: red;
}
.count {
width: 24;
@@ -534,15 +544,11 @@ RadListView {
border-color: transparent;
}
.combination {
- margin: 8 8 0;
+ margin: 0 8 8;
border-radius: 4;
font-size: 14;
- .bx {
- font-size: 24;
- padding: 0 0 0 16;
- }
.combinationTitle {
- padding: 14 24;
+ padding: 14 16;
margin: 0;
line-height: 6;
}
@@ -624,21 +630,22 @@ MDButton.closeBtn {
font-size: 14;
padding: 0 0 0 16;
}
- MDRipple {
- background: white;
- }
- .recipes {
- margin: 0 8 8 16;
+ .recipe {
+ margin: 0 8;
+ .titleContainer {
+ border-radius: 4;
+ margin: 0 8 8;
+ }
.recipeTitle {
font-size: 14;
padding: 14 16;
line-height: 6;
}
}
- // .closeBtn {
- // margin: 0 16 0 4;
- // vertical-alignment: top;
- // }
+ .closeBtn {
+ margin: 8 0;
+ vertical-alignment: top;
+ }
MDButton,
MDRipple {
ripple-color: rgba($gray6, 0.2);
@@ -657,6 +664,14 @@ MDButton.closeBtn {
color: $gray1;
background: $gray9;
}
+ .dialogIcon {
+ text-align: center;
+ padding: 32;
+ font-size: 48;
+ &.flip {
+ transform: scaleX(-1);
+ }
+ }
.dialogTitle {
line-height: 6;
padding: 24 24 16;
@@ -684,6 +699,18 @@ MDButton.closeBtn {
.actionsContainer {
padding: 8;
}
+ .shareItem {
+ border-radius: 4;
+ margin: 0 16 16;
+ android-elevation: 1;
+ text-align: center;
+ .bx {
+ padding: 16 0 0;
+ }
+ .item {
+ padding: 8 16 16;
+ }
+ }
.action {
font-size: 12;
padding: 12;
diff --git a/app/components/About.vue b/app/components/About.vue
deleted file mode 100644
index bd29bb22..00000000
--- a/app/components/About.vue
+++ /dev/null
@@ -1,148 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/components/App.vue b/app/components/App.vue
index 0d154196..e696d08f 100644
--- a/app/components/App.vue
+++ b/app/components/App.vue
@@ -1,4 +1,4 @@
-
+GroceryListcui
@@ -6,9 +6,9 @@
-
-
-
+
+
+
+ :hijackGlobalBackEvent="hijackGlobalBackEvent" :releaseGlobalBackEvent="releaseGlobalBackEvent"
+ @backToHome="backToHome"
+ />
@@ -87,9 +93,10 @@ import {
from "vuex"
import EnRecipes from "./EnRecipes"
import MealPlanner from "./MealPlanner"
+import GroceryList from "./GroceryList"
import Settings from "./Settings"
-import About from "./About"
import PromptDialog from "./modal/PromptDialog"
+let filterTimer;
export default {
data() {
return {
@@ -100,41 +107,37 @@ export default {
filterFavourites: false,
filterTrylater: false,
MealPlanner: MealPlanner,
+ GroceryList: GroceryList,
+ Settings: Settings,
topmenu: [ {
title: "EnRecipes",
component: "EnRecipes",
icon: "home",
}, {
- title: "Try Later",
+ title: "trylater",
component: "Try Later",
icon: "trylater",
}, {
- title: "Favourites",
+ title: "favourites",
component: "Favourites",
icon: "heart",
}, ],
- bottommenu: [ {
- title: "Settings",
- component: Settings,
- icon: "cog",
- }, {
- title: "About",
- component: About,
- icon: "info",
- }, ],
appTheme: "Light",
+ setFilter: true,
}
},
components: {
EnRecipes,
MealPlanner,
+ GroceryList,
+ Settings
},
computed: {
...mapState( [ "icon", "recipes", "cuisines", "categories", "yieldUnits", "mealPlans", "currentComponent" ] ),
getCurrentPath() {
let path = "/"
if ( this.selectedCuisine ) path += localize( this.selectedCuisine )
- else path = "Cuisines"
+ else path = "cuis"
if ( this.selectedCategory ) path += "/" + localize( this.selectedCategory )
if ( this.selectedTag ) path += "/" + localize( this.selectedTag )
return path;
@@ -153,22 +156,22 @@ export default {
}
},
cuisinesWithRecipes() {
- let arr = this.recipes.map( ( e ) => e.cuisine )
- return arr.length ? [ "All Cuisines", ...new Set( arr ) ] : []
+ let arr = this.recipes.map( ( e ) => e.cuisine ).sort()
+ return arr.length ? [ "allCuis", ...new Set( arr ) ] : []
},
categoriesWithRecipes() {
- let arr = this.recipes.map( e => ( this.selectedCuisine === "All Cuisines" || e.cuisine === this.selectedCuisine ) && e.category ).filter( e => e )
- return arr.length ? [ "All Categories", ...new Set( arr ) ] : []
+ let arr = this.recipes.map( e => ( this.selectedCuisine === "allCuis" || e.cuisine === this.selectedCuisine ) && e.category ).filter( e => e ).sort()
+ return arr.length ? [ "allCats", ...new Set( arr ) ] : []
},
tagsWithRecipes() {
let arr = this.recipes.map( e => {
- if ( this.selectedCuisine === "All Cuisines" && this.selectedCategory === "All Categories" && e.tags.length ) return e.tags;
- else if ( this.selectedCuisine === "All Cuisines" && e.category === this.selectedCategory && e.tags.length ) return e.tags;
- else if ( this.selectedCategory === "All Categories" && e.cuisine === this.selectedCuisine && e.tags.length ) return e.tags;
+ if ( this.selectedCuisine === "allCuis" && this.selectedCategory === "allCats" && e.tags.length ) return e.tags;
+ else if ( this.selectedCuisine === "allCuis" && e.category === this.selectedCategory && e.tags.length ) return e.tags;
+ else if ( this.selectedCategory === "allCats" && e.cuisine === this.selectedCuisine && e.tags.length ) return e.tags;
else if ( e.category === this.selectedCategory && e.cuisine === this.selectedCuisine && e.tags.length ) return e.tags;
- } ).flat().filter( e => e )
- let showAllTags = this.selectedCuisine === "All Cuisines" && this.selectedCategory === "All Categories"
- return arr.length ? [ !showAllTags && "All Tags", ...new Set( arr ) ].filter( e => e ) : []
+ } ).flat().filter( e => e ).sort()
+ let showAllTags = this.selectedCuisine === "allCuis" && this.selectedCategory === "allCats"
+ return arr.length ? [ !showAllTags && "allTs", ...new Set( arr ) ].filter( e => e ) : []
},
},
methods: {
@@ -183,36 +186,44 @@ export default {
},
// HELPERS
setRecipeFilter( item ) {
+ this.setFilter = this.filterFavourites = this.filterTrylater = false
this.$navigateBack( {
frame: "main-frame",
backstackVisible: false
} )
- this.filterFavourites = this.filterTrylater = false
- if ( this.selectedCuisine == null ) {
- this.selectedFilterType = 'category'
- this.selectedCuisine = item
- } else if ( this.selectedCategory == null ) {
- this.selectedFilterType = 'tag'
- this.selectedCategory = item
- if ( !this.tagsWithRecipes.length ) this.closeDrawer()
- } else {
- this.selectedTag = item;
- this.closeDrawer()
- }
- this.setCurrentComponentAction( "Filtered result" )
- this.$refs.enrecipes.updateFilter()
+ setTimeout( e => {
+ if ( this.selectedCuisine == null ) {
+ this.selectedCuisine = item
+ this.selectedFilterType = 'category'
+ } else if ( this.selectedCategory == null ) {
+ this.selectedCategory = item
+ this.selectedFilterType = 'tag'
+ if ( !this.tagsWithRecipes.length ) this.closeDrawer()
+ } else {
+ this.selectedTag = item;
+ this.closeDrawer()
+ }
+ this.setFilter = true
+ }, 200 )
+
+ clearTimeout( filterTimer )
+ filterTimer = setTimeout( e => {
+ this.setCurrentComponentAction( "Filtered recipes" )
+ this.$refs.enrecipes.updateFilter()
+ }, 750 )
},
previousRecipeFilter() {
if ( this.selectedCategory ) {
this.selectedFilterType = 'category'
this.selectedTag = this.selectedCategory = null
- this.setCurrentComponentAction( "Filtered result" )
+ this.setCurrentComponentAction( "Filtered recipes" )
} else {
this.selectedFilterType = 'cuisine'
this.selectedCuisine = null
this.setCurrentComponentAction( "EnRecipes" )
}
- this.$refs.enrecipes.updateFilter()
+ clearTimeout( filterTimer )
+ filterTimer = setTimeout( e => this.$refs.enrecipes.updateFilter(), 750 )
},
closeDrawer() {
this.$refs.drawer.nativeView.closeDrawer()
@@ -223,31 +234,31 @@ export default {
case 'EnRecipes':
count = this.recipes.length
break;
- case 'Try Later':
+ case 'trylater':
count = this.recipes.filter( e => !e.tried ).length
break;
- case 'Favourites':
+ case 'favourites':
count = this.recipes.filter( e => e.isFavorite ).length
break;
default: {
switch ( this.selectedFilterType ) {
case 'cuisine':
- count = this.recipes.filter( e => arg === "All Cuisines" ? e.cuisine : e.cuisine === arg ).length
+ count = this.recipes.filter( e => arg === "allCuis" ? e.cuisine : e.cuisine === arg ).length
break;
case 'category':
- count = this.recipes.filter( e => this.selectedCuisine === "All Cuisines" ? arg === "All Categories" ? e.category : e.category === arg : arg === "All Categories" ? e.cuisine === this.selectedCuisine && e.category : e.cuisine === this
+ count = this.recipes.filter( e => this.selectedCuisine === "allCuis" ? arg === "allCats" ? e.category : e.category === arg : arg === "allCats" ? e.cuisine === this.selectedCuisine && e.category : e.cuisine === this
.selectedCuisine && e.category === arg ).length
break;
case 'tag':
count = this.recipes.filter( e => {
- if ( this.selectedCuisine === "All Cuisines" && this.selectedCategory === "All Categories" ) {
- return e.tags.includes( arg ) || arg === "All Tags"
- } else if ( this.selectedCuisine === "All Cuisines" && e.category === this.selectedCategory ) {
- return e.tags.includes( arg ) || arg === "All Tags"
- } else if ( this.selectedCategory === "All Categories" && e.cuisine === this.selectedCuisine ) {
- return e.tags.includes( arg ) || arg === "All Tags"
+ if ( this.selectedCuisine === "allCuis" && this.selectedCategory === "allCats" ) {
+ return e.tags.includes( arg ) || arg === "allTs"
+ } else if ( this.selectedCuisine === "allCuis" && e.category === this.selectedCategory ) {
+ return e.tags.includes( arg ) || arg === "allTs"
+ } else if ( this.selectedCategory === "allCats" && e.cuisine === this.selectedCuisine ) {
+ return e.tags.includes( arg ) || arg === "allTs"
} else if ( e.category === this.selectedCategory && e.cuisine === this.selectedCuisine ) {
- return e.tags.includes( arg ) || arg === "All Tags"
+ return e.tags.includes( arg ) || arg === "allTs"
}
} ).length
break;
@@ -271,16 +282,19 @@ export default {
preventDefault()
this.closeDrawer()
} else if (
- [ "Favourites", "Try Later", "Filtered result" ].includes( this.currentComponent ) ) {
+ [ "Favourites", "Try Later", "Filtered recipes" ].includes( this.currentComponent ) ) {
preventDefault()
- this.setCurrentComponentAction( "EnRecipes" )
- this.filterFavourites = this.filterTrylater = false
- this.selectedTag = this.selectedCategory = this.selectedCuisine = null
- this.selectedFilterType = "cuisine"
- this.$refs.enrecipes.updateFilter()
+ this.backToHome()
this.releaseGlobalBackEvent()
}
},
+ backToHome() {
+ this.setCurrentComponentAction( "EnRecipes" )
+ this.filterFavourites = this.filterTrylater = false
+ this.selectedTag = this.selectedCategory = this.selectedCuisine = null
+ this.selectedFilterType = "cuisine"
+ this.$refs.enrecipes.updateFilter()
+ },
navigateTo( to, title, isTrueComponent ) {
if ( title !== this.currentComponent ) {
if ( isTrueComponent ) {
diff --git a/app/components/EditRecipe.vue b/app/components/EditRecipe.vue
index 8b56aa9b..a72abcc2 100644
--- a/app/components/EditRecipe.vue
+++ b/app/components/EditRecipe.vue
@@ -1,5 +1,5 @@
-
+
@@ -21,45 +21,45 @@
-
-
+
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
+
@@ -71,46 +71,46 @@
-
+
-
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -143,6 +143,10 @@ import {
localize
}
from "@nativescript/localize"
+import {
+ SnackBar
+} from '@nativescript-community/ui-material-snackbar';
+const snackbar = new SnackBar();
import {
mapState,
mapActions
@@ -159,7 +163,7 @@ export default {
props: [ "recipeID", "selectedCuisine", "selectedCategory", "selectedTag", "filterFavourites", "filterTrylater", "navigationFromView", ],
data() {
return {
- title: "New recipe",
+ title: "newRec",
viewIsScrolled: false,
recipeContent: {
imageSrc: null,
@@ -184,6 +188,7 @@ export default {
lastTried: null,
lastModified: null,
created: null,
+ inCart: false,
},
tempRecipeContent: {},
tags: undefined,
@@ -220,6 +225,10 @@ export default {
page.bindingContext = new Observable();
this.showFab = true
},
+ onPageUnload() {
+ this.releaseBackEvent()
+ snackbar.dismiss()
+ },
timeRequired( time ) {
let t = this.recipeContent[ time ].split( ":" )
let h = parseInt( t[ 0 ] )
@@ -268,7 +277,7 @@ export default {
let min = t[ 1 ]
this.$showModal( ListPicker, {
props: {
- title: `${time == "prepTime" ? "Preparation" : "Cooking"} time`,
+ title: `${time == "prepTime" ? "prepT" : "cookT"}`,
action: "SET",
selectedHr: hr,
selectedMin: min,
@@ -301,23 +310,24 @@ export default {
this.releaseBackEvent()
this.$showModal( ActionDialog, {
props: {
- title: "Cuisine",
+ title: "cui",
list: this.cuisines,
stretch: true,
- action: "ADD NEW",
+ action: "aNBtn",
+ helpIcon: 'cuisine',
},
} ).then( ( action ) => {
- if ( action == "ADD NEW" ) {
+ if ( action == "aNBtn" ) {
this.$showModal( PromptDialog, {
props: {
- title: "New cuisine",
- action: "ADD",
+ title: "newCui",
+ action: "aBtn",
+ helpIcon: 'cuisine',
},
} ).then( ( item ) => {
this.hijackBackEvent()
if ( item.length ) {
this.recipeContent.cuisine = item
- ApplicationSettings.setString( "previousCuisine", item )
this.addListItemAction( {
item,
listName: 'cuisines'
@@ -328,7 +338,6 @@ export default {
} )
} else if ( action ) {
this.recipeContent.cuisine = action
- ApplicationSettings.setString( "previousCuisine", action )
this.hijackBackEvent()
this.modalOpen = false
if ( focus ) this.autoFocusField( "category", false )
@@ -343,23 +352,24 @@ export default {
this.releaseBackEvent()
this.$showModal( ActionDialog, {
props: {
- title: "Category",
+ title: "cat",
list: this.categories,
stretch: true,
- action: "ADD NEW",
+ action: "aNBtn",
+ helpIcon: 'category',
},
} ).then( ( action ) => {
- if ( action == "ADD NEW" ) {
+ if ( action == "aNBtn" ) {
this.$showModal( PromptDialog, {
props: {
- title: "New category",
- action: "ADD",
+ title: "nwCat",
+ action: "aBtn",
+ helpIcon: 'category',
},
} ).then( ( item ) => {
this.hijackBackEvent()
if ( item.length ) {
this.recipeContent.category = item
- ApplicationSettings.setString( "previousCategory", item )
this.addListItemAction( {
item,
listName: 'categories'
@@ -370,7 +380,6 @@ export default {
} )
} else if ( action ) {
this.recipeContent.category = action
- ApplicationSettings.setString( "previousCategory", action )
this.hijackBackEvent()
this.modalOpen = false
if ( focus ) this.autoFocusField( "tags", true )
@@ -385,23 +394,24 @@ export default {
this.releaseBackEvent()
this.$showModal( ActionDialog, {
props: {
- title: "Yield measured in",
+ title: "yieldU",
list: this.yieldUnits,
stretch: true,
- action: "ADD NEW",
+ action: "aNBtn",
+ helpIcon: 'dish',
},
} ).then( ( action ) => {
- if ( action == "ADD NEW" ) {
+ if ( action == "aNBtn" ) {
this.$showModal( PromptDialog, {
props: {
- title: "New yield unit",
- action: "ADD",
+ title: "nwYiU",
+ action: "aBtn",
+ helpIcon: 'dish',
},
} ).then( ( item ) => {
this.hijackBackEvent()
if ( item.length ) {
this.recipeContent.yield.unit = item
- ApplicationSettings.setString( "previousYieldUnit", item )
this.addListItemAction( {
item,
listName: 'yieldUnits'
@@ -412,7 +422,6 @@ export default {
} )
} else if ( action ) {
this.recipeContent.yield.unit = action
- ApplicationSettings.setString( "previousYieldUnit", action )
this.hijackBackEvent()
this.modalOpen = false
if ( focus ) this.autoFocusField( "difficultyLevel", false )
@@ -430,6 +439,7 @@ export default {
title: "Difficulty level",
list: this.difficultyLevels,
stretch: false,
+ helpIcon: 'meter',
},
} ).then( ( action ) => {
if ( action ) {
@@ -448,18 +458,19 @@ export default {
this.releaseBackEvent()
this.$showModal( ActionDialog, {
props: {
- title: "Units",
+ title: "Unit",
list: this.units,
stretch: true,
- action: "ADD NEW",
+ action: "aNBtn",
+ helpIcon: 'ruler',
},
} ).then( ( action ) => {
- this.hijackBackEvent()
- if ( action == "ADD NEW" ) {
+ if ( action == "aNBtn" ) {
this.$showModal( PromptDialog, {
props: {
- title: "New unit",
- action: "ADD",
+ title: "newUnit",
+ action: "aBtn",
+ helpIcon: 'ruler',
},
} ).then( ( item ) => {
this.hijackBackEvent()
@@ -472,12 +483,11 @@ export default {
this.modalOpen = false
if ( focus && this.recipeContent.ingredients.length - 1 === index )
this.autoFocusRefField( 'ingredient', index )
-
-
}
} )
} else if ( action ) {
this.recipeContent.ingredients[ index ].unit = action
+ this.hijackBackEvent()
this.modalOpen = false
if ( focus && this.recipeContent.ingredients.length - 1 === index ) this.autoFocusRefField( 'ingredient', index )
}
@@ -514,10 +524,12 @@ export default {
this.blockModal = true
this.$showModal( ConfirmDialog, {
props: {
- title: "Unsaved changes",
- description: localize( "Are you sure you want to discard unsaved changes to this recipe?" ),
- cancelButtonText: "DISCARD",
- okButtonText: "KEEP EDITING",
+ title: "unsaved",
+ description: localize( "disc" ),
+ cancelButtonText: "disBtn",
+ okButtonText: "kEdit",
+ helpIcon: 'error',
+ bgColor: '#c92a2a',
},
} ).then( ( action ) => {
this.blockModal = false
@@ -550,9 +562,11 @@ export default {
this.blockModal = true
this.$showModal( ConfirmDialog, {
props: {
- title: "Recipe photo",
- cancelButtonText: "REMOVE",
- okButtonText: "REPLACE PHOTO",
+ title: "recPic",
+ cancelButtonText: "rBtn",
+ okButtonText: "repBtn",
+ helpIcon: 'image',
+ bgColor: '#adb5bd',
},
} ).then( ( action ) => {
this.blockModal = false
@@ -570,10 +584,12 @@ export default {
permissionConfirmation() {
return this.$showModal( ConfirmDialog, {
props: {
- title: "Grant permission",
- description: localize( "EnRecipes requires storage permission in order to set recipe photo." ),
- cancelButtonText: "NOT NOW",
- okButtonText: "CONTINUE",
+ title: "grant",
+ description: localize( "reqAcc" ),
+ cancelButtonText: "nNBtn",
+ okButtonText: "conBtn",
+ helpIcon: 'folder',
+ bgColor: '#ff5200',
},
} )
},
@@ -590,7 +606,7 @@ export default {
ApplicationSettings.setBoolean( "storagePermissionAsked", true )
break
case "denied":
- Toast.makeText( localize( "Permission denied" ) ).show()
+ Toast.makeText( localize( "dend" ) ).show()
break
default:
break
@@ -618,7 +634,7 @@ export default {
height: 1080,
}, {
hideBottomControls: true,
- toolbarTitle: localize( "Crop photo" ),
+ toolbarTitle: localize( "cPic" ),
statusBarColor: "#ff5200",
toolbarTextColor: this.appTheme == "light" ? "#212529" : "#f1f3f5",
toolbarColor: this.appTheme == "light" ? "#f1f3f5" : "#212529",
@@ -646,14 +662,16 @@ export default {
joinTags() {
this.tags = this.recipeContent.tags.join( " " )
},
- fieldDeletionConfirm( title ) {
- return this.$showModal( ConfirmDialog, {
- props: {
- title,
- cancelButtonText: "CANCEL",
- okButtonText: "REMOVE",
- },
- } )
+ undoDeletion( message ) {
+ return snackbar
+ .action( {
+ message,
+ textColor: this.appTheme == "light" ? "#f1f3f5" : "#212529",
+ actionTextColor: '#ff5200',
+ backgroundColor: this.appTheme == "light" ? "#212529" : "#f1f3f5",
+ actionText: 'Undo',
+ hideDelay: 5000
+ } )
},
addIngredient() {
let ingredients = this.recipeContent.ingredients
@@ -667,10 +685,11 @@ export default {
removeIngredient( index ) {
this.modalOpen = true
if ( this.recipeContent.ingredients[ index ].item.length ) {
- this.fieldDeletionConfirm( "Remove ingredient?" ).then( ( res ) => {
- if ( res ) {
- this.recipeContent.ingredients.splice( index, 1 )
- }
+ let item = this.recipeContent.ingredients[ index ]
+ this.recipeContent.ingredients.splice( index, 1 )
+ this.undoDeletion( `${this.$options.filters.L('rmIng')}` ).then( res => {
+ if ( res.command === 'action' )
+ this.recipeContent.ingredients.splice( index, 0, item )
} )
} else {
this.recipeContent.ingredients.splice( index, 1 )
@@ -682,15 +701,35 @@ export default {
},
removeInstruction( index ) {
if ( this.recipeContent.instructions[ index ].length ) {
- this.fieldDeletionConfirm( "Remove instruction?" ).then( ( res ) => {
- res && this.recipeContent.instructions.splice( index, 1 )
+ let item = this.recipeContent.instructions[ index ]
+ this.recipeContent.instructions.splice( index, 1 )
+ this.undoDeletion( `${this.$options.filters.L('rmIns')}` ).then( res => {
+ if ( res.command === 'action' ) {
+ this.recipeContent.instructions.splice( index, 0, item )
+ }
} )
} else this.recipeContent.instructions.splice( index, 1 )
},
+ addNote() {
+ this.recipeContent.notes.push( "" )
+ },
+ removeNote( index ) {
+ if ( this.recipeContent.notes[ index ].length ) {
+ let item = this.recipeContent.notes[ index ]
+ this.recipeContent.notes.splice( index, 1 )
+ this.undoDeletion( `${this.$options.filters.L('rmN')}` ).then( res => {
+ if ( res.command === 'action' ) {
+ this.recipeContent.notes.splice( index, 0, item )
+ }
+ } )
+ } else this.recipeContent.notes.splice( index, 1 )
+ },
getCombinationTitle( id ) {
return this.recipes.filter( ( e ) => e.id === id )[ 0 ].title
},
showCombinations() {
+ this.modalOpen = true
+ this.releaseBackEvent()
let existingCombinations = [ ...this.recipeContent.combinations,
this.recipeContent.id,
]
@@ -698,10 +737,12 @@ export default {
( e ) => !existingCombinations.includes( e.id ) )
this.$showModal( ActionDialogWithSearch, {
props: {
- title: "Select a recipe",
+ title: "selRec",
recipes: filteredRecipes,
+ helpIcon: 'outline',
},
} ).then( ( res ) => {
+ this.hijackBackEvent()
if ( res ) {
this.recipeContent.combinations.push( res )
}
@@ -709,26 +750,18 @@ export default {
},
removeCombination( id ) {
let index = this.recipeContent.combinations.indexOf( id )
- this.fieldDeletionConfirm( "Remove combination?" ).then( res => {
- if ( res ) {
- this.recipeContent.combinations.splice( index, 1 )
- this.unSyncCombinations.push( id )
+ this.recipeContent.combinations.splice( index, 1 )
+ this.unSyncCombinations.push( id )
+ this.undoDeletion( `${this.$options.filters.L('rmCmb')}` ).then( res => {
+ if ( res.command === 'action' ) {
+ console.log( this.recipeContent.combinations, index, id );
+ this.recipeContent.combinations.splice( index, 0, id )
}
} )
},
- addNote() {
- this.recipeContent.notes.push( "" )
- },
- removeNote( index ) {
- if ( this.recipeContent.notes[ index ].length ) {
- this.fieldDeletionConfirm( "Remove note?" ).then( ( res ) => {
- if ( res ) this.recipeContent.notes.splice( index, 1 )
- } )
- } else this.recipeContent.notes.splice( index, 1 )
- },
// SAVE OPERATION
clearEmptyFields() {
- if ( !this.recipeContent.title ) this.recipeContent.title = localize( "Untitled Recipe" )
+ if ( !this.recipeContent.title ) this.recipeContent.title = localize( "untRec" )
if ( !this.recipeContent.yield.quantity ) this.recipeContent.yield.quantity = 1
this.recipeContent.ingredients = this.recipeContent.ingredients.filter(
( e ) => e.item )
@@ -744,6 +777,9 @@ export default {
this.saving = this.modalOpen = true
this.clearEmptyFields()
this.recipeContent.lastModified = new Date()
+ ApplicationSettings.setString( "previousCuisine", this.recipeContent.cuisine )
+ ApplicationSettings.setString( "previousCategory", this.recipeContent.category )
+ ApplicationSettings.setString( "previousYieldUnit", this.recipeContent.yield.unit )
if ( this.cacheImagePath ) {
let recipeImage = path.join( knownFolders.documents().getFolder( "EnRecipes" ).getFolder( "Images" ).path, `${this.getRandomID()}.jpg` )
let binarySource = File.fromPath( this.cacheImagePath ).readSync()
@@ -787,16 +823,16 @@ export default {
setTimeout( ( e ) => {
this.setCurrentComponentAction( "EditRecipe" )
}, 500 )
- this.title = this.recipeID ? "Edit recipe" : "New recipe"
+ this.title = this.recipeID ? "editRec" : "newRec"
if ( this.recipeID ) {
let recipe = this.recipes.filter( ( e ) => e.id === this.recipeID )[ 0 ]
Object.assign( this.recipeContent, JSON.parse( JSON.stringify( recipe ) ) )
Object.assign( this.tempRecipeContent, JSON.parse( JSON.stringify( this.recipeContent ) ) )
if ( this.recipeContent.tags.length ) this.joinTags()
} else {
- this.recipeContent.cuisine = this.selectedCuisine ? /All/.test( this.selectedCuisine ) ? "Undefined" : this.selectedCuisine : ApplicationSettings.getString( "previousCuisine", "Undefined" )
- this.recipeContent.category = this.selectedCategory ? /All/.test( this.selectedCategory ) ? "Undefined" : this.selectedCategory : ApplicationSettings.getString( "previousCategory", "Undefined" )
- if ( this.selectedTag && !/All/.test( this.selectedTag ) ) {
+ this.recipeContent.cuisine = this.selectedCuisine ? /all/.test( this.selectedCuisine ) ? "Undefined" : this.selectedCuisine : ApplicationSettings.getString( "previousCuisine", "Undefined" )
+ this.recipeContent.category = this.selectedCategory ? /all/.test( this.selectedCategory ) ? "Undefined" : this.selectedCategory : ApplicationSettings.getString( "previousCategory", "Undefined" )
+ if ( this.selectedTag && !/all/.test( this.selectedTag ) ) {
this.tags = this.selectedTag
this.splitTags()
}
diff --git a/app/components/EnRecipes.vue b/app/components/EnRecipes.vue
index cda81426..23f6ee07 100644
--- a/app/components/EnRecipes.vue
+++ b/app/components/EnRecipes.vue
@@ -3,7 +3,7 @@
-
+
@@ -32,9 +32,9 @@
-
+
-
+
-
-
+
+
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
@@ -106,6 +99,7 @@
diff --git a/app/components/MealPlanner.vue b/app/components/MealPlanner.vue
index a542f4e8..3e710c00 100644
--- a/app/components/MealPlanner.vue
+++ b/app/components/MealPlanner.vue
@@ -1,9 +1,9 @@
-
+
-
+
@@ -13,13 +13,16 @@
-
@@ -51,6 +54,10 @@ import {
CalendarEvent
}
from "nativescript-ui-calendar"
+import {
+ SnackBar
+} from '@nativescript-community/ui-material-snackbar';
+const snackbar = new SnackBar();
import {
mapState,
mapActions
@@ -66,7 +73,6 @@ export default {
viewIsScrolled: false,
appTheme: "Light",
mealTimes: [ "breakfast", "lunch", "dinner", "snacks" ],
- eventList: [],
selectedDayMealPlans: [],
viewMode: CalendarViewMode.Month,
transitionMode: CalendarTransitionMode.Slide,
@@ -204,6 +210,9 @@ export default {
page.bindingContext = new Observable();
this.setCurrentComponentAction( "MealPlanner" )
},
+ onPageUnload(args){
+ snackbar.dismiss()
+ },
onCalendarLoad( args ) {
args.object.locale = `${Device.language}-${Device.language.toUpperCase()}`
args.object.monthViewStyle = this.monthViewStyle
@@ -233,7 +242,7 @@ export default {
},
getRecipeTitle( id ) {
let recipe = this.recipes.filter( ( e ) => e.id === id )[ 0 ]
- return recipe ? recipe.title : `[ ${this.$options.filters.L('Recipe not found')} ]`
+ return recipe ? recipe.title : `[ ${this.$options.filters.L('resNF')} ]`
},
// NAVIGATION HANDLERS
viewRecipe( recipeID ) {
@@ -253,21 +262,24 @@ export default {
let filteredRecipes = this.recipes.filter( ( e ) => this.getRecipes[ mealType ] ? !this.getRecipes[ mealType ].includes( e.id ) : true )
this.$showModal( ActionDialogWithSearch, {
props: {
- title: "Select a recipe",
+ title: "selRec",
recipes: filteredRecipes,
+ helpIcon: "calendar",
},
} ).then( ( recipeID ) => {
- recipeID && this.newEvent( recipeID, mealType )
+ recipeID && this.newEvent( recipeID, mealType, null )
} )
},
- removeRecipeConfirm( mealType ) {
- return this.$showModal( ConfirmDialog, {
- props: {
- title: `Remove recipe from ${mealType}?`,
- cancelButtonText: "CANCEL",
- okButtonText: "REMOVE",
- },
- } )
+ undoRemove( message ) {
+ return snackbar
+ .action( {
+ message,
+ textColor: this.appTheme == "Light" ? "#f1f3f5" : "#212529",
+ actionTextColor: '#ff5200',
+ backgroundColor: this.appTheme == "Light" ? "#212529" : "#f1f3f5",
+ actionText: 'Undo',
+ hideDelay: 5000
+ } )
},
removeRecipe( mealType, recipeID ) {
let startHour = {
@@ -276,16 +288,19 @@ export default {
dinner: 10,
snacks: 15,
}
- this.removeRecipeConfirm( mealType ).then( ( res ) => {
- if ( res ) {
- let actualMealPlan = this.selectedDayMealPlans.filter(
- ( e ) => e.startDate.getHours() === startHour[ mealType ] && e.title === recipeID )[ 0 ]
- let mealPlan = {
- title: actualMealPlan.title,
- startDate: actualMealPlan.startDate,
- }
- this.deleteMealPlanAction( mealPlan )
- this.updateSelectedDatePlans()
+ let actualMealPlan = this.selectedDayMealPlans.filter(
+ ( e ) => e.startDate.getHours() === startHour[ mealType ] && e.title === recipeID )[ 0 ]
+ let mealPlan = {
+ title: actualMealPlan.title,
+ startDate: actualMealPlan.startDate,
+ }
+ let index = this.mealPlans.findIndex( e =>
+ e.title === mealPlan.title && new Date( e.startDate ).getTime() === new Date( mealPlan.startDate ).getTime() )
+ this.deleteMealPlanAction( mealPlan )
+ this.updateSelectedDatePlans()
+ this.undoRemove( `${this.$options.filters.L('recRm')}` ).then( res => {
+ if ( res.command === 'action' ) {
+ this.newEvent( recipeID, mealType, index )
}
} )
},
@@ -300,7 +315,7 @@ export default {
this.selectedDate = args.date
this.selectedDayMealPlans = args.object.getEventsForDate( args.date )
},
- newEvent( recipeID, mealType ) {
+ newEvent( recipeID, mealType, index ) {
let date = new Date( this.selectedDate )
const selectedDate = () => {
return {
@@ -335,7 +350,8 @@ export default {
let event = new CalendarEvent( recipeID, mealTime[ mealType ].start, mealTime[ mealType ].end, false, new Color( this.color[ mealType ] ) )
this.addMealPlanAction( {
event,
- eventColor: this.color[ mealType ]
+ eventColor: this.color[ mealType ],
+ index
} )
this.updateSelectedDatePlans()
},
diff --git a/app/components/Settings.vue b/app/components/Settings.vue
index 8028d59a..90710ca6 100644
--- a/app/components/Settings.vue
+++ b/app/components/Settings.vue
@@ -8,12 +8,12 @@
-
+
-
+
@@ -26,28 +26,23 @@
-
-
+
-
-
+
+
-
+
-
-
+
+
@@ -58,33 +53,76 @@
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -92,6 +130,8 @@
diff --git a/app/components/ViewRecipe.vue b/app/components/ViewRecipe.vue
index 637147b8..f5690155 100644
--- a/app/components/ViewRecipe.vue
+++ b/app/components/ViewRecipe.vue
@@ -7,7 +7,7 @@
-
+
@@ -17,23 +17,23 @@
-
+
-
+
-
+
-
+
-
+
@@ -49,7 +49,7 @@
-
+
@@ -59,8 +59,8 @@
@@ -81,8 +81,8 @@
@@ -92,8 +92,8 @@
@@ -109,19 +109,18 @@
-
+
-
+
-
-
-
@@ -139,7 +137,7 @@
-
+
@@ -157,7 +155,7 @@
-
+
@@ -169,14 +167,13 @@
-
+
-
-
-
-
-
+
+
+
+
@@ -242,6 +239,8 @@ export default {
viewIsScrolled: false,
isScrolled: [ false, false, false, false, false, false ],
hideActionBar: false,
+ overviewTab: null,
+ checks: [],
}
},
computed: {
@@ -257,7 +256,7 @@ export default {
},
},
methods: {
- ...mapActions( [ "toggleStateAction", "setCurrentComponentAction", "overwriteRecipeAction", "setRecipeAsTriedAction", "setRatingAction" ] ),
+ ...mapActions( [ "toggleStateAction", "setCurrentComponentAction", "overwriteRecipeAction", "setRecipeAsTriedAction", "setRatingAction", "toggleCartAction" ] ),
onPageLoad( args ) {
const page = args.object;
page.bindingContext = new Observable();
@@ -274,6 +273,9 @@ export default {
feedback.hide()
this.keepScreenOn( false )
},
+ overviewLoaded( args ) {
+ this.overviewTab = args
+ },
// HELPERS
niceDates( time ) {
let lastTried = new Date( time ).getTime()
@@ -287,8 +289,8 @@ export default {
return localize( value )
}
return (
- ( diff < 86400 && lastTried > midnight && duration( "today" ) ) || ( dayDiff == 1 && "yesterday" ) || ( dayDiff < 7 && dayDiff + " " + duration( "days ago" ) ) || ( dayDiff < 31 && Math.round( dayDiff / 7 ) + " " + duration(
- "weeks ago" ) ) || ( dayDiff < 366 && Math.round( dayDiff / 30 ) + " " + duration( "months ago" ) ) || ( dayDiff > 365 && duration( "long time ago" ) ) )
+ ( diff < 86400 && lastTried > midnight && duration( "today" ) ) || ( dayDiff == 1 && "yesterday" ) || ( dayDiff < 7 && dayDiff + " " + duration( "dAgo" ) ) || ( dayDiff < 31 && Math.round( dayDiff / 7 ) + " " + duration(
+ "wAgo" ) ) || ( dayDiff < 366 && Math.round( dayDiff / 30 ) + " " + duration( "mAgo" ) ) || ( dayDiff > 365 && duration( "ltAgo" ) ) )
},
selectedIndexChange( args ) {
this.selectedTabIndex = args.object.selectedIndex
@@ -296,7 +298,7 @@ export default {
},
showLastTried() {
feedback.show( {
- title: `${localize('You tried this recipe:')} ${this.niceDates(
+ title: `${localize('triedInfo')} ${this.niceDates(
this.recipe.lastTried
)}`,
titleColor: new Color( `${this.isLightMode ? "#f1f3f5" : "#212529"}` ),
@@ -348,6 +350,10 @@ export default {
recipe: this.recipe,
} )
},
+ checkChange( args, index ) {
+ let check = args.object
+ this.checks[ index ] = !this.checks[ index ]
+ },
// NAVIGATION HANDLERS
onScroll( args ) {
this.viewIsScrolled = this.isScrolled[ this.selectedTabIndex ] = args.scrollY > 8 ? true : false
@@ -369,6 +375,7 @@ export default {
this.currentRecipeID = combination
this.syncCombinations()
this.selectedTabIndex = 0
+ this.overviewTab.object.scrollToVerticalOffset( 0, true )
setTimeout(
( e ) => this.recipe.tried && this.recipe.lastTried && this.showLastTried(), 500 )
},
@@ -377,7 +384,8 @@ export default {
if ( this.recipe.imageSrc ) {
this.$showModal( ShareChooser, {
props: {
- title: "Share",
+ title: "shr",
+ helpIcon: 'share',
},
} ).then( ( result ) => {
switch ( result ) {
@@ -400,12 +408,12 @@ export default {
shareRecipe() {
let overview = `${
this.recipe.title
- }\n\n${localize( "Cuisine" )}: ${localize( this.recipe.cuisine)}\n${localize( "Category" )}: ${localize( this.recipe.category)}\n${localize( "Tags" )}: ${this.recipe.tags.join(", ")}\n${localize( "Star rating" )}: ${this.recipe.rating}\n${localize( "Difficulty level" )}: ${localize( this.recipe.difficulty)}\n${localize("Preparation time")}: ${this.formattedTime(
+ }\n\n${localize( "Cuisine" )}: ${localize( this.recipe.cuisine)}\n${localize( "Category" )}: ${localize( this.recipe.category)}\n${localize( "ts" )}: ${this.recipe.tags.join(", ")}\n${localize( "stars" )}: ${this.recipe.rating}\n${localize( "Difficulty level" )}: ${localize( this.recipe.difficulty)}\n${localize("Preparation time")}: ${this.formattedTime(
this.recipe.prepTime
)}\n${localize( "Cooking time" )}: ${this.formattedTime(this.recipe.cookTime)}\n`
let shareContent = overview
if ( this.recipe.ingredients.length ) {
- let ingredients = `\n\n${localize( "Ingredients" )} (${
+ let ingredients = `\n\n${localize( "ings" )} (${
this.yieldMultiplier
} ${localize( this.recipe.yield.unit )}):\n\n`
this.recipe.ingredients.forEach( ( e ) => {
@@ -425,20 +433,20 @@ export default {
shareContent += instructions
}
if ( this.recipe.notes.length ) {
- let notes = `\n${localize( "Notes" )}:\n\n`
+ let notes = `\n${localize( "nos" )}:\n\n`
this.recipe.notes.forEach( ( e, i ) => {
notes += `${i + 1}. ${e}\n\n`
} )
shareContent += notes
}
if ( this.recipe.combinations.length ) {
- let combinations = `\n${localize( "Combinations" )}:\n\n`
+ let combinations = `\n${localize( "cmbs" )}:\n\n`
this.recipe.combinations.forEach( ( e, i ) => {
combinations += `${i + 1}. ${this.getCombinationTitle(e)}\n\n`
} )
shareContent += combinations
}
- let sharenote = '\n' + localize( "Shared via EnRecipes. Get it on Play Store or F-Droid." )
+ let sharenote = '\n' + localize( "appCrd" )
shareContent += sharenote
SocialShare.shareText( shareContent, "Share recipe using" )
},
@@ -452,11 +460,11 @@ export default {
} )
},
toggleFavourite() {
- this.recipe.isFavorite ? Toast.makeText( localize( "Removed from Favourites" ) ).show() : Toast.makeText( localize( "Added to Favourites" ) ).show()
+ this.recipe.isFavorite ? Toast.makeText( localize( "unfavd" ) ).show() : Toast.makeText( localize( "favd" ) ).show()
this.toggle( "isFavorite" )
},
toggleTrylater() {
- this.recipe.tried ? Toast.makeText( localize( "Added to Try Later" ) ).show() : Toast.makeText( localize( "Removed from Try Later" ) ).show()
+ this.recipe.tried ? Toast.makeText( localize( "aTry" ) ).show() : Toast.makeText( localize( "rmTry" ) ).show()
this.toggle( "tried" )
},
recipeTried() {
@@ -476,6 +484,18 @@ export default {
} )
}
},
+ // SHOPPINGLIST
+ toggleCart() {
+ if ( !this.recipe.inCart ) {
+
+ } else {
+
+ }
+ this.toggleCartAction( {
+ id: this.currentRecipeID,
+ recipe: this.recipe,
+ } )
+ },
// NOTES
createNote( note, i ) {
const vm = this
@@ -527,6 +547,7 @@ export default {
},
created() {
this.recipe = this.recipes.filter( ( e ) => e.id === this.currentRecipeID )[ 0 ]
+ this.checks = this.recipe.ingredients.map( e => true )
},
mounted() {
this.showFab = true
diff --git a/app/components/modal/ActionDialog.vue b/app/components/modal/ActionDialog.vue
index 0680699d..f589710b 100644
--- a/app/components/modal/ActionDialog.vue
+++ b/app/components/modal/ActionDialog.vue
@@ -1,16 +1,17 @@
-
-
-
+
+
+
+
-
-
+
-
+
@@ -18,8 +19,7 @@