Genealogy as a feature (#175)
All checks were successful
continuous-integration/drone/push Build is passing

Start our journey into turning GeneIT as afully featured family intranet by making genealogy a feature that can be disabled by family admins

Reviewed-on: #175
This commit is contained in:
2024-05-16 19:15:15 +00:00
parent 0442538bd5
commit c8ee881b2c
34 changed files with 726 additions and 443 deletions

View File

@ -2,9 +2,10 @@ import ClearIcon from "@mui/icons-material/Clear";
import { Autocomplete, IconButton, TextField, Typography } from "@mui/material";
import React from "react";
import { useNavigate } from "react-router-dom";
import { Member } from "../../api/MemberApi";
import { Member } from "../../api/genealogy/MemberApi";
import { useFamily } from "../BaseFamilyRoute";
import { MemberItem } from "../MemberItem";
import { useGenealogy } from "../genealogy/BaseGenealogyRoute";
export function MemberInput(p: {
editable: boolean;
@ -15,13 +16,14 @@ export function MemberInput(p: {
}): React.ReactElement {
const n = useNavigate();
const family = useFamily();
const genealogy = useGenealogy();
const choices = family.members.filter(p.filter);
const choices = genealogy.members.filter(p.filter);
const [inputValue, setInputValue] = React.useState("");
if (p.current) {
const member = family.members.get(p.current)!;
const member = genealogy.members.get(p.current)!;
return (
<div style={{ display: "flex", alignItems: "center" }}>
<Typography variant="body2">{p.label}</Typography>
@ -30,7 +32,7 @@ export function MemberInput(p: {
onClick={
!p.editable
? () => {
n(family.family.URL(`member/${member.id}`));
n(family.family.memberURL(member));
}
: undefined
}
@ -55,7 +57,7 @@ export function MemberInput(p: {
return (
<Autocomplete
value={p.current ? family.members.get(p.current) : undefined}
value={p.current ? genealogy.members.get(p.current) : undefined}
onChange={(_event: any, newValue: Member | null | undefined) => {
p.onValueChange(newValue?.id);
}}