fix: Tooltip content on assignee hover in all layouts (#2724)

* fix: Tooltip content on assignee hover in all layouts

* chore: comments added
This commit is contained in:
Lakhan Baheti 2023-11-08 22:35:30 +05:30 committed by GitHub
parent 931f9d288a
commit 10037222b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -79,19 +79,32 @@ export const IssuePropertyAssignee: React.FC<IIssuePropertyAssignee> = observer(
const filteredOptions = const filteredOptions =
query === "" ? options : options?.filter((option) => option.query.toLowerCase().includes(query.toLowerCase())); query === "" ? options : options?.filter((option) => option.query.toLowerCase().includes(query.toLowerCase()));
const label = ( const getTooltipContent = (): string => {
<Tooltip if (!value || value.length === 0) return "No Assignee";
tooltipHeading="Assignee"
tooltipContent={ // if multiple assignees
value && value.length > 0 if (Array.isArray(value)) {
? (workspaceMembers ? workspaceMembers : []) const assignees = workspaceMembers?.filter((m) => value.includes(m.member.id));
?.filter((m) => value.includes(m.member.display_name))
.map((m) => m.member.display_name) if (!assignees || assignees.length === 0) return "No Assignee";
.join(", ")
: "No Assignee" // if only one assignee in list
if (assignees.length === 1) {
return "1 assignee";
} else return `${assignees.length} assignees`;
} }
position="top"
> // if single assignee
const assignee = workspaceMembers?.find((m) => m.member.id === value)?.member;
if (!assignee) return "No Assignee";
// if assignee not null & not list
return "1 assignee";
};
const label = (
<Tooltip tooltipHeading="Assignee" tooltipContent={getTooltipContent()} position="top">
<div className="flex items-center cursor-pointer h-full w-full gap-2 text-custom-text-200"> <div className="flex items-center cursor-pointer h-full w-full gap-2 text-custom-text-200">
{value && value.length > 0 && Array.isArray(value) ? ( {value && value.length > 0 && Array.isArray(value) ? (
<AvatarGroup showTooltip={false}> <AvatarGroup showTooltip={false}>