Skip to content

Commit

Permalink
OCT-1484: Add tooltip hover to tick icon on Project detail pages (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmikolajczyk authored Mar 22, 2024
2 parents 92e7a14 + 93deffa commit d0ff825
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ const ButtonAddToAllocate: FC<ButtonAddToAllocateProps> = ({
const [isTooltipClicked, setIsTooltipClicked] = useState(false);
const [isTooltipVisible, setIsTooltipVisible] = useState(false);
const tooltipText = useMemo(() => {
if (isArchivedProject && isAllocatedTo) {
return t('donated');
}
if (isAddedToAllocate && isTooltipClicked) {
return t('saved');
}
Expand All @@ -39,7 +42,7 @@ const ButtonAddToAllocate: FC<ButtonAddToAllocateProps> = ({
}
return t('saveToAllocate');
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isAddedToAllocate, isTooltipClicked]);
}, [isAddedToAllocate, isTooltipClicked, isArchivedProject, isAllocatedTo]);

const handleTooltipVisibilityChange = (isVisible: boolean) => {
setIsTooltipVisible(isVisible);
Expand All @@ -61,7 +64,7 @@ const ButtonAddToAllocate: FC<ButtonAddToAllocateProps> = ({
Icon={
<Tooltip
hideAfterClick
isDisabled={isArchivedProject || isPatronMode}
isDisabled={isPatronMode || (isArchivedProject && !isAddedToAllocate)}
onClickCallback={() => {
if (isTooltipVisible) {
setIsTooltipClicked(true);
Expand Down
3 changes: 2 additions & 1 deletion client/src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
"saveToAllocate": "Save to allocate",
"saved": "Saved",
"removeFromAllocate": "Remove from allocate",
"removed": "Removed"
"removed": "Removed",
"donated": "Donated"
},
"rewardsCalculator": {
"enterGLMAmount": "Enter a GLM amount",
Expand Down

0 comments on commit d0ff825

Please sign in to comment.