From 89941d4a3d8a2551f692f8700c7eaf2824403376 Mon Sep 17 00:00:00 2001 From: adibarra <93070681+adibarra@users.noreply.github.com> Date: Fri, 3 Apr 2026 12:17:47 -0500 Subject: [PATCH 1/6] refactor: extract shared CustomGpuValuePanel from CustomCosts and CustomPowers --- .../components/inference/ui/CustomCosts.tsx | 300 +---------------- .../inference/ui/CustomGpuValuePanel.tsx | 297 +++++++++++++++++ .../components/inference/ui/CustomPowers.tsx | 303 +----------------- .../ui/custom-gpu-value-panel-utils.test.ts | 73 +++++ .../ui/custom-gpu-value-panel-utils.ts | 74 +++++ 5 files changed, 451 insertions(+), 596 deletions(-) create mode 100644 packages/app/src/components/inference/ui/CustomGpuValuePanel.tsx create mode 100644 packages/app/src/components/inference/ui/custom-gpu-value-panel-utils.test.ts create mode 100644 packages/app/src/components/inference/ui/custom-gpu-value-panel-utils.ts diff --git a/packages/app/src/components/inference/ui/CustomCosts.tsx b/packages/app/src/components/inference/ui/CustomCosts.tsx index c95bbb1..b2ee978 100644 --- a/packages/app/src/components/inference/ui/CustomCosts.tsx +++ b/packages/app/src/components/inference/ui/CustomCosts.tsx @@ -1,305 +1,13 @@ 'use client'; -import React, { memo, useCallback, useEffect, useRef, useState } from 'react'; +import { memo } from 'react'; -import { track } from '@/lib/analytics'; - -import { Button } from '@/components/ui/button'; -import { - InputGroup, - InputGroupAddon, - InputGroupInput, - InputGroupText, -} from '@/components/ui/input-group'; -import { Skeleton } from '@/components/ui/skeleton'; - -import { useInference } from '@/components/inference/InferenceContext'; -import { GPU_SPECS } from '@/lib/constants'; - -// Memoized InputGroup component for GPU cost inputs -const GpuCostInputGroup = memo( - ({ - gpuKey, - gpuLabel, - inputValue, - error, - onChange, - }: { - gpuKey: string; - gpuLabel: string; - inputValue: string; - error: string; - onChange: (value: string) => void; - }) => { - return ( -
{error}
} -- Enter your own TCO (Total Cost of Ownership) values for each GPU in $/GPU/hr. These - values will be used to calculate custom cost metrics. -
-- Enter your own TCO (Total Cost of Ownership) values for each GPU in $/GPU/hr. These values - will be used to calculate custom cost metrics. -
-{error}
} +{description}
+{config.description}
+{error}
} -- Enter your own Token Throughput per All in Utility MW (tok/s/MW) values for each GPU. - These values will be used to calculate custom power metrics. -
-- Enter your own Token Throughput per All in Utility MW (tok/s/MW) values for each GPU. - These values will be used to calculate custom power metrics. -
-{description}
-{config.description}
-{description}
+{config.description}
+{description}
-{description}
{config.description}
-{config.description}