diff --git a/frontend/components/Domain/Recipe/RecipeScaleEditButton.vue b/frontend/components/Domain/Recipe/RecipeScaleEditButton.vue new file mode 100644 index 000000000000..eb8b6f8188c0 --- /dev/null +++ b/frontend/components/Domain/Recipe/RecipeScaleEditButton.vue @@ -0,0 +1,102 @@ + + + diff --git a/frontend/composables/recipes/use-recipe-ingredients.ts b/frontend/composables/recipes/use-recipe-ingredients.ts index f3600548720e..4ee1cfd3a058 100644 --- a/frontend/composables/recipes/use-recipe-ingredients.ts +++ b/frontend/composables/recipes/use-recipe-ingredients.ts @@ -23,7 +23,6 @@ export function parseIngredientText(ingredient: RecipeIngredient, disableAmount: // casting to number is required as sometimes quantity is a string if (quantity && Number(quantity) !== 0) { - console.log("Using Quantity", quantity, typeof quantity); if (unit?.fraction) { const fraction = frac(quantity * scale, 10, true); if (fraction[0] !== undefined && fraction[0] > 0) { diff --git a/frontend/lang/messages/de-DE.json b/frontend/lang/messages/de-DE.json index 8d3c04627c83..194f859c40ef 100644 --- a/frontend/lang/messages/de-DE.json +++ b/frontend/lang/messages/de-DE.json @@ -248,6 +248,7 @@ "description": "Beschreibung", "disable-amount": "Zutatenmenge deaktivieren", "disable-comments": "Kommentare deaktivieren", + "edit-scale": "Skalierung bearbeiten", "fat-content": "Fett", "fiber-content": "Ballaststoffe", "grams": "g", diff --git a/frontend/lang/messages/en-US.json b/frontend/lang/messages/en-US.json index c41c0cd02d4f..1b2a102ec126 100644 --- a/frontend/lang/messages/en-US.json +++ b/frontend/lang/messages/en-US.json @@ -248,6 +248,7 @@ "description": "Description", "disable-amount": "Disable Ingredient Amounts", "disable-comments": "Disable Comments", + "edit-scale": "Edit Scale", "fat-content": "Fat", "fiber-content": "Fiber", "grams": "grams", diff --git a/frontend/pages/recipe/_slug/index.vue b/frontend/pages/recipe/_slug/index.vue index 1004ba85bf14..c52d5bfec7df 100644 --- a/frontend/pages/recipe/_slug/index.vue +++ b/frontend/pages/recipe/_slug/index.vue @@ -178,38 +178,18 @@
- Reset Scale + {{ $t("recipe.edit-scale") }} - - { + const regMatchNum = /\d+/; + const yieldString = recipe.value?.recipeYield; + const num = yieldString?.match(regMatchNum); + + if (num && num?.length > 0) { + const yieldAsInt = parseInt(num[0]); + return yieldString?.replace(num[0], String(yieldAsInt)); + } + + return recipe.value?.recipeYield; + }); + async function uploadImage(fileObject: File) { if (!recipe.value || !recipe.value.slug) { return; @@ -830,6 +827,13 @@ export default defineComponent({ const drag = ref(false); + // =============================================================== + // Scale + + const setScale = (newScale: number) => { + state.scale = newScale; + }; + return { // Wake Lock drag, @@ -847,12 +851,14 @@ export default defineComponent({ enableLandscape, imageHeight, scaledYield, + basicYield, toggleJson, ...toRefs(state), recipe, api, loading, addStep, + setScale, deleteRecipe, printRecipe, closeEditor, diff --git a/frontend/utils/icons/icon-type.ts b/frontend/utils/icons/icon-type.ts index 5646cab3479f..e34a677858d0 100644 --- a/frontend/utils/icons/icon-type.ts +++ b/frontend/utils/icons/icon-type.ts @@ -90,6 +90,7 @@ export interface Icon { webhook: string; windowClose: string; zip: string; + undo: string; // Crud backArrow: string; diff --git a/frontend/utils/icons/icons.ts b/frontend/utils/icons/icons.ts index 0d1b2001afe9..afee11b860e0 100644 --- a/frontend/utils/icons/icons.ts +++ b/frontend/utils/icons/icons.ts @@ -109,6 +109,7 @@ import { mdiChartLine, mdiHelpCircleOutline, mdiDocker, + mdiUndo, } from "@mdi/js"; export const icons = { @@ -206,6 +207,7 @@ export const icons = { webhook: mdiWebhook, windowClose: mdiWindowClose, zip: mdiFolderZipOutline, + undo: mdiUndo, // Crud backArrow: mdiArrowLeftBoldOutline,