mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-24 07:15:24 -07:00
Improve add buttons
This commit is contained in:
parent
1d049cdafc
commit
6e57be4b70
1 changed files with 31 additions and 23 deletions
|
@ -72,26 +72,24 @@
|
||||||
{{ ing.input }}
|
{{ ing.input }}
|
||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
<v-spacer />
|
<v-spacer />
|
||||||
<ul style="list-style-type: none;">
|
|
||||||
<li v-if="errors[index].unitError && errors[index].unitErrorMessage !== ''">
|
|
||||||
<BaseButton
|
<BaseButton
|
||||||
|
v-if="errors[index].unitError && errors[index].unitErrorMessage !== ''"
|
||||||
|
:title=errors[index].unitErrorMessage
|
||||||
color="warning"
|
color="warning"
|
||||||
small
|
small
|
||||||
@click="createUnit(ing.ingredient.unit, index)"
|
@click="createUnit(ing.ingredient.unit, index)"
|
||||||
>
|
>
|
||||||
{{ errors[index].unitErrorMessage }}
|
{{ errors[index].unit }}
|
||||||
</BaseButton>
|
</BaseButton>
|
||||||
</li>
|
|
||||||
<li v-if="errors[index].foodError && errors[index].foodErrorMessage !== ''">
|
|
||||||
<BaseButton
|
<BaseButton
|
||||||
|
v-if="errors[index].foodError && errors[index].foodErrorMessage !== ''"
|
||||||
|
:title=errors[index].foodErrorMessage
|
||||||
color="warning"
|
color="warning"
|
||||||
small
|
small
|
||||||
@click="createFood(ing.ingredient.food, index)"
|
@click="createFood(ing.ingredient.food, index)"
|
||||||
>
|
>
|
||||||
{{ errors[index].foodErrorMessage }}
|
{{ errors[index].food }}
|
||||||
</BaseButton>
|
</BaseButton>
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</v-card-actions>
|
</v-card-actions>
|
||||||
</v-expansion-panel-content>
|
</v-expansion-panel-content>
|
||||||
</v-expansion-panel>
|
</v-expansion-panel>
|
||||||
|
@ -101,7 +99,12 @@
|
||||||
</v-container>
|
</v-container>
|
||||||
</v-container>
|
</v-container>
|
||||||
</template>
|
</template>
|
||||||
|
<style lang="css">
|
||||||
|
.v-card__actions {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
overflow: truncate;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { computed, defineComponent, ref, useContext, useRoute, useRouter, watch } from "@nuxtjs/composition-api";
|
import { computed, defineComponent, ref, useContext, useRoute, useRouter, watch } from "@nuxtjs/composition-api";
|
||||||
import { invoke, until } from "@vueuse/core";
|
import { invoke, until } from "@vueuse/core";
|
||||||
|
@ -191,20 +194,23 @@ export default defineComponent({
|
||||||
const unitError = !checkForUnit(ing.ingredient.unit);
|
const unitError = !checkForUnit(ing.ingredient.unit);
|
||||||
const foodError = !checkForFood(ing.ingredient.food);
|
const foodError = !checkForFood(ing.ingredient.food);
|
||||||
|
|
||||||
|
let unit = "";
|
||||||
|
let food = "";
|
||||||
|
|
||||||
let unitErrorMessage = "";
|
let unitErrorMessage = "";
|
||||||
let foodErrorMessage = "";
|
let foodErrorMessage = "";
|
||||||
|
|
||||||
if (unitError || foodError) {
|
if (unitError || foodError) {
|
||||||
if (unitError) {
|
if (unitError) {
|
||||||
if (ing?.ingredient?.unit?.name) {
|
if (ing?.ingredient?.unit?.name) {
|
||||||
const unit = ing.ingredient.unit.name || i18n.tc("recipe.parser.no-unit");
|
unit = ing.ingredient.unit.name || i18n.tc("recipe.parser.no-unit");
|
||||||
unitErrorMessage = i18n.t("recipe.parser.missing-unit", { unit }).toString();
|
unitErrorMessage = i18n.t("recipe.parser.missing-unit", { unit }).toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (foodError) {
|
if (foodError) {
|
||||||
if (ing?.ingredient?.food?.name) {
|
if (ing?.ingredient?.food?.name) {
|
||||||
const food = ing.ingredient.food.name || i18n.tc("recipe.parser.no-food");
|
food = ing.ingredient.food.name || i18n.tc("recipe.parser.no-food");
|
||||||
foodErrorMessage = i18n.t("recipe.parser.missing-food", { food }).toString();
|
foodErrorMessage = i18n.t("recipe.parser.missing-food", { food }).toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,8 +220,10 @@ export default defineComponent({
|
||||||
return {
|
return {
|
||||||
ingredientIndex: index,
|
ingredientIndex: index,
|
||||||
unitError,
|
unitError,
|
||||||
|
unit,
|
||||||
unitErrorMessage,
|
unitErrorMessage,
|
||||||
foodError,
|
foodError,
|
||||||
|
food,
|
||||||
foodErrorMessage,
|
foodErrorMessage,
|
||||||
} as Error;
|
} as Error;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue