import { BarDatum } from "@nivo/bar"; // icons import { IAnalyticsParams, IAnalyticsResponse, TIssuePriorities } from "@plane/types"; import { PriorityIcon } from "@plane/ui"; // helpers import { ANALYTICS_X_AXIS_VALUES, ANALYTICS_Y_AXIS_VALUES } from "@/constants/analytics"; import { generateBarColor, generateDisplayName } from "@/helpers/analytics.helper"; // types // constants type Props = { analytics: IAnalyticsResponse; barGraphData: { data: BarDatum[]; xAxisKeys: string[]; }; params: IAnalyticsParams; yAxisKey: "count" | "estimate"; }; export const AnalyticsTable: React.FC = ({ analytics, barGraphData, params, yAxisKey }) => (
{params.segment ? ( barGraphData.xAxisKeys.map((key) => ( )) ) : ( )} {barGraphData.data.map((item, index) => ( {params.segment ? ( barGraphData.xAxisKeys.map((key, index) => ( )) ) : ( )} ))}
{ANALYTICS_X_AXIS_VALUES.find((v) => v.value === params.x_axis)?.label}
{params.segment === "priority" ? ( ) : ( )} {generateDisplayName(key, analytics, params, "segment")}
{ANALYTICS_Y_AXIS_VALUES.find((v) => v.value === params.y_axis)?.label}
{params.x_axis === "priority" ? ( ) : ( )} {generateDisplayName(`${item.name}`, analytics, params, "x_axis")} {item[key] ?? 0} {item[yAxisKey]}
);