Skip to content

Commit

Permalink
fix(list): add check for shareable in actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Birkbjo committed Oct 1, 2024
1 parent 70b5437 commit 0cfce23
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
2 changes: 2 additions & 0 deletions src/components/sectionList/listActions/DefaultListActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const DefaultListActions = ({

const deletable = canDeleteModel(model)
const editable = canEditModel(model)
const shareable = schema.shareable

return (
<ListActions>
Expand All @@ -30,6 +31,7 @@ export const DefaultListActions = ({
deletable={deletable}
editable={editable}
translatable={schema.translatable}
shareable={shareable}
model={model}
onShowDetailsClick={() => onShowDetailsClick(model)}
onOpenSharingClick={() => onOpenSharingClick(model.id)}
Expand Down
34 changes: 19 additions & 15 deletions src/components/sectionList/listActions/SectionListActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type ActionMoreProps = {
deletable: boolean
editable: boolean
translatable: boolean
shareable: boolean
model: BaseListModel
onShowDetailsClick: () => void
onOpenSharingClick: () => void
Expand All @@ -49,6 +50,7 @@ export const ActionMore = ({
deletable,
editable,
translatable,
shareable,
model,
onOpenSharingClick,
onShowDetailsClick,
Expand Down Expand Up @@ -99,21 +101,23 @@ export const ActionMore = ({
href={href}
/>

<TooltipWrapper
condition={!editable}
content={TOOLTIPS.noEditAccess}
>
<MenuItem
dense
disabled={!editable}
label={i18n.t('Sharing settings')}
icon={<IconShare16 />}
onClick={() => {
onOpenSharingClick()
setOpen(false)
}}
/>
</TooltipWrapper>
{shareable && (
<TooltipWrapper
condition={!editable}
content={TOOLTIPS.noEditAccess}
>
<MenuItem
dense
disabled={!editable}
label={i18n.t('Sharing settings')}
icon={<IconShare16 />}
onClick={() => {
onOpenSharingClick()
setOpen(false)
}}
/>
</TooltipWrapper>
)}
{translatable && (
<MenuItem
dense
Expand Down

0 comments on commit 0cfce23

Please sign in to comment.