mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
1a534a3c19
* chore: global bar graph component * chore: global pie graph component * chore: global line graph component * chore: removed unnecessary file * chore: refactored global chart components to accept all props * chore: function to convert response to chart data * chore: global calendar graph component added * chore: global scatter plot graph component * feat: analytics boilerplate created * chore: null value for segment and project * chore: clean up file * chore: change project query param key * chore: export, refresh buttons, analytics table * fix: analytics fetch key error * chore: show only integer values in the y-axis * chore: custom x-axis tick values and bar colors * refactor: divide analytics page into granular components * chore: convert analytics page to modal, save analytics modal * fix: build error * fix: modal overflow issues, analytics loading screen * chore: custom tooltip, refactor: graphs folder structure * refactor: folder structure, chore: x-axis tick values for larger data * chore: code cleanup * chore: remove unnecessary files * fix: refresh analytics button on error * feat: scope and demand analytics * refactor: scope and demand and custom analytics folder structure * fix: dynamic import type * chore: minor updates * feat: project, cycle and module level analytics * style: project analytics modal * fix: merge conflicts
83 lines
2.6 KiB
TypeScript
83 lines
2.6 KiB
TypeScript
import { useState } from "react";
|
|
|
|
import { useRouter } from "next/router";
|
|
|
|
import useSWR from "swr";
|
|
|
|
// services
|
|
import projectService from "services/project.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 } 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
|
|
);
|
|
|
|
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>
|
|
<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;
|