Can disable couple photos #5

Merged
pierre merged 7 commits from disable_couple_photos into master 2023-08-26 14:55:24 +00:00
2 changed files with 50 additions and 44 deletions
Showing only changes of commit 581283f45b - Show all commits

View File

@ -414,49 +414,52 @@ export function CouplePage(p: {
</PropertiesBox> </PropertiesBox>
</Grid> </Grid>
{/* Photo */} {
<Grid item sm={12} md={6}> /* Photo */ !family.family.disable_couple_photos && (
<PropertiesBox title="Photo"> <Grid item sm={12} md={6}>
<div style={{ textAlign: "center" }}> <PropertiesBox title="Photo">
<CouplePhoto couple={couple} width={150} /> <div style={{ textAlign: "center" }}>
<br /> <CouplePhoto couple={couple} width={150} />
{p.editing ? ( <br />
<p> {p.editing ? (
Veuillez enregistrer / annuler les modifications apportées à <p>
la fiche avant de changer la photo du couple. Veuillez enregistrer / annuler les modifications apportées
</p> à la fiche avant de changer la photo du couple.
) : ( </p>
<> ) : (
<UploadPhotoButton <>
label={couple.hasPhoto ? "Remplacer" : "Ajouter"} <UploadPhotoButton
onPhotoSelected={uploadNewPhoto} label={couple.hasPhoto ? "Remplacer" : "Ajouter"}
aspect={5 / 4} onPhotoSelected={uploadNewPhoto}
/>{" "} aspect={5 / 4}
{couple.hasPhoto && ( />{" "}
<RouterLink to={couple.photoURL!} target="_blank"> {couple.hasPhoto && (
<Button <RouterLink to={couple.photoURL!} target="_blank">
variant="outlined" <Button
startIcon={<FileDownloadIcon />} variant="outlined"
> startIcon={<FileDownloadIcon />}
Télécharger >
</Button> Télécharger
</RouterLink> </Button>
</RouterLink>
)}{" "}
{couple.hasPhoto && (
<Button
variant="outlined"
startIcon={<DeleteIcon />}
color="error"
onClick={deletePhoto}
>
Supprimer
</Button>
)}
</>
)}{" "} )}{" "}
{couple.hasPhoto && ( </div>
<Button </PropertiesBox>
variant="outlined" </Grid>
startIcon={<DeleteIcon />} )
color="error" }
onClick={deletePhoto}
>
Supprimer
</Button>
)}
</>
)}{" "}
</div>
</PropertiesBox>
</Grid>
{/* Children */} {/* Children */}
{p.children && ( {p.children && (

View File

@ -225,6 +225,9 @@ function CouplesTable(p: {
}, },
]; ];
// If couple photos are hidden, remove their column
if (family.family.disable_couple_photos) columns.splice(0, 1);
return ( return (
<DataGrid <DataGrid
style={{ flex: "1" }} style={{ flex: "1" }}
@ -233,7 +236,7 @@ function CouplesTable(p: {
autoPageSize autoPageSize
getRowId={(c) => c.id} getRowId={(c) => c.id}
onCellDoubleClick={(p) => { onCellDoubleClick={(p) => {
let member; /*let member;
if (p.field === "wife") member = family.members.get(p.row.wife); if (p.field === "wife") member = family.members.get(p.row.wife);
else if (p.field === "husband") else if (p.field === "husband")
member = family.members.get(p.row.husband); member = family.members.get(p.row.husband);
@ -241,7 +244,7 @@ function CouplesTable(p: {
if (member) { if (member) {
n(family.family.memberURL(member)); n(family.family.memberURL(member));
return; return;
} }*/
n(family.family.coupleURL(p.row)); n(family.family.coupleURL(p.row));
}} }}