🛂(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:
@@ -11,6 +11,7 @@ and this project adheres to
|
|||||||
|
|
||||||
## Changed
|
## Changed
|
||||||
|
|
||||||
|
- 🛂(frontend) Restore version visibility #629
|
||||||
- 📝(doc) minor README.md formatting and wording enhancements
|
- 📝(doc) minor README.md formatting and wording enhancements
|
||||||
- ♻️Stop setting a default title on doc creation #634
|
- ♻️Stop setting a default title on doc creation #634
|
||||||
|
|
||||||
|
|||||||
@@ -36,8 +36,9 @@ export const ModalSelectVersion = ({
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [selectedVersionId, setSelectedVersionId] =
|
const [selectedVersionId, setSelectedVersionId] =
|
||||||
useState<Versions['version_id']>();
|
useState<Versions['version_id']>();
|
||||||
|
const canRestore = doc.abilities.partial_update;
|
||||||
const restoreModal = useModal();
|
const restoreModal = useModal();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Modal
|
<Modal
|
||||||
@@ -127,21 +128,23 @@ export const ModalSelectVersion = ({
|
|||||||
selectedVersionId={selectedVersionId}
|
selectedVersionId={selectedVersionId}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
<Box
|
{canRestore && (
|
||||||
$padding="xs"
|
<Box
|
||||||
$css={css`
|
$padding="xs"
|
||||||
border-top: 1px solid var(--c--theme--colors--greyscale-200);
|
$css={css`
|
||||||
`}
|
border-top: 1px solid var(--c--theme--colors--greyscale-200);
|
||||||
>
|
`}
|
||||||
<Button
|
|
||||||
fullWidth
|
|
||||||
disabled={!selectedVersionId}
|
|
||||||
onClick={restoreModal.open}
|
|
||||||
color="primary"
|
|
||||||
>
|
>
|
||||||
{t('Restore')}
|
<Button
|
||||||
</Button>
|
fullWidth
|
||||||
</Box>
|
disabled={!selectedVersionId}
|
||||||
|
onClick={restoreModal.open}
|
||||||
|
color="primary"
|
||||||
|
>
|
||||||
|
{t('Restore')}
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|||||||
Reference in New Issue
Block a user