Skip to content

Commit

Permalink
fix(survey): meal time hidden/disabled flags (V4-1162)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukashroch committed Oct 1, 2024
1 parent 7ad10e6 commit ce41443
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
{{ mealName }}
</v-list-item-title>
<v-list-item-action>
<v-list-item-action-text v-if="mealTime?.length">
<v-list-item-action-text v-if="mealTime && !meal.flags.includes('meal-time:hidden')">
{{ mealTime }}
</v-list-item-action-text>
<v-tooltip v-else bottom>
<v-tooltip v-else-if="!mealTime" bottom>
<template #activator="{ on, attrs }">
<v-icon v-bind="attrs" small v-on="on">
$question
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{{ mealName }}
</v-list-item-title>
</v-list-item-content>
<v-list-item-action v-if="meal.time">
<v-list-item-action v-if="meal.time && !meal.flags.includes('meal-time:hidden')">
<v-list-item-action-text>
{{ mealTime }}
</v-list-item-action-text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export function useMealItem(props: UseMealItemProps, { emit }: SetupContext) {
name: i18n.t('recall.menu.meal.editTime').toString(),
action: 'mealTime',
icon: '$mealTime',
if: (meal: MealState) => !meal.flags.includes('meal-time:disabled'),
},
{
name: i18n.t('recall.menu.meal.delete').toString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
/>
<template #actions>
<v-btn
v-if="!meal.flags.includes('meal-time:disabled')"
class="px-4"
color="primary"
large
Expand Down Expand Up @@ -65,6 +66,7 @@
</template>
<template #nav-actions>
<v-btn
v-if="!meal.flags.includes('meal-time:disabled')"
color="primary"
text
:title="$t('recall.actions.nav.mealTime')"
Expand Down
2 changes: 2 additions & 0 deletions packages/common/src/types/recall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export const staticMealFlag = [
'no-meals-between',
'no-meals-before',
'ready-meal-complete',
'meal-time:hidden',
'meal-time:disabled',
] as const;
export type StaticMealFlag = (typeof staticMealFlag)[number];
export const dynamicMealFlag = z.custom<`food-search:${string}` | `${string}-acknowledged` | `${string}-complete`>((val) => {
Expand Down

0 comments on commit ce41443

Please sign in to comment.