-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
276 additions
and
823 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
backend/menus/migrations/0009_remove_recipe_can_be_dinner_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Generated by Django 4.2 on 2024-07-12 17:12 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("menus", "0008_remove_recipe_description_alter_recipeimage_recipe"), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name="recipe", | ||
name="can_be_dinner", | ||
), | ||
migrations.RemoveField( | ||
model_name="recipe", | ||
name="can_be_lunch", | ||
), | ||
migrations.RemoveField( | ||
model_name="recipe", | ||
name="is_only_dinner", | ||
), | ||
migrations.RemoveField( | ||
model_name="recipe", | ||
name="is_only_lunch", | ||
), | ||
migrations.AlterField( | ||
model_name="recipe", | ||
name="meal", | ||
field=models.CharField( | ||
choices=[("LUNCH", "Lunch"), ("DINNER", "Dinner"), ("BOTH", "Both")], | ||
default="LUNCH", | ||
max_length=200, | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="recipe", | ||
name="prefered_meal", | ||
field=models.CharField( | ||
choices=[("LUNCH", "Lunch"), ("DINNER", "Dinner"), ("BOTH", "Both")], | ||
default="LUNCH", | ||
max_length=200, | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 20 additions & 18 deletions
38
client/src/components/form-fields/recipes/MealOfTheDayFields/MealOfTheDayFields.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,43 @@ | ||
import { useTranslation } from "react-i18next"; | ||
import { Group, Select, Switch } from "@mantine/core"; | ||
import { Select } from "@mantine/core"; | ||
import { MealTypes } from "types/recipes-types"; | ||
|
||
type Props = { form: any }; | ||
|
||
export default function MealOfTheDayFields({ form }: Props) { | ||
const { t } = useTranslation(); | ||
const mealTypes = [ | ||
|
||
const preferedMealTypes = [ | ||
{ value: "LUNCH", label: t("Lunch") }, | ||
{ value: "DINNER", label: t("Dinner") }, | ||
]; | ||
|
||
return ( | ||
<> | ||
<Select | ||
label={t("Prefered meal of the day")} | ||
label={t("Meal of the day")} | ||
withAsterisk | ||
placeholder={t<string>("When do you prefer to eat this meal?")} | ||
data={mealTypes} | ||
data={Object.keys(MealTypes).map((mealType) => ({ | ||
value: mealType, | ||
label: t(mealType), | ||
}))} | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
{...form.getInputProps("preferedMeal")} | ||
{...form.getInputProps("meal")} | ||
required | ||
mt="md" | ||
/> | ||
<Group> | ||
<Switch | ||
label={t("Only for lunch")} | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
{...form.getInputProps("isOnlyLunch", { type: "checkbox" })} | ||
mt="md" | ||
/> | ||
|
||
<Switch | ||
label={t("Only for dinner")} | ||
{form.getValues().meal === MealTypes.BOTH && ( | ||
<Select | ||
label={t("Prefered meal of the day")} | ||
withAsterisk | ||
placeholder={t<string>("When do you prefer to eat this meal?")} | ||
data={preferedMealTypes} | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
{...form.getInputProps("isOnlyDinner", { type: "checkbox" })} | ||
{...form.getInputProps("preferedMeal")} | ||
required | ||
mt="md" | ||
/> | ||
</Group> | ||
)} | ||
</> | ||
); | ||
} |
5 changes: 3 additions & 2 deletions
5
client/src/components/form-fields/recipes/RecipeImageField/RecipeImageField.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.