* chore: added code split for the analytics store * chore: done some refactor * refactor: update entity keys in analytics and translations * chore: updated the translations * refactor: simplify AnalyticsStoreV2 class by removing unnecessary constructor * feat: add AnalyticsStoreV2 class and interface for enhanced analytics functionality * feat: enhance WorkItemsModal and analytics store with isEpic functionality * feat: integrate isEpic state into TotalInsights and WorkItemsModal components * refactor: remove isEpic state from WorkItemsModalMainContent component * refactor: removed old analytics components and related services * refactor: new analytics * refactor: removed all nivo chart dependencies * chore: resolved coderabbit comments * fix: update processUrl to handle custom-work-items in peek view * feat: implement CSV export functionality in InsightTable component * feat: enhance analytics service with filter parameters and improve data handling in InsightTable * feat: add new translation keys for various statuses across multiple languages * [WEB-4246] fix: enhance analytics components to include 'isEpic' parameter for improved data fetching * chore: update yarn.lock to remove deprecated @nivo packages and clean up unused dependencies
45 lines
1.6 KiB
TypeScript
45 lines
1.6 KiB
TypeScript
import React from "react";
|
|
import { observer } from "mobx-react";
|
|
import { useParams } from "next/navigation";
|
|
import useSWR from "swr";
|
|
// plane package imports
|
|
import { useTranslation } from "@plane/i18n";
|
|
import { Loader } from "@plane/ui";
|
|
// plane web hooks
|
|
import { useAnalytics, useProject } from "@/hooks/store";
|
|
// plane web components
|
|
import AnalyticsSectionWrapper from "../analytics-section-wrapper";
|
|
import ActiveProjectItem from "./active-project-item";
|
|
|
|
const ActiveProjects = observer(() => {
|
|
const { t } = useTranslation();
|
|
const { fetchProjectAnalyticsCount } = useProject();
|
|
const { workspaceSlug } = useParams();
|
|
const { selectedDurationLabel } = useAnalytics();
|
|
const { data: projectAnalyticsCount, isLoading: isProjectAnalyticsCountLoading } = useSWR(
|
|
workspaceSlug ? ["projectAnalyticsCount", workspaceSlug] : null,
|
|
workspaceSlug
|
|
? () =>
|
|
fetchProjectAnalyticsCount(workspaceSlug.toString(), {
|
|
fields: "total_work_items,total_completed_work_items",
|
|
})
|
|
: null
|
|
);
|
|
return (
|
|
<AnalyticsSectionWrapper
|
|
title={`${t("workspace_analytics.active_projects")}`}
|
|
subtitle={selectedDurationLabel}
|
|
className="md:col-span-2"
|
|
>
|
|
<div className="flex flex-col gap-4 h-[350px] overflow-auto">
|
|
{isProjectAnalyticsCountLoading &&
|
|
Array.from({ length: 5 }).map((_, index) => <Loader.Item key={index} height="40px" width="100%" />)}
|
|
{!isProjectAnalyticsCountLoading &&
|
|
projectAnalyticsCount?.map((project) => <ActiveProjectItem key={project.id} project={project} />)}
|
|
</div>
|
|
</AnalyticsSectionWrapper>
|
|
);
|
|
});
|
|
|
|
export default ActiveProjects;
|