fix: put the consent page's pens next to their section titles

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
hugocasa
2026-12-03 11:29:41 +01:00
co-authored by Claude Opus 5.5
parent 0462642292
commit 5d26fdf507
2 changed files with 19 additions and 36 deletions
@@ -1,5 +1,4 @@
<script lang="ts">
import type { Snippet } from 'svelte'
import ClipboardPanel from '$lib/components/details/ClipboardPanel.svelte'
import type { McpWorkspaceAccess } from '$lib/gen'
import type { McpAccess } from './McpAccessPicker.svelte'
@@ -21,11 +20,9 @@
access: McpAccess
/** Names the workspaces on the single line, for when it sits under a level being picked. */
named?: boolean
/** After the single line, such as a control to change it. */
trailing?: Snippet
}
let { workspaces, covered, all, access, named = false, trailing }: Props = $props()
let { workspaces, covered, all, access, named = false }: Props = $props()
const listed = $derived(workspaces.filter((w) => all || covered.includes(w.id)))
const describe = (w: McpWorkspaceAccess) =>
@@ -61,7 +58,6 @@
<span class="text-secondary">In {listed.map((w) => w.name).join(', ')}:</span>
{/if}
{@render access_(listed[0], false)}
{@render trailing?.()}
</div>
{#if listed.length === 1 && connectsSeparately(listed[0], all, covered, access)}
<ClipboardPanel content={workspaceMcpUrl(listed[0].id)} size="sm" />
@@ -20,12 +20,9 @@
import McpAccessSection from '$lib/components/mcp/McpAccessSection.svelte'
import McpWorkspaceAccessList from '$lib/components/mcp/McpWorkspaceAccessList.svelte'
import {
accessHint,
accessLabel,
defaultConnection,
connectionToolset,
givesAnything,
restriction,
servedOn,
workspaceMcpUrl
} from '$lib/components/mcp/workspaceAccess'
@@ -186,16 +183,6 @@
? workspaceAccess.filter((w) => isTools(w) && !served.includes(w))
: []
)
// One line when every served workspace gets the same, else one row per workspace.
const same = $derived(
served.length > 0 &&
served.every(
(w) =>
accessLabel(w, access) === accessLabel(served[0], access) &&
restriction(w, access) === restriction(served[0], access) &&
accessHint(w, access) === accessHint(served[0], access)
)
)
// A role limit settles the access; a narrower one the client asked for stays editable.
const editable = $derived(served.every((w) => !w.limited) || access !== 'full')
// One tool list per connection: the picked level's, or what a bound workspace leaves.
@@ -475,9 +462,22 @@
{#if isGateway}
<div class="mb-6 flex flex-col gap-2">
<p class="text-xs font-semibold text-emphasis">
{access === 'selected' || toolsOnly || toolsAlone ? 'Workspace' : 'Workspaces'}
</p>
<div class="flex items-center gap-1.5">
<p class="text-xs font-semibold text-emphasis">
{access === 'selected' || toolsOnly || toolsAlone ? 'Workspace' : 'Workspaces'}
</p>
{#if toolsAlone && !loadingWorkspaces}
<Button
variant="subtle"
unifiedSize="xs"
iconOnly
startIcon={{ icon: Pencil }}
aria-label="Change workspaces"
title="Change workspaces"
onClick={coverDefault}
/>
{/if}
</div>
{#if loadingWorkspaces}
<p class="text-xs text-secondary">Loading workspaces...</p>
{:else if accessLoadFailed}
@@ -507,18 +507,7 @@
Your role lets you connect scripts and flows as tools, one workspace per connection.
</p>
{:else if toolsAlone}
<div class="flex items-center gap-1">
<p class="text-xs text-primary">{covered[0].name}</p>
<Button
variant="subtle"
unifiedSize="xs"
iconOnly
startIcon={{ icon: Pencil }}
aria-label="Change workspaces"
title="Change workspaces"
onClick={coverDefault}
/>
</div>
<p class="text-xs text-primary">{covered[0].name}</p>
{:else}
<Toggle
bind:checked={allWorkspaces}
@@ -589,11 +578,10 @@
{/if}
{/snippet}
{#if !loadingWorkspaces && (served.length > 0 || access === 'selected')}
{@const sameEverywhere = served.length > 0 && same}
<div class="mb-6">
<McpAccessSection
tools={{ level: connectionTools, workspace: runnablesHere }}
edit={sameEverywhere ? undefined : pen}
edit={pen}
>
{#if served.length > 0}
<McpWorkspaceAccessList
@@ -601,7 +589,6 @@
covered={served.map((w) => w.id)}
all={false}
{access}
trailing={pen}
/>
{:else}
<p class="text-xs text-primary">