Disable couple photo on couple route

This commit is contained in:
Pierre HUBERT 2023-08-26 16:37:26 +02:00
parent 298df7be77
commit 581283f45b
2 changed files with 50 additions and 44 deletions

View File

@ -414,49 +414,52 @@ export function CouplePage(p: {
</PropertiesBox>
</Grid>
{/* Photo */}
<Grid item sm={12} md={6}>
<PropertiesBox title="Photo">
<div style={{ textAlign: "center" }}>
<CouplePhoto couple={couple} width={150} />
<br />
{p.editing ? (
<p>
Veuillez enregistrer / annuler les modifications apportées à
la fiche avant de changer la photo du couple.
</p>
) : (
<>
<UploadPhotoButton
label={couple.hasPhoto ? "Remplacer" : "Ajouter"}
onPhotoSelected={uploadNewPhoto}
aspect={5 / 4}
/>{" "}
{couple.hasPhoto && (
<RouterLink to={couple.photoURL!} target="_blank">
<Button
variant="outlined"
startIcon={<FileDownloadIcon />}
>
Télécharger
</Button>
</RouterLink>
{
/* Photo */ !family.family.disable_couple_photos && (
<Grid item sm={12} md={6}>
<PropertiesBox title="Photo">
<div style={{ textAlign: "center" }}>
<CouplePhoto couple={couple} width={150} />
<br />
{p.editing ? (
<p>
Veuillez enregistrer / annuler les modifications apportées
à la fiche avant de changer la photo du couple.
</p>
) : (
<>
<UploadPhotoButton
label={couple.hasPhoto ? "Remplacer" : "Ajouter"}
onPhotoSelected={uploadNewPhoto}
aspect={5 / 4}
/>{" "}
{couple.hasPhoto && (
<RouterLink to={couple.photoURL!} target="_blank">
<Button
variant="outlined"
startIcon={<FileDownloadIcon />}
>
Télécharger
</Button>
</RouterLink>
)}{" "}
{couple.hasPhoto && (
<Button
variant="outlined"
startIcon={<DeleteIcon />}
color="error"
onClick={deletePhoto}
>
Supprimer
</Button>
)}
</>
)}{" "}
{couple.hasPhoto && (
<Button
variant="outlined"
startIcon={<DeleteIcon />}
color="error"
onClick={deletePhoto}
>
Supprimer
</Button>
)}
</>
)}{" "}
</div>
</PropertiesBox>
</Grid>
</div>
</PropertiesBox>
</Grid>
)
}
{/* 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 (
<DataGrid
style={{ flex: "1" }}
@ -233,7 +236,7 @@ function CouplesTable(p: {
autoPageSize
getRowId={(c) => c.id}
onCellDoubleClick={(p) => {
let member;
/*let member;
if (p.field === "wife") member = family.members.get(p.row.wife);
else if (p.field === "husband")
member = family.members.get(p.row.husband);
@ -241,7 +244,7 @@ function CouplesTable(p: {
if (member) {
n(family.family.memberURL(member));
return;
}
}*/
n(family.family.coupleURL(p.row));
}}