diff --git a/apps/web/src/components/public-content/index.tsx b/apps/web/src/components/public-content/index.tsx index f970004..778c984 100644 --- a/apps/web/src/components/public-content/index.tsx +++ b/apps/web/src/components/public-content/index.tsx @@ -45,7 +45,7 @@ export function PublicContent({ aria-label={ headingMode === 'article' ? 'Article content' : 'Project documentation' } - className="prose max-w-none min-w-0 wrap-anywhere prose-neutral dark:prose-invert prose-a:decoration-transparent prose-a:transition-all prose-a:duration-300 prose-a:ease-in-out prose-a:hover:decoration-current prose-a:motion-reduce:transition-none" + className="prose max-w-none min-w-0 wrap-anywhere prose-neutral dark:prose-invert prose-a:decoration-transparent prose-a:transition-[text-decoration-color] prose-a:duration-300 prose-a:ease-in-out prose-a:hover:decoration-current prose-a:motion-reduce:transition-none" > { + const [ + { Bar, BarChart, CartesianGrid, XAxis, YAxis }, + { ChartContainer, ChartTooltip, ChartTooltipContent }, + ] = await Promise.all([ + import('recharts').then((module) => { + return { + Bar: module.Bar, + BarChart: module.BarChart, + CartesianGrid: module.CartesianGrid, + XAxis: module.XAxis, + YAxis: module.YAxis, + } + }), + import('@altstack/ui/components/chart').then((module) => { + return { + ChartContainer: module.ChartContainer, + ChartTooltip: module.ChartTooltip, + ChartTooltipContent: module.ChartTooltipContent, + } + }), + ]) + return { + default: function LoadedStatusDistribution({ + statuses, + }: { + statuses: Overview['statuses'] + }) { + const distribution = statuses.map((item) => { + return { ...item, label: labels[item.status] } + }) + return ( + + + + + + } /> + + + + ) + }, + } +}) + export function ProjectStatusChart({ statuses, counts, @@ -36,9 +107,6 @@ export function ProjectStatusChart({ statuses: Overview['statuses'] counts: Overview['counts'] }) { - const distribution = statuses.map((item) => { - return { ...item, label: labels[item.status] } - }) return ( @@ -90,45 +158,15 @@ export function ProjectStatusChart({ {statuses.some((item) => item.count > 0) ? ( - + Loading status chart… + + } > - - - - - } /> - - - + + ) : ( { expect( screen.getByText('Current project distribution by status') ).toBeTruthy() + await screen.findByLabelText('Project status distribution') }) it('keeps catalog filters across reload and history navigation', async () => { const router = await routerAt( diff --git a/apps/web/tests/browser/admin-overview.browser.tsx b/apps/web/tests/browser/admin-overview.browser.tsx index 332750f..c9d3454 100644 --- a/apps/web/tests/browser/admin-overview.browser.tsx +++ b/apps/web/tests/browser/admin-overview.browser.tsx @@ -136,6 +136,11 @@ describe('admin overview in Chromium', () => { await page.viewport(width, 900) for (const theme of ['light', 'dark']) { await mount(theme) + await screen.findByLabelText( + 'Project status distribution', + {}, + { timeout: 10_000 } + ) expect(document.documentElement.scrollWidth).toBeLessThanOrEqual(width) expect( screen