mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
chore: add tooltip for user info
This commit is contained in:
parent
60c3d1a6e9
commit
ac4127c93d
@ -6,7 +6,7 @@ import { useRouter } from "next/router";
|
|||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
import { useMobxStore } from "lib/mobx/store-provider";
|
import { useMobxStore } from "lib/mobx/store-provider";
|
||||||
// ui
|
// ui
|
||||||
import { ReactionSelector } from "components/ui";
|
import { ReactionSelector, Tooltip } from "components/ui";
|
||||||
// helpers
|
// helpers
|
||||||
import { groupReactions, renderEmoji } from "helpers/emoji.helper";
|
import { groupReactions, renderEmoji } from "helpers/emoji.helper";
|
||||||
|
|
||||||
@ -77,41 +77,55 @@ export const CommentReactions: React.FC<Props> = observer((props) => {
|
|||||||
size="md"
|
size="md"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{Object.keys(groupedReactions || {}).map(
|
{Object.keys(groupedReactions || {}).map((reaction) => {
|
||||||
(reaction) =>
|
const reactions = groupedReactions?.[reaction] ?? [];
|
||||||
groupedReactions?.[reaction]?.length &&
|
const REACTIONS_LIMIT = 1000;
|
||||||
groupedReactions[reaction].length > 0 && (
|
|
||||||
<button
|
if (reactions.length > 0)
|
||||||
type="button"
|
return (
|
||||||
onClick={() => {
|
<Tooltip
|
||||||
userStore.requiredLogin(() => {
|
|
||||||
handleReactionClick(reaction);
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
key={reaction}
|
key={reaction}
|
||||||
className={`flex items-center gap-1 text-custom-text-100 text-sm h-full px-2 py-1 rounded-md ${
|
tooltipContent={
|
||||||
commentReactions?.some(
|
<div>
|
||||||
(r) => r.actor_detail.id === userStore.currentUser?.id && r.reaction === reaction
|
{reactions
|
||||||
)
|
.map((r) => r.actor_detail.display_name)
|
||||||
? "bg-custom-primary-100/10"
|
.splice(0, REACTIONS_LIMIT)
|
||||||
: "bg-custom-background-80"
|
.join(", ")}
|
||||||
}`}
|
{reactions.length > REACTIONS_LIMIT && " and " + (reactions.length - REACTIONS_LIMIT) + " more"}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<span>{renderEmoji(reaction)}</span>
|
<button
|
||||||
<span
|
type="button"
|
||||||
className={
|
onClick={() => {
|
||||||
|
userStore.requiredLogin(() => {
|
||||||
|
handleReactionClick(reaction);
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
className={`flex items-center gap-1 text-custom-text-100 text-sm h-full px-2 py-1 rounded-md ${
|
||||||
commentReactions?.some(
|
commentReactions?.some(
|
||||||
(r) => r.actor_detail.id === userStore.currentUser?.id && r.reaction === reaction
|
(r) => r.actor_detail.id === userStore.currentUser?.id && r.reaction === reaction
|
||||||
)
|
)
|
||||||
? "text-custom-primary-100"
|
? "bg-custom-primary-100/10"
|
||||||
: ""
|
: "bg-custom-background-80"
|
||||||
}
|
}`}
|
||||||
>
|
>
|
||||||
{groupedReactions?.[reaction].length}{" "}
|
<span>{renderEmoji(reaction)}</span>
|
||||||
</span>
|
<span
|
||||||
</button>
|
className={
|
||||||
)
|
commentReactions?.some(
|
||||||
)}
|
(r) => r.actor_detail.id === userStore.currentUser?.id && r.reaction === reaction
|
||||||
|
)
|
||||||
|
? "text-custom-primary-100"
|
||||||
|
: ""
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{groupedReactions?.[reaction].length}{" "}
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
})}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user