fix(settings): display correct configuration status for OAuth providers (#382)

This commit is contained in:
paisley
2026-03-10 14:08:45 +08:00
committed by GitHub
Unverified
parent b86f47171b
commit 65c2b73e23

View File

@@ -41,6 +41,7 @@ import {
import { import {
buildProviderAccountId, buildProviderAccountId,
buildProviderListItems, buildProviderListItems,
hasConfiguredCredentials,
type ProviderListItem, type ProviderListItem,
} from '@/lib/provider-accounts'; } from '@/lib/provider-accounts';
import { cn } from '@/lib/utils'; import { cn } from '@/lib/utils';
@@ -435,7 +436,7 @@ function ProviderCard({
)} )}
<span className="w-1 h-1 rounded-full bg-black/20 dark:bg-white/20" /> <span className="w-1 h-1 rounded-full bg-black/20 dark:bg-white/20" />
<span className="flex items-center gap-1"> <span className="flex items-center gap-1">
{status?.hasKey ? ( {hasConfiguredCredentials(account, status) ? (
<><div className="w-1.5 h-1.5 rounded-full bg-green-500" /> {t('aiProviders.card.configured')}</> <><div className="w-1.5 h-1.5 rounded-full bg-green-500" /> {t('aiProviders.card.configured')}</>
) : ( ) : (
<><div className="w-1.5 h-1.5 rounded-full bg-red-500" /> {t('aiProviders.dialog.apiKeyMissing')}</> <><div className="w-1.5 h-1.5 rounded-full bg-red-500" /> {t('aiProviders.dialog.apiKeyMissing')}</>
@@ -575,12 +576,12 @@ function ProviderCard({
<div className="space-y-0.5"> <div className="space-y-0.5">
<Label className="text-[14px] font-bold text-foreground/80">{t('aiProviders.dialog.apiKey')}</Label> <Label className="text-[14px] font-bold text-foreground/80">{t('aiProviders.dialog.apiKey')}</Label>
<p className="text-[12px] text-muted-foreground"> <p className="text-[12px] text-muted-foreground">
{status?.hasKey {hasConfiguredCredentials(account, status)
? t('aiProviders.dialog.apiKeyConfigured') ? t('aiProviders.dialog.apiKeyConfigured')
: t('aiProviders.dialog.apiKeyMissing')} : t('aiProviders.dialog.apiKeyMissing')}
</p> </p>
</div> </div>
{status?.hasKey ? ( {hasConfiguredCredentials(account, status) ? (
<div className="flex items-center gap-1.5 text-[11px] font-medium text-green-600 dark:text-green-500 bg-green-500/10 px-2 py-1 rounded-md"> <div className="flex items-center gap-1.5 text-[11px] font-medium text-green-600 dark:text-green-500 bg-green-500/10 px-2 py-1 rounded-md">
<div className="w-1.5 h-1.5 rounded-full bg-current" /> <div className="w-1.5 h-1.5 rounded-full bg-current" />
{t('aiProviders.card.configured')} {t('aiProviders.card.configured')}