Skip to content

Commit 03aad9e

Browse files
committed
fix build
1 parent 90644ab commit 03aad9e

File tree

4 files changed

+30
-20
lines changed

4 files changed

+30
-20
lines changed

web/components/layout/auth/NavItem.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ const NavItem: React.FC<NavItemProps> = ({
5555
{link.icon && (
5656
<link.icon
5757
className={cn(
58-
"h-4 w-4 text-slate-500",
59-
link.current && "text-blue-600 dark:text-blue-400",
58+
"h-4 w-4",
59+
link.current
60+
? "text-slate-700 dark:text-slate-300"
61+
: "text-slate-500"
6062
)}
6163
/>
6264
)}
@@ -88,19 +90,21 @@ const NavItem: React.FC<NavItemProps> = ({
8890
"flex items-center justify-start rounded-md px-3 transition-colors",
8991
deep && deep > 1 ? "h-6" : "h-8",
9092
"w-full font-normal",
91-
"text-[12px] text-slate-500",
93+
"text-[12px]",
9294
link.current
93-
? "bg-blue-100 text-blue-700 hover:bg-blue-100 dark:bg-blue-900/50 dark:text-blue-300 dark:hover:bg-blue-900/50"
94-
: "hover:bg-slate-200 hover:text-slate-900 dark:hover:bg-slate-700 dark:hover:text-slate-100",
95+
? "bg-blue-100 text-slate-900 hover:bg-blue-100 dark:bg-blue-900/50 dark:text-slate-100 dark:hover:bg-blue-900/50"
96+
: "text-slate-500 hover:bg-slate-200 hover:text-slate-900 dark:hover:bg-slate-700 dark:hover:text-slate-100",
9597
),
9698
)}
9799
>
98100
<div className="flex items-center">
99101
{link.icon && (
100102
<link.icon
101103
className={cn(
102-
"mr-2 h-3.5 w-3.5 text-slate-500",
103-
link.current && "text-blue-700 dark:text-blue-300",
104+
"mr-2 h-3.5 w-3.5",
105+
link.current
106+
? "text-slate-700 dark:text-slate-300"
107+
: "text-slate-500"
104108
)}
105109
/>
106110
)}

web/components/templates/dashboard/dashboardPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ const DashboardPage = (props: DashboardPageProps) => {
163163
const overTimeData = shouldShowMockData ? mockOverTimeData : realOverTimeData;
164164
const models = shouldShowMockData
165165
? { data: mockModels.data, isLoading: false }
166-
: realModels;
166+
: { data: realModels.error === null ? realModels.data ?? undefined : undefined, isLoading: isModelsLoading };
167167
const providers = shouldShowMockData
168168
? { data: [], isLoading: false }
169-
: realProviders;
169+
: { data: realProviders.error === null ? realProviders.data ?? undefined : undefined, isLoading: isProvidersLoading };
170170

171171
const metricsData: MetricsPanelProps["metric"][] = [
172172
{

web/components/templates/dashboard/useDashboardPage.tsx

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,29 @@ export const useDashboardPage = ({
8181
filter,
8282
);
8383
const topModels =
84-
models?.data?.sort((a, b) =>
85-
a.total_requests > b.total_requests ? -1 : 1,
86-
) ?? [];
84+
models && models.error === null && Array.isArray(models.data)
85+
? [...models.data].sort((a, b) =>
86+
a.total_requests > b.total_requests ? -1 : 1,
87+
)
88+
: [];
8789

8890
const { isLoading: isProvidersLoading, providers } = useProviders(
8991
timeFilter,
9092
1000,
9193
filter,
9294
);
93-
const topProviders =
94-
providers?.data?.sort((a, b) =>
95-
a.total_requests > b.total_requests ? -1 : 1,
96-
) ?? [];
95+
96+
// Extract providers data safely from the openapi-fetch response
97+
const providersData =
98+
providers && 'data' in providers && providers.data && typeof providers.data === 'object' && 'data' in providers.data && !providers.data.error
99+
? providers.data.data
100+
: null;
101+
102+
const topProviders = Array.isArray(providersData)
103+
? [...providersData].sort((a, b) =>
104+
a.total_requests > b.total_requests ? -1 : 1,
105+
)
106+
: [];
97107

98108
const params: BackendMetricsCall<any>["params"] = {
99109
timeFilter,

web/lib/clients/jawnTypes/public.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ type JsonValue = string | number | boolean | null | JsonArray | JsonObject;
22
interface JsonArray extends Array<JsonValue> {}
33
interface JsonObject { [key: string]: JsonValue; }
44

5-
type JsonValue = string | number | boolean | null | JsonArray | JsonObject;
6-
interface JsonArray extends Array<JsonValue> {}
7-
interface JsonObject { [key: string]: JsonValue; }
8-
95
/**
106
* This file was auto-generated by openapi-typescript.
117
* Do not make direct changes to the file.

0 commit comments

Comments
 (0)