diff --git a/apps/nextjs/src/app/[locale]/init/_steps/finish/init-finish.tsx b/apps/nextjs/src/app/[locale]/init/_steps/finish/init-finish.tsx index 7e426bcfb..3c4b41012 100644 --- a/apps/nextjs/src/app/[locale]/init/_steps/finish/init-finish.tsx +++ b/apps/nextjs/src/app/[locale]/init/_steps/finish/init-finish.tsx @@ -4,27 +4,21 @@ import { IconBook2, IconLayoutDashboard, IconMailForward } from "@tabler/icons-r import { isProviderEnabled } from "@homarr/auth/server"; import { getMantineColor } from "@homarr/common"; -import { db } from "@homarr/db"; import { createDocumentationLink } from "@homarr/definitions"; import { getScopedI18n } from "@homarr/translation/server"; import { Link } from "@homarr/ui"; import type { TablerIcon } from "@homarr/ui"; export const InitFinish = async () => { - const firstBoard = await db.query.boards.findFirst({ columns: { name: true } }); const tFinish = await getScopedI18n("init.step.finish"); - const boardName = firstBoard?.name ?? "dashboard"; return ( {tFinish("description")} - - {tFinish("action.goToBoard", { name: boardName })} + + {tFinish("action.goToBoard", { name: "dashboard" })} {isProviderEnabled("credentials") && ( diff --git a/apps/nextjs/src/app/[locale]/init/_steps/integrations/init-integrations.tsx b/apps/nextjs/src/app/[locale]/init/_steps/integrations/init-integrations.tsx index 98c4976a4..1f2116b8d 100644 --- a/apps/nextjs/src/app/[locale]/init/_steps/integrations/init-integrations.tsx +++ b/apps/nextjs/src/app/[locale]/init/_steps/integrations/init-integrations.tsx @@ -1,15 +1,15 @@ "use client"; -import { useCallback, useEffect, useRef, useState } from "react"; -import { Button, Card, Center, Group, Loader, Stack, Stepper, Text } from "@mantine/core"; -import { IconArrowRight, IconBook2, IconCheck, IconLayoutDashboard, IconMailForward } from "@tabler/icons-react"; +import { useCallback, useState } from "react"; +import { useRouter } from "next/navigation"; +import { Button, Card, Center, Group, Loader, Progress, Stack, Text } from "@mantine/core"; +import { IconArrowRight } from "@tabler/icons-react"; import { clientApi } from "@homarr/api/client"; -import { getMantineColor } from "@homarr/common"; import type { IntegrationKind } from "@homarr/definitions"; -import { createDocumentationLink, getIntegrationName } from "@homarr/definitions"; +import { getIntegrationName } from "@homarr/definitions"; import { useScopedI18n } from "@homarr/translation/client"; -import { IntegrationAvatar, Link } from "@homarr/ui"; +import { IntegrationAvatar } from "@homarr/ui"; import { NewIntegrationForm } from "~/app/[locale]/manage/integrations/new/_integration-new-form"; import { IntegrationMultiSelectGrid } from "~/components/integration/integration-multi-select-grid"; @@ -21,6 +21,7 @@ export const InitIntegrations = () => { const [selectedKinds, setSelectedKinds] = useState([]); const [currentIndex, setCurrentIndex] = useState(0); const t = useScopedI18n("init.step.integrations"); + const router = useRouter(); const { mutateAsync: setupIntegrations } = clientApi.onboard.setupIntegrations.useMutation(); @@ -33,13 +34,15 @@ export const InitIntegrations = () => { setPhase("configure"); }; - const handleSkipAll = () => { + const finishSetupAsync = async () => { setPhase("done"); + await setupIntegrations(); + router.refresh(); }; const advanceOrFinish = () => { if (currentIndex + 1 >= selectedKinds.length) { - setPhase("done"); + void finishSetupAsync(); } else { setCurrentIndex((i) => i + 1); } @@ -51,44 +54,43 @@ export const InitIntegrations = () => { }; if (phase === "done") { - return ; + return ( + +
+ + + {t("configure.finishing")} + +
+
+ ); } if (phase === "configure") { - const currentKind = selectedKinds[currentIndex]; - if (currentKind === undefined) { - return ( - -
- -
-
- ); - } + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- currentIndex is always within bounds of selectedKinds + const currentKind = selectedKinds[currentIndex]!; + const progress = ((currentIndex + 1) / selectedKinds.length) * 100; return ( - - {selectedKinds.map((kind, index) => ( - } - completedIcon={} - label={index === currentIndex ? getIntegrationName(kind) : undefined} - /> - ))} - - - - {t("configure.progress", { current: String(currentIndex + 1), total: String(selectedKinds.length) })} - + + + + {getIntegrationName(currentKind)} + + + + {t("configure.progress", { current: String(currentIndex + 1), total: String(selectedKinds.length) })} + + @@ -103,7 +105,7 @@ export const InitIntegrations = () => { - - - - - -
-
- ); -};