Skip to content

Commit b7d035f

Browse files
committed
[web] qns/bookmark: remove isFetching from button isDisabled
1 parent 7301c3b commit b7d035f

File tree

1 file changed

+28
-16
lines changed

1 file changed

+28
-16
lines changed

apps/web/src/components/interviews/questions/common/QuestionBookmarkAction.tsx

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,17 @@ export default function QuestionBookmarkAction({
6161
}
6262

6363
const Icon = isBookmarked ? RiBookmarkFill : RiBookmarkLine;
64+
const bookmarkTooltip = isBookmarked
65+
? intl.formatMessage({
66+
defaultMessage: 'Remove',
67+
description: 'Tooltip to remove bookmark',
68+
id: 'DY0cPB',
69+
})
70+
: intl.formatMessage({
71+
defaultMessage: 'Add to bookmark',
72+
description: 'Tooltip to add bookmark',
73+
id: 'LGi4p/',
74+
});
6475

6576
const commonProps = {
6677
href:
@@ -80,32 +91,33 @@ export default function QuestionBookmarkAction({
8091
return <DropdownMenu.Item {...commonProps} />;
8192
}
8293

94+
if (isFetching) {
95+
return (
96+
<Button
97+
addonPosition="start"
98+
isLabelHidden={true}
99+
size="xs"
100+
tooltip={bookmarkTooltip}
101+
variant="secondary"
102+
{...commonProps}
103+
className="cursor-disabled"
104+
onClick={() => {}}
105+
/>
106+
);
107+
}
108+
83109
return (
84110
<Button
85111
addonPosition="start"
86112
isDisabled={
87-
isFetching ||
88-
addBookmarkMutation.isLoading ||
89-
deleteBookmarkMutation.isLoading
113+
addBookmarkMutation.isLoading || deleteBookmarkMutation.isLoading
90114
}
91115
isLabelHidden={true}
92116
isLoading={
93117
addBookmarkMutation.isLoading || deleteBookmarkMutation.isLoading
94118
}
95119
size="xs"
96-
tooltip={
97-
isBookmarked
98-
? intl.formatMessage({
99-
defaultMessage: 'Remove',
100-
description: 'Tooltip to remove bookmark',
101-
id: 'DY0cPB',
102-
})
103-
: intl.formatMessage({
104-
defaultMessage: 'Add to bookmark',
105-
description: 'Tooltip to add bookmark',
106-
id: 'LGi4p/',
107-
})
108-
}
120+
tooltip={bookmarkTooltip}
109121
variant="secondary"
110122
{...commonProps}
111123
/>

0 commit comments

Comments
 (0)