refactor(webui): unify shared shape system
This commit is contained in:
1 parent
7c04af86f9
commit
60993597de
56 files changed
+305
-219
No files matched your search
@@ -117,7 +117,7 @@ export function ModelPresetDeleteDialog({
|
||||
t(key, { defaultValue: fallback, ...(values ?? {}) });
|
||||
return (
|
||||
<Dialog open={preset !== null} onOpenChange={onOpenChange}>
|
||||
<DialogContent className="max-w-[440px] rounded-[24px]">
|
||||
<DialogContent className="max-w-[440px]">
|
||||
<DialogHeader className="text-left">
|
||||
<DialogTitle>
|
||||
{tx("settings.models.deletePresetTitle", "Delete model preset?")}
|
||||
@@ -130,11 +130,10 @@ export function ModelPresetDeleteDialog({
|
||||
)}
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<DialogFooter className="gap-2 sm:space-x-0">
|
||||
<DialogFooter>
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
className="rounded-full"
|
||||
disabled={deleting}
|
||||
onClick={() => onOpenChange(false)}
|
||||
>
|
||||
@@ -143,7 +142,6 @@ export function ModelPresetDeleteDialog({
|
||||
<Button
|
||||
type="button"
|
||||
variant="destructive"
|
||||
className="rounded-full"
|
||||
disabled={deleting}
|
||||
onClick={onConfirm}
|
||||
>
|
||||
@@ -343,7 +341,7 @@ export function ModelsSettings({
|
||||
<div
|
||||
id="model-preset-editor"
|
||||
data-testid="model-preset-editor"
|
||||
className="mx-3 mb-3 divide-y divide-border/45 overflow-hidden rounded-[18px] border border-border/45 bg-background/80 shadow-sm motion-reduce:animate-none animate-in fade-in-0 slide-in-from-top-1 duration-200 sm:mx-5 lg:mx-auto lg:w-[calc(100%-2.5rem)] lg:max-w-6xl"
|
||||
className="mx-3 mb-3 divide-y divide-border/45 overflow-hidden rounded-floating border border-border/45 bg-background/80 shadow-sm motion-reduce:animate-none animate-in fade-in-0 slide-in-from-top-1 duration-200 sm:mx-5 lg:mx-auto lg:w-[calc(100%-2.5rem)] lg:max-w-6xl"
|
||||
>
|
||||
{creating ? (
|
||||
<div className="flex min-h-[52px] items-center px-4 py-3 sm:px-5">
|
||||
@@ -527,7 +525,7 @@ export function ModelsSettings({
|
||||
{!settings.model_call_order_editable ? (
|
||||
<div className="flex flex-col gap-4 px-4 py-4 sm:flex-row sm:items-center sm:justify-between sm:px-5">
|
||||
<div className="flex min-w-0 items-start gap-3">
|
||||
<span className="grid h-9 w-9 shrink-0 place-items-center rounded-[12px] bg-muted text-muted-foreground">
|
||||
<span className="grid h-9 w-9 shrink-0 place-items-center rounded-control bg-muted text-muted-foreground">
|
||||
<ListOrdered className="h-4 w-4" aria-hidden />
|
||||
</span>
|
||||
<div className="min-w-0">
|
||||
@@ -674,7 +672,7 @@ export function ModelsSettings({
|
||||
aria-controls={isSelected ? "model-preset-editor" : undefined}
|
||||
disabled={!preset}
|
||||
onClick={() => preset && selectPreset(preset, key)}
|
||||
className="flex min-w-0 flex-1 items-center gap-3 rounded-[12px] text-left outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
||||
className="flex min-w-0 flex-1 items-center gap-3 rounded-control text-left outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
||||
>
|
||||
{ordered ? (
|
||||
<span className="grid h-7 w-7 shrink-0 place-items-center rounded-full bg-muted font-mono text-[11px] font-semibold tabular-nums text-muted-foreground">
|
||||
@@ -841,7 +839,7 @@ function ModelAdvancedFields({
|
||||
const value = Number(event.target.value);
|
||||
if (Number.isFinite(value)) onChange({ maxTokens: value });
|
||||
}}
|
||||
className="h-9 rounded-[12px] text-[13px]"
|
||||
className="h-9 text-[13px]"
|
||||
/>
|
||||
</label>
|
||||
<label className="block">
|
||||
@@ -858,7 +856,7 @@ function ModelAdvancedFields({
|
||||
const value = Number(event.target.value);
|
||||
if (Number.isFinite(value)) onChange({ temperature: value });
|
||||
}}
|
||||
className="h-9 rounded-[12px] text-[13px]"
|
||||
className="h-9 text-[13px]"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
@@ -887,7 +885,7 @@ function ModelAdvancedFields({
|
||||
placeholder={tx("settings.values.default", "Default")}
|
||||
autoCapitalize="none"
|
||||
spellCheck={false}
|
||||
className="h-9 rounded-[12px] text-[13px]"
|
||||
className="h-9 text-[13px]"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@@ -276,7 +276,7 @@ export function ProviderOAuthLoginDialog({
|
||||
if (!open) onClose();
|
||||
}}
|
||||
>
|
||||
<DialogContent className="w-[min(calc(100vw-2rem),28rem)] rounded-[24px]">
|
||||
<DialogContent className="w-[min(calc(100vw-2rem),28rem)]">
|
||||
<form
|
||||
className="space-y-4"
|
||||
onSubmit={(event) => {
|
||||
@@ -296,7 +296,7 @@ export function ProviderOAuthLoginDialog({
|
||||
: t("settings.oauth.localCodeHelp")}
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<div className="flex items-center gap-2 rounded-[14px] border border-border/45 bg-muted/35 px-3 py-2.5 text-[12px] text-muted-foreground">
|
||||
<div className="flex items-center gap-2 rounded-control border border-border/45 bg-muted/35 px-3 py-2.5 text-[12px] text-muted-foreground">
|
||||
{expectsCallbackUrl && remoteBrowserAccess ? (
|
||||
<Clipboard className="h-3.5 w-3.5 shrink-0" aria-hidden />
|
||||
) : (
|
||||
@@ -341,12 +341,12 @@ export function ProviderOAuthLoginDialog({
|
||||
{error ? (
|
||||
<p
|
||||
role="alert"
|
||||
className="rounded-[14px] border border-destructive/20 bg-destructive/5 px-3 py-2.5 text-[12px] text-destructive"
|
||||
className="rounded-control border border-destructive/20 bg-destructive/5 px-3 py-2.5 text-[12px] text-destructive"
|
||||
>
|
||||
{error}
|
||||
</p>
|
||||
) : null}
|
||||
<DialogFooter className="gap-2 sm:space-x-0">
|
||||
<DialogFooter>
|
||||
<Button type="button" variant="outline" onClick={onOpenAuthorization}>
|
||||
<ExternalLink className="mr-2 h-4 w-4" aria-hidden />
|
||||
{expectsCallbackUrl
|
||||
@@ -380,7 +380,7 @@ function ProviderRequestOptions({
|
||||
const tx = (key: string, fallback: string) => t(key, { defaultValue: fallback });
|
||||
|
||||
return (
|
||||
<div className="overflow-hidden rounded-[18px] border border-border/45 bg-background/75">
|
||||
<div className="overflow-hidden rounded-floating border border-border/45 bg-background/75">
|
||||
{options.map((option, index) => {
|
||||
const title = tx(option.titleKey, option.title);
|
||||
const Icon = option.kind === "priority" ? Zap : Globe2;
|
||||
@@ -599,7 +599,7 @@ function ProviderAdvancedOptions({
|
||||
onChange={(event) => onChange({ extraHeaders: event.target.value })}
|
||||
placeholder={'{"X-Header":"value"}'}
|
||||
spellCheck={false}
|
||||
className="min-h-[88px] resize-y rounded-[14px] bg-background font-mono text-[12px]"
|
||||
className="min-h-[88px] resize-y bg-background font-mono text-[12px]"
|
||||
/>
|
||||
</label>
|
||||
) : null}
|
||||
@@ -613,7 +613,7 @@ function ProviderAdvancedOptions({
|
||||
onChange={(event) => onChange({ extraQuery: event.target.value })}
|
||||
placeholder={'{"api-version":"2024-02-01"}'}
|
||||
spellCheck={false}
|
||||
className="min-h-[88px] resize-y rounded-[14px] bg-background font-mono text-[12px]"
|
||||
className="min-h-[88px] resize-y bg-background font-mono text-[12px]"
|
||||
/>
|
||||
</label>
|
||||
) : null}
|
||||
@@ -627,7 +627,7 @@ function ProviderAdvancedOptions({
|
||||
onChange={(event) => onChange({ extraBody: event.target.value })}
|
||||
placeholder={'{"service_tier":"priority"}'}
|
||||
spellCheck={false}
|
||||
className="min-h-[96px] resize-y rounded-[14px] bg-background font-mono text-[12px]"
|
||||
className="min-h-[96px] resize-y bg-background font-mono text-[12px]"
|
||||
/>
|
||||
</label>
|
||||
) : null}
|
||||
@@ -825,7 +825,7 @@ export function ProvidersSettings({
|
||||
) : null}
|
||||
{isOauthProvider ? (
|
||||
<>
|
||||
<div className="flex flex-col gap-3 rounded-[18px] border border-border/45 bg-background/75 px-4 py-3 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div className="flex flex-col gap-3 rounded-floating border border-border/45 bg-background/75 px-4 py-3 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div className="min-w-0">
|
||||
<p className="text-[13px] font-semibold text-foreground">
|
||||
{tx("settings.oauth.authentication", "OAuth authentication")}
|
||||
@@ -1240,7 +1240,7 @@ export function ProvidersSettings({
|
||||
className="group flex min-h-[70px] w-full items-center justify-between gap-4 px-4 py-3 text-left transition-colors hover:bg-muted/35 sm:px-5"
|
||||
>
|
||||
<span className="flex min-w-0 items-center gap-3">
|
||||
<span className="grid h-10 w-10 shrink-0 place-items-center rounded-[14px] bg-muted text-muted-foreground">
|
||||
<span className="grid h-10 w-10 shrink-0 place-items-center rounded-control bg-muted text-muted-foreground">
|
||||
<Plus className="h-5 w-5" aria-hidden />
|
||||
</span>
|
||||
<span className="truncate text-[15px] font-semibold text-foreground">
|
||||
@@ -1334,7 +1334,7 @@ function ProviderIcon({
|
||||
return (
|
||||
<span
|
||||
data-testid={`provider-logo-${provider}`}
|
||||
className="grid h-10 w-10 shrink-0 place-items-center overflow-hidden rounded-[14px] border border-border/45 bg-background"
|
||||
className="grid h-10 w-10 shrink-0 place-items-center overflow-hidden rounded-control border border-border/45 bg-background"
|
||||
>
|
||||
<img
|
||||
src={logoUrl}
|
||||
@@ -1352,7 +1352,7 @@ function ProviderIcon({
|
||||
return (
|
||||
<span
|
||||
data-testid={`provider-logo-fallback-${provider}`}
|
||||
className="grid h-10 w-10 shrink-0 place-items-center rounded-[14px] text-[11px] font-semibold text-white"
|
||||
className="grid h-10 w-10 shrink-0 place-items-center rounded-control text-[11px] font-semibold text-white"
|
||||
style={{ backgroundColor: brand.color }}
|
||||
aria-hidden
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user