From 0cfce232b6344c4bcd51912a6d2814275d40f1f1 Mon Sep 17 00:00:00 2001 From: Birk Johansson Date: Tue, 1 Oct 2024 16:20:43 +0200 Subject: [PATCH] fix(list): add check for shareable in actions --- .../listActions/DefaultListActions.tsx | 2 ++ .../listActions/SectionListActions.tsx | 34 +++++++++++-------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/components/sectionList/listActions/DefaultListActions.tsx b/src/components/sectionList/listActions/DefaultListActions.tsx index 0ac5cc08..5bff8796 100644 --- a/src/components/sectionList/listActions/DefaultListActions.tsx +++ b/src/components/sectionList/listActions/DefaultListActions.tsx @@ -22,6 +22,7 @@ export const DefaultListActions = ({ const deletable = canDeleteModel(model) const editable = canEditModel(model) + const shareable = schema.shareable return ( @@ -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)} diff --git a/src/components/sectionList/listActions/SectionListActions.tsx b/src/components/sectionList/listActions/SectionListActions.tsx index 7d8be85e..28c8f230 100644 --- a/src/components/sectionList/listActions/SectionListActions.tsx +++ b/src/components/sectionList/listActions/SectionListActions.tsx @@ -39,6 +39,7 @@ type ActionMoreProps = { deletable: boolean editable: boolean translatable: boolean + shareable: boolean model: BaseListModel onShowDetailsClick: () => void onOpenSharingClick: () => void @@ -49,6 +50,7 @@ export const ActionMore = ({ deletable, editable, translatable, + shareable, model, onOpenSharingClick, onShowDetailsClick, @@ -99,21 +101,23 @@ export const ActionMore = ({ href={href} /> - - } - onClick={() => { - onOpenSharingClick() - setOpen(false) - }} - /> - + {shareable && ( + + } + onClick={() => { + onOpenSharingClick() + setOpen(false) + }} + /> + + )} {translatable && (