Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .yarn/install-state.gz
Binary file not shown.
15 changes: 13 additions & 2 deletions src/components/Nutrition/widgets/forms/NutritionDiaryEntryForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export const NutritionDiaryEntryForm = ({ planId, entry, mealId, meals, closeFn
.min(1, t('forms.minValue', { value: '1' })),
ingredient: yup
.number()
.nullable()
.moreThan(0, t('forms.fieldRequired'))
.required(t('forms.fieldRequired')),
datetime: yup
.date()
Expand All @@ -51,7 +53,7 @@ export const NutritionDiaryEntryForm = ({ planId, entry, mealId, meals, closeFn
initialValues={{
datetime: new Date(),
amount: 0,
ingredient: 0,
ingredient: null,
}}
validationSchema={validationSchema}
onSubmit={async (values) => {
Expand Down Expand Up @@ -80,7 +82,16 @@ export const NutritionDiaryEntryForm = ({ planId, entry, mealId, meals, closeFn
<Form>
<Stack spacing={2}>
<IngredientAutocompleter
callback={(value: IngredientSearchResponse | null) => formik.setFieldValue('ingredient', value?.data.id)} />
callback={(value: IngredientSearchResponse | null) => {
formik.setFieldTouched('ingredient', true);
formik.setFieldValue('ingredient', value?.data.id ?? null);
}}
/>
{formik.touched.ingredient && formik.errors.ingredient && (
<div style={{ color: 'crimson', fontSize: '0.7rem', marginLeft: '12px' }}>
{formik.errors.ingredient}
</div>
)}
<TextField
fullWidth
id="amount"
Expand Down
5 changes: 1 addition & 4 deletions src/components/WorkoutRoutines/widgets/DayDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -402,11 +402,8 @@ export const DayDetails = (props: {
</Grid>
)}
</Draggable>
<Box height={0}>
{provided.placeholder}
</Box>

</React.Fragment>)}
{provided.placeholder}
</div>
)}
</Droppable>
Expand Down