bb-plane-fork/web/core/components/analytics/trend-piece.tsx
JayashTripathy 14d2d69120
[WEB-4230] refactor: Analytics code refacor, Removal of nivo charts dependencies and translations (#7131)
* 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
2025-06-06 01:53:38 +05:30

47 lines
1 KiB
TypeScript

// plane package imports
import React from "react";
import { TrendingDown, TrendingUp } from "lucide-react";
import { cn } from "@plane/utils";
// plane web components
type Props = {
percentage: number;
className?: string;
size?: "xs" | "sm" | "md" | "lg";
};
const sizeConfig = {
xs: {
text: "text-xs",
icon: "w-3 h-3",
},
sm: {
text: "text-sm",
icon: "w-4 h-4",
},
md: {
text: "text-base",
icon: "w-5 h-5",
},
lg: {
text: "text-lg",
icon: "w-6 h-6",
},
} as const;
const TrendPiece = (props: Props) => {
const { percentage, className, size = "sm" } = props;
const isPositive = percentage > 0;
const config = sizeConfig[size];
return (
<div
className={cn("flex items-center gap-1", isPositive ? "text-green-500" : "text-red-500", config.text, className)}
>
{isPositive ? <TrendingUp className={config.icon} /> : <TrendingDown className={config.icon} />}
{Math.round(Math.abs(percentage))}%
</div>
);
};
export default TrendPiece;