Fas 3 steg 3b: minimala efterfrågor + hushållsantagandeprofiler per ingrediens
This commit is contained in:
@@ -49,6 +49,8 @@ export default function CookingScreen() {
|
||||
const timerRef = useRef<ReturnType<typeof setInterval> | null>(null);
|
||||
const [finishing, setFinishing] = useState(false);
|
||||
const [mealBoxPortions, setMealBoxPortions] = useState(0);
|
||||
const [actualPortionsEaten, setActualPortionsEaten] = useState<number | null>(null);
|
||||
const [leftoverEstimatePortions, setLeftoverEstimatePortions] = useState<number | null>(null);
|
||||
|
||||
const query = useQuery({
|
||||
queryKey: ["recipe", id],
|
||||
@@ -100,6 +102,9 @@ export default function CookingScreen() {
|
||||
};
|
||||
|
||||
if (finishing) {
|
||||
const defaultEaten = actualPortionsEaten ?? Math.max(0, portionsCooked - mealBoxPortions);
|
||||
const defaultLeftovers = leftoverEstimatePortions ?? mealBoxPortions;
|
||||
|
||||
return (
|
||||
<Screen>
|
||||
<Heading>{t("cooked.title")}</Heading>
|
||||
@@ -127,6 +132,44 @@ export default function CookingScreen() {
|
||||
</Row>
|
||||
</Row>
|
||||
</Card>
|
||||
<Card>
|
||||
<Body>{t("cooked.actualPortionsEaten")}</Body>
|
||||
<Row>
|
||||
<Button
|
||||
label="−"
|
||||
variant="ghost"
|
||||
onPress={() => setActualPortionsEaten(Math.max(0, defaultEaten - 1))}
|
||||
/>
|
||||
<Body>{defaultEaten}</Body>
|
||||
<Button
|
||||
label="+"
|
||||
variant="ghost"
|
||||
onPress={() => setActualPortionsEaten(Math.min(portionsCooked, defaultEaten + 1))}
|
||||
/>
|
||||
</Row>
|
||||
<Small>{t("cooked.actualPortionsEatenHint")}</Small>
|
||||
</Card>
|
||||
<Card>
|
||||
<Body>{t("cooked.leftoverEstimatePortions")}</Body>
|
||||
<Row>
|
||||
<Button
|
||||
label="−"
|
||||
variant="ghost"
|
||||
onPress={() => setLeftoverEstimatePortions(Math.max(0, defaultLeftovers - 1))}
|
||||
/>
|
||||
<Body>{defaultLeftovers}</Body>
|
||||
<Button
|
||||
label="+"
|
||||
variant="ghost"
|
||||
onPress={() =>
|
||||
setLeftoverEstimatePortions(
|
||||
Math.min(portionsCooked - defaultEaten, defaultLeftovers + 1),
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Row>
|
||||
<Small>{t("cooked.leftoverEstimateHint")}</Small>
|
||||
</Card>
|
||||
<Small>{t("cooked.deductPantryNote")}</Small>
|
||||
<Spacer size={spacing.sm} />
|
||||
<Button
|
||||
@@ -136,12 +179,25 @@ export default function CookingScreen() {
|
||||
cook.mutate({
|
||||
portionsCooked,
|
||||
mealBoxPortions,
|
||||
actualPortionsEaten: actualPortionsEaten ?? defaultEaten,
|
||||
leftoverEstimatePortions: leftoverEstimatePortions ?? defaultLeftovers,
|
||||
mealBoxFrozen: false,
|
||||
deductInventory: true,
|
||||
mealType: "dinner",
|
||||
})
|
||||
}
|
||||
/>
|
||||
<Button label={t("common.skip")} variant="ghost" onPress={() =>
|
||||
cook.mutate({
|
||||
portionsCooked,
|
||||
mealBoxPortions,
|
||||
actualPortionsEaten: defaultEaten,
|
||||
leftoverEstimatePortions: defaultLeftovers,
|
||||
mealBoxFrozen: false,
|
||||
deductInventory: true,
|
||||
mealType: "dinner",
|
||||
})
|
||||
} />
|
||||
<Button label={t("common.back")} variant="ghost" onPress={() => setFinishing(false)} />
|
||||
</Screen>
|
||||
);
|
||||
|
||||
@@ -60,6 +60,10 @@
|
||||
"cooked.portionsCooked": "Portioner lavet",
|
||||
"cooked.rate": "Bedøm",
|
||||
"cooked.title": "Hvordan gik det?",
|
||||
"cooked.actualPortionsEaten": "Hvor mange portioner spiste I?",
|
||||
"cooked.actualPortionsEatenHint": "Resten bliver til rester eller madpakker.",
|
||||
"cooked.leftoverEstimatePortions": "Hvor mange restportioner blev der?",
|
||||
"cooked.leftoverEstimateHint": "Gemmes som madpakke, hvis du vil.",
|
||||
"cooked.whoAte": "Hvem spiste?",
|
||||
"cooking.finish": "Færdig – registrér måltidet",
|
||||
"cooking.keepAwake": "Skærmen forbliver tændt, mens du laver mad",
|
||||
|
||||
@@ -60,6 +60,10 @@
|
||||
"cooked.portionsCooked": "Gekochte Portionen",
|
||||
"cooked.rate": "Bewerten",
|
||||
"cooked.title": "Wie ist es gelaufen?",
|
||||
"cooked.actualPortionsEaten": "Wie viele Portionen habt ihr gegessen?",
|
||||
"cooked.actualPortionsEatenHint": "Der Rest wird zu Resten oder Lunchboxen.",
|
||||
"cooked.leftoverEstimatePortions": "Wie viele Restportionen?",
|
||||
"cooked.leftoverEstimateHint": "Wird als Lunchbox gespeichert, wenn du möchtest.",
|
||||
"cooked.whoAte": "Wer hat gegessen?",
|
||||
"cooking.finish": "Fertig – Mahlzeit erfassen",
|
||||
"cooking.keepAwake": "Der Bildschirm bleibt beim Kochen an",
|
||||
|
||||
@@ -60,6 +60,10 @@
|
||||
"cooked.portionsCooked": "Servings cooked",
|
||||
"cooked.rate": "Rate it",
|
||||
"cooked.title": "How did it go?",
|
||||
"cooked.actualPortionsEaten": "How many portions did you eat?",
|
||||
"cooked.actualPortionsEatenHint": "The rest becomes leftovers or meal boxes.",
|
||||
"cooked.leftoverEstimatePortions": "How many leftover portions?",
|
||||
"cooked.leftoverEstimateHint": "Saved as a meal box if you want.",
|
||||
"cooked.whoAte": "Who ate?",
|
||||
"cooking.finish": "Done – log the meal",
|
||||
"cooking.keepAwake": "The screen stays awake while you cook",
|
||||
|
||||
@@ -60,6 +60,10 @@
|
||||
"cooked.portionsCooked": "Raciones cocinadas",
|
||||
"cooked.rate": "Valorar",
|
||||
"cooked.title": "¿Qué tal ha ido?",
|
||||
"cooked.actualPortionsEaten": "¿Cuántas raciones comisteis?",
|
||||
"cooked.actualPortionsEatenHint": "El resto se convierte en sobras o tuppers.",
|
||||
"cooked.leftoverEstimatePortions": "¿Cuántas raciones de sobras?",
|
||||
"cooked.leftoverEstimateHint": "Se guarda como tupper si quieres.",
|
||||
"cooked.whoAte": "¿Quiénes comieron?",
|
||||
"cooking.finish": "Hecho – registrar la comida",
|
||||
"cooking.keepAwake": "La pantalla permanece encendida mientras cocinas",
|
||||
|
||||
@@ -60,6 +60,10 @@
|
||||
"cooked.portionsCooked": "Valmistetut annokset",
|
||||
"cooked.rate": "Arvioi",
|
||||
"cooked.title": "Miten meni?",
|
||||
"cooked.actualPortionsEaten": "Montako annosta söitte?",
|
||||
"cooked.actualPortionsEatenHint": "Loput tulevat tähteiksi tai eväsrasioiksi.",
|
||||
"cooked.leftoverEstimatePortions": "Montako tähteannosta tuli?",
|
||||
"cooked.leftoverEstimateHint": "Tallennetaan eväsrasiaksi, jos haluat.",
|
||||
"cooked.whoAte": "Ketkä söivät?",
|
||||
"cooking.finish": "Valmis – kirjaa ateria",
|
||||
"cooking.keepAwake": "Näyttö pysyy päällä, kun kokkaat",
|
||||
|
||||
@@ -60,6 +60,10 @@
|
||||
"cooked.portionsCooked": "Portions cuisinées",
|
||||
"cooked.rate": "Noter",
|
||||
"cooked.title": "Alors, verdict ?",
|
||||
"cooked.actualPortionsEaten": "Combien de portions avez-vous mangées?",
|
||||
"cooked.actualPortionsEatenHint": "Le reste devient des restes ou des lunchboxes.",
|
||||
"cooked.leftoverEstimatePortions": "Combien de portions de restes?",
|
||||
"cooked.leftoverEstimateHint": "Enregistré comme lunchbox si vous voulez.",
|
||||
"cooked.whoAte": "Qui a mangé ?",
|
||||
"cooking.finish": "Terminé – enregistrer le repas",
|
||||
"cooking.keepAwake": "L'écran reste allumé pendant que vous cuisinez",
|
||||
|
||||
@@ -60,6 +60,10 @@
|
||||
"cooked.portionsCooked": "Porzioni cucinate",
|
||||
"cooked.rate": "Valuta",
|
||||
"cooked.title": "Com'è andata?",
|
||||
"cooked.actualPortionsEaten": "Quante porzioni avete mangiato?",
|
||||
"cooked.actualPortionsEatenHint": "Il resto diventa avanzi o contenitori.",
|
||||
"cooked.leftoverEstimatePortions": "Quante porzioni di avanzi?",
|
||||
"cooked.leftoverEstimateHint": "Salvato come contenitore se vuoi.",
|
||||
"cooked.whoAte": "Chi ha mangiato?",
|
||||
"cooking.finish": "Fatto – registra il pasto",
|
||||
"cooking.keepAwake": "Lo schermo resta acceso mentre cucini",
|
||||
|
||||
@@ -60,6 +60,10 @@
|
||||
"cooked.portionsCooked": "Porsjoner laget",
|
||||
"cooked.rate": "Vurder",
|
||||
"cooked.title": "Hvordan gikk det?",
|
||||
"cooked.actualPortionsEaten": "Hvor mange porsjoner spiste dere?",
|
||||
"cooked.actualPortionsEatenHint": "Resten blir til rester eller matbokser.",
|
||||
"cooked.leftoverEstimatePortions": "Hvor mange restporsjoner ble det?",
|
||||
"cooked.leftoverEstimateHint": "Lagres som matboks hvis du vil.",
|
||||
"cooked.whoAte": "Hvem spiste?",
|
||||
"cooking.finish": "Ferdig – loggfør måltidet",
|
||||
"cooking.keepAwake": "Skjermen holdes våken mens du lager mat",
|
||||
|
||||
@@ -60,6 +60,10 @@
|
||||
"cooked.portionsCooked": "Gekookte porties",
|
||||
"cooked.rate": "Beoordelen",
|
||||
"cooked.title": "Hoe ging het?",
|
||||
"cooked.actualPortionsEaten": "Hoeveel porties hebben jullie gegeten?",
|
||||
"cooked.actualPortionsEatenHint": "De rest wordt restjes of lunchboxen.",
|
||||
"cooked.leftoverEstimatePortions": "Hoeveel restporties?",
|
||||
"cooked.leftoverEstimateHint": "Opgeslagen als lunchbox als je wilt.",
|
||||
"cooked.whoAte": "Wie hebben er gegeten?",
|
||||
"cooking.finish": "Klaar – maaltijd registreren",
|
||||
"cooking.keepAwake": "Het scherm blijft aan tijdens het koken",
|
||||
|
||||
@@ -60,6 +60,10 @@
|
||||
"cooked.portionsCooked": "Ugotowane porcje",
|
||||
"cooked.rate": "Oceń",
|
||||
"cooked.title": "Jak poszło?",
|
||||
"cooked.actualPortionsEaten": "Ile porcji zjedliście?",
|
||||
"cooked.actualPortionsEatenHint": "Reszta stanie się resztkami lub lunchboxami.",
|
||||
"cooked.leftoverEstimatePortions": "Ile porcji resztek?",
|
||||
"cooked.leftoverEstimateHint": "Zapisane jako lunchbox, jeśli chcesz.",
|
||||
"cooked.whoAte": "Kto jadł?",
|
||||
"cooking.finish": "Gotowe – zarejestruj posiłek",
|
||||
"cooking.keepAwake": "Ekran pozostaje włączony podczas gotowania",
|
||||
|
||||
@@ -60,6 +60,10 @@
|
||||
"cooked.portionsCooked": "Doses cozinhadas",
|
||||
"cooked.rate": "Avaliar",
|
||||
"cooked.title": "Como correu?",
|
||||
"cooked.actualPortionsEaten": "Quantas porções comeram?",
|
||||
"cooked.actualPortionsEatenHint": "O resto fica como sobras ou marmitas.",
|
||||
"cooked.leftoverEstimatePortions": "Quantas porções de sobras?",
|
||||
"cooked.leftoverEstimateHint": "Guardado como marmita se quiseres.",
|
||||
"cooked.whoAte": "Quem comeu?",
|
||||
"cooking.finish": "Concluído – registar a refeição",
|
||||
"cooking.keepAwake": "O ecrã fica ligado enquanto cozinha",
|
||||
|
||||
@@ -60,6 +60,10 @@
|
||||
"cooked.portionsCooked": "Portioner lagade",
|
||||
"cooked.rate": "Betygsätt",
|
||||
"cooked.title": "Hur gick det?",
|
||||
"cooked.actualPortionsEaten": "Hur många portioner åt ni?",
|
||||
"cooked.actualPortionsEatenHint": "Resten blir rester eller matlådor.",
|
||||
"cooked.leftoverEstimatePortions": "Hur många restportioner blev det?",
|
||||
"cooked.leftoverEstimateHint": "Sparas som matlåda om du vill.",
|
||||
"cooked.whoAte": "Vilka åt?",
|
||||
"cooking.finish": "Klart – logga måltiden",
|
||||
"cooking.keepAwake": "Skärmen hålls vaken medan du lagar",
|
||||
|
||||
Reference in New Issue
Block a user