Minor adjustements

This commit is contained in:
Pierre HUBERT 2023-08-17 12:50:16 +02:00
parent 65c77be523
commit e753710964
5 changed files with 28 additions and 3 deletions

View File

@ -103,6 +103,7 @@ export class Member implements MemberDataApi {
id: 0, id: 0,
dead: false, dead: false,
family_id: family_id, family_id: family_id,
sex: "M",
}); });
} }

View File

@ -22,7 +22,7 @@ import { PropertiesBox } from "../../widgets/PropertiesBox";
import { RouterLink } from "../../widgets/RouterLink"; import { RouterLink } from "../../widgets/RouterLink";
import { DateInput } from "../../widgets/forms/DateInput"; import { DateInput } from "../../widgets/forms/DateInput";
import { MemberInput } from "../../widgets/forms/MemberInput"; import { MemberInput } from "../../widgets/forms/MemberInput";
import { PropSelect } from "../../widgets/forms/SelectInput"; import { PropSelect } from "../../widgets/forms/PropSelect";
import { UploadPhotoButton } from "../../widgets/forms/UploadPhotoButton"; import { UploadPhotoButton } from "../../widgets/forms/UploadPhotoButton";
import { useQuery } from "../../hooks/useQuery"; import { useQuery } from "../../hooks/useQuery";

View File

@ -33,7 +33,7 @@ import { DateInput } from "../../widgets/forms/DateInput";
import { MemberInput } from "../../widgets/forms/MemberInput"; import { MemberInput } from "../../widgets/forms/MemberInput";
import { PropCheckbox } from "../../widgets/forms/PropCheckbox"; import { PropCheckbox } from "../../widgets/forms/PropCheckbox";
import { PropEdit } from "../../widgets/forms/PropEdit"; import { PropEdit } from "../../widgets/forms/PropEdit";
import { PropSelect } from "../../widgets/forms/SelectInput"; import { PropSelect } from "../../widgets/forms/PropSelect";
import { SexSelection } from "../../widgets/forms/SexSelection"; import { SexSelection } from "../../widgets/forms/SexSelection";
import { UploadPhotoButton } from "../../widgets/forms/UploadPhotoButton"; import { UploadPhotoButton } from "../../widgets/forms/UploadPhotoButton";
import { useQuery } from "../../hooks/useQuery"; import { useQuery } from "../../hooks/useQuery";

View File

@ -6,6 +6,7 @@ import {
mdiFamilyTree, mdiFamilyTree,
mdiHumanMaleFemale, mdiHumanMaleFemale,
mdiLockCheck, mdiLockCheck,
mdiPlus,
mdiRefresh, mdiRefresh,
} from "@mdi/js"; } from "@mdi/js";
import Icon from "@mdi/react"; import Icon from "@mdi/react";
@ -18,6 +19,7 @@ import {
ListItem, ListItem,
ListItemButton, ListItemButton,
ListItemIcon, ListItemIcon,
ListItemSecondaryAction,
ListItemText, ListItemText,
ListSubheader, ListSubheader,
Tooltip, Tooltip,
@ -145,12 +147,30 @@ export function BaseFamilyRoute(): React.ReactElement {
icon={<Icon path={mdiCrowd} size={1} />} icon={<Icon path={mdiCrowd} size={1} />}
label="Membres" label="Membres"
uri="members" uri="members"
secondaryAction={
<Tooltip title="Créer une nouvelle fiche de membre">
<RouterLink to={family!.URL("member/create")}>
<IconButton>
<Icon path={mdiPlus} size={0.75} />
</IconButton>
</RouterLink>
</Tooltip>
}
/> />
<FamilyLink <FamilyLink
icon={<Icon path={mdiHumanMaleFemale} size={1} />} icon={<Icon path={mdiHumanMaleFemale} size={1} />}
label="Couples" label="Couples"
uri="couples" uri="couples"
secondaryAction={
<Tooltip title="Créer une nouvelle fiche de couple">
<RouterLink to={family!.URL("couple/create")}>
<IconButton>
<Icon path={mdiPlus} size={0.75} />
</IconButton>
</RouterLink>
</Tooltip>
}
/> />
<FamilyLink <FamilyLink
@ -234,6 +254,7 @@ function FamilyLink(p: {
icon: React.ReactElement; icon: React.ReactElement;
uri: string; uri: string;
label: string; label: string;
secondaryAction?: React.ReactElement;
}): React.ReactElement { }): React.ReactElement {
const family = useFamily(); const family = useFamily();
const location = useLocation(); const location = useLocation();
@ -244,6 +265,9 @@ function FamilyLink(p: {
<ListItemButton selected={link === location.pathname}> <ListItemButton selected={link === location.pathname}>
<ListItemIcon>{p.icon}</ListItemIcon> <ListItemIcon>{p.icon}</ListItemIcon>
<ListItemText primary={p.label} /> <ListItemText primary={p.label} />
{p.secondaryAction && (
<ListItemSecondaryAction>{p.secondaryAction}</ListItemSecondaryAction>
)}
</ListItemButton> </ListItemButton>
</RouterLink> </RouterLink>
); );

View File

@ -23,7 +23,7 @@ export function PropSelect(p: {
<FormControl fullWidth variant="filled" style={{ marginBottom: "15px" }}> <FormControl fullWidth variant="filled" style={{ marginBottom: "15px" }}>
<InputLabel>{p.label}</InputLabel> <InputLabel>{p.label}</InputLabel>
<Select <Select
value={p.value} value={p.value ?? ""}
label={p.label} label={p.label}
onChange={(e) => p.onValueChange(e.target.value)} onChange={(e) => p.onValueChange(e.target.value)}
> >