forked from github/plane
e9a0eb87cc
* dev: initialize inbox * dev: inbox and inbox issues models, views and serializers * dev: issue object filter for inbox * dev: filter for search issues * dev: inbox snooze and duplicates * dev: set duplicate to null by default * feat: inbox ui and services * feat: project detail in inbox * style: layout, popover, icons, sidebar * dev: default inbox for project and pending issues count * dev: fix exception when creating default inbox * fix: empty state for inbox * dev: auto issue state updation when rejected or marked duplicate * fix: inbox update status * fix: hydrating chose with old values filters workflow * feat: inbox issue filtering * fix: issue inbox filtering * feat: filter inbox issues * refactor: analytics, border colors * dev: filters and views for inbox * dev: source for inboxissue and update list inbox issue * dev: update list endpoint to house filters and additional data * dev: bridge id for list * dev: remove print logs * dev: update inbox issue workflow * dev: add description_html in issue details * fix: inbox track event auth, chore: inbox issue action authorization * fix: removed unnecessary api calls * style: viewed issues * fix: priority validation * dev: remove print logs * dev: update issue inbox update workflow * chore: added inbox view context * fix: type errors * fix: build errors and warnings * dev: update issue inbox workflow and log all the changes * fix: filters logic, sidebar fields to show * dev: update issue filtering status * chore: update create inbox issue modal, fix: mutation issues * dev: update issue accept workflow * chore: add comment to inbox issues * chore: remove inboxIssueId from url after deleting * dev: update the issue triage workflow * fix: mutation after issue status change * chore: issue details sidebar divider * fix: issue activity for inbox issues * dev: update inbox perrmissions * dev: create new permission layer * chore: auth layer for inbox * chore: show accepting status * chore: show issue status at the top of issue details --------- Co-authored-by: Dakshesh Jain <dakshesh.jain14@gmail.com> Co-authored-by: gurusainath <gurusainath007@gmail.com> Co-authored-by: Aaryan Khandelwal <aaryankhandu123@gmail.com>
118 lines
4.6 KiB
TypeScript
118 lines
4.6 KiB
TypeScript
import { useRouter } from "next/router";
|
|
import Link from "next/link";
|
|
|
|
// ui
|
|
import { Tooltip } from "components/ui";
|
|
// icons
|
|
import { getPriorityIcon, getStateGroupIcon } from "components/icons";
|
|
import { CalendarDaysIcon, ClockIcon } from "@heroicons/react/24/outline";
|
|
// helpers
|
|
import { renderShortNumericDateFormat } from "helpers/date-time.helper";
|
|
import { addSpaceIfCamelCase } from "helpers/string.helper";
|
|
// types
|
|
import type { IInboxIssue } from "types";
|
|
|
|
type Props = {
|
|
issue: IInboxIssue;
|
|
active: boolean;
|
|
};
|
|
|
|
export const InboxIssueCard: React.FC<Props> = (props) => {
|
|
const { issue, active } = props;
|
|
|
|
const router = useRouter();
|
|
const { workspaceSlug, projectId, inboxId } = router.query;
|
|
|
|
const issueStatus = issue.issue_inbox[0].status;
|
|
|
|
return (
|
|
<Link
|
|
href={`/${workspaceSlug}/projects/${projectId}/inbox/${inboxId}?inboxIssueId=${issue.bridge_id}`}
|
|
>
|
|
<a>
|
|
<Tooltip
|
|
tooltipContent={
|
|
issueStatus === -2
|
|
? "Pending issue"
|
|
: issueStatus === -1
|
|
? "Declined issue"
|
|
: issueStatus === 0
|
|
? "Snoozed issue"
|
|
: issueStatus === 1
|
|
? "Accepted issue"
|
|
: "Marked as duplicate"
|
|
}
|
|
position="right"
|
|
>
|
|
<div
|
|
id={issue.id}
|
|
className={`relative min-h-[5rem] cursor-pointer select-none space-y-3 py-2 px-4 border-b border-brand-base hover:bg-brand-accent hover:bg-opacity-10 ${
|
|
active ? "bg-brand-accent bg-opacity-5" : " "
|
|
} ${issue.issue_inbox[0].status !== -2 ? "opacity-60" : ""}`}
|
|
>
|
|
<div className="flex items-center gap-x-2">
|
|
<p className="flex-shrink-0 text-brand-secondary text-xs">
|
|
{issue.project_detail?.identifier}-{issue.sequence_id}
|
|
</p>
|
|
<h5 className="truncate text-sm">{issue.name}</h5>
|
|
</div>
|
|
<div className="flex items-center gap-2 flex-wrap">
|
|
<Tooltip
|
|
tooltipHeading="State"
|
|
tooltipContent={addSpaceIfCamelCase(issue.state_detail?.name ?? "Triage")}
|
|
>
|
|
<div className="flex items-center gap-2 rounded border border-brand-base shadow-sm text-xs px-2 py-[0.19rem] text-brand-secondary">
|
|
{getStateGroupIcon(
|
|
issue.state_detail?.group ?? "backlog",
|
|
"14",
|
|
"14",
|
|
issue.state_detail?.color
|
|
)}
|
|
{issue.state_detail?.name ?? "Triage"}
|
|
</div>
|
|
</Tooltip>
|
|
<Tooltip tooltipHeading="Priority" tooltipContent={`${issue.priority ?? "None"}`}>
|
|
<div
|
|
className={`grid h-6 w-6 place-items-center rounded border items-center shadow-sm ${
|
|
issue.priority === "urgent"
|
|
? "border-red-500/20 bg-red-500/20 text-red-500"
|
|
: issue.priority === "high"
|
|
? "border-orange-500/20 bg-orange-500/20 text-orange-500"
|
|
: issue.priority === "medium"
|
|
? "border-yellow-500/20 bg-yellow-500/20 text-yellow-500"
|
|
: issue.priority === "low"
|
|
? "border-green-500/20 bg-green-500/20 text-green-500"
|
|
: "border-brand-base"
|
|
}`}
|
|
>
|
|
{getPriorityIcon(
|
|
issue.priority && issue.priority !== "" ? issue.priority ?? "" : "None",
|
|
"text-sm"
|
|
)}
|
|
</div>
|
|
</Tooltip>
|
|
<Tooltip
|
|
tooltipHeading="Created at"
|
|
tooltipContent={`${renderShortNumericDateFormat(issue.created_at ?? "")}`}
|
|
>
|
|
<div className="flex items-center gap-1 rounded border border-brand-base shadow-sm text-xs px-2 py-[0.19rem] text-brand-secondary">
|
|
<CalendarDaysIcon className="h-3.5 w-3.5" />
|
|
<span>{renderShortNumericDateFormat(issue.created_at ?? "")}</span>
|
|
</div>
|
|
</Tooltip>
|
|
{issue.issue_inbox[0].snoozed_till && (
|
|
<div className="text-xs flex items-center gap-1 text-brand-accent">
|
|
<ClockIcon className="h-3.5 w-3.5" />
|
|
<span>
|
|
Snoozed till {renderShortNumericDateFormat(issue.issue_inbox[0].snoozed_till)}
|
|
</span>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</Tooltip>
|
|
</a>
|
|
</Link>
|
|
);
|
|
};
|