fix: issue label activity truncate fix and chip component added (#5120)
This commit is contained in:
parent
4b0946e093
commit
830d1c0b5a
3 changed files with 32 additions and 24 deletions
|
|
@ -16,6 +16,7 @@ export * from "./link";
|
|||
export * from "./attachment";
|
||||
export * from "./archived-at";
|
||||
export * from "./inbox";
|
||||
export * from "./label-activity-chip";
|
||||
|
||||
// helpers
|
||||
export * from "./helpers/activity-block";
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
import { FC } from "react";
|
||||
import { Tooltip } from "@plane/ui";
|
||||
|
||||
type TIssueLabelPill = { name?: string; color?: string };
|
||||
|
||||
export const LabelActivityChip: FC<TIssueLabelPill> = (props) => {
|
||||
const { name, color } = props;
|
||||
return (
|
||||
<Tooltip tooltipContent={name}>
|
||||
<span className="inline-flex w-min max-w-32 cursor-default flex-shrink-0 items-center gap-2 truncate whitespace-nowrap rounded-full border border-custom-border-300 px-2 py-0.5 text-xs">
|
||||
<span
|
||||
className="h-1.5 w-1.5 flex-shrink-0 rounded-full"
|
||||
style={{
|
||||
backgroundColor: color ?? "#000000",
|
||||
}}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<span className="flex-shrink truncate font-medium text-custom-text-100">{name}</span>
|
||||
</span>
|
||||
</Tooltip>
|
||||
);
|
||||
};
|
||||
|
|
@ -4,7 +4,7 @@ import { Tag } from "lucide-react";
|
|||
// hooks
|
||||
import { useIssueDetail, useLabel } from "@/hooks/store";
|
||||
// components
|
||||
import { IssueActivityBlockComponent, IssueLink } from "./";
|
||||
import { IssueActivityBlockComponent, IssueLink, LabelActivityChip } from "./";
|
||||
|
||||
type TIssueLabelActivity = { activityId: string; showIssue?: boolean; ends: "top" | "bottom" | undefined };
|
||||
|
||||
|
|
@ -27,29 +27,14 @@ export const IssueLabelActivity: FC<TIssueLabelActivity> = observer((props) => {
|
|||
>
|
||||
<>
|
||||
{activity.old_value === "" ? `added a new label ` : `removed the label `}
|
||||
{activity.old_value === "" ? (
|
||||
<span className="inline-flex w-min items-center gap-2 truncate whitespace-nowrap rounded-full border border-custom-border-300 px-2 py-0.5 text-xs">
|
||||
<span
|
||||
className="h-1.5 w-1.5 flex-shrink-0 rounded-full"
|
||||
style={{
|
||||
backgroundColor: projectLabels?.find((l) => l.id === activity.new_identifier)?.color ?? "#000000",
|
||||
}}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<span className="flex-shrink truncate font-medium text-custom-text-100">{activity.new_value}</span>
|
||||
</span>
|
||||
) : (
|
||||
<span className="inline-flex w-min items-center gap-2 truncate whitespace-nowrap rounded-full border border-custom-border-300 px-2 py-0.5 text-xs">
|
||||
<span
|
||||
className="h-1.5 w-1.5 flex-shrink-0 rounded-full"
|
||||
style={{
|
||||
backgroundColor: projectLabels?.find((l) => l.id === activity.old_identifier)?.color ?? "#000000",
|
||||
}}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<span className="flex-shrink truncate font-medium text-custom-text-100">{activity.old_value}</span>
|
||||
</span>
|
||||
)}
|
||||
<LabelActivityChip
|
||||
name={activity.old_value === "" ? activity.new_value : activity.old_value}
|
||||
color={
|
||||
activity.old_value === ""
|
||||
? projectLabels?.find((l) => l.id === activity.new_identifier)?.color
|
||||
: projectLabels?.find((l) => l.id === activity.old_identifier)?.color
|
||||
}
|
||||
/>
|
||||
{showIssue && (activity.old_value === "" ? ` to ` : ` from `)}
|
||||
{showIssue && <IssueLink activityId={activityId} />}
|
||||
</>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue