From b941561ccfc247d0e450f8ef62e3d06324eb1636 Mon Sep 17 00:00:00 2001 From: LandaMm Date: Sat, 24 May 2025 14:24:29 +0200 Subject: [PATCH] feat: render accounts saved in db --- web/src/pages/Index/index.tsx | 68 ++++++++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 5 deletions(-) diff --git a/web/src/pages/Index/index.tsx b/web/src/pages/Index/index.tsx index 2907398..93e53e1 100644 --- a/web/src/pages/Index/index.tsx +++ b/web/src/pages/Index/index.tsx @@ -1,14 +1,72 @@ -import { useAccountRepo } from "@/repository/account"; -import { useEffect, type FC } from "react"; +import { useDbContext } from "@/context/db/db"; +import { useAccountRepo, type LocalAccount } from "@/repository/account"; +import { useEffect, useState, type FC } from "react"; + +import overlay from "@/assets/overlay.jpg"; +import { Card, CardContent } from "@/components/ui/card"; +import { User } from "lucide-react"; const IndexPage: FC = () => { + const [accounts, setAccounts] = useState([]); + const repo = useAccountRepo(); + const { connected } = useDbContext(); useEffect(() => { - repo.loadAll().then((res) => console.log({ res })); - }, [repo]); + if (connected) repo.loadAll().then(setAccounts); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [connected]); - return
; + return ( +
+
+ +
+
+ icon + +
+

+ Select Account +

+

+ Choose one of the accounts below in order to proceed to home + lab services and tools. +

+
+
+ + {/* */} + + {accounts.map((account) => ( +
+
+
+ +
+
+
+

{account.label}

+

{account.email}

+
+
+ ))} +
+
+
+
+
+ ); }; export default IndexPage;