2023-11-29 08:55:57 +00:00
|
|
|
import React from "react";
|
2023-09-26 14:26:59 +00:00
|
|
|
import { useRouter } from "next/router";
|
2023-11-27 08:45:33 +00:00
|
|
|
import { ChevronRight } from "lucide-react";
|
2023-11-02 10:32:34 +00:00
|
|
|
// components
|
|
|
|
import { Tooltip } from "@plane/ui";
|
2023-09-26 14:26:59 +00:00
|
|
|
// types
|
2023-10-19 09:23:01 +00:00
|
|
|
import { IIssue, IIssueDisplayProperties } from "types";
|
2023-09-26 14:26:59 +00:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
issue: IIssue;
|
|
|
|
expanded: boolean;
|
|
|
|
handleToggleExpand: (issueId: string) => void;
|
2023-10-19 09:23:01 +00:00
|
|
|
properties: IIssueDisplayProperties;
|
2023-11-27 08:45:33 +00:00
|
|
|
quickActions: (issue: IIssue) => React.ReactNode;
|
2023-09-26 14:26:59 +00:00
|
|
|
disableUserActions: boolean;
|
|
|
|
nestingLevel: number;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const IssueColumn: React.FC<Props> = ({
|
|
|
|
issue,
|
|
|
|
expanded,
|
|
|
|
handleToggleExpand,
|
|
|
|
properties,
|
2023-11-27 08:45:33 +00:00
|
|
|
quickActions,
|
2023-09-26 14:26:59 +00:00
|
|
|
disableUserActions,
|
|
|
|
nestingLevel,
|
|
|
|
}) => {
|
2023-11-29 08:55:57 +00:00
|
|
|
// router
|
2023-09-26 14:26:59 +00:00
|
|
|
const router = useRouter();
|
|
|
|
|
2023-11-03 11:50:14 +00:00
|
|
|
const handleIssuePeekOverview = (issue: IIssue) => {
|
|
|
|
const { query } = router;
|
2023-11-29 08:55:57 +00:00
|
|
|
|
2023-11-03 11:50:14 +00:00
|
|
|
router.push({
|
|
|
|
pathname: router.pathname,
|
2023-11-29 08:55:57 +00:00
|
|
|
query: { ...query, peekIssueId: issue?.id, peekProjectId: issue?.project },
|
2023-11-03 11:50:14 +00:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2023-09-26 14:26:59 +00:00
|
|
|
const paddingLeft = `${nestingLevel * 54}px`;
|
|
|
|
|
|
|
|
return (
|
2023-11-03 11:50:14 +00:00
|
|
|
<>
|
2023-11-27 08:45:33 +00:00
|
|
|
<div className="group flex items-center w-[28rem] text-sm h-11 top-0 bg-custom-background-100 truncate border-b border-custom-border-100">
|
2023-11-03 11:50:14 +00:00
|
|
|
{properties.key && (
|
|
|
|
<div
|
2023-11-14 12:58:49 +00:00
|
|
|
className="flex gap-1.5 px-4 pr-0 py-2.5 items-center min-w-min"
|
2023-11-03 11:50:14 +00:00
|
|
|
style={issue.parent && nestingLevel !== 0 ? { paddingLeft } : {}}
|
|
|
|
>
|
|
|
|
<div className="relative flex items-center cursor-pointer text-xs text-center hover:text-custom-text-100">
|
|
|
|
<span className="flex items-center justify-center font-medium opacity-100 group-hover:opacity-0 ">
|
|
|
|
{issue.project_detail?.identifier}-{issue.sequence_id}
|
|
|
|
</span>
|
|
|
|
|
|
|
|
{!disableUserActions && (
|
2023-11-27 08:45:33 +00:00
|
|
|
<div className="absolute top-0 left-2.5 opacity-0 group-hover:opacity-100">{quickActions(issue)}</div>
|
2023-11-03 11:50:14 +00:00
|
|
|
)}
|
|
|
|
</div>
|
2023-09-29 09:35:27 +00:00
|
|
|
|
2023-11-03 11:50:14 +00:00
|
|
|
{issue.sub_issues_count > 0 && (
|
|
|
|
<div className="h-6 w-6 flex justify-center items-center">
|
|
|
|
<button
|
|
|
|
className="h-5 w-5 hover:bg-custom-background-90 hover:text-custom-text-100 rounded-sm cursor-pointer"
|
|
|
|
onClick={() => handleToggleExpand(issue.id)}
|
2023-09-29 09:35:27 +00:00
|
|
|
>
|
2023-11-03 11:50:14 +00:00
|
|
|
<ChevronRight className={`h-3.5 w-3.5 ${expanded ? "rotate-90" : ""}`} />
|
|
|
|
</button>
|
2023-09-29 09:35:27 +00:00
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</div>
|
2023-11-03 11:50:14 +00:00
|
|
|
)}
|
|
|
|
<div className="w-full overflow-hidden">
|
|
|
|
<Tooltip tooltipHeading="Title" tooltipContent={issue.name}>
|
|
|
|
<div
|
|
|
|
className="px-4 py-2.5 h-full w-full truncate text-custom-text-100 text-left cursor-pointer text-[0.825rem]"
|
|
|
|
onClick={() => handleIssuePeekOverview(issue)}
|
|
|
|
>
|
2023-11-02 10:32:34 +00:00
|
|
|
{issue.name}
|
|
|
|
</div>
|
2023-11-03 11:50:14 +00:00
|
|
|
</Tooltip>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</>
|
2023-09-26 14:26:59 +00:00
|
|
|
);
|
|
|
|
};
|