javascript toolings

This commit is contained in:
Hayden 2021-01-20 19:06:22 -09:00
commit 12dc191935
6 changed files with 76 additions and 25 deletions

3
frontend/jsconfig.json Normal file
View file

@ -0,0 +1,3 @@
{
"include": ["./src/**/*"]
}

View file

@ -54,5 +54,11 @@
"> 1%", "> 1%",
"last 2 versions", "last 2 versions",
"not dead" "not dead"
] ],
} "prettier": {
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": false
}
}

View file

@ -34,11 +34,11 @@
</template> </template>
<script> <script>
import Menu from "./components/UI/Menu"; import Menu from "./components/UI/Menu"
import SearchBar from "./components/UI/SearchBar"; import SearchBar from "./components/UI/SearchBar"
import AddRecipeFab from "./components/UI/AddRecipeFab"; import AddRecipeFab from "./components/UI/AddRecipeFab"
import SnackBar from "./components/UI/SnackBar"; import SnackBar from "./components/UI/SnackBar"
import Vuetify from "./plugins/vuetify"; import Vuetify from "./plugins/vuetify"
export default { export default {
name: "App", name: "App",
@ -51,15 +51,15 @@ export default {
watch: { watch: {
$route() { $route() {
this.search = false; this.search = false
}, },
}, },
mounted() { mounted() {
this.$store.dispatch("initTheme"); this.$store.dispatch("initTheme")
this.$store.dispatch("requestRecentRecipes"); this.$store.dispatch("requestRecentRecipes")
this.darkModeSystemCheck(); this.darkModeSystemCheck()
this.darkModeAddEventListener(); this.darkModeAddEventListener()
}, },
data: () => ({ data: () => ({
@ -73,30 +73,30 @@ export default {
if (this.$store.getters.getDarkMode === "system") if (this.$store.getters.getDarkMode === "system")
Vuetify.framework.theme.dark = window.matchMedia( Vuetify.framework.theme.dark = window.matchMedia(
"(prefers-color-scheme: dark)" "(prefers-color-scheme: dark)"
).matches; ).matches
}, },
/** /**
* This will monitor the OS level darkmode and call to update dark mode. * This will monitor the OS level darkmode and call to update dark mode.
*/ */
darkModeAddEventListener() { darkModeAddEventListener() {
const darkMediaQuery = window.matchMedia("(prefers-color-scheme: dark)"); const darkMediaQuery = window.matchMedia("(prefers-color-scheme: dark)")
darkMediaQuery.addEventListener("change", () => { darkMediaQuery.addEventListener("change", () => {
this.darkModeSystemCheck(); this.darkModeSystemCheck()
}); })
}, },
toggleSearch() { toggleSearch() {
if (this.search === true) { if (this.search === true) {
this.search = false; this.search = false
} else { } else {
this.search = true; this.search = true
} }
}, },
navigateFromSearch(slug) { navigateFromSearch(slug) {
this.$router.push(`/recipe/${slug}`); this.$router.push(`/recipe/${slug}`)
}, },
}, },
}; }
</script> </script>
<style> <style>

View file

@ -1,13 +1,17 @@
<template> <template>
<v-card> <v-card>
<v-card-title class="headline"> {{$t('meal-plan.edit-meal-plan')}} </v-card-title> <v-card-title class="headline">
{{ $t("meal-plan.edit-meal-plan") }}
</v-card-title>
<v-divider></v-divider> <v-divider></v-divider>
<v-card-text> <v-card-text>
<MealPlanCard v-model="mealPlan.meals" /> <MealPlanCard v-model="mealPlan.meals" />
<v-row align="center" justify="end"> <v-row align="center" justify="end">
<v-card-actions> <v-card-actions>
<v-btn color="success" text @click="update"> {{$t('general.update')}} </v-btn> <v-btn color="success" text @click="update">
{{ $t("general.update") }}
</v-btn>
<v-spacer></v-spacer> <v-spacer></v-spacer>
</v-card-actions> </v-card-actions>
</v-row> </v-row>

View file

@ -1,7 +1,7 @@
<template> <template>
<v-card> <v-card>
<v-card-title class="headline"> <v-card-title class="headline">
{{$t('meal-plan.create-a-new-meal-plan')}} {{ $t("meal-plan.create-a-new-meal-plan") }}
</v-card-title> </v-card-title>
<v-divider></v-divider> <v-divider></v-divider>
<v-card-text> <v-card-text>
@ -71,9 +71,11 @@
<v-row align="center" justify="end"> <v-row align="center" justify="end">
<v-card-actions> <v-card-actions>
<v-btn color="success" @click="random" v-if="meals[1]" text> <v-btn color="success" @click="random" v-if="meals[1]" text>
{{$t('general.random')}} {{ $t("general.random") }}
</v-btn>
<v-btn color="success" @click="save" text>
{{ $t("general.save") }}
</v-btn> </v-btn>
<v-btn color="success" @click="save" text> {{$t('general.save')}} </v-btn>
<v-spacer></v-spacer> <v-spacer></v-spacer>
<v-btn icon @click="show = !show"> </v-btn> <v-btn icon @click="show = !show"> </v-btn>

36
frontend/vetur.config.js Normal file
View file

@ -0,0 +1,36 @@
// vetur.config.js
/** @type {import('vls').VeturConfig} */
module.exports = {
// **optional** default: `{}`
// override vscode settings part
// Notice: It only affects the settings used by Vetur.
settings: {
"vetur.useWorkspaceDependencies": true,
"vetur.experimental.templateInterpolationService": true,
},
// **optional** default: `[{ root: './' }]`
// support monorepos
projects: [
{
// **required**
// Where is your project?
// It is relative to `vetur.config.js`.
root: "./frontend",
// **optional** default: `'package.json'`
// Where is `package.json` in the project?
// We use it to determine the version of vue.
// It is relative to root property.
package: "package.json",
// **optional**
// Where is TypeScript config file in the project?
// It is relative to root property.
// Where is vetur custom snippets folders?
// **optional** default: `[]`
// Register globally Vue component glob.
// If you set it, you can get completion by that components.
// It is relative to root property.
// Notice: It won't actually do it. You need to use `require.context` or `Vue.component`
globalComponents: ["./src/components/**/*.vue"],
},
],
};