import { BarDatum } from "@nivo/bar"; // icons import { PriorityIcon } from "components/icons"; // helpers import { generateBarColor, generateDisplayName } from "helpers/analytics.helper"; // types import { IAnalyticsParams, IAnalyticsResponse, TIssuePriorities } from "types"; // constants import { ANALYTICS_X_AXIS_VALUES, ANALYTICS_Y_AXIS_VALUES } from "constants/analytics"; 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]}
);