1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-07 14:35:25 +02:00
mealie/frontend/components/Domain/Recipe/RecipePage/RecipePageParts/RecipePageScale.vue
Michael Genson 245ca5fe3b
feat: Remove "Is Food" and "Disable Amounts" Flags (#5684)
Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
2025-07-31 17:36:24 +02:00

38 lines
1.1 KiB
Vue

<template>
<div class="d-flex justify-space-between align-center pt-2 pb-3">
<RecipeScaleEditButton
v-if="!isEditMode"
v-model.number="scale"
:recipe-servings="recipeServings"
:edit-scale="hasFoodOrUnit && !isEditMode"
/>
</div>
</template>
<script setup 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";
const props = defineProps<{ recipe: NoUndefinedField<Recipe> }>();
const scale = defineModel<number>({ default: 1 });
const { isEditMode } = usePageState(props.recipe.slug);
const recipeServings = computed<number>(() => {
return props.recipe.recipeServings || props.recipe.recipeYieldQuantity || 1;
});
const hasFoodOrUnit = computed(() => {
if (props.recipe.recipeIngredient) {
for (const ingredient of props.recipe.recipeIngredient) {
if (ingredient.food || ingredient.unit) {
return true;
}
}
}
return false;
});
</script>