feat(web): Add provider button sits with the provider list (#17152)
Co-authored-by: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
37eaf5d293
commit
5e2225671f
2 files changed
+34
-18
No files matched your search
@@ -1154,6 +1154,25 @@ export function EnvironmentProviderSettings({
|
||||
<SettingsSection
|
||||
{...searchableSetting("providers")}
|
||||
variant="plain"
|
||||
titleAction={
|
||||
!readOnly ? (
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
render={
|
||||
<Button
|
||||
size="icon-xs"
|
||||
variant="ghost-muted"
|
||||
onClick={() => setIsAddInstanceDialogOpen(true)}
|
||||
aria-label="Add provider"
|
||||
>
|
||||
<PlusIcon />
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
<TooltipPopup side="top">Add provider</TooltipPopup>
|
||||
</Tooltip>
|
||||
) : null
|
||||
}
|
||||
headerAction={
|
||||
<div className="flex min-w-0 items-center gap-2">
|
||||
<ProviderUpdatesAction />
|
||||
@@ -1181,23 +1200,6 @@ export function EnvironmentProviderSettings({
|
||||
/>
|
||||
<TooltipPopup side="top">Refresh provider status</TooltipPopup>
|
||||
</Tooltip>
|
||||
{!readOnly ? (
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
render={
|
||||
<Button
|
||||
size="icon-xs"
|
||||
variant="ghost-muted"
|
||||
onClick={() => setIsAddInstanceDialogOpen(true)}
|
||||
aria-label="Add provider"
|
||||
>
|
||||
<PlusIcon />
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
<TooltipPopup side="top">Add provider</TooltipPopup>
|
||||
</Tooltip>
|
||||
) : null}
|
||||
</div>
|
||||
}
|
||||
>
|
||||
@@ -1227,6 +1229,16 @@ export function EnvironmentProviderSettings({
|
||||
>
|
||||
<div className="divide-y divide-border/50">
|
||||
{rows.map((row) => renderProviderInstance(row, "list"))}
|
||||
{!readOnly ? (
|
||||
<button
|
||||
type="button"
|
||||
className="flex w-full cursor-pointer items-center gap-3 px-3 py-3 text-left text-sm text-muted-foreground transition-colors outline-none hover:bg-muted/25 hover:text-foreground focus-visible:bg-muted/25 focus-visible:text-foreground sm:px-4"
|
||||
onClick={() => setIsAddInstanceDialogOpen(true)}
|
||||
>
|
||||
<PlusIcon className="size-4 shrink-0" />
|
||||
Add provider
|
||||
</button>
|
||||
) : null}
|
||||
</div>
|
||||
</ScrollArea>
|
||||
</div>
|
||||
|
||||
@@ -176,6 +176,7 @@ export function SettingsSection({
|
||||
title,
|
||||
hideTitle = false,
|
||||
icon,
|
||||
titleAction,
|
||||
headerAction,
|
||||
variant = "grouped",
|
||||
children,
|
||||
@@ -185,6 +186,8 @@ export function SettingsSection({
|
||||
title: string;
|
||||
hideTitle?: boolean;
|
||||
icon?: ReactNode;
|
||||
/** Small control shown right after the title, such as an add button. */
|
||||
titleAction?: ReactNode;
|
||||
headerAction?: ReactNode;
|
||||
variant?: "grouped" | "plain";
|
||||
children: ReactNode;
|
||||
@@ -205,11 +208,12 @@ export function SettingsSection({
|
||||
data-settings-scroll-target
|
||||
className="flex min-h-7 items-start justify-between gap-4 px-3 sm:px-4"
|
||||
>
|
||||
<div className="min-w-0">
|
||||
<div className="flex min-w-0 items-center gap-1">
|
||||
<h2 className="flex min-h-7 items-center gap-2 text-sm font-normal text-foreground/70">
|
||||
{icon}
|
||||
{title}
|
||||
</h2>
|
||||
{titleAction}
|
||||
</div>
|
||||
<div className="flex min-h-7 min-w-7 items-center justify-end">{headerAction}</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user