test build

This commit is contained in:
vishnuraghavb 2021-04-14 19:08:22 +05:30
parent 8189d481e6
commit 6fd6b006ba
7 changed files with 80 additions and 40 deletions

View file

@ -46,15 +46,34 @@
</Page> </Page>
</template> </template>
<script> <script lang="ts">
import { Screen } from "@nativescript/core"; import { Screen } from "@nativescript/core";
import { localize } from "@nativescript/localize"; import { localize } from "@nativescript/localize";
import { mapState, mapActions } from "vuex"; import { mapState, mapActions } from "vuex";
import ConfirmDialog from "./ConfirmDialog.vue"; import ConfirmDialog from "./ConfirmDialog.vue";
interface IData {
newList: unknown[];
stretch: boolean;
listHeight: number;
}
export default { export default {
props: ["title", "list", "action"], props: {
data() { title: {
type: String,
required: true,
},
list: {
type: Array,
required: true,
},
action: {
type: String,
required: false,
},
},
data(): IData {
return { return {
newList: this.list, newList: this.list,
stretch: false, stretch: false,
@ -66,14 +85,13 @@ export default {
}, },
methods: { methods: {
...mapActions(["removeListItemAction"]), ...mapActions(["removeListItemAction"]),
localized(item) { localized(item: string): string {
if (this.title !== "lang") return localize(item); return this.title !== "lang" ? localize(item) : item;
else return item;
}, },
tapAction(item) { tapAction(item: string): void {
this.$modal.close(item); this.$modal.close(item);
}, },
deletionConfirmation(type, description) { deletionConfirmation(description: string): void {
return this.$showModal(ConfirmDialog, { return this.$showModal(ConfirmDialog, {
props: { props: {
title: "conf", title: "conf",
@ -83,14 +101,12 @@ export default {
}, },
}); });
}, },
removeItem(item) { removeItem(item: string): void {
let vm = this; let vm = this;
function removeListItem(listName: string, desc: string): void {
function removeListItem(type, listName, desc) {
vm.deletionConfirmation( vm.deletionConfirmation(
type,
`${localize(desc)} "${localize(item)}"\n\n${localize("rmLIInfo")}` `${localize(desc)} "${localize(item)}"\n\n${localize("rmLIInfo")}`
).then((action) => { ).then((action: boolean) => {
if (action != null && action) if (action != null && action)
vm.removeListItemAction({ vm.removeListItemAction({
item, item,
@ -100,20 +116,20 @@ export default {
} }
switch (this.title) { switch (this.title) {
case "cui": case "cui":
removeListItem("cuisine", "cuisines", "rmCuiInfo"); removeListItem("cuisines", "rmCuiInfo");
break; break;
case "cat": case "cat":
removeListItem("category", "categories", "rmCatInfo"); removeListItem("categories", "rmCatInfo");
break; break;
case "yieldU": case "yieldU":
removeListItem("yield unit", "yieldUnits", "rmYUInfo"); removeListItem("yieldUnits", "rmYUInfo");
break; break;
case "Unit": case "Unit":
removeListItem("unit", "units", "rmUInfo"); removeListItem("units", "rmUInfo");
break; break;
} }
}, },
touch({ object, action }) { touch({ object, action }): void {
object.className = action.match(/down|move/) object.className = action.match(/down|move/)
? "listItem fade" ? "listItem fade"
: "listItem"; : "listItem";

View file

@ -31,10 +31,27 @@
</Page> </Page>
</template> </template>
<script> <script lang="ts">
import { mapState } from "vuex"; import { mapState } from "vuex";
export default { export default {
props: ["title", "description", "cancelButtonText", "okButtonText"], props: {
title: {
type: String,
required: true,
},
description: {
type: String,
required: true,
},
cancelButtonText: {
type: String,
required: true,
},
okButtonText: {
type: String,
required: true,
},
},
computed: { computed: {
...mapState(["icon", "appTheme"]), ...mapState(["icon", "appTheme"]),
}, },

View file

@ -9,7 +9,7 @@ on(launchEvent, (args) => {
} }
}) })
import Vue from 'nativescript-vue' import Vue from 'nativescript-vue'
import EnRecipes from './components/EnRecipes' import EnRecipes from './components/EnRecipes.vue'
import store from './store' import store from './store'
import CollectionView from '@nativescript-community/ui-collectionview/vue' import CollectionView from '@nativescript-community/ui-collectionview/vue'

View file

@ -1,13 +1,8 @@
import Vue from 'vue' import Vue from 'nativescript-vue'
import Vuex from 'vuex' import Vuex from 'vuex'
Vue.use(Vuex) Vue.use(Vuex)
import { CouchBase } from '@triniwiz/nativescript-couchbase' import { CouchBase } from '@triniwiz/nativescript-couchbase'
import { import { getFileAccess, File, ApplicationSettings } from '@nativescript/core'
Application,
getFileAccess,
File,
ApplicationSettings,
} from '@nativescript/core'
const EnRecipesDB = new CouchBase('EnRecipes') const EnRecipesDB = new CouchBase('EnRecipes')
const userCuisinesDB = new CouchBase('userCuisines') const userCuisinesDB = new CouchBase('userCuisines')
const userCategoriesDB = new CouchBase('userCategories') const userCategoriesDB = new CouchBase('userCategories')

30
package-lock.json generated
View file

@ -27,7 +27,8 @@
"@types/node": "^14.14.37", "@types/node": "^14.14.37",
"nativescript-vue-template-compiler": "~2.9.0", "nativescript-vue-template-compiler": "~2.9.0",
"sass": "^1.32.8", "sass": "^1.32.8",
"typescript": "^4.2.4" "typescript": "^4.2.4",
"vue": "^2.6.12"
} }
}, },
"node_modules/@babel/code-frame": { "node_modules/@babel/code-frame": {
@ -1843,9 +1844,9 @@
"dev": true "dev": true
}, },
"node_modules/electron-to-chromium": { "node_modules/electron-to-chromium": {
"version": "1.3.715", "version": "1.3.716",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.715.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.716.tgz",
"integrity": "sha512-VCWxo9RqTYhcCsHtG+l0TEOS6H5QmO1JyVCQB9nv8fllmAzj1VcCYH3qBCXP75/En6FeoepefnogLPE+5W7OiQ==", "integrity": "sha512-yUWKAfpJH5ovgwIlNbBHioedAWolzTVl6tmMaXP1RmCMyYv+U+ukvo9gwA10mLW0eFbyW4n/oC4UIN12gTMn/w==",
"dev": true "dev": true
}, },
"node_modules/emoji-regex": { "node_modules/emoji-regex": {
@ -2991,8 +2992,7 @@
"node_modules/nativescript-vue": { "node_modules/nativescript-vue": {
"version": "2.9.0", "version": "2.9.0",
"resolved": "https://registry.npmjs.org/nativescript-vue/-/nativescript-vue-2.9.0.tgz", "resolved": "https://registry.npmjs.org/nativescript-vue/-/nativescript-vue-2.9.0.tgz",
"integrity": "sha512-bu7ifi/953805c6dwEsiPgkPadEdsCqAZVgqe0ir7kBpdEkiodVuDtEb8F8n9c36ka8zqWw9GBx+STCe19hg2Q==", "integrity": "sha512-bu7ifi/953805c6dwEsiPgkPadEdsCqAZVgqe0ir7kBpdEkiodVuDtEb8F8n9c36ka8zqWw9GBx+STCe19hg2Q=="
"license": "MIT"
}, },
"node_modules/nativescript-vue-template-compiler": { "node_modules/nativescript-vue-template-compiler": {
"version": "2.9.0", "version": "2.9.0",
@ -4303,6 +4303,12 @@
"integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==",
"dev": true "dev": true
}, },
"node_modules/vue": {
"version": "2.6.12",
"resolved": "https://registry.npmjs.org/vue/-/vue-2.6.12.tgz",
"integrity": "sha512-uhmLFETqPPNyuLLbsKz6ioJ4q7AZHzD8ZVFNATNyICSZouqP2Sz0rotWQC8UNBF6VGSCs5abnKJoStA6JbCbfg==",
"dev": true
},
"node_modules/vue-hot-reload-api": { "node_modules/vue-hot-reload-api": {
"version": "2.3.4", "version": "2.3.4",
"resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.4.tgz", "resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.4.tgz",
@ -6235,9 +6241,9 @@
"dev": true "dev": true
}, },
"electron-to-chromium": { "electron-to-chromium": {
"version": "1.3.715", "version": "1.3.716",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.715.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.716.tgz",
"integrity": "sha512-VCWxo9RqTYhcCsHtG+l0TEOS6H5QmO1JyVCQB9nv8fllmAzj1VcCYH3qBCXP75/En6FeoepefnogLPE+5W7OiQ==", "integrity": "sha512-yUWKAfpJH5ovgwIlNbBHioedAWolzTVl6tmMaXP1RmCMyYv+U+ukvo9gwA10mLW0eFbyW4n/oC4UIN12gTMn/w==",
"dev": true "dev": true
}, },
"emoji-regex": { "emoji-regex": {
@ -8063,6 +8069,12 @@
"integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==",
"dev": true "dev": true
}, },
"vue": {
"version": "2.6.12",
"resolved": "https://registry.npmjs.org/vue/-/vue-2.6.12.tgz",
"integrity": "sha512-uhmLFETqPPNyuLLbsKz6ioJ4q7AZHzD8ZVFNATNyICSZouqP2Sz0rotWQC8UNBF6VGSCs5abnKJoStA6JbCbfg==",
"dev": true
},
"vue-hot-reload-api": { "vue-hot-reload-api": {
"version": "2.3.4", "version": "2.3.4",
"resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.4.tgz", "resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.4.tgz",

View file

@ -1,6 +1,6 @@
{ {
"name": "enrecipes", "name": "enrecipes",
"main": "./app/main.js", "main": "./app/main.ts",
"version": "1.0.0", "version": "1.0.0",
"description": "A native application built with NativeScript-Vue", "description": "A native application built with NativeScript-Vue",
"homepage": "https://enrecipes.vercel.app/", "homepage": "https://enrecipes.vercel.app/",
@ -36,6 +36,7 @@
"@types/node": "^14.14.37", "@types/node": "^14.14.37",
"nativescript-vue-template-compiler": "~2.9.0", "nativescript-vue-template-compiler": "~2.9.0",
"sass": "^1.32.8", "sass": "^1.32.8",
"typescript": "^4.2.4" "typescript": "^4.2.4",
"vue": "^2.6.12"
} }
} }

View file

@ -1,5 +1,4 @@
const webpack = require('@nativescript/webpack') const webpack = require('@nativescript/webpack')
const TerserPlugin = require('terser-webpack-plugin')
module.exports = (env) => { module.exports = (env) => {
webpack.init(env) webpack.init(env)