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>
109 lines
3.7 KiB
TypeScript
109 lines
3.7 KiB
TypeScript
import { useState } from "react";
|
|
|
|
import Link from "next/link";
|
|
import { useRouter } from "next/router";
|
|
|
|
import useSWR from "swr";
|
|
|
|
// services
|
|
import projectService from "services/project.service";
|
|
import inboxService from "services/inbox.service";
|
|
// layouts
|
|
import { ProjectAuthorizationWrapper } from "layouts/auth-layout";
|
|
// contexts
|
|
import { IssueViewContextProvider } from "contexts/issue-view.context";
|
|
// helper
|
|
import { truncateText } from "helpers/string.helper";
|
|
// components
|
|
import { IssuesFilterView, IssuesView } from "components/core";
|
|
import { AnalyticsProjectModal } from "components/analytics";
|
|
// ui
|
|
import { PrimaryButton, SecondaryButton } from "components/ui";
|
|
import { BreadcrumbItem, Breadcrumbs } from "components/breadcrumbs";
|
|
// icons
|
|
import { PlusIcon } from "@heroicons/react/24/outline";
|
|
// types
|
|
import type { NextPage } from "next";
|
|
// fetch-keys
|
|
import { PROJECT_DETAILS, INBOX_LIST } from "constants/fetch-keys";
|
|
|
|
const ProjectIssues: NextPage = () => {
|
|
const [analyticsModal, setAnalyticsModal] = useState(false);
|
|
|
|
const router = useRouter();
|
|
const { workspaceSlug, projectId } = router.query;
|
|
|
|
const { data: projectDetails } = useSWR(
|
|
workspaceSlug && projectId ? PROJECT_DETAILS(projectId as string) : null,
|
|
workspaceSlug && projectId
|
|
? () => projectService.getProject(workspaceSlug as string, projectId as string)
|
|
: null
|
|
);
|
|
|
|
const { data: inboxList } = useSWR(
|
|
workspaceSlug && projectId ? INBOX_LIST(projectId as string) : null,
|
|
workspaceSlug && projectId
|
|
? () => inboxService.getInboxes(workspaceSlug as string, projectId as string)
|
|
: null
|
|
);
|
|
|
|
return (
|
|
<IssueViewContextProvider>
|
|
<ProjectAuthorizationWrapper
|
|
breadcrumbs={
|
|
<Breadcrumbs>
|
|
<BreadcrumbItem title="Projects" link={`/${workspaceSlug}/projects`} />
|
|
<BreadcrumbItem
|
|
title={`${truncateText(projectDetails?.name ?? "Project", 12)} Issues`}
|
|
/>
|
|
</Breadcrumbs>
|
|
}
|
|
right={
|
|
<div className="flex items-center gap-2">
|
|
<IssuesFilterView />
|
|
<SecondaryButton
|
|
onClick={() => setAnalyticsModal(true)}
|
|
className="!py-1.5 rounded-md font-normal text-brand-secondary"
|
|
outline
|
|
>
|
|
Analytics
|
|
</SecondaryButton>
|
|
{projectDetails && projectDetails.inbox_view && (
|
|
<Link href={`/${workspaceSlug}/projects/${projectId}/inbox/${inboxList?.[0]?.id}`}>
|
|
<a>
|
|
<SecondaryButton
|
|
className="relative !py-1.5 rounded-md font-normal text-brand-secondary"
|
|
outline
|
|
>
|
|
<span>Inbox</span>
|
|
{inboxList && inboxList?.[0]?.pending_issue_count !== 0 && (
|
|
<span className="absolute -top-1 -right-1 h-4 w-4 rounded-full text-brand-base bg-brand-surface-2 border border-brand-base">
|
|
{inboxList?.[0]?.pending_issue_count}
|
|
</span>
|
|
)}
|
|
</SecondaryButton>
|
|
</a>
|
|
</Link>
|
|
)}
|
|
<PrimaryButton
|
|
className="flex items-center gap-2"
|
|
onClick={() => {
|
|
const e = new KeyboardEvent("keydown", { key: "c" });
|
|
document.dispatchEvent(e);
|
|
}}
|
|
>
|
|
<PlusIcon className="h-4 w-4" />
|
|
Add Issue
|
|
</PrimaryButton>
|
|
</div>
|
|
}
|
|
>
|
|
<AnalyticsProjectModal isOpen={analyticsModal} onClose={() => setAnalyticsModal(false)} />
|
|
<IssuesView />
|
|
</ProjectAuthorizationWrapper>
|
|
</IssueViewContextProvider>
|
|
);
|
|
};
|
|
|
|
export default ProjectIssues;
|