🛂(frontend) hide version restore button when reader

When you are a reader member, you have the right to
see the version but you cannot restore
them. So, we hide the restore button
when you are a reader.
This commit is contained in:
Anthony LC
2025-02-11 15:53:28 +01:00
committed by Anthony LC
parent 15dc1e3012
commit aefbc2e0b9
2 changed files with 19 additions and 15 deletions

View File

@@ -11,6 +11,7 @@ and this project adheres to
## Changed
- 🛂(frontend) Restore version visibility #629
- 📝(doc) minor README.md formatting and wording enhancements
-Stop setting a default title on doc creation #634

View File

@@ -36,8 +36,9 @@ export const ModalSelectVersion = ({
const { t } = useTranslation();
const [selectedVersionId, setSelectedVersionId] =
useState<Versions['version_id']>();
const canRestore = doc.abilities.partial_update;
const restoreModal = useModal();
return (
<>
<Modal
@@ -127,21 +128,23 @@ export const ModalSelectVersion = ({
selectedVersionId={selectedVersionId}
/>
</Box>
<Box
$padding="xs"
$css={css`
border-top: 1px solid var(--c--theme--colors--greyscale-200);
`}
>
<Button
fullWidth
disabled={!selectedVersionId}
onClick={restoreModal.open}
color="primary"
{canRestore && (
<Box
$padding="xs"
$css={css`
border-top: 1px solid var(--c--theme--colors--greyscale-200);
`}
>
{t('Restore')}
</Button>
</Box>
<Button
fullWidth
disabled={!selectedVersionId}
onClick={restoreModal.open}
color="primary"
>
{t('Restore')}
</Button>
</Box>
)}
</Box>
</Box>
</Modal>