From 4f5d0ae0ee4ef4ab84ff4b15a36646b05850806e Mon Sep 17 00:00:00 2001 From: Jayash Tripathy <76092296+JayashTripathy@users.noreply.github.com> Date: Mon, 15 Dec 2025 13:32:11 +0530 Subject: [PATCH 1/2] refactor: update styling and class names according to new design system in charts --- .../(projects)/analytics/[tabId]/page.tsx | 9 ++++- .../analytics/overview/project-insights.tsx | 12 +++--- packages/propel/src/charts/bar-chart/bar.tsx | 12 ++++-- packages/propel/src/charts/bar-chart/root.tsx | 10 ++--- packages/propel/src/charts/pie-chart/root.tsx | 4 +- packages/propel/src/charts/tree-map/root.tsx | 4 +- packages/propel/src/tabs/tabs.tsx | 36 +++++++++++++----- packages/ui/src/badge/helper.tsx | 38 +++++++++---------- 8 files changed, 75 insertions(+), 50 deletions(-) diff --git a/apps/web/app/(all)/[workspaceSlug]/(projects)/analytics/[tabId]/page.tsx b/apps/web/app/(all)/[workspaceSlug]/(projects)/analytics/[tabId]/page.tsx index c6b225de8fd..c4d97924bcd 100644 --- a/apps/web/app/(all)/[workspaceSlug]/(projects)/analytics/[tabId]/page.tsx +++ b/apps/web/app/(all)/[workspaceSlug]/(projects)/analytics/[tabId]/page.tsx @@ -67,7 +67,7 @@ function AnalyticsPage({ params }: Route.ComponentProps) { {workspaceProjectIds && ( <> {workspaceProjectIds.length > 0 || loader === "init-loader" ? ( -
+
- + {ANALYTICS_TABS.map((tab) => ( { + if (!tab.isDisabled) { + handleTabChange(tab.key); + } + }} > {tab.label} diff --git a/apps/web/core/components/analytics/overview/project-insights.tsx b/apps/web/core/components/analytics/overview/project-insights.tsx index 67da6f355f4..f777dab3f01 100644 --- a/apps/web/core/components/analytics/overview/project-insights.tsx +++ b/apps/web/core/components/analytics/overview/project-insights.tsx @@ -65,15 +65,15 @@ const ProjectInsights = observer(function ProjectInsights() { {projectInsightsData && ( }> )}
-
{t("workspace_analytics.summary_of_projects")}
+
{t("workspace_analytics.summary_of_projects")}
{t("workspace_analytics.all_projects")}
-
+
{t("workspace_analytics.trend_on_charts")}
{t("common.work_items")}
{projectInsightsData?.map((item) => ( -
+
{item.name}
{/* */} diff --git a/packages/propel/src/charts/bar-chart/bar.tsx b/packages/propel/src/charts/bar-chart/bar.tsx index 424f5995751..d77e0bbe337 100644 --- a/packages/propel/src/charts/bar-chart/bar.tsx +++ b/packages/propel/src/charts/bar-chart/bar.tsx @@ -10,6 +10,7 @@ const BAR_TOP_BORDER_RADIUS = 4; // Border radius for the top of bars const BAR_BOTTOM_BORDER_RADIUS = 4; // Border radius for the bottom of bars const DEFAULT_LOLLIPOP_LINE_WIDTH = 2; // Width of lollipop stick const DEFAULT_LOLLIPOP_CIRCLE_RADIUS = 8; // Radius of lollipop circle +const DEFAULT_BAR_FILL_COLOR = "#000000"; // Default color when fill is a function - black // Types interface TShapeProps { @@ -66,7 +67,7 @@ function PercentageText({ className?: string; }) { return ( - + {percentage}% ); @@ -109,9 +110,12 @@ const CustomBar = React.memo(function CustomBar(props: TBarProps) { {showText && ( @@ -172,11 +176,13 @@ const createShapeVariant = ); }; +export { DEFAULT_BAR_FILL_COLOR }; + export const barShapeVariants: Record< TBarChartShapeVariant, (props: TShapeProps, bar: TBarItem, stackKeys: string[]) => React.ReactNode > = { - bar: createShapeVariant(CustomBar), // Standard bar with rounded-sm corners + bar: createShapeVariant(CustomBar), // Standard bar with rounded corners lollipop: createShapeVariant(CustomBarLollipop), // Line with circle at top "lollipop-dotted": createShapeVariant(CustomBarLollipop, { dotted: true }), // Dotted line lollipop variant }; diff --git a/packages/propel/src/charts/bar-chart/root.tsx b/packages/propel/src/charts/bar-chart/root.tsx index 64885e58956..0e373203e7f 100644 --- a/packages/propel/src/charts/bar-chart/root.tsx +++ b/packages/propel/src/charts/bar-chart/root.tsx @@ -17,9 +17,7 @@ import type { TBarChartProps } from "@plane/types"; import { getLegendProps } from "../components/legend"; import { CustomXAxisTick, CustomYAxisTick } from "../components/tick"; import { CustomTooltip } from "../components/tooltip"; -import { barShapeVariants } from "./bar"; - -const DEFAULT_BAR_FILL_COLOR = "#000000"; +import { barShapeVariants, DEFAULT_BAR_FILL_COLOR } from "./bar"; export const BarChart = React.memo(function BarChart(props: TBarChartProps) { const { @@ -129,7 +127,7 @@ export const BarChart = React.memo(function BarChart - + { @@ -176,8 +174,8 @@ export const BarChart = React.memo(function BarChart ( } animationEasing="ease-out" isUpdateAnimationActive={isAnimationActive} @@ -29,7 +29,7 @@ export const TreeMapChart = React.memo(function TreeMapChart(props: TreeMapChart content={({ active, payload }) => } cursor={{ fill: "currentColor", - className: "text-custom-background-90/80 cursor-pointer", + className: "bg-layer-1 cursor-pointer", }} wrapperStyle={{ pointerEvents: "auto", diff --git a/packages/propel/src/tabs/tabs.tsx b/packages/propel/src/tabs/tabs.tsx index 6790bbe4caf..e3408ed2631 100644 --- a/packages/propel/src/tabs/tabs.tsx +++ b/packages/propel/src/tabs/tabs.tsx @@ -2,11 +2,15 @@ import * as React from "react"; import { Tabs as TabsPrimitive } from "@base-ui-components/react/tabs"; import { cn } from "../utils/classname"; +type BackgroundVariant = "layer-1" | "layer-2" | "layer-3" | "layer-transparent"; + type TabsCompound = React.ForwardRefExoticComponent< React.ComponentProps & React.RefAttributes> > & { List: React.ForwardRefExoticComponent< - React.ComponentProps & React.RefAttributes> + React.ComponentProps & { + background?: BackgroundVariant; + } & React.RefAttributes> >; Trigger: React.ForwardRefExoticComponent< React.ComponentProps & { size?: "sm" | "md" | "lg" } & React.RefAttributes< @@ -34,14 +38,26 @@ const TabsRoot = React.forwardRef(function TabsRoot( }); const TabsList = React.forwardRef(function TabsList( - { className, ...props }: React.ComponentProps, + { + className, + background = "layer-1", + ...props + }: React.ComponentProps & { + background?: BackgroundVariant; + }, ref: React.ForwardedRef> ) { return ( Date: Mon, 15 Dec 2025 20:26:51 +0530 Subject: [PATCH 2/2] refactor: clean up --- .../analytics/overview/project-insights.tsx | 6 +-- packages/propel/src/tabs/tabs.tsx | 14 +++---- packages/ui/src/badge/helper.tsx | 38 +++++++++---------- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/apps/web/core/components/analytics/overview/project-insights.tsx b/apps/web/core/components/analytics/overview/project-insights.tsx index f777dab3f01..c0fa6c6b1ad 100644 --- a/apps/web/core/components/analytics/overview/project-insights.tsx +++ b/apps/web/core/components/analytics/overview/project-insights.tsx @@ -90,15 +90,15 @@ const ProjectInsights = observer(function ProjectInsights() { )}
-
{t("workspace_analytics.summary_of_projects")}
+
{t("workspace_analytics.summary_of_projects")}
{t("workspace_analytics.all_projects")}
-
+
{t("workspace_analytics.trend_on_charts")}
{t("common.work_items")}
{projectInsightsData?.map((item) => ( -
+
{item.name}
{/* */} diff --git a/packages/propel/src/tabs/tabs.tsx b/packages/propel/src/tabs/tabs.tsx index e3408ed2631..b6136731cbc 100644 --- a/packages/propel/src/tabs/tabs.tsx +++ b/packages/propel/src/tabs/tabs.tsx @@ -75,13 +75,13 @@ const TabsTrigger = React.forwardRef(function TabsTrigger( data-slot="tabs-trigger" className={cn( "flex items-center justify-center p-1 min-w-fit w-full font-medium text-primary outline-none focus:outline-none cursor-pointer transition-all duration-200 ease-in-out rounded-sm", - "hover:text-tertiary hover:bg-layer-transparent-hover", - "data-[selected]:!bg-layer-transparent-active data-[selected]:text-primary data-[selected]:shadow-sm data-[selected]:hover:bg-layer-transparent-active", - "text-placeholder disabled:text-placeholder disabled:cursor-not-allowed", + "data-[selected]:bg-layer-transparent-active data-[selected]:text-primary data-[selected]:shadow-sm", + "text-placeholder hover:text-tertiary hover:bg-layer-transparent-hover", + "disabled:text-placeholder disabled:cursor-not-allowed", { - "text-xs": size === "sm", - "text-sm": size === "md", - "text-base": size === "lg", + "text-11": size === "sm", + "text-13": size === "md", + "text-14": size === "lg", }, className )} @@ -111,7 +111,7 @@ const TabsIndicator = React.forwardRef(function TabsIndicator( return (