From e3d50707e8fe8ef16f50da74d373992dfe6c2c9b Mon Sep 17 00:00:00 2001 From: "Sven (AAMOS AI)" Date: Fri, 14 Aug 2026 03:12:49 +0700 Subject: [PATCH] =?UTF-8?q?feat(mobile):=20veckoplan=20=E2=80=93=20skapa?= =?UTF-8?q?=20ink=C3=B6pslista=20fr=C3=A5n=20planen=20(st=C3=A4nger=20plan?= =?UTF-8?q?=E2=86=92laga=E2=86=92handla-loopen)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/mobile/src/app/(tabs)/plan.tsx | 24 ++++++++++++++++++++++++ apps/mobile/src/locales/da/common.json | 1 + apps/mobile/src/locales/de/common.json | 1 + apps/mobile/src/locales/en/common.json | 1 + apps/mobile/src/locales/es/common.json | 1 + apps/mobile/src/locales/fi/common.json | 1 + apps/mobile/src/locales/fr/common.json | 1 + apps/mobile/src/locales/it/common.json | 1 + apps/mobile/src/locales/nb/common.json | 1 + apps/mobile/src/locales/nl/common.json | 1 + apps/mobile/src/locales/pl/common.json | 1 + apps/mobile/src/locales/pt/common.json | 1 + apps/mobile/src/locales/sv/common.json | 1 + 13 files changed, 36 insertions(+) diff --git a/apps/mobile/src/app/(tabs)/plan.tsx b/apps/mobile/src/app/(tabs)/plan.tsx index 6162138..2463bdb 100644 --- a/apps/mobile/src/app/(tabs)/plan.tsx +++ b/apps/mobile/src/app/(tabs)/plan.tsx @@ -1,5 +1,6 @@ import { useEffect, useMemo, useState } from "react"; import { Alert, Pressable, Text, View } from "react-native"; +import { router } from "expo-router"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { api } from "@/lib/api"; import { getLanguageTag, t } from "@/lib/i18n"; @@ -89,6 +90,7 @@ export default function PlanScreen() { const plan = query.data?.plans?.[0] ?? null; const planId = plan?.id ?? null; const draftPlanId = plan && plan.status === "draft" ? plan.id : null; + const hasEntries = (plan?.entries?.length ?? 0) > 0; const entriesByDate = useMemo(() => { const map: Record = {}; @@ -147,6 +149,16 @@ export default function PlanScreen() { onError: onMutationError, }); + const createList = useMutation({ + mutationFn: (weekPlanId: string) => + api("/v1/shopping-lists", { + method: "POST", + body: { weekPlanId, generateFromPlan: true }, + }), + onSuccess: () => router.push("/shopping"), + onError: onMutationError, + }); + const openActions = (entry: WeekPlanEntry) => { if (!planId) return; Alert.alert(entry.titleSv, undefined, [ @@ -306,6 +318,18 @@ export default function PlanScreen() { )} )} + + {hasEntries ? ( + <> + +