Skip to content

Commit a94de4f

Browse files
committed
fix(web): prevent rendering tooltip for add someday btn when dragging someday event
1 parent a28803f commit a94de4f

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

packages/web/src/views/Calendar/components/Sidebar/SomedayTab/SomedayEvents/SomedayEventsContainer/SomedayEventsContainer.tsx

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,23 @@ export const SomedayEventsContainer: FC<Props> = ({
5454
const isDraftingThisCategory =
5555
state.isDraftingNew && category === draftCategory;
5656

57+
// Render add someday event tooltip
58+
const renderWithTooltip = (children: React.ReactNode) => {
59+
return (
60+
<TooltipWrapper
61+
description={
62+
category === Categories_Event.SOMEDAY_MONTH
63+
? "Add to month"
64+
: "Add to week"
65+
}
66+
onClick={() => onPlaceholderClick(category)}
67+
shortcut={category === Categories_Event.SOMEDAY_MONTH ? "M" : "W"}
68+
>
69+
{children}
70+
</TooltipWrapper>
71+
);
72+
};
73+
5774
return (
5875
<>
5976
<Droppable droppableId={column.id}>
@@ -78,19 +95,11 @@ export const SomedayEventsContainer: FC<Props> = ({
7895

7996
{!isDraftingNew && (
8097
<div style={{ opacity: state.isDragging ? 0 : 1 }}>
81-
<TooltipWrapper
82-
description={
83-
category === Categories_Event.SOMEDAY_MONTH
84-
? "Add to month"
85-
: "Add to week"
86-
}
87-
onClick={() => onPlaceholderClick(category)}
88-
shortcut={
89-
category === Categories_Event.SOMEDAY_MONTH ? "M" : "W"
90-
}
91-
>
98+
{state.isDragging ? (
9299
<AddSomedayEvent />
93-
</TooltipWrapper>
100+
) : (
101+
renderWithTooltip(<AddSomedayEvent />)
102+
)}
94103
</div>
95104
)}
96105

0 commit comments

Comments
 (0)