diff --git a/site/src/api/api.ts b/site/src/api/api.ts index f3a91f176ab88..ac4ef4a1ca340 100644 --- a/site/src/api/api.ts +++ b/site/src/api/api.ts @@ -2089,6 +2089,19 @@ class ApiMethods { return response.data; }; + getInsightsUserStatusCounts = async ( + offset = Math.trunc(new Date().getTimezoneOffset() / 60), + ): Promise => { + const searchParams = new URLSearchParams({ + tz_offset: offset.toString(), + }); + const response = await this.axios.get( + `/api/v2/insights/user-status-counts?${searchParams}`, + ); + + return response.data; + }; + getInsightsTemplate = async ( params: InsightsTemplateParams, ): Promise => { diff --git a/site/src/api/queries/insights.ts b/site/src/api/queries/insights.ts index a7044a2f2469f..afdf9f7efedd0 100644 --- a/site/src/api/queries/insights.ts +++ b/site/src/api/queries/insights.ts @@ -1,4 +1,6 @@ import { API, type InsightsParams, type InsightsTemplateParams } from "api/api"; +import type { GetUserStatusCountsResponse } from "api/typesGenerated"; +import { type UseQueryOptions, UseQueryResult } from "react-query"; export const insightsTemplate = (params: InsightsTemplateParams) => { return { @@ -20,3 +22,15 @@ export const insightsUserActivity = (params: InsightsParams) => { queryFn: () => API.getInsightsUserActivity(params), }; }; + +export const insightsUserStatusCounts = () => { + return { + queryKey: ["insights", "userStatusCounts"], + queryFn: () => API.getInsightsUserStatusCounts(), + select: (data) => data.status_counts, + } satisfies UseQueryOptions< + GetUserStatusCountsResponse, + unknown, + GetUserStatusCountsResponse["status_counts"] + >; +}; diff --git a/site/src/components/Chart/Chart.stories.tsx b/site/src/components/Chart/Chart.stories.tsx index df863d4abee0e..74fded80d2b4d 100644 --- a/site/src/components/Chart/Chart.stories.tsx +++ b/site/src/components/Chart/Chart.stories.tsx @@ -19,7 +19,7 @@ const chartData = [ const chartConfig = { users: { label: "Users", - color: "hsl(var(--chart-1))", + color: "hsl(var(--highlight-purple))", }, } satisfies ChartConfig; diff --git a/site/src/components/Chart/Chart.tsx b/site/src/components/Chart/Chart.tsx index ba5ff7e7ed43d..d8435c33337f8 100644 --- a/site/src/components/Chart/Chart.tsx +++ b/site/src/components/Chart/Chart.tsx @@ -66,6 +66,8 @@ export const ChartContainer = React.forwardRef< "[&_.recharts-sector[stroke='#fff']]:stroke-transparent", "[&_.recharts-sector]:outline-none", "[&_.recharts-surface]:outline-none", + "[&_.recharts-text]:fill-content-secondary [&_.recharts-text]:font-medium", + "[&_.recharts-cartesian-axis-line]:stroke-[hsl(var(--border-default))]", className, )} {...props} @@ -195,7 +197,7 @@ export const ChartTooltipContent = React.forwardRef<
diff --git a/site/src/components/Link/Link.tsx b/site/src/components/Link/Link.tsx index e70475899f825..616a24e9fa65f 100644 --- a/site/src/components/Link/Link.tsx +++ b/site/src/components/Link/Link.tsx @@ -1,4 +1,4 @@ -import { Slot } from "@radix-ui/react-slot"; +import { Slot, Slottable } from "@radix-ui/react-slot"; import { type VariantProps, cva } from "class-variance-authority"; import { SquareArrowOutUpRightIcon } from "lucide-react"; import { forwardRef } from "react"; @@ -38,7 +38,7 @@ export const Link = forwardRef( ref={ref} {...props} > - {children} + {children}