Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
790b365
chore: updated label for epics
JayashTripathy Jun 10, 2025
772fd95
chore: improved export logic
JayashTripathy Jun 10, 2025
028ca93
refactor: move csvConfig to export.ts and clean up export logic
JayashTripathy Jun 10, 2025
60d8e72
refactor: remove unused CSV export logic from WorkItemsInsightTable c…
JayashTripathy Jun 10, 2025
38570ce
refactor: streamline data handling in InsightTable component for impr…
JayashTripathy Jun 10, 2025
50c105f
Merge branch 'preview' of https://github.com/makeplane/plane into ana…
JayashTripathy Jun 11, 2025
1f804db
feat: add translation for "No. of {entity}" and update priority chart…
JayashTripathy Jun 11, 2025
2929cc1
refactor: cleaned up some component and added utilitites
JayashTripathy Jun 12, 2025
fc1a72c
feat: add "at_risk" translation to multiple languages in translations…
JayashTripathy Jun 12, 2025
f698ef9
refactor: update TrendPiece component to use new status variants for …
JayashTripathy Jun 12, 2025
7381459
fix: adjust TrendPiece component logic for on-track and off-track status
JayashTripathy Jun 12, 2025
fd4c16d
refactor: use nullish coalescing operator for yAxis.dx in line and sc…
JayashTripathy Jun 12, 2025
b213ad0
feat: add "at_risk" translation to various languages in translations.…
JayashTripathy Jun 12, 2025
f0917da
feat: add "no_of" translation to various languages in translations.js…
JayashTripathy Jun 12, 2025
c4d69fe
feat: update "at_risk" translation in Ukrainian, Vietnamese, and Chin…
JayashTripathy Jun 12, 2025
5c2f145
refactor: rename insightsFields to ANALYTICS_INSIGHTS_FIELDS and upda…
JayashTripathy Jun 13, 2025
2902fa0
Merge branch 'preview' of https://github.com/makeplane/plane into ana…
JayashTripathy Jun 13, 2025
4c65734
feat: update AnalyticsWrapper to use i18n for titles and add new tran…
JayashTripathy Jun 13, 2025
0f3cef7
fix: update yAxis labels and offsets in various charts to use new tra…
JayashTripathy Jun 13, 2025
9b3beed
feat: define AnalyticsTab interface and refactor getAnalyticsTabs fun…
JayashTripathy Jun 13, 2025
39932ac
fix: update AnalyticsTab interface to use TAnalyticsTabsBase for impr…
JayashTripathy Jun 13, 2025
88aa62d
fix: add whitespace-nowrap class to TableHead for improved header lay…
JayashTripathy Jun 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/constants/src/analytics/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface IInsightField {
};
}

export const insightsFields: Record<TAnalyticsTabsBase, IInsightField[]> = {
export const ANALYTICS_INSIGHTS_FIELDS: Record<TAnalyticsTabsBase, IInsightField[]> = {
overview: [
{
key: "total_users",
Expand Down
3 changes: 2 additions & 1 deletion packages/i18n/src/locales/ru/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,8 @@
"completed": "Завершено",
"in_progress": "В процессе",
"planned": "Запланировано",
"paused": "На паузе"
"paused": "На паузе",
"no_of": "Количество {entity}"
},
"chart": {
"x_axis": "Ось X",
Expand Down
4 changes: 2 additions & 2 deletions packages/propel/src/charts/bar-chart/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ export const BarChart = React.memo(<K extends string, T extends string>(props: T
value: yAxis.label,
angle: -90,
position: "bottom",
offset: -24,
dx: -16,
offset: yAxis.offset ?? -24,
dx: yAxis.dx ?? -16,
className: AXIS_LABEL_CLASSNAME,
}}
tick={(props) => <CustomYAxisTick {...props} />}
Expand Down
6 changes: 6 additions & 0 deletions packages/types/src/analytics.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import { Row } from "@tanstack/react-table";

export type TAnalyticsTabsBase = "overview" | "work-items";
export type TAnalyticsGraphsBase = "projects" | "work-items" | "custom-work-items";
export interface AnalyticsTab {
key: TAnalyticsTabsBase;
label: string;
content: React.FC;
isDisabled: boolean;
}
export type TAnalyticsFilterParams = {
project_ids?: string;
cycle_id?: string;
Expand Down
9 changes: 6 additions & 3 deletions web/app/(all)/[workspaceSlug]/(projects)/analytics/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { ComicBoxButton, DetailedEmptyState } from "@/components/empty-state";
// hooks
import { useCommandPalette, useEventTracker, useProject, useUserPermissions, useWorkspace } from "@/hooks/store";
import { useResolvedAssetPath } from "@/hooks/use-resolved-asset-path";
import { ANALYTICS_TABS } from "@/plane-web/components/analytics/tabs";
import { getAnalyticsTabs } from "@/plane-web/components/analytics/tabs";

const AnalyticsPage = observer(() => {
const router = useRouter();
Expand All @@ -40,17 +40,20 @@ const AnalyticsPage = observer(() => {
EUserPermissionsLevel.WORKSPACE
);

const ANALYTICS_TABS = useMemo(() => getAnalyticsTabs(t), [t]);

const tabs = useMemo(
() =>
ANALYTICS_TABS.map((tab) => ({
key: tab.key,
label: t(tab.i18nKey),
label: tab.label,
content: <tab.content />,
onClick: () => {
router.push(`?tab=${tab.key}`);
},
isDisabled: tab.isDisabled,
})),
[router, t]
[ANALYTICS_TABS, router]
);
const defaultTab = searchParams.get("tab") || ANALYTICS_TABS[0].key;

Expand Down
12 changes: 0 additions & 12 deletions web/ce/components/analytics/tabs.ts

This file was deleted.

8 changes: 8 additions & 0 deletions web/ce/components/analytics/tabs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { AnalyticsTab } from "@plane/types";
import { Overview } from "@/components/analytics/overview";
import { WorkItems } from "@/components/analytics/work-items";

export const getAnalyticsTabs = (t: (key: string, params?: Record<string, any>) => string): AnalyticsTab[] => [
{ key: "overview", label: t("common.overview"), content: Overview, isDisabled: false },
{ key: "work-items", label: t("sidebar.work_items"), content: WorkItems, isDisabled: false },
];
9 changes: 5 additions & 4 deletions web/core/components/analytics/analytics-wrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import React from "react";
// plane package imports
import { useTranslation } from "@plane/i18n";
import { cn } from "@plane/utils";

type Props = {
title: string;
i18nTitle: string;
children: React.ReactNode;
className?: string;
};

const AnalyticsWrapper: React.FC<Props> = (props) => {
const { title, children, className } = props;

const { i18nTitle, children, className } = props;
const { t } = useTranslation();
return (
<div className={cn("px-6 py-4", className)}>
<h1 className={"mb-4 text-2xl font-bold md:mb-6"}>{title}</h1>
<h1 className={"mb-4 text-2xl font-bold md:mb-6"}>{t(i18nTitle)}</h1>
{children}
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion web/core/components/analytics/insight-table/data-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export function DataTable<TData, TValue>({ columns, data, searchPlaceholder, act
{table.getHeaderGroups().map((headerGroup) => (
<TableRow key={headerGroup.id}>
{headerGroup.headers.map((header) => (
<TableHead key={header.id} colSpan={header.colSpan}>
<TableHead key={header.id} colSpan={header.colSpan} className="whitespace-nowrap">
{header.isPlaceholder
? null
: (flexRender(header.column.columnDef.header, header.getContext()) as any)}
Expand Down
2 changes: 1 addition & 1 deletion web/core/components/analytics/overview/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ActiveProjects from "./active-projects";
import ProjectInsights from "./project-insights";

const Overview: React.FC = () => (
<AnalyticsWrapper title="Overview">
<AnalyticsWrapper i18nTitle="common.overview">
<div className="flex flex-col gap-14">
<TotalInsights analyticsType="overview" />
<div className="grid grid-cols-1 gap-14 md:grid-cols-5 ">
Expand Down
6 changes: 3 additions & 3 deletions web/core/components/analytics/total-insights.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { observer } from "mobx-react-lite";
import { useParams } from "next/navigation";
import useSWR from "swr";
import { IInsightField, insightsFields } from "@plane/constants";
import { IInsightField, ANALYTICS_INSIGHTS_FIELDS } from "@plane/constants";
import { useTranslation } from "@plane/i18n";
import { IAnalyticsResponse, TAnalyticsTabsBase } from "@plane/types";
//hooks
Expand Down Expand Up @@ -80,13 +80,13 @@ const TotalInsights: React.FC<{
className={cn(
"grid grid-cols-1 gap-8 sm:grid-cols-2 md:gap-10",
!peekView
? insightsFields[analyticsType]?.length % 5 === 0
? ANALYTICS_INSIGHTS_FIELDS[analyticsType]?.length % 5 === 0
? "gap-10 lg:grid-cols-5"
: "gap-8 lg:grid-cols-4"
: "grid-cols-2"
)}
>
{insightsFields[analyticsType]?.map((item) => (
{ANALYTICS_INSIGHTS_FIELDS[analyticsType]?.map((item) => (
<InsightCard
key={`${analyticsType}-${item.key}`}
isLoading={isLoading}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ const CreatedVsResolved = observer(() => {
}}
yAxis={{
key: "count",
label: t("no_of", { entity: isEpic ? t("epics") : t("work_items") }),
offset: -30,
dx: -22,
label: t("common.no_of", { entity: isEpic ? t("epics") : t("work_items") }),
offset: -60,
dx: -24,
}}
legend={{
align: "left",
Expand Down
4 changes: 2 additions & 2 deletions web/core/components/analytics/work-items/priority-chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ const PriorityChart = observer((props: Props) => {
}}
yAxis={{
key: "count",
label: t("no_of", { entity: yAxisLabel.replace("_", " ") }),
offset: -40,
label: t("common.no_of", { entity: yAxisLabel.replace("_", " ") }),
offset: -60,
dx: -26,
}}
/>
Expand Down
2 changes: 1 addition & 1 deletion web/core/components/analytics/work-items/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import CustomizedInsights from "./customized-insights";
import WorkItemsInsightTable from "./workitems-insight-table";

const WorkItems: React.FC = () => (
<AnalyticsWrapper title="Work Items">
<AnalyticsWrapper i18nTitle="sidebar.work_items">
<div className="flex flex-col gap-14">
<TotalInsights analyticsType="work-items" />
<CreatedVsResolved />
Expand Down