add warning/tooltip for unparsed foods/units

This commit is contained in:
Michael Genson 2025-07-28 19:49:35 +00:00
commit 22183d4969
3 changed files with 55 additions and 0 deletions

View file

@ -63,6 +63,22 @@
clearable
@keyup.enter="handleUnitEnter"
>
<template #prepend>
<v-tooltip v-if="unitError" bottom>
<template #activator="{ props }">
<v-icon
v-bind="props"
class="ml-2 mr-n3"
color="primary"
>
{{ $globals.icons.alert }}
</v-icon>
</template>
<span v-if="unitErrorTooltip">
{{ unitErrorTooltip }}
</span>
</v-tooltip>
</template>
<template #no-data>
<div class="caption text-center pb-2">
{{ $t("recipe.press-enter-to-create") }}
@ -104,6 +120,22 @@
clearable
@keyup.enter="handleFoodEnter"
>
<template #prepend>
<v-tooltip v-if="foodError" bottom>
<template #activator="{ props }">
<v-icon
v-bind="props"
class="ml-2 mr-n3"
color="primary"
>
{{ $globals.icons.alert }}
</v-icon>
</template>
<span v-if="foodErrorTooltip">
{{ foodErrorTooltip }}
</span>
</v-tooltip>
</template>
<template #no-data>
<div class="caption text-center pb-2">
{{ $t("recipe.press-enter-to-create") }}
@ -188,6 +220,22 @@ const props = defineProps({
type: Boolean,
default: false,
},
unitError: {
type: Boolean,
default: false,
},
unitErrorTooltip: {
type: String,
default: "",
},
foodError: {
type: Boolean,
default: false,
},
foodErrorTooltip: {
type: String,
default: "",
},
});
defineEmits([

View file

@ -662,6 +662,9 @@
"no-unit": "No unit",
"missing-unit": "Create missing unit: {unit}",
"missing-food": "Create missing food: {food}",
"this-unit-could-not-be-parsed-automatically": "This unit could not be parsed automatically",
"this-food-could-not-be-parsed-automatically": "This food could not be parsed automatically",
"confidence-score": "Confidence Score",
"no-food": "No Food"
},
"reset-servings-count": "Reset Servings Count",

View file

@ -103,6 +103,10 @@
<RecipeIngredientEditor
v-model="parsedIng[index].ingredient"
allow-insert-ingredient
:unit-error="errors[index].unitError && errors[index].unitErrorMessage !== ''"
:unit-error-tooltip="$t('recipe.parser.this-unit-could-not-be-parsed-automatically')"
:food-error="errors[index].foodError && errors[index].foodErrorMessage !== ''"
:food-error-tooltip="$t('recipe.parser.this-food-could-not-be-parsed-automatically')"
@insert-above="insertIngredient(index)"
@insert-below="insertIngredient(index + 1)"
@delete="deleteIngredient(index)"