Skip to content

armgit / mimik

Public Imported from GitHub
0

🎬 A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots πŸ“–

fix(ui): move the API key status under the provider name in narrow cards

Luis Ortiz6f81eb954272
diff --git a/packages/ui/src/ai/components/ApiKeysSettings.tsx b/packages/ui/src/ai/components/ApiKeysSettings.tsx
index 2f61bae..d3a5367 100644
--- a/packages/ui/src/ai/components/ApiKeysSettings.tsx
+++ b/packages/ui/src/ai/components/ApiKeysSettings.tsx
@@ -17,7 +17,7 @@ export function ApiKeysSettings({ state, validate, title }: ApiKeysSettingsProps
return (
<>
<SettingsCard icon={KeyRound} title={title} className={title ? 'pb-1' : 'py-1'}>
- <div className="divide-y divide-secondary">
+ <div className="@container divide-y divide-secondary">
{KEY_PROVIDERS.map((provider) => (
<ProviderKeyRow
key={provider}
diff --git a/packages/ui/src/ai/components/KeyStatusPill.tsx b/packages/ui/src/ai/components/KeyStatusPill.tsx
index 6b83f77..4db9a03 100644
--- a/packages/ui/src/ai/components/KeyStatusPill.tsx
+++ b/packages/ui/src/ai/components/KeyStatusPill.tsx
@@ -5,6 +5,11 @@ import type { KeyStatus } from '../types';
const GOOD = 'bg-[#ECFDF5] text-[#047857]';
const BAD = 'bg-[#FEF3F2] text-[#B42318]';
const QUIET = 'bg-secondary text-muted-foreground';
+const COMPACT: Record<string, string> = {
+ [GOOD]: 'text-[#047857]',
+ [BAD]: 'text-[#B42318]',
+ [QUIET]: 'text-muted-foreground',
+};
const PILLS: Record<NonNullable<KeyStatus>, { label: string; tone: string }> = {
checking: { label: 'settings.keyChecking', tone: QUIET },
@@ -15,14 +20,22 @@ const PILLS: Record<NonNullable<KeyStatus>, { label: string; tone: string }> = {
'model-invalid': { label: 'settings.keyCheckModel', tone: BAD },
};
-export function KeyStatusPill({ status }: { status: KeyStatus }) {
+export function KeyStatusPill({
+ status,
+ compact = false,
+ className = '',
+}: {
+ status: KeyStatus;
+ compact?: boolean;
+ className?: string;
+}) {
if (!status) return null;
const pill = PILLS[status];
+ const look = compact
+ ? `items-center gap-1 text-[10.5px] font-semibold leading-4 ${COMPACT[pill.tone]}`
+ : `inline-flex h-[22px] shrink-0 items-center gap-1.5 rounded-full px-2.5 text-[11px] font-semibold ${pill.tone}`;
return (
- <span
- role="status"
- className={`inline-flex h-[22px] shrink-0 items-center gap-1.5 rounded-full px-2.5 text-[11px] font-semibold ${pill.tone}`}
- >
+ <span role="status" className={`${look} ${className}`}>
{status === 'checking' && <Loader2 size={11} className="animate-spin" />}
{i18n.t(pill.label)}
</span>
diff --git a/packages/ui/src/ai/components/ProviderKeyRow.tsx b/packages/ui/src/ai/components/ProviderKeyRow.tsx
index 28e082a..dccaef3 100644
--- a/packages/ui/src/ai/components/ProviderKeyRow.tsx
+++ b/packages/ui/src/ai/components/ProviderKeyRow.tsx
@@ -33,8 +33,9 @@ export function ProviderKeyRow({ provider, value, onChange, validate, bare = fal
<span className="w-7 h-7 rounded-lg bg-secondary text-foreground flex items-center justify-center shrink-0">
<ProviderLogo provider={provider} />
</span>
- <span className="w-28 shrink-0 text-[13px] font-semibold text-foreground">
+ <span className="flex w-28 shrink-0 flex-col text-[13px] font-semibold text-foreground @max-[440px]:w-24">
{KEY_PROVIDER_LABELS[provider]}
+ <KeyStatusPill status={keyCheck.status} compact className="hidden @max-[440px]:flex" />
</span>
</>
)}
@@ -48,7 +49,7 @@ export function ProviderKeyRow({ provider, value, onChange, validate, bare = fal
if (value.trim()) void check(provider, value.trim());
}}
placeholder={KEY_PLACEHOLDERS[provider]}
- status={<KeyStatusPill status={keyCheck.status} />}
+ status={keyCheck.status ? <KeyStatusPill status={keyCheck.status} /> : undefined}
aria-label={bare ? i18n.t('settings.apiKey') : undefined}
className={bare ? 'h-11 rounded-xl pl-4 text-sm border-border' : 'h-8 text-[13px] rounded-lg border-border'}
/>
diff --git a/packages/ui/src/ai/components/SecretInput.tsx b/packages/ui/src/ai/components/SecretInput.tsx
index c1d08e0..adfb75a 100644
--- a/packages/ui/src/ai/components/SecretInput.tsx
+++ b/packages/ui/src/ai/components/SecretInput.tsx
@@ -31,11 +31,11 @@ export function SecretInput({
onChange={(e) => onChange(e.target.value)}
onBlur={onBlur}
placeholder={placeholder}
- className={`${status ? 'pr-40' : value ? 'pr-14' : 'pr-8'} ${className ?? ''}`}
+ className={`${status ? (value ? 'pr-40 @max-[440px]:pr-14' : 'pr-40 @max-[440px]:pr-8') : value ? 'pr-14' : 'pr-8'} ${className ?? ''}`}
/>
{status && (
<span
- className={`pointer-events-none absolute top-1/2 flex -translate-y-1/2 ${value ? 'right-14' : 'right-8'}`}
+ className={`pointer-events-none absolute top-1/2 flex -translate-y-1/2 @max-[440px]:hidden ${value ? 'right-14' : 'right-8'}`}
>
{status}
</span>