/* eslint-disable @stylistic/quotes */ /* eslint-disable @typescript-eslint/no-unsafe-argument */ import { ChartType } from "@allurereport/charts-api"; import type { UIChartData } from "@allurereport/web-commons"; import { themeStore } from "@allurereport/web-commons"; import { Grid, GridItem, HeatMapWidget, Loadable, PageLoader, ThemeProvider, TreeMapChartWidget, } from "@allurereport/web-components"; import { computed } from "@preact/signals"; import { useEffect } from "preact/hooks"; import { useI18n } from "@/stores"; import { chartsStore, fetchChartsData } from "@/stores/charts"; import * as styles from "./Overview.module.scss"; const getChartWidgetByType = ( chartData: UIChartData, { empty }: Record string>, ) => { switch (chartData.type) { case ChartType.CoverageDiff: { return ( ); } case ChartType.SuccessRateDistribution: { return ( ); } case ChartType.ProblemsDistribution: { return ( ); } default: { return null; } } }; const currentTheme = computed(() => themeStore.value.current); const Overview = () => { const { t } = useI18n("charts"); const { t: empty } = useI18n("empty"); useEffect(() => { fetchChartsData(); }, []); return ( } renderData={(data) => { const charts = Object.entries(data).map(([chartId, value]) => { const chartWidget = getChartWidgetByType(value, { t, empty }); return ( {chartWidget} ); }); return (
{charts}
); }} />
); }; export default Overview;