🛂(frontend) right pad update

Manage the right on the pad update.
If a use cannot update a pad, we will not display
the update button in the dropdown menu.
This commit is contained in:
Anthony LC
2024-05-27 09:35:44 +02:00
committed by Anthony LC
parent d5d374c311
commit effa77dc10
2 changed files with 56 additions and 10 deletions

View File

@@ -57,16 +57,30 @@ export const PadToolBox = ({ pad }: PadToolBoxProps) => {
isOpen={isDropOpen}
>
<Box>
<Button
onClick={() => {
setIsModalUpdateOpen(true);
setIsDropOpen(false);
}}
color="primary-text"
icon={<span className="material-icons">edit</span>}
>
<Text $theme="primary">{t('Update document')}</Text>
</Button>
{pad.abilities.partial_update && (
<Button
onClick={() => {
setIsModalUpdateOpen(true);
setIsDropOpen(false);
}}
color="primary-text"
icon={<span className="material-icons">edit</span>}
>
<Text $theme="primary">{t('Update document')}</Text>
</Button>
)}
{pad.abilities.destroy && (
<Button
onClick={() => {
setIsModalUpdateOpen(true);
setIsDropOpen(false);
}}
color="primary-text"
icon={<span className="material-icons">edit</span>}
>
<Text $theme="primary">{t('Update document')}</Text>
</Button>
)}
<Button
onClick={() => {
setIsModalRemoveOpen(true);