Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 29 additions & 17 deletions apps/web/src/components/settings/ProviderSettingsPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 />
Expand Down Expand Up @@ -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>
}
>
Expand Down Expand Up @@ -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>
Expand Down
6 changes: 5 additions & 1 deletion apps/web/src/components/settings/settingsLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ export function SettingsSection({
title,
hideTitle = false,
icon,
titleAction,
headerAction,
variant = "grouped",
children,
Expand All @@ -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;
Expand All @@ -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>
Expand Down
Loading