File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed
webview-ui/src/components/settings Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 1- import { useState } from "react"
1+ import { useState , ReactNode } from "react"
22import { Checkbox } from "vscrui"
33import { VSCodeTextField } from "@vscode/webview-ui-toolkit/react"
44import { VSCodeButtonLink } from "@src/components/common/VSCodeButtonLink"
@@ -14,6 +14,7 @@ type ApiKeyProps = {
1414 getApiKeyUrl ?: string
1515 getApiKeyLabel ?: string
1616 disabled ?: boolean
17+ balanceDisplay ?: ReactNode
1718}
1819
1920export const ApiKey = ( {
@@ -26,6 +27,7 @@ export const ApiKey = ({
2627 getApiKeyUrl,
2728 getApiKeyLabel,
2829 disabled = false ,
30+ balanceDisplay,
2931} : ApiKeyProps ) => {
3032
3133 const env = ( window as any ) . PROCESS_ENV || { }
@@ -46,7 +48,10 @@ export const ApiKey = ({
4648 placeholder = { t ( "settings:placeholders.apiKey" ) }
4749 className = "w-full"
4850 disabled = { useEnvVar || disabled } >
49- < label className = "block font-medium mb-1" > { apiKeyLabel } </ label >
51+ < div className = "flex justify-between items-center mb-1" >
52+ < label className = "block font-medium" > { apiKeyLabel } </ label >
53+ { apiKey && balanceDisplay && balanceDisplay }
54+ </ div >
5055 </ VSCodeTextField >
5156 < div className = "text-sm text-vscode-descriptionForeground -mt-2" >
5257 { t ( "settings:providers.apiKeyStorageNotice" ) }
Original file line number Diff line number Diff line change @@ -62,6 +62,12 @@ export const OpenRouter = ({
6262 apiKeyLabel = { t ( "settings:providers.openRouterApiKey" ) }
6363 getApiKeyUrl = { getOpenRouterAuthUrl ( uriScheme ) }
6464 getApiKeyLabel = { t ( "settings:providers.getOpenRouterApiKey" ) }
65+ balanceDisplay = { apiConfiguration ?. openRouterApiKey && (
66+ < OpenRouterBalanceDisplay
67+ apiKey = { apiConfiguration . openRouterApiKey }
68+ baseUrl = { apiConfiguration . openRouterBaseUrl }
69+ />
70+ ) }
6571 />
6672 { ! fromWelcomeView && (
6773 < >
Original file line number Diff line number Diff line change @@ -58,6 +58,9 @@ export const Requesty = ({
5858 apiKeyLabel = { t ( "settings:providers.requestyApiKey" ) }
5959 getApiKeyUrl = "https://app.requesty.ai/api-keys"
6060 getApiKeyLabel = { t ( "settings:providers.getRequestyApiKey" ) }
61+ balanceDisplay = { apiConfiguration ?. requestyApiKey && (
62+ < RequestyBalanceDisplay apiKey = { apiConfiguration . requestyApiKey } />
63+ ) }
6164 />
6265 < Button
6366 variant = "outline"
You can’t perform that action at this time.
0 commit comments