diff --git a/geneit_app/src/api/FamilyApi.ts b/geneit_app/src/api/FamilyApi.ts index 0b6e5d2..0e2c663 100644 --- a/geneit_app/src/api/FamilyApi.ts +++ b/geneit_app/src/api/FamilyApi.ts @@ -46,4 +46,14 @@ export class FamilyApi { return JoinFamilyResult.Error; } } -} + + /** + * Get the list of families + */ + static async GetList():Promise { + return (await APIClient.exec({ + method: "GET", + uri: "/family/list", + + })).data + }} diff --git a/geneit_app/src/routes/FamiliesListRoute.tsx b/geneit_app/src/routes/FamiliesListRoute.tsx index a0edf20..e693c98 100644 --- a/geneit_app/src/routes/FamiliesListRoute.tsx +++ b/geneit_app/src/routes/FamiliesListRoute.tsx @@ -1,9 +1,11 @@ +import AddIcon from "@mui/icons-material/Add"; +import ConfirmationNumberIcon from "@mui/icons-material/ConfirmationNumber"; +import { Button, IconButton, Tooltip, Typography } from "@mui/material"; import React from "react"; -import { AsyncWidget } from "../widgets/AsyncWidget"; -import { Family } from "../api/FamilyApi"; -import { Button, Typography } from "@mui/material"; +import { Family, FamilyApi } from "../api/FamilyApi"; import { CreateFamilyDialog } from "../dialogs/CreateFamilyDialog"; import { JoinFamilyDialog } from "../dialogs/JoinFamilyDialog"; +import { AsyncWidget } from "../widgets/AsyncWidget"; export function FamiliesListRoute(): React.ReactElement { const loadKey = React.useRef(1); @@ -14,8 +16,7 @@ export function FamiliesListRoute(): React.ReactElement { const [joinFamily, setJoinFamily] = React.useState(false); const load = async () => { - // TODO : implement - setFamilies([]); + setFamilies(await FamilyApi.GetList()); }; const reload = () => { @@ -44,7 +45,11 @@ export function FamiliesListRoute(): React.ReactElement { onRequestJoinFamily={onRequestJoinFamily} /> ) : ( - + )} {/** Create family dialog anchor */} @@ -122,7 +127,27 @@ function NoFamilyButton(p: { function HasFamilysWidget(p: { families: Family[]; - onReload: () => void; + onRequestCreateFamily: () => void; + onRequestJoinFamily: () => void; }): React.ReactElement { - return

todo has families

; + return ( +
+
+ Mes familles +
+ + + + + + + + + + +
+
+ TODO list of families +
+ ); }