mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-29 15:52:36 +01:00
feat(ui): move the connection page to the Plugins design (#23029)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The Plugins page is where a person connects tools to agents and sets what those tools can do > - #22869 and #23005 moved Browse, the plugin page, and Reviews to the Plugins marketplace design > - The connection page that opens after a successful connection kept the old design and an old side rail > - A person who connects a plugin lands on a page that does not look like the page they came from, and the plugin page does not show a clear way back to it > - This pull request applies the plugin page design to the connection page and adds a Settings button to each account row on the plugin page > - The benefit is one consistent path: Plugins, then the plugin, then the account settings ## Linked Issues or Issue Description Refs #22869, #23005 **What existing behavior does this improve?** The connection page at `/apps/:connectionId/permissions` and `/apps/:connectionId/review`, and the account rows on the plugin page. **Subsystem affected** UI, Plugins (Apps catalog) pages. **Current behavior** - The connection page shows a second side rail with "All connectors", Permissions, and Review. - The page uses a left-aligned column, ruled dividers, bordered chips, and raw palette colors for the status badge. - The plugin page opens the connection page only from the account name and the "⋯" menu. **Proposed behavior** - The connection page has no second rail. It shows a back link to the plugin, the header, and Permissions and Review as tabs in the page. The Review tab shows the count of waiting items. - The page uses the centered column, the quiet section labels, and the rounded grouped surfaces of the plugin page. - The Read and Write action groups are grouped cards. The control that sets all actions is in the card header. - Each account row on the plugin page has a Settings button that opens the connection page. - The breadcrumb reads Plugins, plugin, account. **Reason and benefit** The page after a connection matches the plugin page. A person can go from the plugin to its account settings and back with one click. **Breaking changes** None. The routes, the labels that assistive technology reads, and the permission logic do not change. ## What Changed - `Layout.tsx`, `Layout.production.tsx`: connection routes no longer mount `AppDetailSidebar`. The page for an app that is not connected keeps its rail. - `AppDetail.tsx`: new page shell, a restyled `AppDetailHeader`, an exported `ConnectionBackLink`, and `ConnectionTabs` with the review count. The status badge uses status tokens. - `IdentitiesSection.tsx`, `PermissionsPanel.tsx`, `AgentConnectionAccess.tsx`: quiet labels and grouped surfaces. No logic changes. - `Browse.tsx`: a Settings button on each account row that is not a draft. - `AiConnectionPoolConnector.tsx`: a "Plugins" back link, because the rail that held it is gone. - `replay-masking.test.tsx`, `connection-pools.spec.ts`: updated for the new header class and the new back link. ## Verification - `cd ui && pnpm typecheck`: pass. - `pnpm run check:token-gates`: all gates clean. - `node scripts/check-query-error-rendering.mjs`: 0 findings. - `npx vitest run` on the 11 test files that import the changed components: 732 passed, 1 skipped. - `npx playwright test --config tests/e2e/playwright.config.ts tests/e2e/connection-reviews.spec.ts tests/e2e/apps-prosumer-mcp-flow.spec.ts tests/e2e/applications-crud.spec.ts`: 9 passed, 1 skipped. - Manual check in a local instance, dark theme, with a Context7 connection: the Permissions tab, the Review tab, and the Settings button on the plugin page. - Not run: `tests/ai-connections-app/connection-pools.spec.ts`. Not checked in the browser: the GitHub repositories block, the reconnect banner, the light theme, and narrow widths. ## Risks - Low. The change is presentation only for the sections, and the routes are the same. - The connection pool page lost the rail. Its only way back is now the "Plugins" back link and the breadcrumb. - The page for an app that is not connected still has the old rail. This is a known inconsistency. > For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and discuss it in `#dev` before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See `CONTRIBUTING.md`. ## Model Used - Claude Fable 5.2 (`claude-fable-5-2`) in Claude Code, with tool use, code execution, and a browser preview. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [ ] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
1480f716c9
commit
dadbc495b3
10 files changed
+216
-173
No files matched your search
@@ -145,12 +145,6 @@ export function Layout() {
|
||||
);
|
||||
const isToolsRoute = companyPathSegments[0]?.toLowerCase() === "tools";
|
||||
const isAppsRoute = companyPathSegments[0]?.toLowerCase() === "apps";
|
||||
const appDetailConnectionId =
|
||||
isAppsRoute &&
|
||||
companyPathSegments[1] &&
|
||||
!RESERVED_APP_SUBPATHS.has(companyPathSegments[1].toLowerCase())
|
||||
? companyPathSegments[1]
|
||||
: null;
|
||||
const appDetailApplicationId =
|
||||
isAppsRoute &&
|
||||
companyPathSegments[1]?.toLowerCase() === "app" &&
|
||||
@@ -205,8 +199,6 @@ export function Layout() {
|
||||
);
|
||||
const secondarySidebar = isCompanySettingsRoute ? (
|
||||
<CompanySettingsSidebar />
|
||||
) : appDetailConnectionId ? (
|
||||
<AppDetailSidebar kind="connection" connectionId={appDetailConnectionId} />
|
||||
) : appDetailApplicationId ? (
|
||||
<AppDetailSidebar
|
||||
kind="application"
|
||||
|
||||
@@ -157,10 +157,6 @@ export function Layout({ sidebarSections }: { sidebarSections?: ReactNode }) {
|
||||
const isToolsRoute = companyPathSegments[0]?.toLowerCase() === "tools";
|
||||
const isAppsRoute = companyPathSegments[0]?.toLowerCase() === "apps";
|
||||
const appsDeveloperTabs = useAppsDeveloperTabs();
|
||||
const appDetailConnectionId =
|
||||
isAppsRoute && companyPathSegments[1] && !RESERVED_APP_SUBPATHS.has(companyPathSegments[1].toLowerCase())
|
||||
? companyPathSegments[1]
|
||||
: null;
|
||||
const appDetailApplicationId =
|
||||
isAppsRoute && companyPathSegments[1]?.toLowerCase() === "app" && companyPathSegments[2]
|
||||
? companyPathSegments[2]
|
||||
@@ -210,8 +206,6 @@ export function Layout({ sidebarSections }: { sidebarSections?: ReactNode }) {
|
||||
<CompanySettingsSidebar />
|
||||
) : !streamlinedUiEnabled && shellRoute.builtInContextualSurface === "skills" ? (
|
||||
<SkillsContextualSidebar />
|
||||
) : appDetailConnectionId ? (
|
||||
<AppDetailSidebar kind="connection" connectionId={appDetailConnectionId} />
|
||||
) : appDetailApplicationId ? (
|
||||
<AppDetailSidebar kind="application" applicationId={appDetailApplicationId} />
|
||||
) : appsRouteHasRail(companyPathSegments, appsDeveloperTabs.length > 0) ? (
|
||||
|
||||
@@ -14,7 +14,7 @@ import { useToast } from "@/context/ToastContext";
|
||||
import { Link, useNavigate } from "@/lib/router";
|
||||
import { queryKeys } from "@/lib/queryKeys";
|
||||
import { AppLogo } from "@/pages/apps/AppLogo";
|
||||
import { AppDetailHeader } from "@/pages/apps/AppDetail";
|
||||
import { AppDetailHeader, ConnectionBackLink } from "@/pages/apps/AppDetail";
|
||||
import { StepHeader } from "@/features/connections/ConnectionSetupHeader";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { QueryErrorState, useQueryView } from "@/components/QueryView";
|
||||
@@ -146,7 +146,8 @@ function PoolConnector({ companyId, pluginKey, connection }: { companyId: string
|
||||
})}
|
||||
{draft.members.length === 0 && <li className="px-4 py-6 text-sm text-muted-foreground">Add a connection to get started.</li>}
|
||||
</ol>;
|
||||
return <div className={connection ? "space-y-6" : "mx-auto max-w-2xl"}>
|
||||
return <div className={connection ? "mx-auto w-full max-w-3xl space-y-6" : "mx-auto max-w-2xl"}>
|
||||
{connection ? <ConnectionBackLink label="Plugins" href="/apps" /> : null}
|
||||
{connection ? <div className="flex items-start justify-between gap-4">
|
||||
<AppDetailHeader appName={draft.name} connection={connection} logoEntry={logoEntry} brandKey={logoEntry.slug} allowRemoteLogo canRename={!disabled} status={editing?.enabled ? { label: "Connected", tone: "connected" } : { label: "Paused", tone: "paused" }} actionCount={null} renaming={renaming} nameDraft={nameDraft} renamePending={disabled} onNameDraftChange={setNameDraft} onRenameStart={() => { if (!disabled) { setNameDraft(draft.name); setRenaming(true); } }} onRenameCancel={() => setRenaming(false)} onRenameSubmit={value => void save({ ...draft, name: value })} />
|
||||
<DropdownMenu><DropdownMenuTrigger asChild><Button variant="ghost" size="icon-sm" aria-label="Manage connection pool"><MoreHorizontal className="size-4" /></Button></DropdownMenuTrigger><DropdownMenuContent className={ANALYTICS_MASK_CLASS} align="end"><DropdownMenuItem variant="destructive" disabled={busy || !canManage} onSelect={() => { setError(""); setRemoving(true); }}><Trash2 />Remove connection</DropdownMenuItem></DropdownMenuContent></DropdownMenu>
|
||||
|
||||
@@ -65,7 +65,7 @@ const MASKED_SURFACES: Array<{ file: string; content: string }> = [
|
||||
{ file: "pages/apps/Browse.tsx", content: "“{connection.name}”" },
|
||||
{ file: "pages/apps/Connections.tsx", content: ">{row.displayName}</span>" },
|
||||
{ file: "pages/apps/AppDetail.tsx", content: "<h1 className={cn(\"text-xl font-semibold\", ANALYTICS_MASK_CLASS)}>{appName}" },
|
||||
{ file: "pages/apps/AppDetail.tsx", content: "<h1 className={cn(\"truncate text-xl font-bold\", ANALYTICS_MASK_CLASS)}>{appName}" },
|
||||
{ file: "pages/apps/AppDetail.tsx", content: "<h1 className={cn(\"truncate text-2xl leading-8 font-semibold tracking-tight text-foreground\", ANALYTICS_MASK_CLASS)}>{appName}" },
|
||||
{ file: "components/AppConnectionSidebar.tsx", content: "{appName}</span>" },
|
||||
{ file: "features/connections/ConnectionChoiceList.tsx", content: ">{choice.name}</span>" },
|
||||
{ file: "features/connections/ConnectionIntentInteractionBody.tsx", content: "${accessRequest.connectionName}" },
|
||||
|
||||
+128
-84
@@ -12,7 +12,7 @@ import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } fro
|
||||
import { EmailConnectionAccess } from "@/components/EmailConnectionAccess";
|
||||
import { EmailConnectionInboxes } from "./chat/EmailEndpointSetup";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { Check, Loader2, Pencil } from "lucide-react";
|
||||
import { ArrowLeft, Check, Loader2, Pencil } from "lucide-react";
|
||||
import type {
|
||||
ToolConnection,
|
||||
ToolPolicy,
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
aiSubscriptionNeedsIsolatedLogin,
|
||||
isToolConnectionAttentionHealth as isAttentionHealthStatus,
|
||||
} from "@paperclipai/shared";
|
||||
import { Navigate, useParams, useNavigate, useSearchParams } from "@/lib/router";
|
||||
import { Link, Navigate, useParams, useNavigate, useSearchParams } from "@/lib/router";
|
||||
import { useCompany } from "@/context/CompanyContext";
|
||||
import { useBreadcrumbs } from "@/context/BreadcrumbContext";
|
||||
import { useToast } from "@/context/ToastContext";
|
||||
@@ -57,7 +57,7 @@ import {
|
||||
galleryEntryFor,
|
||||
type AppGalleryDisplayEntry,
|
||||
} from "./app-definition-display";
|
||||
import { appTabHref, appTabLabel, isAppTabKey, type AppTabKey } from "./app-tabs";
|
||||
import { APP_TABS, appTabHref, isAppTabKey, type AppTabKey } from "./app-tabs";
|
||||
import { ConnectionProvenanceChip } from "./ConnectionProvenanceChip";
|
||||
import { IdentitiesSection } from "./app-detail/IdentitiesSection";
|
||||
import { PermissionsPanel } from "./app-detail/PermissionsPanel";
|
||||
@@ -258,6 +258,8 @@ function StandardAppDetail({ renderActions, renderAgentSettings, renderConnectio
|
||||
const appName = connection
|
||||
? connectionDisplayNameForOwner(connection, baseAppName, owner)
|
||||
: "App";
|
||||
// A connection made from the catalog belongs to a plugin page; anything else goes back to the marketplace.
|
||||
const pluginHref = logoEntry ? `/apps/plugin/${encodeURIComponent(appDefinitionSlug(logoEntry))}` : null;
|
||||
const successNoticeShownFor = useRef<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -285,11 +287,11 @@ function StandardAppDetail({ renderActions, renderAgentSettings, renderConnectio
|
||||
if (!activeTab) return;
|
||||
setBreadcrumbs([
|
||||
{ label: "Plugins", href: "/apps" },
|
||||
{ label: appName, href: appTabHref(connectionId, "permissions") },
|
||||
{ label: appTabLabel(activeTab) },
|
||||
...(pluginHref ? [{ label: baseAppName, href: pluginHref }] : []),
|
||||
{ label: appName },
|
||||
]);
|
||||
return () => setBreadcrumbs([]);
|
||||
}, [setBreadcrumbs, appName, connectionId, activeTab]);
|
||||
}, [setBreadcrumbs, appName, baseAppName, pluginHref, activeTab]);
|
||||
|
||||
const { catalog, active, quarantined, readOnly, canChange } = useMemo(() => {
|
||||
const catalog = catalogQuery.data?.catalog ?? [];
|
||||
@@ -543,7 +545,7 @@ function StandardAppDetail({ renderActions, renderAgentSettings, renderConnectio
|
||||
}
|
||||
if (connectionQuery.isLoading || connectionView.kind === "reconnecting") {
|
||||
return (
|
||||
<div className="max-w-3xl space-y-4">
|
||||
<div className="mx-auto w-full max-w-3xl space-y-4">
|
||||
<Skeleton className="h-10 w-56" />
|
||||
<Skeleton className="h-48 w-full" />
|
||||
<Skeleton className="h-40 w-full" />
|
||||
@@ -591,9 +593,11 @@ function StandardAppDetail({ renderActions, renderAgentSettings, renderConnectio
|
||||
const permissionsFailure = permissionsViews.find((view) => view.kind === "error");
|
||||
|
||||
return (
|
||||
<div className="max-w-4xl space-y-10 pb-12">
|
||||
<div className="mx-auto flex w-full max-w-3xl flex-col gap-8 pb-12">
|
||||
{authorization.fallback}
|
||||
{workspaceGate.dialog}
|
||||
<div className="flex flex-col gap-4">
|
||||
<ConnectionBackLink label={pluginHref ? baseAppName : "Plugins"} href={pluginHref ?? "/apps"} />
|
||||
<AppDetailHeader
|
||||
appName={appName}
|
||||
connection={connection}
|
||||
@@ -616,7 +620,9 @@ function StandardAppDetail({ renderActions, renderAgentSettings, renderConnectio
|
||||
else setRenaming(false);
|
||||
}}
|
||||
/>
|
||||
<div className={cn("space-y-10", ANALYTICS_MASK_CLASS)}>
|
||||
<ConnectionTabs connectionId={connectionId} active={activeTab} />
|
||||
</div>
|
||||
<div className={cn("flex flex-col gap-8", ANALYTICS_MASK_CLASS)}>
|
||||
|
||||
{status.tone === "attention" && connection.requiresReauthorization === false && (
|
||||
<AccessRetryBanner
|
||||
@@ -668,7 +674,7 @@ function StandardAppDetail({ renderActions, renderAgentSettings, renderConnectio
|
||||
}} />
|
||||
: permissionsLoading
|
||||
? <ToolsLoading />
|
||||
: <div className="space-y-10">
|
||||
: <div className="flex flex-col gap-8">
|
||||
{isAppAggregator(brandKey) && grantsQuery.data?.capabilities.canConfigure === true
|
||||
? <ConnectedAggregatorApps key={connection.id} connection={connection} /> : null}
|
||||
{connection.config?.sourceTemplateKey === "honcho" && <HonchoWorkspaceSettings key={connection.id} connection={connection} canConfigure={grantsQuery.data?.capabilities?.canConfigure ?? false} />}
|
||||
@@ -708,10 +714,10 @@ function StandardAppDetail({ renderActions, renderAgentSettings, renderConnectio
|
||||
onReplaceAudience={(grant, memberUserIds) =>
|
||||
replaceAudience.mutate({ grantId: grant.id, memberUserIds })}
|
||||
/>
|
||||
{connection.config?.sourceTemplateKey === "composio" ? <p className="text-sm text-muted-foreground">
|
||||
{connection.config?.sourceTemplateKey === "composio" ? <p className="px-4 text-sm text-muted-foreground">
|
||||
These permissions apply to all apps available through this Composio connection. Manage app accounts and sign-in in Composio.
|
||||
</p> : null}
|
||||
{connection.config?.sourceTemplateKey !== "composio" && isRemoteMcpConnectorMethod(connection.config?.sourceTemplateKey, connection.config?.connectionMethodKey) && <p className="text-sm text-muted-foreground">Paperclip controls access to the tools listed here. App and action permissions inside these tools are managed in {baseAppName}.</p>}
|
||||
{connection.config?.sourceTemplateKey !== "composio" && isRemoteMcpConnectorMethod(connection.config?.sourceTemplateKey, connection.config?.connectionMethodKey) && <p className="px-4 text-sm text-muted-foreground">Paperclip controls access to the tools listed here. App and action permissions inside these tools are managed in {baseAppName}.</p>}
|
||||
<PermissionsPanel
|
||||
afterAgentAccess={<>{instructionsTemplate && <ConnectionInstructionsSettings key={connection.id} connection={connection} provider={instructionsTemplate.provider} template={instructionsTemplate.template} canConfigure={grantsQuery.data?.capabilities?.canConfigure ?? false} />}{renderAgentSettings?.(connection)}</>}
|
||||
actions={actionsContent}
|
||||
@@ -759,7 +765,7 @@ function StandardAppDetail({ renderActions, renderAgentSettings, renderConnectio
|
||||
onDisconnect={() => disconnectRemote.mutateAsync()}
|
||||
/>}
|
||||
{grantsQuery.data?.capabilities.canConfigure === true && connection.connectionPurpose === "tool" && (
|
||||
<section className="border-t border-border">
|
||||
<section className="rounded-2xl bg-muted/50 px-4">
|
||||
<StoredContentDeletionRow connectionId={connectionId} appName={appName} />
|
||||
</section>
|
||||
)}
|
||||
@@ -805,76 +811,119 @@ export function AppDetailHeader({
|
||||
onRenameSubmit: (value: string) => void;
|
||||
}) {
|
||||
const unverifiedHost = unverifiedRemoteHost(connection);
|
||||
const hint = connectionDisplaySecondaryHint(connection);
|
||||
return (
|
||||
<header>
|
||||
<div className="flex items-center gap-3">
|
||||
<AppLogo
|
||||
name={appName}
|
||||
brandKey={brandKey}
|
||||
logoUrl={appDefinitionLogoUrl(logoEntry)}
|
||||
darkLogoUrl={appDefinitionDarkLogoUrl(logoEntry)}
|
||||
allowRemoteFallback={allowRemoteLogo}
|
||||
size={44}
|
||||
/>
|
||||
<div className="min-w-0">
|
||||
{renaming ? (
|
||||
<form
|
||||
className="flex items-center gap-2"
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
onRenameSubmit(nameDraft.trim());
|
||||
}}
|
||||
<header className="flex flex-wrap items-center gap-4">
|
||||
<AppLogo
|
||||
name={appName}
|
||||
brandKey={brandKey}
|
||||
logoUrl={appDefinitionLogoUrl(logoEntry)}
|
||||
darkLogoUrl={appDefinitionDarkLogoUrl(logoEntry)}
|
||||
allowRemoteFallback={allowRemoteLogo}
|
||||
size={64}
|
||||
className="rounded-2xl"
|
||||
/>
|
||||
<div className="flex min-w-0 flex-1 flex-col gap-1">
|
||||
{renaming ? (
|
||||
<form
|
||||
className="flex items-center gap-2"
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
onRenameSubmit(nameDraft.trim());
|
||||
}}
|
||||
>
|
||||
<Input
|
||||
aria-label="App name"
|
||||
value={nameDraft}
|
||||
onChange={(event) => onNameDraftChange(event.target.value)}
|
||||
className="h-9 w-64 text-lg font-semibold"
|
||||
autoFocus
|
||||
/>
|
||||
<Button type="submit" size="sm" disabled={renamePending || !nameDraft.trim()}>
|
||||
{renamePending ? <Loader2 className="size-3.5 animate-spin" /> : "Save"}
|
||||
</Button>
|
||||
<Button type="button" size="sm" variant="ghost" onClick={onRenameCancel} disabled={renamePending}>
|
||||
Cancel
|
||||
</Button>
|
||||
</form>
|
||||
) : (
|
||||
<div className="flex min-w-0 items-center gap-1.5">
|
||||
<h1 className={cn("truncate text-2xl leading-8 font-semibold tracking-tight text-foreground", ANALYTICS_MASK_CLASS)}>{appName}</h1>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
className="shrink-0 text-muted-foreground"
|
||||
aria-label="Rename app"
|
||||
disabled={!canRename}
|
||||
onClick={onRenameStart}
|
||||
>
|
||||
<Input
|
||||
aria-label="App name"
|
||||
value={nameDraft}
|
||||
onChange={(event) => onNameDraftChange(event.target.value)}
|
||||
className="h-9 w-64 text-lg font-bold"
|
||||
autoFocus
|
||||
/>
|
||||
<Button type="submit" size="sm" disabled={renamePending || !nameDraft.trim()}>
|
||||
{renamePending ? <Loader2 className="h-3.5 w-3.5 animate-spin" /> : "Save"}
|
||||
</Button>
|
||||
<Button type="button" size="sm" variant="ghost" onClick={onRenameCancel} disabled={renamePending}>
|
||||
Cancel
|
||||
</Button>
|
||||
</form>
|
||||
) : (
|
||||
<div className="flex items-center gap-1.5">
|
||||
<h1 className={cn("truncate text-xl font-bold", ANALYTICS_MASK_CLASS)}>{appName}</h1>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-7 w-7 text-muted-foreground"
|
||||
aria-label="Rename app"
|
||||
disabled={!canRename}
|
||||
onClick={onRenameStart}
|
||||
>
|
||||
<Pencil className="h-3.5 w-3.5" />
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
<div className="mt-2 flex flex-wrap items-center gap-2">
|
||||
<StatusBadge status={status} />
|
||||
{connection.config?.provider !== "agentmail" && actionCount !== null && (
|
||||
<span className="text-xs text-muted-foreground">
|
||||
{actionCount} {actionCount === 1 ? "action" : "actions"} available
|
||||
</span>
|
||||
)}
|
||||
{connectionDisplaySecondaryHint(connection) ? (
|
||||
<span className="text-xs text-muted-foreground">
|
||||
{connectionDisplaySecondaryHint(connection)}
|
||||
</span>
|
||||
) : null}
|
||||
{unverifiedHost ? <UnverifiedServerBadge host={unverifiedHost} /> : null}
|
||||
<ConnectionProvenanceChip connection={connection} />
|
||||
<Pencil aria-hidden />
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
<div className="flex flex-wrap items-center gap-x-3 gap-y-1 text-sm text-muted-foreground">
|
||||
<StatusBadge status={status} />
|
||||
{connection.config?.provider !== "agentmail" && actionCount !== null && (
|
||||
<span className="tabular-nums">
|
||||
{actionCount} {actionCount === 1 ? "action" : "actions"} available
|
||||
</span>
|
||||
)}
|
||||
{hint ? <span>{hint}</span> : null}
|
||||
{unverifiedHost ? <UnverifiedServerBadge host={unverifiedHost} /> : null}
|
||||
<ConnectionProvenanceChip connection={connection} />
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
|
||||
/** Returns from a connection to the plugin it belongs to, or to the marketplace when it has none. */
|
||||
export function ConnectionBackLink({ label, href }: { label: string; href: string }) {
|
||||
return (
|
||||
<Button asChild variant="ghost" size="sm" className="-ml-3 h-8 self-start text-muted-foreground">
|
||||
<Link to={href} aria-label={`Back to ${label}`}>
|
||||
<ArrowLeft aria-hidden />
|
||||
{label}
|
||||
</Link>
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
/** Permissions and Review for one connection, with how many requests and new actions are waiting. */
|
||||
function ConnectionTabs({ connectionId, active }: { connectionId: string; active: AppTabKey }) {
|
||||
const { selectedCompanyId } = useCompany();
|
||||
const counts = useQuery({
|
||||
queryKey: queryKeys.apps.connectionReviewCounts(selectedCompanyId ?? "__none__", connectionId),
|
||||
queryFn: () => toolsApi.getConnectionReviewCounts(connectionId),
|
||||
enabled: !!selectedCompanyId && !!connectionId,
|
||||
refetchInterval: 30_000,
|
||||
});
|
||||
const waiting = (counts.data?.pendingActionRequestCount ?? 0) + ((counts.data?.quarantinedCatalogEntryCount ?? 0) > 0 ? 1 : 0);
|
||||
return (
|
||||
<nav aria-label="Connection sections" className="flex items-center gap-1">
|
||||
{APP_TABS.map((tab) => (
|
||||
<Link
|
||||
key={tab.key}
|
||||
to={appTabHref(connectionId, tab.key)}
|
||||
aria-current={tab.key === active ? "page" : undefined}
|
||||
className={cn(
|
||||
"inline-flex h-8 items-center gap-2 rounded-lg px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
||||
tab.key === active ? "bg-muted font-medium text-foreground" : "text-muted-foreground hover:text-foreground",
|
||||
)}
|
||||
>
|
||||
{tab.label}
|
||||
{tab.key === "review" && waiting > 0 ? (
|
||||
<span className="inline-flex h-5 items-center rounded-md bg-(--status-task-todo)/15 px-1.5 text-xs font-normal text-(--status-task-icon-todo) tabular-nums">
|
||||
{waiting}
|
||||
<span className="sr-only"> needing review</span>
|
||||
</span>
|
||||
) : null}
|
||||
</Link>
|
||||
))}
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
|
||||
function ToolsLoading({ mcpActions = false }: { mcpActions?: boolean }) {
|
||||
return (
|
||||
<div className="flex items-center gap-2 py-8 text-sm text-muted-foreground" role="status">
|
||||
@@ -921,18 +970,13 @@ function statusFor(connection: ToolConnection): StatusInfo {
|
||||
|
||||
function StatusBadge({ status }: { status: StatusInfo }) {
|
||||
const klass: Record<StatusInfo["tone"], string> = {
|
||||
connected: "border-emerald-500/40 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",
|
||||
attention: "border-amber-500/40 bg-amber-500/10 text-amber-700 dark:text-amber-300",
|
||||
paused: "border-border bg-muted text-muted-foreground",
|
||||
connected: "bg-(--status-task-done)/15 text-(--status-task-icon-done)",
|
||||
attention: "bg-(--status-task-todo)/15 text-(--status-task-icon-todo)",
|
||||
paused: "bg-muted text-muted-foreground",
|
||||
};
|
||||
return (
|
||||
<span
|
||||
className={cn(
|
||||
"inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium",
|
||||
klass[status.tone],
|
||||
)}
|
||||
>
|
||||
{status.tone === "connected" && <Check className="h-3 w-3" />}
|
||||
<span className={cn("inline-flex h-6 items-center gap-1 rounded-md px-2 text-xs", klass[status.tone])}>
|
||||
{status.tone === "connected" && <Check className="size-3" aria-hidden />}
|
||||
{status.label}
|
||||
</span>
|
||||
);
|
||||
|
||||
@@ -1731,7 +1731,12 @@ function ConnectionAccountRow({
|
||||
: "Reconnect"
|
||||
: "Finish setup"}
|
||||
</Button>
|
||||
) : null}
|
||||
) : state.kind === "draft" ? null : (
|
||||
<Button type="button" size="sm" variant="ghost" className="text-muted-foreground" aria-label={`${accountName} settings`} onClick={() => onNavigate(`/apps/${connection.id}/permissions`)}>
|
||||
Settings
|
||||
<ChevronRight aria-hidden />
|
||||
</Button>
|
||||
)}
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button
|
||||
|
||||
@@ -61,16 +61,16 @@ export function AgentConnectionAccess({ connectionId, profiles, policies, catalo
|
||||
}
|
||||
}
|
||||
|
||||
return <section className="space-y-4 border-t border-border pt-8">
|
||||
<div className="space-y-2">
|
||||
<h2 className="text-sm font-semibold">Additional agent access</h2>
|
||||
<p className="text-sm text-muted-foreground">These agents can use the listed actions in addition to the permissions above. Removing a grant restores their other permissions.</p>
|
||||
return <section className="flex flex-col gap-3">
|
||||
<div className="flex flex-col gap-1 px-4">
|
||||
<h2 className="text-sm text-muted-foreground">Additional agent access</h2>
|
||||
<p className="text-xs text-muted-foreground">These agents can use the listed actions in addition to the permissions above. Removing a grant restores their other permissions.</p>
|
||||
</div>
|
||||
{grants.map(profile => {
|
||||
const agentId = profile.metadata!.agentId as string;
|
||||
const agent = agentsById.get(agentId);
|
||||
const tools = toolsByProfileId.get(profile.id) ?? [];
|
||||
return <div key={profile.id} className="space-y-3 rounded-lg border border-border p-4">
|
||||
return <div key={profile.id} className="space-y-3 rounded-2xl bg-muted/50 p-4">
|
||||
<div className="flex items-center justify-between gap-4">
|
||||
<div className="flex items-center gap-3">
|
||||
<AgentAvatar agent={agent ?? { id: agentId, name: "Agent" }} size={32} />
|
||||
@@ -91,6 +91,6 @@ export function AgentConnectionAccess({ connectionId, profiles, policies, catalo
|
||||
</ul>
|
||||
</div>;
|
||||
})}
|
||||
{error && <p role="alert" className="text-sm text-destructive">{error}</p>}
|
||||
{error && <p role="alert" className="px-4 text-sm text-destructive">{error}</p>}
|
||||
</section>;
|
||||
}
|
||||
@@ -32,7 +32,7 @@ import {
|
||||
AlertDialogTitle,
|
||||
} from "@/components/ui/alert-dialog";
|
||||
import { Link } from "@/lib/router";
|
||||
import { brandBanner, brandChipBadge } from "@/lib/status-colors";
|
||||
import { brandChipBadge } from "@/lib/status-colors";
|
||||
import { agentUrl, cn } from "@/lib/utils";
|
||||
import {
|
||||
audienceUserIds,
|
||||
@@ -46,6 +46,9 @@ import {
|
||||
} from "../connection-identity";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
/** Section labels on the connection page match the plugin page: a quiet line over one grouped surface. */
|
||||
const GROUP_LABEL = "px-4 text-sm text-muted-foreground";
|
||||
|
||||
const STATUS_CHIP: Record<GrantStatusTone, string> = {
|
||||
connected: brandChipBadge.green,
|
||||
attention: brandChipBadge.amber,
|
||||
@@ -155,16 +158,16 @@ export function IdentitiesSection({
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<section className="space-y-5" aria-busy="true">
|
||||
<section className="flex flex-col gap-3" aria-busy="true">
|
||||
<IdentitiesHeading />
|
||||
<Skeleton className="h-14 w-full" />
|
||||
<Skeleton className="h-14 w-full rounded-2xl" />
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<section className="space-y-5">
|
||||
<section className="flex flex-col gap-3">
|
||||
<IdentitiesHeading />
|
||||
<InlineBanner tone="warning" compact>
|
||||
We couldn't load who this connection acts as. Reload the page to try again.
|
||||
@@ -176,9 +179,9 @@ export function IdentitiesSection({
|
||||
if (credentialPolicy === "per_agent") {
|
||||
const github = agentGrant?.providerTenant?.github;
|
||||
return (
|
||||
<section className="space-y-5">
|
||||
<h2 className="text-sm font-semibold text-foreground">GitHub identity</h2>
|
||||
<p className="text-sm text-muted-foreground">This agent uses this GitHub account for everyone’s work, instead of the person giving instructions.</p>
|
||||
<section className="flex flex-col gap-3">
|
||||
<h2 className={GROUP_LABEL}>GitHub identity</h2>
|
||||
<p className="px-4 text-sm text-muted-foreground">This agent uses this GitHub account for everyone’s work, instead of the person giving instructions.</p>
|
||||
<IdentityRow
|
||||
title={github ? <span className={ANALYTICS_MASK_CLASS}>@{github.login}</span> : "Dedicated GitHub account"}
|
||||
status={agentGrant?.status ?? null}
|
||||
@@ -203,7 +206,7 @@ export function IdentitiesSection({
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="space-y-5">
|
||||
<section className="flex flex-col gap-3">
|
||||
<IdentitiesHeading />
|
||||
|
||||
<HumanAccessCards
|
||||
@@ -248,7 +251,7 @@ export function IdentitiesSection({
|
||||
) : (
|
||||
orgGrant ? (
|
||||
orgGrant.capabilities?.canEditAudience ? (
|
||||
<div className="flex justify-end">
|
||||
<div className="flex justify-end px-4">
|
||||
<Button size="sm" variant="outline" onClick={() => onOpenAudience(orgGrant.id)}>
|
||||
Manage access
|
||||
</Button>
|
||||
@@ -310,24 +313,21 @@ function GitHubConnectionSummary({
|
||||
? "No repositories selected"
|
||||
: `${github.repositoryCount} selected ${github.repositoryCount === 1 ? "repository" : "repositories"}`;
|
||||
return (
|
||||
<div className="divide-y divide-border border-y border-border">
|
||||
<div className="py-3">
|
||||
<div className="text-sm font-medium text-foreground">GitHub account</div>
|
||||
<a className={cn("text-sm text-muted-foreground hover:underline", ANALYTICS_MASK_CLASS)} href={`https://github.com/${encodeURIComponent(github.login)}`} target="_blank" rel="noreferrer">
|
||||
<div className="divide-y divide-border overflow-hidden rounded-2xl bg-muted/50">
|
||||
<div className="flex min-h-11 items-center justify-between gap-4 px-4 py-2">
|
||||
<div className="text-sm text-muted-foreground">GitHub account</div>
|
||||
<a className={cn("truncate text-sm text-foreground hover:underline", ANALYTICS_MASK_CLASS)} href={`https://github.com/${encodeURIComponent(github.login)}`} target="_blank" rel="noreferrer">
|
||||
@{github.login}
|
||||
</a>
|
||||
</div>
|
||||
<div className="space-y-3 py-3">
|
||||
<div className="space-y-3 px-4 py-3">
|
||||
<div className="flex flex-wrap items-center justify-between gap-3">
|
||||
<div className="min-w-0">
|
||||
<div className="text-sm font-medium text-foreground">Repositories</div>
|
||||
{repositoryWarning ? (
|
||||
<div
|
||||
role="note"
|
||||
className={cn(
|
||||
"mt-1 inline-flex items-center gap-1.5 rounded-md border px-2 py-1 text-xs",
|
||||
brandBanner.warning,
|
||||
)}
|
||||
className="mt-1 inline-flex h-6 items-center gap-1.5 rounded-md bg-(--status-task-todo)/15 px-2 text-xs text-(--status-task-icon-todo)"
|
||||
>
|
||||
<TriangleAlert className="h-3.5 w-3.5 shrink-0" aria-hidden="true" />
|
||||
{repositoryWarning}
|
||||
@@ -338,7 +338,7 @@ function GitHubConnectionSummary({
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
{onRefreshAccess && configurationUrl ? (
|
||||
<Button size="icon-sm" variant="outline" aria-label="Refresh access" title="Refresh access" disabled={refreshPending} onClick={onRefreshAccess}>
|
||||
<Button size="icon-sm" variant="ghost" aria-label="Refresh access" title="Refresh access" disabled={refreshPending} onClick={onRefreshAccess}>
|
||||
{refreshPending ? <Loader2 className="animate-spin" aria-hidden="true" /> : <RefreshCw aria-hidden="true" />}
|
||||
</Button>
|
||||
) : null}
|
||||
@@ -380,7 +380,7 @@ function GitHubConnectionSummary({
|
||||
}
|
||||
|
||||
function IdentitiesHeading() {
|
||||
return <h2 className="text-sm font-semibold text-foreground">Which humans can use this credential?</h2>;
|
||||
return <h2 className={GROUP_LABEL}>Which humans can use this credential?</h2>;
|
||||
}
|
||||
|
||||
function HumanAccessCards({
|
||||
@@ -407,7 +407,7 @@ function HumanAccessCards({
|
||||
<RadioCardGroup
|
||||
ariaLabel="Which humans can use this credential"
|
||||
value={personal ? "personal" : restricted ? "selected" : "company"}
|
||||
className="sm:grid-cols-2"
|
||||
className="*:rounded-2xl sm:grid-cols-2"
|
||||
onValueChange={(next) => {
|
||||
if (!canEditAudience || personal) return;
|
||||
if (next === "company") onChooseAll();
|
||||
@@ -438,7 +438,7 @@ function HumanAccessCards({
|
||||
]}
|
||||
/>
|
||||
{connectedName && status !== null ? (
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<div className="flex flex-wrap items-center gap-2 px-4">
|
||||
<Identity name={connectedName} avatarUrl={connectedImage} className={ANALYTICS_MASK_CLASS} />
|
||||
{status === "active" ? null : <StatusText status={status} />}
|
||||
</div>
|
||||
@@ -461,7 +461,7 @@ function IdentityRow({
|
||||
actions: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<div id={id} className="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between sm:gap-8">
|
||||
<div id={id} className="flex flex-col gap-4 rounded-2xl bg-muted/50 px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:gap-8">
|
||||
<div className="min-w-0">
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<span className="text-sm font-semibold text-foreground">{title}</span>
|
||||
|
||||
@@ -24,6 +24,8 @@ function NoIcon() {
|
||||
import type { AccessDraft, AppDetailSectionProps } from "./types";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
const NOTE = "rounded-2xl bg-muted/50 px-4 py-3 text-sm text-muted-foreground";
|
||||
|
||||
type ActionPermission = "off" | "ask" | "allowed";
|
||||
type ActionKindFilter = "all" | "read" | "write";
|
||||
|
||||
@@ -76,7 +78,7 @@ export function PermissionsPanel({
|
||||
}) {
|
||||
const [searchParams] = useSearchParams();
|
||||
return (
|
||||
<div className="space-y-10">
|
||||
<div className="flex flex-col gap-8">
|
||||
<AgentAccessSection
|
||||
agents={agents}
|
||||
access={access}
|
||||
@@ -135,9 +137,9 @@ function AgentAccessSection({
|
||||
const requiredAgentIds = install.agentIds;
|
||||
|
||||
return (
|
||||
<section className="space-y-4 border-t border-border pt-8">
|
||||
<div className="flex flex-wrap items-center justify-between gap-3">
|
||||
<h2 className="text-sm font-semibold text-foreground">Which agents can use this connection?</h2>
|
||||
<section className="flex flex-col gap-3">
|
||||
<div className="flex flex-wrap items-center justify-between gap-3 px-4">
|
||||
<h2 className="text-sm text-muted-foreground">Which agents can use this connection?</h2>
|
||||
{disabled ? <span className="text-xs text-muted-foreground">Saving…</span> : null}
|
||||
</div>
|
||||
|
||||
@@ -147,7 +149,7 @@ function AgentAccessSection({
|
||||
ariaLabel="Which agents can use this connection"
|
||||
value={access.mode}
|
||||
disabled={disabled}
|
||||
className="sm:grid-cols-2"
|
||||
className="*:rounded-2xl sm:grid-cols-2"
|
||||
onValueChange={(next) => {
|
||||
if (next === "all") onSave({ mode: "all", agentIds: new Set() });
|
||||
else onSave({
|
||||
@@ -191,13 +193,13 @@ function AgentAccessSection({
|
||||
) : null}
|
||||
</div>
|
||||
) : access.mode === "all" ? (
|
||||
<p className="text-sm text-muted-foreground">Any agent can use this connection.</p>
|
||||
<p className={NOTE}>Any agent can use this connection.</p>
|
||||
) : selectedAgents.length === 0 ? (
|
||||
<p className="text-sm text-muted-foreground">No agents can use this connection.</p>
|
||||
<p className={NOTE}>No agents can use this connection.</p>
|
||||
) : (
|
||||
<div className="space-y-0.5">
|
||||
<div className="flex flex-col divide-y divide-border overflow-hidden rounded-2xl bg-muted/50">
|
||||
{selectedAgents.map((agent) => (
|
||||
<div key={agent.id} className="flex items-center gap-2 px-1.5 py-1 text-sm">
|
||||
<div key={agent.id} className="flex min-h-11 items-center gap-2 px-4 py-2 text-sm">
|
||||
<AgentAvatar agent={agent} size={16} className="h-4 w-4 shrink-0 text-muted-foreground"/>
|
||||
<span className="min-w-0 flex-1 truncate text-foreground">{agent.name}</span>
|
||||
</div>
|
||||
@@ -257,23 +259,20 @@ export function ActionsSection({
|
||||
|
||||
return (
|
||||
<TooltipProvider>
|
||||
<section className="space-y-6 border-t border-border pt-8">
|
||||
<div className="flex flex-wrap items-center justify-between gap-2">
|
||||
<h2 className="text-lg font-semibold text-foreground">Actions</h2>
|
||||
<section className="flex flex-col gap-3">
|
||||
<div className="flex min-h-8 flex-wrap items-center justify-between gap-2 px-4">
|
||||
<h2 className="text-sm text-muted-foreground">Actions</h2>
|
||||
{canConfigure ? (
|
||||
<div className="flex items-center gap-2">
|
||||
{disabled ? <span className="text-xs text-muted-foreground">Saving…</span> : null}
|
||||
<Button
|
||||
variant="outline"
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="-mr-2 h-8 text-muted-foreground"
|
||||
onClick={onRefreshActions}
|
||||
disabled={refreshPending || disabled}
|
||||
>
|
||||
{refreshPending ? (
|
||||
<Loader2 className="mr-1.5 h-3.5 w-3.5 animate-spin" />
|
||||
) : (
|
||||
<RefreshCw className="mr-1.5 h-3.5 w-3.5" />
|
||||
)}
|
||||
{refreshPending ? <Loader2 className="animate-spin" aria-hidden /> : <RefreshCw aria-hidden />}
|
||||
Refresh actions
|
||||
</Button>
|
||||
</div>
|
||||
@@ -310,18 +309,19 @@ export function ActionsSection({
|
||||
<FilterChip label={`Read ${readOnly.length}`} active={kindFilter === "read"} onClick={() => setKindFilter("read")} />
|
||||
<FilterChip label={`Write ${canChange.length}`} active={kindFilter === "write"} onClick={() => setKindFilter("write")} />
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">{visibleCount} matches · sorted A–Z</p>
|
||||
<p className="px-4 text-xs text-muted-foreground tabular-nums">{visibleCount} {visibleCount === 1 ? "match" : "matches"}, sorted A–Z</p>
|
||||
</div>
|
||||
|
||||
{visibleCount === 0 ? (
|
||||
<div className="py-6 text-center text-sm text-muted-foreground">
|
||||
<div className={NOTE}>
|
||||
No actions match “{query}”. Clear the search to see them all.
|
||||
</div>
|
||||
) : (
|
||||
<div className="space-y-6">
|
||||
<div className="flex flex-col gap-2">
|
||||
<ActionGroup
|
||||
key={`read:${needle}:${kindFilter}`}
|
||||
kind="read"
|
||||
label="Read"
|
||||
title={`Read (${visibleRead.length})`}
|
||||
actions={visibleRead}
|
||||
connectionId={connectionId}
|
||||
@@ -336,6 +336,7 @@ export function ActionsSection({
|
||||
<ActionGroup
|
||||
key={`write:${needle}:${kindFilter}`}
|
||||
kind="write"
|
||||
label="Write"
|
||||
title={`Write (${visibleWrite.length})`}
|
||||
actions={visibleWrite}
|
||||
connectionId={connectionId}
|
||||
@@ -361,10 +362,8 @@ function FilterChip({ label, active, onClick }: { label: string; active: boolean
|
||||
onClick={onClick}
|
||||
aria-pressed={active}
|
||||
className={cn(
|
||||
"rounded-full border px-3 py-1 text-xs font-medium transition-colors",
|
||||
active
|
||||
? "border-primary bg-primary/10 text-primary"
|
||||
: "border-border text-muted-foreground hover:bg-accent",
|
||||
"inline-flex h-9 items-center rounded-lg px-3 text-sm tabular-nums outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
||||
active ? "bg-muted font-medium text-foreground" : "text-muted-foreground hover:text-foreground",
|
||||
)}
|
||||
>
|
||||
{label}
|
||||
@@ -384,6 +383,7 @@ function matchesAction(entry: ToolCatalogEntry, needle: string) {
|
||||
|
||||
function ActionGroup({
|
||||
kind,
|
||||
label,
|
||||
title,
|
||||
actions,
|
||||
connectionId,
|
||||
@@ -396,6 +396,8 @@ function ActionGroup({
|
||||
onSetPermission,
|
||||
}: {
|
||||
kind: "read" | "write";
|
||||
/** The visible name; `title` keeps the count in the name assistive tech and tests read. */
|
||||
label: string;
|
||||
title: string;
|
||||
actions: ToolCatalogEntry[];
|
||||
connectionId: string;
|
||||
@@ -419,9 +421,12 @@ function ActionGroup({
|
||||
: "";
|
||||
})();
|
||||
return (
|
||||
<div>
|
||||
<div className="mb-1.5 flex flex-wrap items-center justify-between gap-2">
|
||||
<h3 className="text-xs font-semibold uppercase tracking-wide text-muted-foreground">{title}</h3>
|
||||
<div className="overflow-hidden rounded-2xl bg-muted/50">
|
||||
<div className="flex min-h-12 flex-wrap items-center justify-between gap-2 px-4">
|
||||
<h3 aria-label={title} className="flex items-baseline gap-2 text-sm font-semibold text-foreground">
|
||||
{label}
|
||||
<span className="font-normal text-muted-foreground tabular-nums">{actions.length}</span>
|
||||
</h3>
|
||||
{canConfigure ? (
|
||||
// PAP-659 C6b: set the whole group at once, so narrowing a fresh
|
||||
// connection's writes is one choice rather than one per action;
|
||||
@@ -438,7 +443,7 @@ function ActionGroup({
|
||||
// the last call overwrite the others.
|
||||
onSetPermission(actions.map((action) => action.id), event.target.value as ActionPermission);
|
||||
}}
|
||||
className="h-7 rounded-md border border-input bg-background px-2 text-xs text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30"
|
||||
className="h-8 rounded-lg bg-transparent px-2 text-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring"
|
||||
>
|
||||
{groupValue === "" ? <option value="">Mixed</option> : null}
|
||||
{PERMISSION_OPTIONS.map((option) => (
|
||||
@@ -448,7 +453,7 @@ function ActionGroup({
|
||||
</label>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="divide-y divide-border">
|
||||
<div className="divide-y divide-border border-t border-border">
|
||||
{visibleActions.map((action) => (
|
||||
<ActionRow
|
||||
key={action.id}
|
||||
@@ -464,9 +469,11 @@ function ActionGroup({
|
||||
))}
|
||||
</div>
|
||||
{visibleLimit < actions.length ? (
|
||||
<Button type="button" variant="outline" size="sm" className="mt-3" onClick={() => setVisibleLimit(limit => limit + ACTION_PAGE_SIZE)}>
|
||||
Show more {kind} actions
|
||||
</Button>
|
||||
<div className="border-t border-border px-2 py-2">
|
||||
<Button type="button" variant="ghost" size="sm" className="text-muted-foreground" onClick={() => setVisibleLimit(limit => limit + ACTION_PAGE_SIZE)}>
|
||||
Show more {kind} actions
|
||||
</Button>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
@@ -515,8 +522,8 @@ const ActionRow = memo(function ActionRow({
|
||||
<div
|
||||
ref={rowRef}
|
||||
className={cn(
|
||||
"flex flex-col gap-3 py-3 sm:flex-row sm:items-center",
|
||||
focused && "rounded-md bg-primary/5 ring-2 ring-primary/40",
|
||||
"flex flex-col gap-3 px-4 py-3 sm:flex-row sm:items-center",
|
||||
focused && "bg-primary/5 ring-2 ring-primary/40 ring-inset",
|
||||
)}
|
||||
data-action-id={action.id}
|
||||
>
|
||||
@@ -530,7 +537,7 @@ const ActionRow = memo(function ActionRow({
|
||||
what each action was classified as. A misfiled tool is then one
|
||||
glance to spot and one click to move. */}
|
||||
<span
|
||||
className="rounded-full border border-border px-1.5 py-px text-xs font-medium uppercase tracking-wide text-muted-foreground"
|
||||
className="rounded-md bg-foreground/5 px-1.5 py-px text-xs text-muted-foreground"
|
||||
title={`Paperclip classified this action as ${action.riskLevel}`}
|
||||
>
|
||||
{action.riskLevel}
|
||||
@@ -545,7 +552,7 @@ const ActionRow = memo(function ActionRow({
|
||||
<div
|
||||
role="radiogroup"
|
||||
aria-label={`${title} permission`}
|
||||
className="inline-flex rounded-md border border-border bg-muted/40 p-0.5"
|
||||
className="inline-flex rounded-lg bg-foreground/5 p-0.5"
|
||||
>
|
||||
{PERMISSION_OPTIONS.map((option) => {
|
||||
const Icon = option.icon;
|
||||
@@ -561,7 +568,7 @@ const ActionRow = memo(function ActionRow({
|
||||
disabled={disabled}
|
||||
onClick={() => onSetPermission([action.id], option.value)}
|
||||
className={cn(
|
||||
"flex h-8 w-8 items-center justify-center rounded-sm text-muted-foreground outline-none transition-colors",
|
||||
"flex size-8 items-center justify-center rounded-md text-muted-foreground outline-none transition-colors",
|
||||
"hover:bg-background hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",
|
||||
"disabled:cursor-not-allowed disabled:opacity-50",
|
||||
selected && "bg-background text-foreground shadow-xs",
|
||||
@@ -582,8 +589,8 @@ const ActionRow = memo(function ActionRow({
|
||||
{PERMISSION_OPTIONS.find((option) => option.value === value)?.label}
|
||||
</span>
|
||||
)}
|
||||
<Button type="button" size="sm" variant="outline" onClick={() => setTestOpen(true)}>
|
||||
<FlaskConical className="mr-1.5 h-3.5 w-3.5" />
|
||||
<Button type="button" size="sm" variant="ghost" className="text-muted-foreground" onClick={() => setTestOpen(true)}>
|
||||
<FlaskConical aria-hidden />
|
||||
Test
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user