mirror of
https://github.com/hay-kot/mealie.git
synced 2025-07-05 20:42:23 -07:00
Some checks are pending
CodeQL / Analyze (push) Waiting to run
Docker Nightly Production / Backend Server Tests (push) Waiting to run
Docker Nightly Production / Frontend Tests (push) Waiting to run
Docker Nightly Production / Build Package (push) Waiting to run
Docker Nightly Production / Build Tagged Release (push) Blocked by required conditions
Docker Nightly Production / Notify Discord (push) Blocked by required conditions
Release Drafter / ✏️ Draft release (push) Waiting to run
Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com> Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
56 lines
1.3 KiB
Vue
56 lines
1.3 KiB
Vue
<template>
|
|
<div class="d-flex justify-space-between align-center pt-2 pb-3">
|
|
<RecipeScaleEditButton
|
|
v-if="!isEditMode"
|
|
v-model.number="scaleValue"
|
|
:recipe-servings="recipeServings"
|
|
:edit-scale="!recipe.settings.disableAmount && !isEditMode"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import RecipeScaleEditButton from "~/components/Domain/Recipe/RecipeScaleEditButton.vue";
|
|
import type { NoUndefinedField } from "~/lib/api/types/non-generated";
|
|
import type { Recipe } from "~/lib/api/types/recipe";
|
|
import { usePageState } from "~/composables/recipe-page/shared-state";
|
|
|
|
export default defineNuxtComponent({
|
|
components: {
|
|
RecipeScaleEditButton,
|
|
},
|
|
props: {
|
|
recipe: {
|
|
type: Object as () => NoUndefinedField<Recipe>,
|
|
required: true,
|
|
},
|
|
scale: {
|
|
type: Number,
|
|
default: 1,
|
|
},
|
|
},
|
|
emits: ["update:scale"],
|
|
setup(props, { emit }) {
|
|
const { isEditMode } = usePageState(props.recipe.slug);
|
|
|
|
const recipeServings = computed<number>(() => {
|
|
return props.recipe.recipeServings || props.recipe.recipeYieldQuantity || 1;
|
|
});
|
|
|
|
const scaleValue = computed<number>({
|
|
get() {
|
|
return props.scale;
|
|
},
|
|
set(val) {
|
|
emit("update:scale", val);
|
|
},
|
|
});
|
|
|
|
return {
|
|
recipeServings,
|
|
scaleValue,
|
|
isEditMode,
|
|
};
|
|
},
|
|
});
|
|
</script>
|