From a4eeb32e3291566cf6da4557690c96442ab58beb Mon Sep 17 00:00:00 2001 From: Thomas L Fagermyr Date: Wed, 23 Oct 2024 10:36:02 +0200 Subject: [PATCH] feat: Added tooltip when button is disabled --- .../Compute/CaseGroup/CaseButtons/CaseButtons.tsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/features/Compute/CaseGroup/CaseButtons/CaseButtons.tsx b/src/features/Compute/CaseGroup/CaseButtons/CaseButtons.tsx index 4737009..64f6522 100644 --- a/src/features/Compute/CaseGroup/CaseButtons/CaseButtons.tsx +++ b/src/features/Compute/CaseGroup/CaseButtons/CaseButtons.tsx @@ -60,10 +60,21 @@ export const CaseButtons = ({ setDeleteConfirm(false); }; + const deleteTooltip = () => { + if (!isOwner()) return 'Can not delete because you are not owner or admin.'; + return 'Can not delete unsaved case.'; + }; + + const duplicateTooltip = () => { + if (!isOwner()) + return 'Can not duplicate because you are not owner or admin.'; + return 'Can not duplicate unsaved case.'; + }; + return ( {id.length < 3 || !isOwner() ? ( - + @@ -81,7 +92,7 @@ export const CaseButtons = ({ {caseType === 'Variogram' && ( <> {id.length < 3 || !isOwner() ? ( - +