Genealogy as a feature #175
@ -67,12 +67,16 @@ export function App(): React.ReactElement {
|
||||
<Route path="family/:familyId/*" element={<BaseFamilyRoute />}>
|
||||
<Route path="" element={<FamilyHomeRoute />} />
|
||||
|
||||
<Route path="genealogy/*">
|
||||
<Route path="members" element={<FamilyMembersListRoute />} />
|
||||
<Route
|
||||
path="member/create"
|
||||
element={<FamilyCreateMemberRoute />}
|
||||
/>
|
||||
<Route path="member/:memberId" element={<FamilyMemberRoute />} />
|
||||
<Route
|
||||
path="member/:memberId"
|
||||
element={<FamilyMemberRoute />}
|
||||
/>
|
||||
<Route
|
||||
path="member/:memberId/edit"
|
||||
element={<FamilyEditMemberRoute />}
|
||||
@ -83,7 +87,10 @@ export function App(): React.ReactElement {
|
||||
path="couple/create"
|
||||
element={<FamilyCreateCoupleRoute />}
|
||||
/>
|
||||
<Route path="couple/:coupleId" element={<FamilyCoupleRoute />} />
|
||||
<Route
|
||||
path="couple/:coupleId"
|
||||
element={<FamilyCoupleRoute />}
|
||||
/>
|
||||
<Route
|
||||
path="couple/:coupleId/edit"
|
||||
element={<FamilyEditCoupleRoute />}
|
||||
@ -94,6 +101,8 @@ export function App(): React.ReactElement {
|
||||
path="tree/:memberId"
|
||||
element={<FamilyMemberTreeRoute />}
|
||||
/>
|
||||
<Route path="*" element={<NotFoundRoute />} />
|
||||
</Route>
|
||||
|
||||
<Route path="settings" element={<FamilySettingsRoute />} />
|
||||
<Route path="users" element={<FamilyUsersListRoute />} />
|
||||
|
@ -60,7 +60,8 @@ export class Family implements FamilyAPI {
|
||||
*/
|
||||
memberURL(member: Member, edit?: boolean): string {
|
||||
return (
|
||||
`/family/${this.family_id}/member/${member.id}` + (edit ? "/edit" : "")
|
||||
`/family/${this.family_id}/genealogy/member/${member.id}` +
|
||||
(edit ? "/edit" : "")
|
||||
);
|
||||
}
|
||||
|
||||
@ -68,7 +69,7 @@ export class Family implements FamilyAPI {
|
||||
* Get family tree URL for member
|
||||
*/
|
||||
familyTreeURL(member: Member | number): string {
|
||||
return `/family/${this.family_id}/tree/${
|
||||
return `/family/${this.family_id}/genealogy/tree/${
|
||||
typeof member === "number" ? member : member.id
|
||||
}`;
|
||||
}
|
||||
@ -78,7 +79,8 @@ export class Family implements FamilyAPI {
|
||||
*/
|
||||
coupleURL(member: Couple, edit?: boolean): string {
|
||||
return (
|
||||
`/family/${this.family_id}/couple/${member.id}` + (edit ? "/edit" : "")
|
||||
`/family/${this.family_id}/genealogy/couple/${member.id}` +
|
||||
(edit ? "/edit" : "")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ export function FamilyCreateCoupleRoute(): React.ReactElement {
|
||||
|
||||
const cancel = () => {
|
||||
setShouldQuit(true);
|
||||
n(family.family.URL("couples"));
|
||||
n(family.family.URL("genealogy/couples"));
|
||||
};
|
||||
|
||||
return (
|
||||
@ -115,7 +115,7 @@ export function FamilyCoupleRoute(): React.ReactElement {
|
||||
await CoupleApi.Delete(couple!);
|
||||
|
||||
snackbar("La fiche du couple a été supprimée avec succès !");
|
||||
n(family.family.URL("couples"));
|
||||
n(family.family.URL("genealogy/couples"));
|
||||
|
||||
await family.reloadCouplesList();
|
||||
} catch (e) {
|
||||
@ -486,7 +486,7 @@ export function CouplePage(p: {
|
||||
<div style={{ display: "flex", justifyContent: "end" }}>
|
||||
<RouterLink
|
||||
to={family.family.URL(
|
||||
`member/create?mother=${couple.wife}&father=${couple.husband}`
|
||||
`genealogy/member/create?mother=${couple.wife}&father=${couple.husband}`
|
||||
)}
|
||||
>
|
||||
<Button>Nouveau</Button>
|
||||
|
@ -63,7 +63,7 @@ export function FamilyCreateMemberRoute(): React.ReactElement {
|
||||
await family.reloadMembersList();
|
||||
|
||||
setShouldQuit(true);
|
||||
n(family.family.URL(`member/${r.id}`));
|
||||
n(family.family.URL(`genealogy/member/${r.id}`));
|
||||
snackbar(`La fiche pour ${r.fullName} a été créée avec succès !`);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
@ -73,7 +73,7 @@ export function FamilyCreateMemberRoute(): React.ReactElement {
|
||||
|
||||
const cancel = () => {
|
||||
setShouldQuit(true);
|
||||
n(family.family.URL("members"));
|
||||
n(family.family.URL("genealogy/members"));
|
||||
};
|
||||
|
||||
const member = Member.New(family.family.family_id);
|
||||
@ -130,7 +130,7 @@ export function FamilyMemberRoute(): React.ReactElement {
|
||||
await MemberApi.Delete(member!);
|
||||
|
||||
snackbar("La fiche de membre a été supprimée avec succès !");
|
||||
n(family.family.URL("members"));
|
||||
n(family.family.URL("genealogy/members"));
|
||||
|
||||
await family.reloadMembersList();
|
||||
} catch (e) {
|
||||
@ -155,9 +155,7 @@ export function FamilyMemberRoute(): React.ReactElement {
|
||||
editing={false}
|
||||
onrequestOpenTree={() => n(family.family.familyTreeURL(member!))}
|
||||
onRequestDelete={deleteMember}
|
||||
onRequestEdit={() =>
|
||||
n(family.family.URL(`member/${member!.id}/edit`))
|
||||
}
|
||||
onRequestEdit={() => n(family.family.memberURL(member!, true))}
|
||||
onForceReload={forceReload}
|
||||
/>
|
||||
)}
|
||||
@ -199,7 +197,7 @@ export function FamilyEditMemberRoute(): React.ReactElement {
|
||||
await family.reloadMembersList();
|
||||
|
||||
setShouldQuit(true);
|
||||
n(family.family.URL(`member/${member!.id}`));
|
||||
n(family.family.memberURL(member!));
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
alert("Échec de la mise à jour des informations du membre !");
|
||||
@ -682,10 +680,7 @@ export function MemberPage(p: {
|
||||
<>Aucun enfant</>
|
||||
) : (
|
||||
p.children.map((c) => (
|
||||
<RouterLink
|
||||
key={c.id}
|
||||
to={family.family.URL(`member/${c.id}`)}
|
||||
>
|
||||
<RouterLink key={c.id} to={family.family.memberURL(c)}>
|
||||
<MemberItem member={c} />
|
||||
</RouterLink>
|
||||
))
|
||||
@ -694,7 +689,7 @@ export function MemberPage(p: {
|
||||
<div style={{ display: "flex", justifyContent: "end" }}>
|
||||
<RouterLink
|
||||
to={family.family.URL(
|
||||
`member/create?${
|
||||
`genealogy/member/create?${
|
||||
member.sex === "F" ? "mother" : "father"
|
||||
}=${member.id}`
|
||||
)}
|
||||
@ -714,10 +709,7 @@ export function MemberPage(p: {
|
||||
<>Aucun frère ou sœur</>
|
||||
) : (
|
||||
p.siblings.map((c) => (
|
||||
<RouterLink
|
||||
key={c.id}
|
||||
to={family.family.URL(`member/${c.id}`)}
|
||||
>
|
||||
<RouterLink key={c.id} to={family.family.memberURL(c)}>
|
||||
<MemberItem member={c} />
|
||||
</RouterLink>
|
||||
))
|
||||
@ -727,7 +719,7 @@ export function MemberPage(p: {
|
||||
<div style={{ display: "flex", justifyContent: "end" }}>
|
||||
<RouterLink
|
||||
to={family.family.URL(
|
||||
`member/create?mother=${member.mother}&father=${member.father}`
|
||||
`genealogy/member/create?mother=${member.mother}&father=${member.father}`
|
||||
)}
|
||||
>
|
||||
<Button>Nouveau</Button>
|
||||
|
@ -87,7 +87,7 @@ export function FamilyMemberTreeRoute(): React.ReactElement {
|
||||
dense
|
||||
member={member}
|
||||
secondary={
|
||||
<RouterLink to={family.family.URL("tree")}>
|
||||
<RouterLink to={family.family.URL("genealogy/tree")}>
|
||||
<IconButton>
|
||||
<ClearIcon />
|
||||
</IconButton>
|
||||
|
@ -60,7 +60,7 @@ export function FamilyMembersListRoute(): React.ReactElement {
|
||||
}}
|
||||
>
|
||||
<FamilyPageTitle title="Membres de la famille" />
|
||||
<RouterLink to={family.family.URL("member/create")}>
|
||||
<RouterLink to={family.family.URL("genealogy/member/create")}>
|
||||
<Tooltip title="Créer la fiche d'un nouveau membre">
|
||||
<Button startIcon={<AddIcon />}>Nouveau</Button>
|
||||
</Tooltip>
|
||||
|
@ -14,9 +14,9 @@ import {
|
||||
} from "@mui/material";
|
||||
import React from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { DataApi } from "../../api/genealogy/DataApi";
|
||||
import { FamilyApi } from "../../api/FamilyApi";
|
||||
import { ServerApi } from "../../api/ServerApi";
|
||||
import { DataApi } from "../../api/genealogy/DataApi";
|
||||
import { useAlert } from "../../hooks/context_providers/AlertDialogProvider";
|
||||
import { useConfirm } from "../../hooks/context_providers/ConfirmDialogProvider";
|
||||
import { useLoadingMessage } from "../../hooks/context_providers/LoadingMessageProvider";
|
||||
@ -55,7 +55,7 @@ export function FamilySettingsRoute(): React.ReactElement {
|
||||
return (
|
||||
<>
|
||||
<FamilySettingsCard />
|
||||
<FamilyExportCard />
|
||||
{family.family.enable_genealogy && <GenealogyExportCard />}
|
||||
<div style={{ textAlign: "center", marginTop: "50px" }}>
|
||||
<Button
|
||||
size="small"
|
||||
@ -191,7 +191,7 @@ function FamilySettingsCard(): React.ReactElement {
|
||||
);
|
||||
}
|
||||
|
||||
function FamilyExportCard(): React.ReactElement {
|
||||
function GenealogyExportCard(): React.ReactElement {
|
||||
const loading = useLoadingMessage();
|
||||
const confirm = useConfirm();
|
||||
const alert = useAlert();
|
||||
@ -254,7 +254,7 @@ function FamilyExportCard(): React.ReactElement {
|
||||
<FamilyCard error={error} success={success}>
|
||||
<CardContent>
|
||||
<Typography gutterBottom variant="h5" component="div">
|
||||
Export / import des données de la famille
|
||||
Export / import des données de généalogie
|
||||
</Typography>
|
||||
<p>
|
||||
Vous pouvez, à des fins de sauvegardes ou de transfert, exporter et
|
||||
|
@ -26,8 +26,8 @@ import {
|
||||
} from "@mui/material";
|
||||
import React from "react";
|
||||
import { Outlet, useLocation, useParams } from "react-router-dom";
|
||||
import { CoupleApi, CouplesList } from "../api/genealogy/CoupleApi";
|
||||
import { ExtendedFamilyInfo, FamilyApi } from "../api/FamilyApi";
|
||||
import { CoupleApi, CouplesList } from "../api/genealogy/CoupleApi";
|
||||
import { MemberApi, MembersList } from "../api/genealogy/MemberApi";
|
||||
import { useAlert } from "../hooks/context_providers/AlertDialogProvider";
|
||||
import { useConfirm } from "../hooks/context_providers/ConfirmDialogProvider";
|
||||
@ -150,10 +150,10 @@ export function BaseFamilyRoute(): React.ReactElement {
|
||||
<FamilyLink
|
||||
icon={<Icon path={mdiCrowd} size={1} />}
|
||||
label="Membres"
|
||||
uri="members"
|
||||
uri="genealogy/members"
|
||||
secondaryAction={
|
||||
<Tooltip title="Créer une nouvelle fiche de membre">
|
||||
<RouterLink to={family!.URL("member/create")}>
|
||||
<RouterLink to={family!.URL("genealogy/member/create")}>
|
||||
<IconButton>
|
||||
<Icon path={mdiPlus} size={0.75} />
|
||||
</IconButton>
|
||||
@ -165,10 +165,10 @@ export function BaseFamilyRoute(): React.ReactElement {
|
||||
<FamilyLink
|
||||
icon={<Icon path={mdiHumanMaleFemale} size={1} />}
|
||||
label="Couples"
|
||||
uri="couples"
|
||||
uri="genealogy/couples"
|
||||
secondaryAction={
|
||||
<Tooltip title="Créer une nouvelle fiche de couple">
|
||||
<RouterLink to={family!.URL("couple/create")}>
|
||||
<RouterLink to={family!.URL("genealogy/couple/create")}>
|
||||
<IconButton>
|
||||
<Icon path={mdiPlus} size={0.75} />
|
||||
</IconButton>
|
||||
@ -180,7 +180,7 @@ export function BaseFamilyRoute(): React.ReactElement {
|
||||
<FamilyLink
|
||||
icon={<Icon path={mdiFamilyTree} size={1} />}
|
||||
label="Arbre"
|
||||
uri="tree"
|
||||
uri="genealogy/tree"
|
||||
/>
|
||||
|
||||
<Divider sx={{ my: 1 }} />
|
||||
|
@ -30,7 +30,7 @@ export function MemberInput(p: {
|
||||
onClick={
|
||||
!p.editable
|
||||
? () => {
|
||||
n(family.family.URL(`member/${member.id}`));
|
||||
n(family.family.memberURL(member));
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user