mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-05-24 01:12:54 -04:00
Refactor recipe page to use break up the component and make it more usable across different pages. I've left the old route in as well in case there is some functional breaks, I plan to remove it before the official release once we've tested the new editor some more in production. For now there will just have to be some duplicate components and pages around.
61 lines
1.5 KiB
Vue
61 lines
1.5 KiB
Vue
<template>
|
|
<div>
|
|
<RecipeIngredients
|
|
:value="recipe.recipeIngredient"
|
|
:scale="scale"
|
|
:disable-amount="recipe.settings.disableAmount"
|
|
/>
|
|
<div v-if="!isEditMode && recipe.tools && recipe.tools.length > 0">
|
|
<h2 class="mb-2 mt-4">Required Tools</h2>
|
|
<v-list-item v-for="(tool, index) in recipe.tools" :key="index" dense>
|
|
<v-checkbox
|
|
v-model="recipe.tools[index].onHand"
|
|
hide-details
|
|
class="pt-0 my-auto py-auto"
|
|
color="secondary"
|
|
@change="toolStore.actions.updateOne(recipe.tools[index])"
|
|
>
|
|
</v-checkbox>
|
|
<v-list-item-content>
|
|
{{ tool.name }}
|
|
</v-list-item-content>
|
|
</v-list-item>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import { defineComponent } from "@nuxtjs/composition-api";
|
|
import { usePageState } from "~/composables/recipe-page/shared-state";
|
|
import { useToolStore } from "~/composables/store";
|
|
import { NoUndefinedField } from "~/types/api";
|
|
import { Recipe } from "~/types/api-types/recipe";
|
|
import RecipeIngredients from "~/components/Domain/Recipe/RecipeIngredients.vue";
|
|
|
|
export default defineComponent({
|
|
components: {
|
|
RecipeIngredients,
|
|
},
|
|
props: {
|
|
recipe: {
|
|
type: Object as () => NoUndefinedField<Recipe>,
|
|
required: true,
|
|
},
|
|
scale: {
|
|
type: Number,
|
|
required: true,
|
|
},
|
|
},
|
|
setup(props) {
|
|
const toolStore = useToolStore();
|
|
|
|
const { isEditMode } = usePageState(props.recipe.slug);
|
|
|
|
return {
|
|
toolStore,
|
|
isEditMode,
|
|
};
|
|
},
|
|
});
|
|
</script>
|