Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

feat(web): build every admin page from shared admin building blocks (#16198)

moaazad62dd01c098
diff --git a/packages/web/public/locales/en/translation.json b/packages/web/public/locales/en/translation.json
index cc9ca9036c3..dd20ed82664 100644
--- a/packages/web/public/locales/en/translation.json
+++ b/packages/web/public/locales/en/translation.json
@@ -3218,5 +3218,57 @@
"1 min ago": "1 min ago",
"{count} mins ago": "{count} mins ago",
"1 hour ago": "1 hour ago",
- "{count} hours ago": "{count} hours ago"
+ "{count} hours ago": "{count} hours ago",
+ "Docs": "Docs",
+ "Branding": "Branding",
+ "Open in a new tab": "Open in a new tab",
+ "Projects guide": "Projects guide",
+ "Users guide": "Users guide",
+ "Users and roles guide": "Users and roles guide",
+ "Connections guide": "Connections guide",
+ "Global connections guide": "Global connections guide",
+ "AI providers guide": "AI providers guide",
+ "AI capabilities guide": "AI capabilities guide",
+ "Pieces guide": "Pieces guide",
+ "Templates guide": "Templates guide",
+ "General settings guide": "General settings guide",
+ "Usage guide": "Usage guide",
+ "API reference": "API reference",
+ "Secret managers guide": "Secret managers guide",
+ "Audit logs guide": "Audit logs guide",
+ "Event streaming guide": "Event streaming guide",
+ "Embedding admin guide": "Embedding admin guide",
+ "SSO setup guide": "SSO setup guide",
+ "SCIM provisioning": "SCIM provisioning",
+ "Workers guide": "Workers guide",
+ "Health guide": "Health guide",
+ "Trigger health guide": "Trigger health guide",
+ "MCP server guide": "MCP server guide",
+ "MCP tools reference": "MCP tools reference",
+ "Online": "Online",
+ "Offline": "Offline",
+ "Docs and tutorials": "Docs and tutorials",
+ "Tutorials": "Tutorials",
+ "Open docs": "Open docs",
+ "Passed": "Passed",
+ "Not applicable": "Not applicable",
+ "More info": "More info",
+ "Video tutorial": "Video tutorial",
+ "Branding preview isn't saved": "Branding preview isn't saved",
+ "Upgrade to save": "Upgrade to save",
+ "Save name": "Save name",
+ "Shown in the sidebar, emails and the sign-in page.": "Shown in the sidebar, emails and the sign-in page.",
+ "Try your logo and colors here. The preview is only for you and is not saved until you upgrade.": "Try your logo and colors here. The preview is only for you and is not saved until you upgrade.",
+ "Your logo and colors replace ours everywhere, including sign-in and emails.": "Your logo and colors replace ours everywhere, including sign-in and emails.",
+ "{tier} plan": "{tier} plan",
+ "Choose an image file (PNG, JPG, SVG, WebP or ICO).": "Choose an image file (PNG, JPG, SVG, WebP or ICO).",
+ "This file is larger than {size} MB.": "This file is larger than {size} MB.",
+ "PNG, JPG, SVG, WebP or ICO up to {size} MB. You can also drop a file here.": "PNG, JPG, SVG, WebP or ICO up to {size} MB. You can also drop a file here.",
+ "Undo": "Undo",
+ "Upload": "Upload",
+ "The full logo in the sidebar, emails and the sign-in page.": "The full logo in the sidebar, emails and the sign-in page.",
+ "The square mark used where the full logo does not fit.": "The square mark used where the full logo does not fit.",
+ "The small icon in the browser tab.": "The small icon in the browser tab.",
+ "configurations": "configurations",
+ "Needs attention": "Needs attention"
}
diff --git a/packages/web/src/app/components/admin/admin-data-table.tsx b/packages/web/src/app/components/admin/admin-data-table.tsx
new file mode 100644
index 00000000000..d870d11ed2c
--- /dev/null
+++ b/packages/web/src/app/components/admin/admin-data-table.tsx
@@ -0,0 +1,39 @@
+import {
+ DataTable,
+ DataTableProps,
+ DataWithId,
+} from '@/components/custom/data-table';
+
+import { adminSurface } from './admin-surface';
+
+export function AdminDataTable<
+ TData extends DataWithId,
+ TValue,
+ Keys extends string,
+>(
+ props: Omit<
+ DataTableProps<TData, TValue, Keys>,
+ 'bordered' | 'frameClassName' | 'toolbarClassName'
+ >,
+) {
+ return (
+ <div
+ data-slot="admin-data-table"
+ className="flex max-h-full min-h-0 flex-initial flex-col"
+ >
+ <DataTable
+ {...props}
+ emptyStateIcon={
+ props.emptyStateIcon && (
+ <span className="flex size-10 items-center justify-center rounded-lg bg-gray-3 text-gray-11 [&_svg]:size-5">
+ {props.emptyStateIcon}
+ </span>
+ )
+ }
+ bordered
+ frameClassName={adminSurface.listFrame}
+ toolbarClassName="px-0 pt-0 pb-4"
+ />
+ </div>
+ );
+}
diff --git a/packages/web/src/app/components/admin/admin-empty.tsx b/packages/web/src/app/components/admin/admin-empty.tsx
new file mode 100644
index 00000000000..513650ec749
--- /dev/null
+++ b/packages/web/src/app/components/admin/admin-empty.tsx
@@ -0,0 +1,48 @@
+import { ReactNode } from 'react';
+
+import {
+ Empty,
+ EmptyContent,
+ EmptyDescription,
+ EmptyHeader,
+ EmptyMedia,
+ EmptyTitle,
+} from '@/components/ui/empty';
+import { cn } from '@/lib/utils';
+
+import { adminSurface } from './admin-surface';
+
+export function AdminEmpty({
+ icon,
+ title,
+ description,
+ action,
+ framed = true,
+ className,
+}: AdminEmptyProps) {
+ return (
+ <Empty
+ className={cn(
+ 'flex-none',
+ framed && cn(adminSurface.listFrame, 'border-solid'),
+ className,
+ )}
+ >
+ <EmptyHeader>
+ {icon && <EmptyMedia variant="icon">{icon}</EmptyMedia>}
+ <EmptyTitle>{title}</EmptyTitle>
+ {description && <EmptyDescription>{description}</EmptyDescription>}
+ </EmptyHeader>
+ {action && <EmptyContent>{action}</EmptyContent>}
+ </Empty>
+ );
+}
+
+type AdminEmptyProps = {
+ icon?: ReactNode;
+ title: ReactNode;
+ description?: ReactNode;
+ action?: ReactNode;
+ framed?: boolean;
+ className?: string;
+};
diff --git a/packages/web/src/app/components/admin/admin-layout.ts b/packages/web/src/app/components/admin/admin-layout.ts
new file mode 100644
index 00000000000..fc8192d8815
--- /dev/null
+++ b/packages/web/src/app/components/admin/admin-layout.ts
@@ -0,0 +1,13 @@
+export const adminLayout = {
+ contentWidth: 'mx-auto max-w-4xl',
+ dialog: {
+ sm: 'max-w-md max-h-[calc(100dvh-2rem)] overflow-y-auto',
+ md: 'max-w-xl max-h-[calc(100dvh-2rem)] overflow-y-auto',
+ lg: 'max-w-4xl max-h-[calc(100dvh-2rem)] overflow-y-auto',
+ },
+ sheet: {
+ sm: 'w-full sm:max-w-md',
+ md: 'w-full sm:max-w-xl',
+ lg: 'w-full sm:max-w-4xl',
+ },
+} as const;
diff --git a/packages/web/src/app/components/admin/admin-page-resources.ts b/packages/web/src/app/components/admin/admin-page-resources.ts
new file mode 100644
index 00000000000..17dadbeb8e2
--- /dev/null
+++ b/packages/web/src/app/components/admin/admin-page-resources.ts
@@ -0,0 +1,147 @@
+import { t } from 'i18next';
+
+import { AdminControl } from '@/lib/admin-control';
+
+import { AdminResource } from './admin-resources';
+
+const docs = ({
+ label,
+ path,
+ control,
+}: {
+ label: () => string;
+ path: string;
+ control?: AdminControl;
+}): AdminResource => ({
+ kind: 'doc',
+ label,
+ url: `${DOCS_BASE_URL}/${path}`,
+ control,
+});
+
+const DOCS_BASE_URL = 'https://www.activepieces.com/docs';
+
+export const adminPageResources = {
+ projects: [
+ docs({
+ label: () => t('Projects guide'),
+ path: 'admin-guide/guides/structure-projects',
+ }),
+ ],
+ users: [
+ docs({
+ label: () => t('Users guide'),
+ path: 'admin-guide/guides/permissions',
+ }),
+ ],
+ roles: [
+ docs({
+ label: () => t('Users and roles guide'),
+ path: 'admin-guide/guides/permissions',
+ }),
+ ],
+ connections: [
+ docs({
+ label: () => t('Connections guide'),
+ path: 'admin-guide/guides/connections',
+ }),
+ ],
+ globalConnections: [
+ docs({
+ label: () => t('Global connections guide'),
+ path: 'admin-guide/guides/global-connections',
+ }),
+ ],
+ aiProviders: [
+ docs({
+ label: () => t('AI providers guide'),
+ path: 'admin-guide/guides/setup-ai-providers',
+ }),
+ ],
+ aiCapabilities: [
+ docs({
+ label: () => t('AI capabilities guide'),
+ path: 'admin-guide/guides/ai-capabilities',
+ }),
+ ],
+ pieces: [
+ docs({
+ label: () => t('Pieces guide'),
+ path: 'admin-guide/guides/manage-pieces',
+ }),
+ ],
+ templates: [
+ docs({
+ label: () => t('Templates guide'),
+ path: 'admin-guide/guides/templates',
+ }),
+ ],
+ general: [
+ docs({
+ label: () => t('General settings guide'),
+ path: 'admin-guide/guides/general',
+ }),
+ ],
+ usage: [
+ docs({ label: () => t('Usage guide'), path: 'admin-guide/guides/usage' }),
+ ],
+ apiKeys: [
+ docs({ label: () => t('API reference'), path: 'endpoints/overview' }),
+ ],
+ secretManagers: [
+ docs({
+ label: () => t('Secret managers guide'),
+ path: 'admin-guide/guides/secret-managers/overview',
+ }),
+ ],
+ auditLogs: [
+ docs({
+ label: () => t('Audit logs guide'),
+ path: 'admin-guide/security/audit-logs/overview',
+ }),
+ ],
+ eventStreaming: [
+ docs({
+ label: () => t('Event streaming guide'),
+ path: 'admin-guide/guides/event-streaming',
+ }),
+ ],
+ embedding: [
+ docs({
+ label: () => t('Embedding admin guide'),
+ path: 'admin-guide/guides/embedding',
+ }),
+ ],
+ sso: [
+ docs({ label: () => t('SSO setup guide'), path: 'admin-guide/guides/sso' }),
+ docs({
+ label: () => t('SCIM provisioning'),
+ path: 'admin-guide/guides/scim/overview',
+ }),
+ ],
+ workers: [
+ docs({
+ label: () => t('Workers guide'),
+ path: 'admin-guide/guides/workers',
+ }),
+ ],
+ health: [
+ docs({ label: () => t('Health guide'), path: 'admin-guide/guides/health' }),
+ ],
+ triggers: [
+ docs({
+ label: () => t('Trigger health guide'),
+ path: 'admin-guide/guides/trigger-health',
+ }),
+ ],
+ mcp: [
+ docs({ label: () => t('MCP server guide'), path: 'mcp/overview' }),
+ docs({ label: () => t('MCP tools reference'), path: 'mcp/tools' }),
+ ],
+ configurations: [
+ docs({
+ label: () => t('Telemetry'),
+ path: 'install/configure-operate/telemetry',
+ }),
+ ],
+} satisfies Record<string, AdminResource[]>;
diff --git a/packages/web/src/app/components/admin/admin-page.tsx b/packages/web/src/app/components/admin/admin-page.tsx
new file mode 100644
index 00000000000..9ebc7dbc485
--- /dev/null
+++ b/packages/web/src/app/components/admin/admin-page.tsx
@@ -0,0 +1,175 @@
+import { ArrowLeft } from 'lucide-react';
+import { ReactNode } from 'react';
+import { Link } from 'react-router-dom';
+
+import { useEmbedding } from '@/components/providers/embed-provider';
+import { cn } from '@/lib/utils';
+
+import { adminLayout } from './admin-layout';
+import { AdminResource, AdminResources } from './admin-resources';
+import { adminSurface } from './admin-surface';
+
+export function AdminPage({
+ width = 'full',
+ fill = false,
+ footer,
+ className,
+ children,
+}: AdminPageProps) {
+ return (
+ <div
+ data-slot="admin-page"
+ className={cn(
+ adminSurface.page,
+ 'flex w-full flex-col',
+ fill ? 'h-full min-h-0' : 'flex-1',
+ )}
+ >
+ <div
+ className={cn(
+ 'flex w-full flex-1 flex-col gap-6 px-4 py-6 md:px-6',
+ fill && 'min-h-0',
+ WIDTH_CLASS[width],
+ className,
+ )}
+ >
+ {children}
+ </div>
+ {footer}
+ </div>
+ );
+}
+
+export function AdminPageHeader({
+ title,
+ description,
+ back,
+ badge,
+ resources,
+ children,
+}: AdminPageHeaderProps) {
+ const { embedState } = useEmbedding();
+ if (embedState.hidePageHeader) {
+ if (!back && !children) {
+ return null;
+ }
+ return (
+ <div
+ data-slot="admin-page-actions"
+ className="flex shrink-0 flex-wrap items-center justify-between gap-2"
+ >
+ {back && <AdminBackLink back={back} />}
+ {children && (
+ <div className="ml-auto flex flex-wrap items-center gap-2">
+ {children}
+ </div>
+ )}
+ </div>
+ );
+ }
+ const hasResources =
+ !embedState.isEmbedded && resources !== undefined && resources.length > 0;
+
+ return (
+ <header
+ data-slot="admin-page-header"
+ className="flex shrink-0 flex-col gap-2"
+ >
+ {back && <AdminBackLink back={back} />}
+ <div className="flex min-h-9 flex-wrap items-center justify-between gap-x-4 gap-y-2">
+ <div className="flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1">
+ {typeof title === 'string' ? (
+ <h1 className="min-w-0 break-words text-2xl font-semibold tracking-tight text-gray-12">
+ {title}
+ </h1>
+ ) : (
+ title
+ )}
+ {badge}
+ </div>
+ {(hasResources || children) && (
+ <div className="flex flex-wrap items-center gap-2">
+ {hasResources && <AdminResources resources={resources} />}
+ {children}
+ </div>
+ )}
+ </div>
+ {description && (
+ <div className="max-w-3xl text-sm text-gray-11">{description}</div>
+ )}
+ </header>
+ );
+}
+
+export function AdminSection({
+ title,
+ description,
+ action,
+ className,
+ children,
+}: AdminSectionProps) {
+ return (
+ <section className={cn('flex flex-col gap-4', className)}>
+ {(title || action) && (
+ <div className="flex flex-wrap items-end justify-between gap-x-4 gap-y-2">
+ <div className="flex min-w-0 flex-col gap-1">
+ {title && (
+ <h2 className="text-base font-semibold text-gray-12">{title}</h2>
+ )}
+ {description && (
+ <p className="text-sm text-gray-11">{description}</p>
+ )}
+ </div>
+ {action && <div className="flex items-center gap-2">{action}</div>}
+ </div>
+ )}
+ {children}
+ </section>
+ );
+}
+
+function AdminBackLink({ back }: { back: AdminPageBack }) {
+ return (
+ <Link
+ to={back.to}
+ className="inline-flex w-fit items-center gap-1 text-sm font-medium text-gray-11 hover:text-gray-12"
+ >
+ <ArrowLeft className="size-4" />
+ {back.label}
+ </Link>
+ );
+}
+
+const WIDTH_CLASS: Record<AdminPageWidth, string> = {
+ full: '',
+ content: adminLayout.contentWidth,
+};
+
+type AdminPageBack = { label: string; to: string };
+
+type AdminPageWidth = 'full' | 'content';
+
+type AdminPageProps = {
+ width?: AdminPageWidth;
+ fill?: boolean;
+ footer?: ReactNode;
+ className?: string;
+ children: ReactNode;
+};
+
+type AdminPageHeaderProps = {
+ title: ReactNode;
+ description?: ReactNode;
+ back?: AdminPageBack;
+ badge?: ReactNode;
+ resources?: AdminResource[];
+ children?: ReactNode;
+};
+
+type AdminSectionProps = {
+ title?: ReactNode;
+ description?: ReactNode;
+ action?: ReactNode;
+ className?: string;
+ children: ReactNode;
+};
diff --git a/packages/web/src/app/components/admin/admin-resources.tsx b/packages/web/src/app/components/admin/admin-resources.tsx
new file mode 100644
index 00000000000..12b36c3e935
--- /dev/null
+++ b/packages/web/src/app/components/admin/admin-resources.tsx
@@ -0,0 +1,226 @@
+import { t } from 'i18next';
+import { BookOpen, ChevronDown, ExternalLink, PlayCircle } from 'lucide-react';
+import { RefObject, useRef, useState } from 'react';
+
+import { Button } from '@/components/ui/button';
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogHeader,
+ DialogTitle,
+} from '@/components/ui/dialog';
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuLabel,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+} from '@/components/ui/dropdown-menu';
+import { AdminControl, adminControl } from '@/lib/admin-control';
+
+import { adminLayout } from './admin-layout';
+
+export function AdminResources({ resources }: AdminResourcesProps) {
+ const [playing, setPlaying] = useState<AdminResource | null>(null);
+ const triggerRef = useRef<HTMLButtonElement>(null);
+ const docs = resources.filter((resource) => resource.kind === 'doc');
+ const videos = resources.filter((resource) => resource.kind === 'video');
+
+ const trigger =
+ resources.length === 1 ? (
+ <SingleResourceButton
+ resource={resources[0]}
+ buttonRef={triggerRef}
+ onPlay={() => setPlaying(resources[0])}
+ />
+ ) : (
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button ref={triggerRef} type="button" variant="ghost">
+ {videos.length > 0 ? <PlayCircle /> : <BookOpen />}
+ {videos.length > 0 ? t('Docs and tutorials') : t('Docs')}
+ <ChevronDown />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="w-64">
+ {docs.length > 0 && videos.length > 0 && (
+ <DropdownMenuLabel>{t('Docs')}</DropdownMenuLabel>
+ )}
+ {docs.map((doc) => (
+ <DropdownMenuItem key={doc.url} asChild>
+ <a
+ {...adminControl(doc.control)}
+ href={doc.url}
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ <BookOpen />
+ <span className="flex-1 truncate">{doc.label()}</span>
+ <ExternalLink className="text-gray-11" />
+ </a>
+ </DropdownMenuItem>
+ ))}
+ {docs.length > 0 && videos.length > 0 && (
+ <>
+ <DropdownMenuSeparator />
+ <DropdownMenuLabel>{t('Tutorials')}</DropdownMenuLabel>
+ </>
+ )}
+ {videos.map((video) => (
+ <DropdownMenuItem
+ key={video.url}
+ onSelect={() => setTimeout(() => setPlaying(video), 0)}
+ >
+ <PlayCircle />
+ <span className="flex-1 truncate">{video.label()}</span>
+ </DropdownMenuItem>
+ ))}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ );
+
+ return (
+ <>
+ {trigger}
+ <AdminVideoDialog
+ video={playing}
+ returnFocusRef={triggerRef}
+ onOpenChange={(open) => {
+ if (!open) {
+ setPlaying(null);
+ }
+ }}
+ />
+ </>
+ );
+}
+
+export function AdminVideoDialog({
+ video,
+ returnFocusRef,
+ onOpenChange,
+}: AdminVideoDialogProps) {
+ const embed = video === null ? null : toEmbedUrl(video.url);
+ return (
+ <Dialog open={video !== null} onOpenChange={onOpenChange}>
+ <DialogContent
+ className={adminLayout.dialog.lg}
+ onCloseAutoFocus={(event) => {
+ if (returnFocusRef?.current) {
+ event.preventDefault();
+ returnFocusRef.current.focus();
+ }
+ }}
+ >
+ <DialogHeader>
+ <DialogTitle>{video && video.label()}</DialogTitle>
+ <DialogDescription className="sr-only">
+ {t('Video tutorial')}
+ </DialogDescription>
+ </DialogHeader>
+ {video && embed && (
+ <div className="aspect-video w-full overflow-hidden rounded-lg bg-gray-3">
+ {embed.kind === 'file' ? (
+ <video src={embed.url} controls autoPlay className="size-full" />
+ ) : (
+ <iframe
+ src={embed.url}
+ title={video.label()}
+ allow="autoplay; fullscreen; picture-in-picture"
+ allowFullScreen
+ className="size-full"
+ />
+ )}
+ </div>
+ )}
+ {video && (
+ <a
+ href={video.url}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="inline-flex w-fit items-center gap-1 text-sm font-medium text-accent-11 hover:underline"
+ >
+ {t('Open in a new tab')}
+ <ExternalLink className="size-3.5" />
+ </a>
+ )}
+ </DialogContent>
+ </Dialog>
+ );
+}
+
+function SingleResourceButton({
+ resource,
+ buttonRef,
+ onPlay,
+}: {
+ resource: AdminResource;
+ buttonRef: RefObject<HTMLButtonElement | null>;
+ onPlay: () => void;
+}) {
+ if (resource.kind === 'video') {
+ return (
+ <Button ref={buttonRef} type="button" variant="ghost" onClick={onPlay}>
+ <PlayCircle />
+ {resource.label()}
+ </Button>
+ );
+ }
+ return (
+ <Button variant="ghost" asChild>
+ <a
+ {...adminControl(resource.control)}
+ href={resource.url}
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ <BookOpen />
+ {resource.label()}
+ </a>
+ </Button>
+ );
+}
+
+function toEmbedUrl(
+ url: string,
+): { kind: 'iframe' | 'file'; url: string } | null {
+ const youtube = url.match(
+ /(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([\w-]{6,})/,
+ );
+ if (youtube) {
+ return {
+ kind: 'iframe',
+ url: `https://www.youtube-nocookie.com/embed/${youtube[1]}?autoplay=1`,
+ };
+ }
+ const loom = url.match(/loom\.com\/(?:share|embed)\/([\w-]+)/);
+ if (loom) {
+ return {
+ kind: 'iframe',
+ url: `https://www.loom.com/embed/${loom[1]}?autoplay=1`,
+ };
+ }
+ if (/\.(mp4|webm|mov)(\?.*)?$/i.test(url)) {
+ return { kind: 'file', url };
+ }
+ return null;
+}
+
+export type AdminResource = {
+ kind: 'doc' | 'video';
+ label: () => string;
+ url: string;
+ control?: AdminControl;
+};
+
+type AdminResourcesProps = {
+ resources: AdminResource[];
+};
+
+type AdminVideoDialogProps = {
+ video: AdminResource | null;
+ returnFocusRef?: RefObject<HTMLButtonElement | null>;
+ onOpenChange: (open: boolean) => void;
+};
diff --git a/packages/web/src/app/components/admin/admin-surface.ts b/packages/web/src/app/components/admin/admin-surface.ts
new file mode 100644
index 00000000000..5247f1ce493
--- /dev/null
+++ b/packages/web/src/app/components/admin/admin-surface.ts
@@ -0,0 +1,11 @@
+export const adminSurface = {
+ page: 'bg-(--admin-page)',
+ card: 'rounded-xl border border-(--admin-card-border) bg-(--admin-surface)',
+ panelHeader: 'border-b',
+ divider: 'divide-gray-6',
+ listFrame:
+ 'rounded-xl border border-(--admin-card-border) bg-(--admin-surface)',
+ saveBar: 'border-t bg-(--admin-surface)',
+ lockedOverlay: 'rounded-xl border border-gray-7 bg-gray-1',
+ lockedInline: 'rounded-xl border border-accent-7 bg-accent-3',
+} as const;
diff --git a/packages/web/src/app/components/admin/index.ts b/packages/web/src/app/components/admin/index.ts
new file mode 100644
index 00000000000..90e6de0e55d
--- /dev/null
+++ b/packages/web/src/app/components/admin/index.ts
@@ -0,0 +1,15 @@
+export { AdminPage, AdminPageHeader, AdminSection } from './admin-page';
+export { AdminResources, AdminVideoDialog } from './admin-resources';
+export type { AdminResource } from './admin-resources';
+export { adminPageResources } from './admin-page-resources';
+export { adminSurface } from './admin-surface';
+export { adminLayout } from './admin-layout';
+export { AdminDataTable } from './admin-data-table';
+export { AdminEmpty } from './admin-empty';
+export { SettingsPanel, SettingsRow, DangerZone } from './settings-panel';
+export { SaveBar } from './save-bar';
+export type { SaveBarLock } from './save-bar';
+export { StatusDot } from './status-dot';
+export type { StatusTone } from './status-dot';
+export { StatCard, StatGrid } from './stat-card';
+export { LockedCallout } from './locked-callout';
diff --git a/packages/web/src/app/components/admin/locked-callout.tsx b/packages/web/src/app/components/admin/locked-callout.tsx
new file mode 100644
index 00000000000..815d04880b7
--- /dev/null
+++ b/packages/web/src/app/components/admin/locked-callout.tsx
@@ -0,0 +1,70 @@
+import { Gem } from 'lucide-react';
+import { ReactNode } from 'react';
+
+import { cn } from '@/lib/utils';
+
+import { adminSurface } from './admin-surface';
+
+export function LockedCallout({
+ variant,
+ icon,
+ title,
+ description,
+ className,
+ children,
+}: LockedCalloutProps) {
+ if (variant === 'inline') {
+ return (
+ <div
+ data-slot="locked-callout"
+ className={cn(
+ adminSurface.lockedInline,
+ 'flex flex-wrap items-center gap-x-4 gap-y-2 px-4 py-3 text-sm text-accent-11',
+ className,
+ )}
+ >
+ <span className="flex shrink-0 [&_svg:not([class*='size-'])]:size-4">
+ {icon ?? <Gem />}
+ </span>
+ <div className="flex min-w-0 flex-1 basis-64 flex-col gap-1">
+ <span className="font-medium">{title}</span>
+ {description && <span>{description}</span>}
+ </div>
+ {children && (
+ <div className="flex flex-wrap items-center gap-2">{children}</div>
+ )}
+ </div>
+ );
+ }
+
+ return (
+ <div
+ data-slot="locked-callout"
+ className={cn(
+ adminSurface.lockedOverlay,
+ 'pointer-events-auto flex w-full max-w-md flex-col gap-4 p-6',
+ className,
+ )}
+ >
+ <div className="grid size-10 place-items-center rounded-lg bg-accent-3 text-accent-11 [&_svg:not([class*='size-'])]:size-5">
+ {icon ?? <Gem />}
+ </div>
+ <div className="flex flex-col gap-2">
+ <h2 className="text-base font-semibold text-gray-12">{title}</h2>
+ {description && (
+ <p className="text-sm leading-relaxed text-gray-11">{description}</p>
+ )}
+ </div>
+ {children}
+ </div>
+ );
+}
+
+type LockedCalloutProps = {
+ variant: 'overlay' | 'inline';
+ icon?: ReactNode;
+ title: ReactNode;
+ description?: ReactNode;
+ className?: string;
+ children?: ReactNode;
+};
diff --git a/packages/web/src/app/components/admin/save-bar.tsx b/packages/web/src/app/components/admin/save-bar.tsx
new file mode 100644
index 00000000000..bb988964554
--- /dev/null
+++ b/packages/web/src/app/components/admin/save-bar.tsx
@@ -0,0 +1,102 @@
+import { t } from 'i18next';
+import { ReactNode } from 'react';
+
+import { Button } from '@/components/ui/button';
+import { AdminControl, adminControl } from '@/lib/admin-control';
+import { cn } from '@/lib/utils';
+
+import { adminLayout } from './admin-layout';
+import { adminSurface } from './admin-surface';
+import { StatusDot } from './status-dot';
+
+export function SaveBar({
+ dirty,
+ saving,
+ disabled = false,
+ onSave,
+ onDiscard,
+ canDiscard,
+ saveLabel,
+ discardLabel,
+ status,
+ saveControl,
+ locked,
+ width = 'full',
+ children,
+}: SaveBarProps) {
+ const showSave = !locked || locked.canSaveRest === true;
+ return (
+ <div
+ data-slot="save-bar"
+ className={cn(adminSurface.saveBar, 'sticky bottom-0 z-20 mt-auto')}
+ >
+ <div
+ className={cn(
+ 'flex w-full flex-wrap items-center justify-end gap-2 px-4 py-3 md:px-6',
+ width === 'content' && adminLayout.contentWidth,
+ )}
+ >
+ <div role="status" className="flex min-w-0 flex-1 items-center">
+ {status ??
+ (locked ? (
+ <StatusDot tone="accent" className="text-gray-11">
+ {locked.message}
+ </StatusDot>
+ ) : (
+ dirty && (
+ <StatusDot tone="warning" className="text-gray-11">
+ {t('You have unsaved changes')}
+ </StatusDot>
+ )
+ ))}
+ </div>
+ {children}
+ {onDiscard && (
+ <Button
+ type="button"
+ variant="outline"
+ disabled={!(canDiscard ?? dirty) || saving}
+ onClick={onDiscard}
+ >
+ {discardLabel ?? t('Cancel')}
+ </Button>
+ )}
+ {showSave && (
+ <Button
+ {...adminControl(saveControl)}
+ type={onSave ? 'button' : 'submit'}
+ onClick={onSave}
+ loading={saving}
+ disabled={!dirty || disabled}
+ variant={locked ? 'outline' : 'default'}
+ >
+ {saveLabel ?? t('Save')}
+ </Button>
+ )}
+ {locked?.action}
+ </div>
+ </div>
+ );
+}
+
+type SaveBarProps = {
+ dirty: boolean;
+ saving: boolean;
+ disabled?: boolean;
+ onSave?: () => void;
+ onDiscard?: () => void;
+ canDiscard?: boolean;
+ saveLabel?: string;
+ discardLabel?: string;
+ status?: ReactNode;
+ saveControl?: AdminControl;
+ locked?: SaveBarLock;
+ width?: 'full' | 'content';
+ children?: ReactNode;
+};
+
+export type SaveBarLock = {
+ message: ReactNode;
+ action: ReactNode;
+ canSaveRest?: boolean;
+};
diff --git a/packages/web/src/app/components/admin/settings-panel.tsx b/packages/web/src/app/components/admin/settings-panel.tsx
new file mode 100644
index 00000000000..0dd5e9c9791
--- /dev/null
+++ b/packages/web/src/app/components/admin/settings-panel.tsx
@@ -0,0 +1,136 @@
+import { t } from 'i18next';
+import { ReactNode, useId } from 'react';
+
+import { cn } from '@/lib/utils';
+
+import { adminSurface } from './admin-surface';
+
+export function SettingsPanel({
+ title,
+ description,
+ action,
+ flush = false,
+ className,
+ children,
+}: SettingsPanelProps) {
+ const hasHeader = title !== undefined || action !== undefined;
+ return (
+ <section
+ data-slot="settings-panel"
+ className={cn(adminSurface.card, 'flex flex-col', className)}
+ >
+ {hasHeader && (
+ <header
+ className={cn(
+ adminSurface.panelHeader,
+ 'flex items-start justify-between gap-4 p-5',
+ )}
+ >
+ <div className="flex min-w-0 flex-col gap-1">
+ {title && (
+ <h2 className="text-sm font-semibold text-gray-12">{title}</h2>
+ )}
+ {description && (
+ <p className="text-sm text-gray-11">{description}</p>
+ )}
+ </div>
+ {action && (
+ <div className="flex shrink-0 items-center gap-2">{action}</div>
+ )}
+ </header>
+ )}
+ <div
+ className={cn(
+ 'flex flex-col',
+ flush
+ ? cn(
+ 'divide-y *:last:rounded-b-xl',
+ !hasHeader && '*:first:rounded-t-xl',
+ adminSurface.divider,
+ )
+ : 'gap-4 p-5',
+ )}
+ >
+ {children}
+ </div>
+ </section>
+ );
+}
+
+export function SettingsRow({
+ icon,
+ media,
+ title,
+ description,
+ children,
+ below,
+ className,
+ ...rest
+}: SettingsRowProps) {
+ const id = useId();
+ const titleId = `${id}-title`;
+ const descriptionId = `${id}-description`;
+ return (
+ <div
+ data-slot="settings-row"
+ role="group"
+ aria-labelledby={titleId}
+ aria-describedby={description ? descriptionId : undefined}
+ className={cn('flex flex-col gap-4 px-5 py-4', className)}
+ {...rest}
+ >
+ <div className="flex flex-wrap items-center gap-4">
+ {media && <div className="flex shrink-0 items-center">{media}</div>}
+ {icon && (
+ <div className="flex size-9 shrink-0 items-center justify-center rounded-lg border bg-gray-3 text-gray-12 [&_svg:not([class*='size-'])]:size-4">
+ {icon}
+ </div>
+ )}
+ <div className="flex min-w-0 flex-1 basis-56 flex-col gap-1">
+ <div
+ id={titleId}
+ className="flex items-center gap-2 text-sm font-medium text-gray-12"
+ >
+ {title}
+ </div>
+ {description && (
+ <div id={descriptionId} className="text-sm text-gray-11">
+ {description}
+ </div>
+ )}
+ </div>
+ {children && (
+ <div className="flex max-w-full shrink-0 items-center gap-2">
+ {children}
+ </div>
+ )}
+ </div>
+ {below}
+ </div>
+ );
+}
+
+export function DangerZone({ children }: { children: ReactNode }) {
+ return (
+ <SettingsPanel title={t('Danger zone')} flush>
+ {children}
+ </SettingsPanel>
+ );
+}
+
+type SettingsPanelProps = {
+ title?: ReactNode;
+ description?: ReactNode;
+ action?: ReactNode;
+ flush?: boolean;
+ className?: string;
+ children: ReactNode;
+};
+
+type SettingsRowProps = Omit<React.ComponentProps<'div'>, 'title'> & {
+ icon?: ReactNode;
+ media?: ReactNode;
+ title: ReactNode;
+ description?: ReactNode;
+ below?: ReactNode;
+};
diff --git a/packages/web/src/app/components/admin/stat-card.tsx b/packages/web/src/app/components/admin/stat-card.tsx
new file mode 100644
index 00000000000..32bab3f5c7d
--- /dev/null
+++ b/packages/web/src/app/components/admin/stat-card.tsx
@@ -0,0 +1,97 @@
+import { t } from 'i18next';
+import { Info } from 'lucide-react';
+import { ReactNode } from 'react';
+
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from '@/components/ui/tooltip';
+import { cn } from '@/lib/utils';
+
+import { adminSurface } from './admin-surface';
+
+export function StatCard({
+ label,
+ value,
+ icon,
+ info,
+ hint,
+ tone = 'default',
+ className,
+ children,
+}: StatCardProps) {
+ return (
+ <div
+ data-slot="stat-card"
+ className={cn(adminSurface.card, 'flex flex-col gap-2 p-5', className)}
+ >
+ <div className="flex items-center gap-2 text-sm text-gray-11">
+ {icon && (
+ <span className="flex shrink-0 [&_svg:not([class*='size-'])]:size-4">
+ {icon}
+ </span>
+ )}
+ <span className="truncate">{label}</span>
+ {info && (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <button
+ type="button"
+ aria-label={t('More info')}
+ className="flex shrink-0 rounded-sm text-gray-11 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-8"
+ >
+ <Info className="size-4" />
+ </button>
+ </TooltipTrigger>
+ <TooltipContent className="max-w-xs">{info}</TooltipContent>
+ </Tooltip>
+ )}
+ </div>
+ <div
+ className={cn(
+ 'text-3xl font-semibold tracking-tight tabular-nums text-gray-12',
+ tone === 'danger' && 'text-danger-11',
+ tone === 'success' && 'text-success-11',
+ tone === 'warning' && 'text-warning-11',
+ )}
+ >
+ {value}
+ </div>
+ {hint && <div className="text-xs text-gray-11">{hint}</div>}
+ {children}
+ </div>
+ );
+}
+
+export function StatGrid({ columns = 3, className, children }: StatGridProps) {
+ return (
+ <div
+ className={cn(
+ 'grid grid-cols-1 gap-4 sm:grid-cols-2',
+ columns === 3 && 'lg:grid-cols-3',
+ columns === 4 && 'lg:grid-cols-4',
+ className,
+ )}
+ >
+ {children}
+ </div>
+ );
+}
+
+type StatCardProps = {
+ label: ReactNode;
+ value: ReactNode;
+ icon?: ReactNode;
+ info?: ReactNode;
+ hint?: ReactNode;
+ tone?: 'default' | 'success' | 'warning' | 'danger';
+ className?: string;
+ children?: ReactNode;
+};
+
+type StatGridProps = {
+ columns?: 2 | 3 | 4;
+ className?: string;
+ children: ReactNode;
+};
diff --git a/packages/web/src/app/components/admin/status-dot.tsx b/packages/web/src/app/components/admin/status-dot.tsx
new file mode 100644
index 00000000000..2e1c696930e
--- /dev/null
+++ b/packages/web/src/app/components/admin/status-dot.tsx
@@ -0,0 +1,63 @@
+import { cva } from 'class-variance-authority';
+import { ReactNode } from 'react';
+
+import { TextWithTooltip } from '@/components/custom/text-with-tooltip';
+import { cn } from '@/lib/utils';
+
+const dotVariants = cva('size-2 shrink-0 rounded-full', {
+ variants: {
+ tone: {
+ success: 'bg-success-10',
+ warning: 'bg-warning-10',
+ danger: 'bg-danger-10',
+ accent: 'bg-accent-10',
+ neutral: 'bg-gray-10',
+ },
+ },
+ defaultVariants: {
+ tone: 'neutral',
+ },
+});
+
+export function StatusDot({
+ tone,
+ pulse = false,
+ className,
+ children,
+}: StatusDotProps) {
+ return (
+ <span
+ data-slot="status-dot"
+ className={cn(
+ 'inline-flex min-w-0 items-center gap-2 text-sm text-gray-12',
+ className,
+ )}
+ >
+ <span
+ aria-hidden
+ className={cn(dotVariants({ tone }), pulse && 'animate-pulse')}
+ />
+ {typeof children === 'string' ? (
+ <TextWithTooltip tooltipMessage={children}>
+ <span className="truncate">{children}</span>
+ </TextWithTooltip>
+ ) : (
+ children !== undefined && <span className="truncate">{children}</span>
+ )}
+ </span>
+ );
+}
+
+export type StatusTone =
+ | 'success'
+ | 'warning'
+ | 'danger'
+ | 'accent'
+ | 'neutral';
+
+type StatusDotProps = {
+ tone: StatusTone;
+ pulse?: boolean;
+ className?: string;
+ children?: ReactNode;
+};
diff --git a/packages/web/src/app/components/centered-page.tsx b/packages/web/src/app/components/centered-page.tsx
deleted file mode 100644
index 5c649aaa228..00000000000
--- a/packages/web/src/app/components/centered-page.tsx
+++ /dev/null
@@ -1,89 +0,0 @@
-import React from 'react';
-
-import { ScrollArea } from '@/components/ui/scroll-area';
-import { Separator } from '@/components/ui/separator';
-import { cn } from '@/lib/utils';
-
-const GUTTER = 'w-full px-4 sm:px-6';
-
-export const CenteredPage = ({
- title,
- description,
- actions,
- footer,
- breadcrumb,
- children,
- widthClassName = 'max-w-[40rem]',
- showHeaderSeparator = true,
- className,
-}: {
- title?: string;
- description?: React.ReactNode;
- actions?: React.ReactNode;
- footer?: React.ReactNode;
- breadcrumb?: React.ReactNode;
- children: React.ReactNode;
- widthClassName?: string;
- showHeaderSeparator?: boolean;
- className?: string;
-}) => {
- const header =
- title === undefined && !description && !actions && !breadcrumb ? null : (
- <>
- {breadcrumb && <div className="pb-3">{breadcrumb}</div>}
- <div
- className={cn(
- 'flex items-start justify-between gap-4',
- !showHeaderSeparator && 'mb-6',
- )}
- >
- <div className="flex flex-col gap-1">
- {title !== undefined && (
- <h1 className="text-xl font-medium">{title}</h1>
- )}
- {description && (
- <div className="text-sm text-gray-11">{description}</div>
- )}
- </div>
- {actions && <div className="shrink-0">{actions}</div>}
- </div>
- {showHeaderSeparator && <Separator className="my-4" />}
- </>
- );
-
- if (!footer) {
- return (
- <div className={cn(GUTTER, 'py-6', className)}>
- <div className={cn('w-full mx-auto', widthClassName)}>
- {header}
- {children}
- </div>
- </div>
- );
- }
-
- return (
- <div className="flex flex-col h-full min-h-0">
- <div className={cn(GUTTER, 'pt-6 shrink-0')}>
- <div className={cn('w-full mx-auto', widthClassName)}>{header}</div>
- </div>
- <ScrollArea className="flex-1 min-h-0">
- <div className={cn(GUTTER, 'pb-6')}>
- <div className={cn('w-full mx-auto', widthClassName)}>{children}</div>
- </div>
- </ScrollArea>
- <div className="shrink-0 border-t bg-gray-1">
- <div className={cn(GUTTER, 'py-3')}>
- <div
- className={cn(
- 'w-full mx-auto flex justify-end gap-2',
- widthClassName,
- )}
- >
- {footer}
- </div>
- </div>
- </div>
- </div>
- );
-};
diff --git a/packages/web/src/app/components/dashboard-page-header.tsx b/packages/web/src/app/components/dashboard-page-header.tsx
deleted file mode 100644
index 29ffd7b923c..00000000000
--- a/packages/web/src/app/components/dashboard-page-header.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import { PageHeader } from '@/components/custom/page-header';
-
-export const DashboardPageHeader = ({
- title,
- children,
- description,
-}: {
- title: React.ReactNode;
- children?: React.ReactNode;
- description?: React.ReactNode;
-}) => {
- return (
- <PageHeader
- title={title}
- description={description}
- rightContent={children}
- className="min-w-full"
- />
- );
-};
diff --git a/packages/web/src/app/components/feature-sample.tsx b/packages/web/src/app/components/feature-sample.tsx
index f1389f583a1..5698193b395 100644
--- a/packages/web/src/app/components/feature-sample.tsx
+++ b/packages/web/src/app/components/feature-sample.tsx
@@ -18,6 +18,8 @@ import {
import { flagsHooks } from '@/hooks/flags-hooks';
import { AdminControl, adminControl } from '@/lib/admin-control';
+import { LockedCallout } from './admin/locked-callout';
+
export function FeatureSample({
locked,
title,
@@ -50,20 +52,18 @@ export function FeatureSample({
</div>
<div className="absolute inset-0 grid place-items-center overflow-auto p-6">
- <div className="pointer-events-auto flex w-full max-w-md flex-col items-center gap-5 rounded-xl border bg-gray-1 px-8 py-9 text-center shadow-xl">
- <div className="grid size-12 place-items-center rounded-xl bg-accent-3">
- <Lock className="size-5.5 text-accent-11" />
- </div>
- <div className="flex flex-col gap-2">
- <h2 className="text-lg font-semibold">{t(title)}</h2>
- {description !== undefined && description !== '' && (
- <p className="text-sm leading-relaxed text-gray-11">
- {t(description)}
- </p>
- )}
- </div>
+ <LockedCallout
+ variant="overlay"
+ icon={<Lock />}
+ title={t(title)}
+ description={
+ description !== undefined && description !== ''
+ ? t(description)
+ : undefined
+ }
+ >
{isCommunity ? (
- <div className="flex flex-col items-center gap-3">
+ <div className="flex flex-col items-start gap-3">
{showContactSales && featureKey !== undefined && (
<RequestTrial
featureKey={featureKey}
@@ -107,7 +107,7 @@ export function FeatureSample({
</span>
</>
)}
- </div>
+ </LockedCallout>
</div>
</div>
);
diff --git a/packages/web/src/app/components/platform-layout.tsx b/packages/web/src/app/components/platform-layout.tsx
index e47271cf3a0..6b8ad0495be 100644
--- a/packages/web/src/app/components/platform-layout.tsx
+++ b/packages/web/src/app/components/platform-layout.tsx
@@ -30,9 +30,9 @@ export function PlatformLayout({ children }: { children: React.ReactNode }) {
<div className="flex-1 flex flex-col pr-2 pt-3 pb-3 overflow-hidden max-md:pl-2 max-md:pt-2">
<div
id="dashboard-content-container"
- className="relative flex flex-col h-full bg-gray-1 rounded-xl shadow-panel border overflow-clip"
+ className="relative flex flex-col h-full bg-(--admin-page) rounded-xl shadow-panel border overflow-clip"
>
- <div className="flex flex-col flex-1 overflow-auto">
+ <div className="flex flex-col flex-1 overflow-auto [scrollbar-gutter:stable]">
{children}
</div>
</div>
diff --git a/packages/web/src/app/routes/platform/billing/index.tsx b/packages/web/src/app/routes/platform/billing/index.tsx
index 850b8243d37..6aa8427203f 100644
--- a/packages/web/src/app/routes/platform/billing/index.tsx
+++ b/packages/web/src/app/routes/platform/billing/index.tsx
@@ -11,6 +11,11 @@ import { ArrowUpRight, ExternalLink, RefreshCw } from 'lucide-react';
import React, { useState } from 'react';
import { toast } from 'sonner';
+import {
+ AdminPage,
+ AdminPageHeader,
+ adminSurface,
+} from '@/app/components/admin';
import { BillingPageShell } from '@/app/components/billing-page-shell';
import { Alert, AlertDescription } from '@/components/ui/alert';
import { Button } from '@/components/ui/button';
@@ -43,23 +48,17 @@ export function BillingPlanTab() {
errorMessage={t('Failed to load billing information')}
>
{({ platform, info }) => (
- <div className="flex w-full flex-col gap-4 p-6">
- <div className="flex items-start justify-between gap-4">
- <div className="flex flex-col gap-1">
- <h1 className="text-xl font-medium">
- {t('Billing & subscription')}
- </h1>
- <div className="text-sm text-gray-11">
- {t(
- 'For questions about billing contact us at [email protected]',
- )}
- </div>
- </div>
+ <AdminPage>
+ <AdminPageHeader
+ title={t('Billing & subscription')}
+ description={t(
+ 'For questions about billing contact us at [email protected]',
+ )}
+ >
<BillingRefreshButton />
- </div>
- <Separator />
+ </AdminPageHeader>
<PlanTab platform={platform} info={info} />
- </div>
+ </AdminPage>
)}
</BillingPageShell>
);
@@ -84,8 +83,6 @@ function BillingRefreshButton() {
<Button
{...adminControl(AdminControl.BILLING_REFRESH_RUN)}
variant="outline"
- size="sm"
- className="shrink-0"
loading={isRefreshing}
onClick={() =>
refreshBilling(undefined, {
@@ -93,7 +90,7 @@ function BillingRefreshButton() {
})
}
>
- <RefreshCw className="size-4 mr-2" />
+ <RefreshCw className="size-4" />
{t('Refresh')}
</Button>
);
@@ -136,7 +133,7 @@ function PlanTab({ platform, info }: PlanTabProps) {
const licenseKeyCopy = licenseKeySectionCopy({ hasLicenseKey, isCloud });
return (
- <div className="flex w-full flex-col gap-4 p-6">
+ <div className="flex w-full flex-col gap-6">
{info.billingUnavailable && (
<Alert variant="warning">
<AlertDescription>
@@ -190,7 +187,7 @@ function PlanTab({ platform, info }: PlanTabProps) {
</div>
}
>
- <CreditsCard info={info} />
+ <CreditsCard info={info} className={adminSurface.card} />
{isPaid &&
isNil(info.trialEndsAt) &&
!isNil(displayedCreditsFeature) && (
@@ -198,6 +195,7 @@ function PlanTab({ platform, info }: PlanTabProps) {
feature={displayedCreditsFeature}
hasCard={hasBillingPortal}
note={autoRechargeNote}
+ className={adminSurface.card}
/>
)}
</BillingSection>
@@ -212,7 +210,11 @@ function PlanTab({ platform, info }: PlanTabProps) {
'Manage how many members can join your platform. New seats are available immediately.',
)}
>
- <UsersCard info={info} feature={seatsFeature} />
+ <UsersCard
+ info={info}
+ feature={seatsFeature}
+ className={adminSurface.card}
+ />
</BillingSection>
</>
)}
@@ -236,7 +238,7 @@ function PlanTab({ platform, info }: PlanTabProps) {
onClick={() => redirectToPortalSession()}
>
{t('Manage subscription in Stripe')}
- <ExternalLink className="size-3.5 ml-2" />
+ <ExternalLink className="size-3.5" />
</Button>
)}
{!isCompedLifetimePlan &&
@@ -334,7 +336,7 @@ const BillingSection = ({
description?: React.ReactNode;
children: React.ReactNode;
}) => (
- <section className="grid grid-cols-1 gap-4 md:grid-cols-[minmax(0,1fr)_400px] md:gap-20 pr-4">
+ <section className="grid grid-cols-1 gap-4 md:grid-cols-[minmax(0,1fr)_400px] md:gap-20">
<div className="flex flex-col gap-1">
<h2 className="text-base font-semibold">{title}</h2>
<div className="text-sm text-gray-11">{description}</div>
diff --git a/packages/web/src/app/routes/platform/billing/usage-tab.tsx b/packages/web/src/app/routes/platform/billing/usage-tab.tsx
index 81da9068646..09a06aaee45 100644
--- a/packages/web/src/app/routes/platform/billing/usage-tab.tsx
+++ b/packages/web/src/app/routes/platform/billing/usage-tab.tsx
@@ -2,7 +2,12 @@ import { PlatformBillingInformation } from '@activepieces/shared';
import { t } from 'i18next';
import { Info } from 'lucide-react';
-import { Separator } from '@/components/ui/separator';
+import {
+ AdminPage,
+ AdminPageHeader,
+ adminPageResources,
+ adminSurface,
+} from '@/app/components/admin';
import {
Tooltip,
TooltipContent,
@@ -13,13 +18,15 @@ import { platformHooks } from '@/hooks/platform-hooks';
export function UsageTab({ platform, info }: UsageTabProps) {
return (
- <div className="flex w-full flex-col gap-4 p-6">
- <div className="flex flex-col gap-1">
- <div className="flex items-center gap-1.5">
- <h1 className="text-xl font-medium">{t('Usage')}</h1>
+ <AdminPage>
+ <AdminPageHeader
+ title={t('Usage')}
+ description={t('Track your workspace usage across your plan limits.')}
+ resources={adminPageResources.usage}
+ badge={
<Tooltip>
<TooltipTrigger asChild>
- <Info className="size-3.5 text-gray-11 cursor-help" />
+ <Info className="size-4 cursor-help text-gray-11" />
</TooltipTrigger>
<TooltipContent side="right" className="max-w-60">
<p className="text-sm">
@@ -27,16 +34,17 @@ export function UsageTab({ platform, info }: UsageTabProps) {
</p>
</TooltipContent>
</Tooltip>
- </div>
- <div className="text-sm text-gray-11">
- {t('Track your workspace usage across your plan limits.')}
- </div>
- </div>
- <Separator />
- <FeatureUsageCards platformSubscription={info} />
- <Separator />
- <ProjectsUsageTable platformId={platform.id} />
- </div>
+ }
+ />
+ <FeatureUsageCards
+ platformSubscription={info}
+ cardClassName={adminSurface.card}
+ />
+ <ProjectsUsageTable
+ platformId={platform.id}
+ frameClassName={adminSurface.listFrame}
+ />
+ </AdminPage>
);
}
diff --git a/packages/web/src/app/routes/platform/connections/index.tsx b/packages/web/src/app/routes/platform/connections/index.tsx
index c20984cd043..197b2263df2 100644
--- a/packages/web/src/app/routes/platform/connections/index.tsx
+++ b/packages/web/src/app/routes/platform/connections/index.tsx
@@ -19,16 +19,21 @@ import {
} from 'lucide-react';
import { Link } from 'react-router-dom';
-import { DashboardPageHeader } from '@/app/components/dashboard-page-header';
+import {
+ AdminDataTable,
+ AdminPage,
+ AdminPageHeader,
+ StatusDot,
+ StatusTone,
+ adminPageResources,
+} from '@/app/components/admin';
import { CopyTextTooltip } from '@/components/custom/clipboard/copy-text-tooltip';
import {
- DataTable,
DataTableFilters,
RowDataWithActions,
} from '@/components/custom/data-table';
import { DataTableColumnHeader } from '@/components/custom/data-table/data-table-column-header';
import { FormattedDate } from '@/components/custom/formatted-date';
-import { StatusIconWithText } from '@/components/custom/status-icon-with-text';
import { TextWithTooltip } from '@/components/custom/text-with-tooltip';
import { Badge } from '@/components/ui/badge';
import {
@@ -36,7 +41,6 @@ import {
TooltipContent,
TooltipTrigger,
} from '@/components/ui/tooltip';
-import { appConnectionUtils } from '@/features/connections';
import { PieceIconWithPieceName, piecesHooks } from '@/features/pieces';
import { platformAppConnectionsQueries } from '@/features/platform-admin/hooks/platform-app-connections-hooks';
import { getProjectName, projectCollectionUtils } from '@/features/projects';
@@ -149,18 +153,11 @@ export default function PlatformConnectionsPage() {
icon={Activity}
/>
),
- cell: ({ row }) => {
- const status = row.original.status;
- const { variant, icon: Icon } =
- appConnectionUtils.getStatusIcon(status);
- return (
- <StatusIconWithText
- icon={Icon}
- text={formatUtils.convertEnumToHumanReadable(status)}
- variant={variant}
- />
- );
- },
+ cell: ({ row }) => (
+ <StatusDot tone={CONNECTION_STATUS_TONE[row.original.status]}>
+ {formatUtils.convertEnumToHumanReadable(row.original.status)}
+ </StatusDot>
+ ),
},
{
accessorKey: 'projects',
@@ -225,35 +222,38 @@ export default function PlatformConnectionsPage() {
];
return (
- <div className="flex flex-col w-full">
- <DashboardPageHeader
+ <AdminPage>
+ <AdminPageHeader
title={t('Connections')}
description={t(
'All app connections across every project on this platform',
)}
+ resources={adminPageResources.connections}
/>
- {owners?.truncated && (
- <div className="px-6 pb-2 text-xs text-gray-11">
- {t('Owner filter is limited to the first {count} owners', {
- count: MAX_PLATFORM_APP_CONNECTION_OWNERS,
- })}
- </div>
- )}
- <DataTable
- emptyStateTextTitle={t('No connections found')}
- emptyStateTextDescription={t(
- 'Connections created in any project on this platform will appear here.',
+ <div className="flex flex-col gap-2">
+ {owners?.truncated && (
+ <p className="text-xs text-gray-11">
+ {t('Owner filter is limited to the first {count} owners', {
+ count: MAX_PLATFORM_APP_CONNECTION_OWNERS,
+ })}
+ </p>
)}
- emptyStateIcon={<Unplug className="size-14" />}
- columns={columns}
- page={connections}
- isLoading={isLoading}
- isError={isError}
- errorStateEntity={t('connections')}
- onRetry={refetch}
- filters={filters}
- />
- </div>
+ <AdminDataTable
+ emptyStateTextTitle={t('No connections found')}
+ emptyStateTextDescription={t(
+ 'Connections created in any project on this platform will appear here.',
+ )}
+ emptyStateIcon={<Unplug />}
+ columns={columns}
+ page={connections}
+ isLoading={isLoading}
+ isError={isError}
+ errorStateEntity={t('connections')}
+ onRetry={refetch}
+ filters={filters}
+ />
+ </div>
+ </AdminPage>
);
}
@@ -312,3 +312,9 @@ const ProjectsCell = ({
</Tooltip>
);
};
+
+const CONNECTION_STATUS_TONE: Record<AppConnectionStatus, StatusTone> = {
+ [AppConnectionStatus.ACTIVE]: 'success',
+ [AppConnectionStatus.ERROR]: 'danger',
+ [AppConnectionStatus.MISSING]: 'neutral',
+};
diff --git a/packages/web/src/app/routes/platform/infra/configurations/index.tsx b/packages/web/src/app/routes/platform/infra/configurations/index.tsx
index deda4aef6f3..75a581e07b4 100644
--- a/packages/web/src/app/routes/platform/infra/configurations/index.tsx
+++ b/packages/web/src/app/routes/platform/infra/configurations/index.tsx
@@ -13,8 +13,15 @@ import { Navigate } from 'react-router-dom';
import { toast } from 'sonner';
import { platformConfigurationApi } from '@/api/platform-configuration-api';
-import { CenteredPage } from '@/app/components/centered-page';
-import { Button } from '@/components/ui/button';
+import {
+ AdminPage,
+ AdminPageHeader,
+ SaveBar,
+ SettingsPanel,
+ SettingsRow,
+ adminPageResources,
+} from '@/app/components/admin';
+import { DataFetchErrorState } from '@/components/custom/data-fetch-error-state';
import { Form } from '@/components/ui/form';
import { Skeleton } from '@/components/ui/skeleton';
import { flagsHooks } from '@/hooks/flags-hooks';
@@ -24,16 +31,29 @@ import { TelemetrySection } from './telemetry-section';
export const ConfigurationsPage = () => {
const { data: edition } = flagsHooks.useFlag<ApEdition>(ApFlagId.EDITION);
- const { data: configuration, isLoading } =
- platformConfigurationHooks.useCurrentPlatformConfiguration({
- refetchOnMount: 'always',
- meta: { showErrorDialog: true, loadSubsetOptions: {} },
- });
+ const {
+ data: configuration,
+ isLoading,
+ isError,
+ refetch,
+ } = platformConfigurationHooks.useCurrentPlatformConfiguration({
+ refetchOnMount: 'always',
+ meta: { loadSubsetOptions: {} },
+ });
if (edition === ApEdition.CLOUD) {
return <Navigate to="/platform/workers" replace />;
}
+ if (isError && isNil(configuration)) {
+ return (
+ <AdminPage width="content">
+ <ConfigurationsHeader />
+ <DataFetchErrorState entity={t('configurations')} onRetry={refetch} />
+ </AdminPage>
+ );
+ }
+
if (isLoading || isNil(configuration)) {
return <ConfigurationsSkeleton />;
}
@@ -77,43 +97,59 @@ const ConfigurationsContent = ({
return (
<Form {...form}>
<form
- className="flex flex-1 flex-col min-h-0"
+ className="flex flex-1 flex-col"
onSubmit={form.handleSubmit((values) => saveConfiguration(values))}
>
- <CenteredPage
- title={t('Configurations')}
+ <AdminPage
+ width="content"
footer={
- <Button
- type="submit"
- loading={isPending}
- disabled={!form.formState.isDirty}
- >
- {t('Save')}
- </Button>
+ <SaveBar
+ width="content"
+ dirty={form.formState.isDirty}
+ saving={isPending}
+ onDiscard={() => form.reset()}
+ />
}
>
+ <ConfigurationsHeader />
<TelemetrySection control={form.control} disabled={isPending} />
- </CenteredPage>
+ </AdminPage>
</form>
</Form>
);
};
+const ConfigurationsHeader = () => (
+ <AdminPageHeader
+ title={t('Configurations')}
+ resources={adminPageResources.configurations}
+ />
+);
+
const ConfigurationsSkeleton = () => {
return (
- <div className="flex flex-1 flex-col min-h-0">
- <CenteredPage
- title={t('Configurations')}
- footer={<Button disabled>{t('Save')}</Button>}
- >
- <div className="flex flex-col gap-3">
- <div className="flex flex-col gap-2">
- <Skeleton className="h-5 w-24" />
- <Skeleton className="h-4 w-full" />
- </div>
- <Skeleton className="h-[4.5rem] w-full rounded-xl" />
- </div>
- </CenteredPage>
+ <div className="flex flex-1 flex-col">
+ <AdminPage width="content">
+ <ConfigurationsHeader />
+ <SettingsPanel
+ title={t('Telemetry')}
+ description={t(
+ 'Help us improve Activepieces. We never receive what your flows do, the data they process, or anything inside your connections and API keys.',
+ )}
+ flush
+ >
+ {[0, 1].map((row) => (
+ <SettingsRow
+ key={row}
+ icon={<Skeleton className="size-4" />}
+ title={<Skeleton className="h-4 w-32" />}
+ description={<Skeleton className="h-4 w-full" />}
+ >
+ <Skeleton className="h-5 w-9 rounded-full" />
+ </SettingsRow>
+ ))}
+ </SettingsPanel>
+ </AdminPage>
</div>
);
};
diff --git a/packages/web/src/app/routes/platform/infra/configurations/telemetry-section.tsx b/packages/web/src/app/routes/platform/infra/configurations/telemetry-section.tsx
index 1dbf76081a9..102799e72c2 100644
--- a/packages/web/src/app/routes/platform/infra/configurations/telemetry-section.tsx
+++ b/packages/web/src/app/routes/platform/infra/configurations/telemetry-section.tsx
@@ -3,15 +3,8 @@ import { t } from 'i18next';
import { Activity, Server } from 'lucide-react';
import { Control } from 'react-hook-form';
+import { SettingsPanel, SettingsRow } from '@/app/components/admin';
import { FormField, FormItem, FormMessage } from '@/components/ui/form';
-import {
- Item,
- ItemMedia,
- ItemContent,
- ItemTitle,
- ItemDescription,
- ItemActions,
-} from '@/components/ui/item';
import { Switch } from '@/components/ui/switch';
import { TrackedEventsDialog } from './tracked-events-dialog';
@@ -21,75 +14,65 @@ export const TelemetrySection = ({
disabled,
}: TelemetrySectionProps) => {
return (
- <div className="flex flex-col gap-3">
- <div className="flex flex-col gap-1">
- <h2 className="text-base font-semibold">{t('Telemetry')}</h2>
- <p className="text-sm text-gray-11">
- {t(
- 'Help us improve Activepieces. We never receive what your flows do, the data they process, or anything inside your connections and API keys.',
- )}
- </p>
- </div>
- <Item variant="outline">
- <ItemMedia variant="icon">
- <Activity />
- </ItemMedia>
- <ItemContent>
- <ItemTitle>{t('Product analytics')}</ItemTitle>
- <ItemDescription className="line-clamp-none">
+ <SettingsPanel
+ title={t('Telemetry')}
+ description={t(
+ 'Help us improve Activepieces. We never receive what your flows do, the data they process, or anything inside your connections and API keys.',
+ )}
+ flush
+ >
+ <SettingsRow
+ icon={<Activity />}
+ title={t('Product analytics')}
+ description={
+ <div className="flex flex-col items-start gap-2">
{t(
'Shares usage events so we can see which features are used and fix what breaks.',
)}
- </ItemDescription>
- <TrackedEventsDialog />
- </ItemContent>
- <ItemActions>
- <FormField
- control={control}
- name="isProductTelemetryEnabled"
- render={({ field }) => (
- <FormItem>
- <Switch
- checked={field.value}
- onCheckedChange={field.onChange}
- disabled={disabled}
- />
- <FormMessage />
- </FormItem>
- )}
- />
- </ItemActions>
- </Item>
- <Item variant="outline">
- <ItemMedia variant="icon">
- <Server />
- </ItemMedia>
- <ItemContent>
- <ItemTitle>{t('Deployment setup')}</ItemTitle>
- <ItemDescription className="line-clamp-none">
- {t(
- 'Sends a snapshot of your Workers and Health pages, without IPs or hostnames, so we can answer your support questions faster.',
- )}
- </ItemDescription>
- </ItemContent>
- <ItemActions>
- <FormField
- control={control}
- name="isInfraSetupTelemetryEnabled"
- render={({ field }) => (
- <FormItem>
- <Switch
- checked={field.value}
- onCheckedChange={field.onChange}
- disabled={disabled}
- />
- <FormMessage />
- </FormItem>
- )}
- />
- </ItemActions>
- </Item>
- </div>
+ <TrackedEventsDialog />
+ </div>
+ }
+ >
+ <FormField
+ control={control}
+ name="isProductTelemetryEnabled"
+ render={({ field }) => (
+ <FormItem>
+ <Switch
+ aria-label={t('Product analytics')}
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ disabled={disabled}
+ />
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </SettingsRow>
+ <SettingsRow
+ icon={<Server />}
+ title={t('Deployment setup')}
+ description={t(
+ 'Sends a snapshot of your Workers and Health pages, without IPs or hostnames, so we can answer your support questions faster.',
+ )}
+ >
+ <FormField
+ control={control}
+ name="isInfraSetupTelemetryEnabled"
+ render={({ field }) => (
+ <FormItem>
+ <Switch
+ aria-label={t('Deployment setup')}
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ disabled={disabled}
+ />
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </SettingsRow>
+ </SettingsPanel>
);
};
diff --git a/packages/web/src/app/routes/platform/infra/configurations/tracked-events-dialog.tsx b/packages/web/src/app/routes/platform/infra/configurations/tracked-events-dialog.tsx
index 230ff58c716..bbc2ed2dccb 100644
--- a/packages/web/src/app/routes/platform/infra/configurations/tracked-events-dialog.tsx
+++ b/packages/web/src/app/routes/platform/infra/configurations/tracked-events-dialog.tsx
@@ -1,6 +1,7 @@
import { t } from 'i18next';
import { ExternalLinkIcon, List } from 'lucide-react';
+import { adminLayout } from '@/app/components/admin';
import { Button } from '@/components/ui/button';
import {
Dialog,
@@ -37,7 +38,7 @@ export const TrackedEventsDialog = () => {
<List className="size-4" /> {t('See the events we track')}
</Button>
</DialogTrigger>
- <DialogContent className="max-w-2xl">
+ <DialogContent className={adminLayout.dialog.md}>
<DialogHeader>
<DialogTitle>{t('Events we track')}</DialogTitle>
</DialogHeader>
diff --git a/packages/web/src/app/routes/platform/infra/event-destinations/components/destination-start-cards.tsx b/packages/web/src/app/routes/platform/infra/event-destinations/components/destination-start-cards.tsx
index b5aec568c22..2ce4c7ba084 100644
--- a/packages/web/src/app/routes/platform/infra/event-destinations/components/destination-start-cards.tsx
+++ b/packages/web/src/app/routes/platform/infra/event-destinations/components/destination-start-cards.tsx
@@ -15,7 +15,7 @@ import { VendorLogoStack } from './vendor-logo-stack';
export const DestinationStartCards = () => {
return (
- <div className="mb-10 mt-4 grid w-full max-w-[640px] grid-cols-1 gap-3 sm:grid-cols-2 text-left">
+ <div className="mb-10 mt-4 grid w-full max-w-160 grid-cols-1 gap-4 text-left sm:grid-cols-2">
<StartCard
to={newDestinationPath('otel')}
icon={<Activity className="size-4" />}
@@ -59,7 +59,7 @@ const StartCard = ({
<Link
{...adminControl(AdminControl.EVENT_DESTINATIONS_DESTINATION_NEW_OPEN)}
to={to}
- className="flex gap-3 rounded-xl border p-4 transition-colors hover:bg-gray-3"
+ className="flex gap-3 rounded-lg border p-4 transition-colors hover:bg-gray-3"
>
<span
className={cn(
diff --git a/packages/web/src/app/routes/platform/infra/event-destinations/destination-form/destination-step.tsx b/packages/web/src/app/routes/platform/infra/event-destinations/destination-form/destination-step.tsx
index db40e5627d5..f8ff93196e8 100644
--- a/packages/web/src/app/routes/platform/infra/event-destinations/destination-form/destination-step.tsx
+++ b/packages/web/src/app/routes/platform/infra/event-destinations/destination-form/destination-step.tsx
@@ -1,6 +1,7 @@
import { t } from 'i18next';
import { UseFormReturn } from 'react-hook-form';
+import { SettingsPanel } from '@/app/components/admin';
import { FormField, FormItem, FormMessage } from '@/components/ui/form';
import { Label } from '@/components/ui/label';
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group';
@@ -26,58 +27,57 @@ export const DestinationStep = ({
render={({ field }) => {
const selectedKind = destinationKinds.kindOf(field.value);
return (
- <FormItem className="flex flex-col gap-4">
- <div className="flex flex-col gap-0.5">
- <span className="text-sm font-medium">
- {t('Where should events go?')}
- </span>
- <span className="text-sm text-gray-11">
- {t("This decides the format. You can't change it later.")}
- </span>
- </div>
- <RadioGroup
- className="grid grid-cols-1 gap-3 sm:grid-cols-2"
- value={selectedKind}
- disabled={isEdit}
- onValueChange={(value) => {
- const kind = destinationKinds.parse(value);
- if (kind === null || kind === selectedKind) {
- return;
- }
- field.onChange(destinationKinds.defaultFormatOf(kind));
- form.setValue('url', '');
- form.setValue('headers', []);
- form.clearErrors(['url', 'headers']);
- }}
- >
- {options.map((option) => {
- const isSelected = option.kind === selectedKind;
- const itemId = `destination-kind-${option.kind}`;
- return (
- <Label
- key={option.kind}
- htmlFor={itemId}
- className={cn(
- 'block rounded-xl border p-4 font-normal transition-shadow',
- isEdit ? 'cursor-not-allowed' : 'cursor-pointer',
- isSelected &&
- 'border-accent-9 ring-[3px] ring-accent-9/15',
- isEdit && !isSelected && 'opacity-60',
- )}
- >
- <DestinationKindCard
- option={option}
- isSelected={isSelected}
- trailing={
- <RadioGroupItem id={itemId} value={option.kind} />
- }
- />
- </Label>
- );
- })}
- </RadioGroup>
- <FormMessage />
- </FormItem>
+ <SettingsPanel
+ title={t('Where should events go?')}
+ description={t(
+ "This decides the format. You can't change it later.",
+ )}
+ >
+ <FormItem className="flex flex-col gap-4">
+ <RadioGroup
+ className="grid grid-cols-1 gap-3 sm:grid-cols-2"
+ value={selectedKind}
+ disabled={isEdit}
+ onValueChange={(value) => {
+ const kind = destinationKinds.parse(value);
+ if (kind === null || kind === selectedKind) {
+ return;
+ }
+ field.onChange(destinationKinds.defaultFormatOf(kind));
+ form.setValue('url', '');
+ form.setValue('headers', []);
+ form.clearErrors(['url', 'headers']);
+ }}
+ >
+ {options.map((option) => {
+ const isSelected = option.kind === selectedKind;
+ const itemId = `destination-kind-${option.kind}`;
+ return (
+ <Label
+ key={option.kind}
+ htmlFor={itemId}
+ className={cn(
+ 'block rounded-lg border p-4 font-normal transition-shadow',
+ isEdit ? 'cursor-not-allowed' : 'cursor-pointer',
+ isSelected &&
+ 'border-accent-9 ring-[3px] ring-accent-9/15',
+ isEdit && !isSelected && 'opacity-60',
+ )}
+ >
+ <DestinationKindCard
+ option={option}
+ isSelected={isSelected}
+ trailing={
+ <RadioGroupItem id={itemId} value={option.kind} />
+ }
+ />
+ </Label>
+ );
+ })}
+ </RadioGroup>
+ <FormMessage />
+ </FormItem>
+ </SettingsPanel>
);
}}
/>
diff --git a/packages/web/src/app/routes/platform/infra/event-destinations/destination-form/events-step.tsx b/packages/web/src/app/routes/platform/infra/event-destinations/destination-form/events-step.tsx
index 80daccbd84a..ef467161085 100644
--- a/packages/web/src/app/routes/platform/infra/event-destinations/destination-form/events-step.tsx
+++ b/packages/web/src/app/routes/platform/infra/event-destinations/destination-form/events-step.tsx
@@ -3,6 +3,7 @@ import { t } from 'i18next';
import { useId, useState } from 'react';
import { UseFormReturn } from 'react-hook-form';
+import { adminSurface } from '@/app/components/admin';
import { SearchInput } from '@/components/custom/search-input';
import { Button } from '@/components/ui/button';
import { Checkbox } from '@/components/ui/checkbox';
@@ -115,7 +116,12 @@ export const EventsStep = ({
</Button>
</div>
- <div className="grid min-h-[340px] grid-cols-[240px_minmax(0,1fr)] overflow-hidden rounded-xl border">
+ <div
+ className={cn(
+ adminSurface.card,
+ 'grid min-h-85 grid-cols-[240px_minmax(0,1fr)] overflow-hidden',
+ )}
+ >
<nav className="flex flex-col gap-0.5 border-r bg-gray-3 p-1.5">
{visibleGroups.map((group) => {
const isActive = group.key === activeGroup?.key;
@@ -129,7 +135,7 @@ export const EventsStep = ({
onClick={() => setActiveGroupKey(group.key)}
aria-current={isActive ? 'true' : undefined}
className={cn(
- 'flex h-[34px] items-center gap-2.5 rounded-md px-2.5 text-left text-sm transition-colors',
+ 'flex h-8 items-center gap-2 rounded-md px-2.5 text-left text-sm transition-colors',
isActive
? 'bg-panel font-semibold text-gray-12'
: 'hover:bg-gray-4',
@@ -147,7 +153,7 @@ export const EventsStep = ({
})}
</nav>
- <div className="flex flex-col gap-1 px-[18px] py-3.5">
+ <div className="flex flex-col gap-1 px-5 py-4">
{activeGroup === undefined ? (
<p className="py-6 text-center text-sm text-gray-11">
{t('No events match your search')}
diff --git a/packages/web/src/app/routes/platform/infra/event-destinations/destination-form/index.tsx b/packages/web/src/app/routes/platform/infra/event-destinations/destination-form/index.tsx
index d658a002fd2..8323758ec20 100644
--- a/packages/web/src/app/routes/platform/infra/event-destinations/destination-form/index.tsx
+++ b/packages/web/src/app/routes/platform/infra/event-destinations/destination-form/index.tsx
@@ -6,7 +6,6 @@ import { Check } from 'lucide-react';
import { Fragment, useRef, useState } from 'react';
import { FieldErrors, useForm, useWatch } from 'react-hook-form';
import {
- Link,
Navigate,
useNavigate,
useParams,
@@ -14,20 +13,18 @@ import {
} from 'react-router-dom';
import { toast } from 'sonner';
-import { CenteredPage } from '@/app/components/centered-page';
+import {
+ AdminPage,
+ AdminPageHeader,
+ adminPageResources,
+ adminSurface,
+ adminLayout,
+} from '@/app/components/admin';
import { DataFetchErrorState } from '@/components/custom/data-fetch-error-state';
import {
LeaveWithoutSavingDialog,
useWarnBeforeLosingChanges,
} from '@/components/custom/leave-without-saving';
-import {
- Breadcrumb,
- BreadcrumbItem,
- BreadcrumbLink,
- BreadcrumbList,
- BreadcrumbPage,
- BreadcrumbSeparator,
-} from '@/components/ui/breadcrumb';
import { Button } from '@/components/ui/button';
import { Form } from '@/components/ui/form';
import { SkeletonList } from '@/components/ui/skeleton';
@@ -67,9 +64,9 @@ const EditDestination = ({ destinationId }: { destinationId: string }) => {
switch (opened.status) {
case 'loading':
return (
- <div className="w-full mx-auto py-6 px-6">
- <SkeletonList numberOfItems={4} className="w-full h-[72px]" />
- </div>
+ <AdminPage width="content">
+ <SkeletonList numberOfItems={4} className="h-18 w-full" />
+ </AdminPage>
);
case 'error':
return (
@@ -192,75 +189,70 @@ const DestinationForm = ({
});
return (
- <CenteredPage
- widthClassName="max-w-full px-6"
- breadcrumb={
- <Breadcrumb>
- <BreadcrumbList>
- <BreadcrumbItem>
- <BreadcrumbLink asChild>
- <Link to={EVENT_STREAMING_PATH}>{t('Event Streaming')}</Link>
- </BreadcrumbLink>
- </BreadcrumbItem>
- <BreadcrumbSeparator />
- <BreadcrumbItem>
- <BreadcrumbPage>
- {isEdit ? t('Edit destination') : t('New destination')}
- </BreadcrumbPage>
- </BreadcrumbItem>
- </BreadcrumbList>
- </Breadcrumb>
- }
- title={isEdit ? t('Edit destination') : t('New destination')}
+ <AdminPage
+ width="content"
footer={
- <>
- <Button
- type="button"
- variant="outline"
- onClick={() => navigate(EVENT_STREAMING_PATH)}
- disabled={isSaving}
+ <div
+ className={cn(adminSurface.saveBar, 'sticky bottom-0 z-20 mt-auto')}
+ >
+ <div
+ className={cn(
+ adminLayout.contentWidth,
+ 'flex w-full flex-wrap items-center justify-end gap-2 px-4 py-3 md:px-6',
+ )}
>
- {t('Cancel')}
- </Button>
- <span className="flex-1" />
- <span className="self-center pr-2 text-sm text-gray-11">
- {footerStatus}
- </span>
- {!isEdit && stepIndex > DESTINATION_STEP && (
+ <span className="min-w-0 flex-1 text-sm text-gray-11">
+ {footerStatus}
+ </span>
<Button
type="button"
variant="outline"
- onClick={() => setStepIndex(stepIndex - 1)}
- >
- {t('Back')}
- </Button>
- )}
- {!isEdit && !isLastStep && (
- <Button type="button" onClick={goToNextStep}>
- {t('Continue')}
- </Button>
- )}
- {showSubmit && (
- <Button
- {...adminControl(
- isEdit
- ? AdminControl.EVENT_DESTINATIONS_DESTINATION_UPDATE_SUBMIT
- : AdminControl.EVENT_DESTINATIONS_DESTINATION_CREATE_SUBMIT,
- )}
- type="button"
- loading={isSaving}
+ onClick={() => navigate(EVENT_STREAMING_PATH)}
disabled={isSaving}
- onClick={form.handleSubmit(handleSubmit, handleInvalidSubmit)}
>
- {isEdit ? t('Save changes') : t('Create destination')}
+ {t('Cancel')}
</Button>
- )}
- </>
+ {!isEdit && stepIndex > DESTINATION_STEP && (
+ <Button
+ type="button"
+ variant="outline"
+ onClick={() => setStepIndex(stepIndex - 1)}
+ >
+ {t('Back')}
+ </Button>
+ )}
+ {!isEdit && !isLastStep && (
+ <Button type="button" onClick={goToNextStep}>
+ {t('Continue')}
+ </Button>
+ )}
+ {showSubmit && (
+ <Button
+ {...adminControl(
+ isEdit
+ ? AdminControl.EVENT_DESTINATIONS_DESTINATION_UPDATE_SUBMIT
+ : AdminControl.EVENT_DESTINATIONS_DESTINATION_CREATE_SUBMIT,
+ )}
+ type="button"
+ loading={isSaving}
+ disabled={isSaving}
+ onClick={form.handleSubmit(handleSubmit, handleInvalidSubmit)}
+ >
+ {isEdit ? t('Save changes') : t('Create destination')}
+ </Button>
+ )}
+ </div>
+ </div>
}
>
+ <AdminPageHeader
+ back={{ label: t('Event Streaming'), to: EVENT_STREAMING_PATH }}
+ title={isEdit ? t('Edit destination') : t('New destination')}
+ resources={adminPageResources.eventStreaming}
+ />
<Form {...form}>
<form
- className="flex max-w-[50rem] flex-col gap-6"
+ className="flex flex-col gap-6"
onSubmit={(event) => event.preventDefault()}
>
<StepHeader
@@ -295,7 +287,7 @@ const DestinationForm = ({
onKeepEditing={() => leaveBlocker.reset?.()}
onDiscard={() => leaveBlocker.proceed?.()}
/>
- </CenteredPage>
+ </AdminPage>
);
};
diff --git a/packages/web/src/app/routes/platform/infra/event-destinations/destination-form/open-telemetry-connection.tsx b/packages/web/src/app/routes/platform/infra/event-destinations/destination-form/open-telemetry-connection.tsx
index ac3c9b5d165..87401c2d9f0 100644
--- a/packages/web/src/app/routes/platform/infra/event-destinations/destination-form/open-telemetry-connection.tsx
+++ b/packages/web/src/app/routes/platform/infra/event-destinations/destination-form/open-telemetry-connection.tsx
@@ -4,6 +4,7 @@ import { t } from 'i18next';
import { RefObject } from 'react';
import { UseFormReturn, useWatch } from 'react-hook-form';
+import { SettingsPanel } from '@/app/components/admin';
import { Badge } from '@/components/ui/badge';
import {
FormControl,
@@ -39,113 +40,115 @@ export const OpenTelemetryConnection = ({
return (
<div className="flex flex-col gap-6">
- <FormField
- control={form.control}
- name="url"
- rules={{ deps: ['headers'] }}
- render={({ field }) => (
- <FormItem>
- <FormLabel showRequiredIndicator>{t('Endpoint URL')}</FormLabel>
- <FormControl>
- <Input
- className="font-mono"
- placeholder="https://otlp.datadoghq.com/v1/logs"
- {...field}
- onChange={(event) => {
- field.onChange(event);
- const currentFormat = form.getValues('format');
- const next = destinationFormUtils.resolveOtlpFormat({
- url: event.target.value,
- format: currentFormat,
- isAutoSwitched: isFormatAutoSwitched.current,
- });
- isFormatAutoSwitched.current = next.isAutoSwitched;
- if (next.format !== currentFormat) {
- form.setValue('format', next.format, {
- shouldDirty: true,
+ <SettingsPanel>
+ <FormField
+ control={form.control}
+ name="url"
+ rules={{ deps: ['headers'] }}
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel showRequiredIndicator>{t('Endpoint URL')}</FormLabel>
+ <FormControl>
+ <Input
+ className="font-mono"
+ placeholder="https://otlp.datadoghq.com/v1/logs"
+ {...field}
+ onChange={(event) => {
+ field.onChange(event);
+ const currentFormat = form.getValues('format');
+ const next = destinationFormUtils.resolveOtlpFormat({
+ url: event.target.value,
+ format: currentFormat,
+ isAutoSwitched: isFormatAutoSwitched.current,
});
- }
- }}
- />
- </FormControl>
- <FormDescription>
- {t("Paste your tool's full OTLP logs URL.")}
- </FormDescription>
- {isWebhookUrl && (
- <p className="text-xs text-warning-11">
- {t(
- 'This URL is a flow webhook, which accepts only JSON, so Protobuf is off. A generated handler flow reads Raw JSON: to use one, send to a webhook instead.',
- )}
- </p>
- )}
- {!isWebhookUrl && !isLogsEndpoint(url) && (
- <p className="text-xs text-warning-11">
- {t(
- 'This URL does not end in /logs. An OTLP receiver expects the full logs URL.',
- )}
- </p>
- )}
- <FormMessage />
- </FormItem>
- )}
- />
-
- <HeadersField
- form={form}
- storedHeaderNames={storedHeaderNames}
- keyPlaceholder="DD-API-KEY"
- />
-
- <FormField
- control={form.control}
- name="format"
- render={({ field }) => (
- <FormItem className="flex flex-col gap-2.5">
- <div className="flex flex-col gap-0.5">
- <FormLabel>{t('Encoding')}</FormLabel>
+ isFormatAutoSwitched.current = next.isAutoSwitched;
+ if (next.format !== currentFormat) {
+ form.setValue('format', next.format, {
+ shouldDirty: true,
+ });
+ }
+ }}
+ />
+ </FormControl>
<FormDescription>
- {t("Check your tool's docs if you're not sure.")}
+ {t("Paste your tool's full OTLP logs URL.")}
</FormDescription>
- </div>
- <RadioGroup
- className="flex gap-6"
- value={field.value}
- onValueChange={(value) => {
- const encoding = OTLP_FORMATS.find(
- (candidate) => candidate === value,
- );
- if (!isNil(encoding)) {
- isFormatAutoSwitched.current = false;
- field.onChange(encoding);
- }
- }}
- >
- <div className="flex items-center gap-2">
- <RadioGroupItem
- id="otlp-protobuf"
- value={EventDestinationFormat.OTLP_PROTOBUF}
- disabled={isWebhookUrl}
- />
- <Label htmlFor="otlp-protobuf" className="font-normal">
- {t('Protobuf')}
- </Label>
- <Badge>{t('Recommended')}</Badge>
- </div>
- <div className="flex items-center gap-2">
- <RadioGroupItem
- id="otlp-json"
- value={EventDestinationFormat.OTLP_JSON}
- />
- <Label htmlFor="otlp-json" className="font-normal">
- {t('JSON')}
- </Label>
+ {isWebhookUrl && (
+ <p className="text-xs text-warning-11">
+ {t(
+ 'This URL is a flow webhook, which accepts only JSON, so Protobuf is off. A generated handler flow reads Raw JSON: to use one, send to a webhook instead.',
+ )}
+ </p>
+ )}
+ {!isWebhookUrl && !isLogsEndpoint(url) && (
+ <p className="text-xs text-warning-11">
+ {t(
+ 'This URL does not end in /logs. An OTLP receiver expects the full logs URL.',
+ )}
+ </p>
+ )}
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+
+ <HeadersField
+ form={form}
+ storedHeaderNames={storedHeaderNames}
+ keyPlaceholder="DD-API-KEY"
+ />
+
+ <FormField
+ control={form.control}
+ name="format"
+ render={({ field }) => (
+ <FormItem className="flex flex-col gap-2.5">
+ <div className="flex flex-col gap-0.5">
+ <FormLabel>{t('Encoding')}</FormLabel>
+ <FormDescription>
+ {t("Check your tool's docs if you're not sure.")}
+ </FormDescription>
</div>
- </RadioGroup>
- </FormItem>
- )}
- />
+ <RadioGroup
+ className="flex gap-6"
+ value={field.value}
+ onValueChange={(value) => {
+ const encoding = OTLP_FORMATS.find(
+ (candidate) => candidate === value,
+ );
+ if (!isNil(encoding)) {
+ isFormatAutoSwitched.current = false;
+ field.onChange(encoding);
+ }
+ }}
+ >
+ <div className="flex items-center gap-2">
+ <RadioGroupItem
+ id="otlp-protobuf"
+ value={EventDestinationFormat.OTLP_PROTOBUF}
+ disabled={isWebhookUrl}
+ />
+ <Label htmlFor="otlp-protobuf" className="font-normal">
+ {t('Protobuf')}
+ </Label>
+ <Badge>{t('Recommended')}</Badge>
+ </div>
+ <div className="flex items-center gap-2">
+ <RadioGroupItem
+ id="otlp-json"
+ value={EventDestinationFormat.OTLP_JSON}
+ />
+ <Label htmlFor="otlp-json" className="font-normal">
+ {t('JSON')}
+ </Label>
+ </div>
+ </RadioGroup>
+ </FormItem>
+ )}
+ />
- <EncryptedHeadersNotice />
+ <EncryptedHeadersNotice />
+ </SettingsPanel>
<TestEventCard
form={form}
diff --git a/packages/web/src/app/routes/platform/infra/event-destinations/destination-form/test-event-card.tsx b/packages/web/src/app/routes/platform/infra/event-destinations/destination-form/test-event-card.tsx
index a7df7eb3f11..0b91b0d3681 100644
--- a/packages/web/src/app/routes/platform/infra/event-destinations/destination-form/test-event-card.tsx
+++ b/packages/web/src/app/routes/platform/infra/event-destinations/destination-form/test-event-card.tsx
@@ -9,7 +9,7 @@ import { Send } from 'lucide-react';
import { useState } from 'react';
import { UseFormReturn, useFormState, useWatch } from 'react-hook-form';
-import { Badge } from '@/components/ui/badge';
+import { SettingsPanel, StatusDot } from '@/app/components/admin';
import { Button } from '@/components/ui/button';
import {
Select,
@@ -86,11 +86,7 @@ export const TestEventCard = ({
!isNil(headerBlocker);
return (
- <div className="flex flex-col gap-3 rounded-xl border p-4">
- <div className="flex flex-col gap-0.5">
- <span className="text-sm font-medium">{t('Send test event')}</span>
- <span className="text-sm text-gray-11">{description}</span>
- </div>
+ <SettingsPanel title={t('Send test event')} description={description}>
<div className="flex gap-2">
<Select
value={activeEvent ?? ''}
@@ -139,10 +135,8 @@ export const TestEventCard = ({
)}
{isCurrent && !isNil(testError) && (
- <div className="flex flex-col gap-2 border-t pt-3">
- <Badge className="self-start" variant="destructive">
- {t('Failed')}
- </Badge>
+ <div className="flex flex-col gap-2 border-t pt-4">
+ <StatusDot tone="danger">{t('Failed')}</StatusDot>
<p className="text-xs text-danger-11">
{destinationErrors.describe(testError)}
</p>
@@ -150,22 +144,21 @@ export const TestEventCard = ({
)}
{isCurrent && !isNil(testResult) && (
- <div className="flex flex-col gap-2 border-t pt-3">
+ <div className="flex flex-col gap-2 border-t pt-4">
<div className="flex items-center gap-2.5">
{!isNil(testResult.status) && (
- <Badge
- variant={
+ <StatusDot
+ tone={
testResult.status < SUCCESS_STATUS_CEILING
? 'success'
- : 'destructive'
+ : 'danger'
}
>
- <span className="size-1.5 rounded-full bg-current" />
{testResult.status}
- </Badge>
+ </StatusDot>
)}
{!isNil(testResult.errorCode) && (
- <Badge variant="destructive">{t('Failed')}</Badge>
+ <StatusDot tone="danger">{t('Failed')}</StatusDot>
)}
<span className="text-sm text-gray-11">
{t('{duration} ms', { duration: testResult.durationMs })}
@@ -187,7 +180,7 @@ export const TestEventCard = ({
</pre>
</div>
)}
- </div>
+ </SettingsPanel>
);
};
diff --git a/packages/web/src/app/routes/platform/infra/event-destinations/destination-form/webhook-connection.tsx b/packages/web/src/app/routes/platform/infra/event-destinations/destination-form/webhook-connection.tsx
index de4483aef72..0c9fca86252 100644
--- a/packages/web/src/app/routes/platform/infra/event-destinations/destination-form/webhook-connection.tsx
+++ b/packages/web/src/app/routes/platform/infra/event-destinations/destination-form/webhook-connection.tsx
@@ -5,8 +5,8 @@ import { ExternalLink, Info, Plus, Workflow } from 'lucide-react';
import { UseFormReturn, useWatch } from 'react-hook-form';
import { toast } from 'sonner';
+import { SettingsPanel, StatusDot } from '@/app/components/admin';
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';
-import { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
import {
FormControl,
@@ -68,71 +68,76 @@ export const WebhookConnection = ({
</>
)}
- <FormField
- control={form.control}
- name="url"
- rules={{ deps: ['headers'] }}
- render={({ field }) => (
- <FormItem>
- <FormLabel showRequiredIndicator>
- {isEdit || isHandlerFlow
- ? t('Endpoint URL')
- : t('Use your own webhook URL')}
- </FormLabel>
- <FormControl>
- <Input placeholder="https://" {...field} />
- </FormControl>
- {url === '' && (
- <FormDescription>
+ <SettingsPanel>
+ <FormField
+ control={form.control}
+ name="url"
+ rules={{ deps: ['headers'] }}
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel showRequiredIndicator>
+ {isEdit || isHandlerFlow
+ ? t('Endpoint URL')
+ : t('Use your own webhook URL')}
+ </FormLabel>
+ <FormControl>
+ <Input placeholder="https://" {...field} />
+ </FormControl>
+ {url === '' && (
+ <FormDescription>
+ {t(
+ 'Any endpoint that accepts a JSON POST. Headers and a test send appear after you paste a URL.',
+ )}
+ </FormDescription>
+ )}
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+
+ {isHandlerFlow && (
+ <>
+ <HandlerFlowCard flowId={handlerFlowId} />
+ <Alert>
+ <Info className="size-4" />
+ <AlertTitle>
+ {isEdit
+ ? t('Keep this flow published so it receives events')
+ : t('Publish the flow before you create the destination')}
+ </AlertTitle>
+ <AlertDescription>
{t(
- 'Any endpoint that accepts a JSON POST. Headers and a test send appear after you paste a URL.',
+ 'The flow receives each selected event as a plain JSON object.',
)}
- </FormDescription>
- )}
- <FormMessage />
- </FormItem>
+ </AlertDescription>
+ </Alert>
+ </>
)}
- />
- {isHandlerFlow && (
- <>
- <HandlerFlowCard flowId={handlerFlowId} />
- <Alert>
- <Info className="size-4" />
- <AlertTitle>
- {isEdit
- ? t('Keep this flow published so it receives events')
- : t('Publish the flow before you create the destination')}
- </AlertTitle>
- <AlertDescription>
- {t(
- 'The flow receives each selected event as a plain JSON object.',
- )}
- </AlertDescription>
- </Alert>
- </>
- )}
+ {url !== '' && (
+ <>
+ <HeadersField
+ form={form}
+ storedHeaderNames={storedHeaderNames}
+ keyPlaceholder="Authorization"
+ />
+ <EncryptedHeadersNotice />
+ </>
+ )}
+ </SettingsPanel>
{url !== '' && (
- <>
- <HeadersField
- form={form}
- storedHeaderNames={storedHeaderNames}
- keyPlaceholder="Authorization"
- />
- <EncryptedHeadersNotice />
- <TestEventCard
- form={form}
- description={
- isHandlerFlow
- ? t(
- 'Sends a sample to the handler flow, which runs it like any other event. Publish the flow first, or the test answers 404.',
- )
- : t('Sends one of your selected events to the endpoint above.')
- }
- storedHeaderNames={storedHeaderNames}
- />
- </>
+ <TestEventCard
+ form={form}
+ description={
+ isHandlerFlow
+ ? t(
+ 'Sends a sample to the handler flow, which runs it like any other event. Publish the flow first, or the test answers 404.',
+ )
+ : t('Sends one of your selected events to the endpoint above.')
+ }
+ storedHeaderNames={storedHeaderNames}
+ />
)}
</div>
);
@@ -183,32 +188,34 @@ const GenerateHandlerFlowCard = ({
};
return (
- <div className="flex flex-col items-center gap-3 rounded-xl border p-6 text-center">
- <span className="flex size-10 items-center justify-center rounded-xl bg-accent-3 text-accent-11">
- <Workflow className="size-[18px]" />
- </span>
- <div className="flex max-w-[460px] flex-col gap-1">
- <span className="text-sm font-medium">
- {t('Create a handler flow')}
- </span>
- <span className="text-sm leading-normal text-gray-11">
- {t(
- "We'll create a flow with a webhook trigger, loaded with sample data for {count, plural, =1 {the event} other {the # events}} you picked. Add steps for Slack, Gmail, or any app.",
- { count: selectedEvents.length },
- )}
+ <SettingsPanel>
+ <div className="flex flex-col items-center gap-4 py-2 text-center">
+ <span className="flex size-10 items-center justify-center rounded-lg bg-accent-3 text-accent-11">
+ <Workflow className="size-5" />
</span>
+ <div className="flex max-w-md flex-col gap-1">
+ <span className="text-sm font-medium">
+ {t('Create a handler flow')}
+ </span>
+ <span className="text-sm leading-normal text-gray-11">
+ {t(
+ "We'll create a flow with a webhook trigger, loaded with sample data for {count, plural, =1 {the event} other {the # events}} you picked. Add steps for Slack, Gmail, or any app.",
+ { count: selectedEvents.length },
+ )}
+ </span>
+ </div>
+ <Button
+ {...adminControl(AdminControl.EVENT_DESTINATIONS_HANDLER_FLOW_RUN)}
+ type="button"
+ onClick={handleGenerate}
+ disabled={isImporting || selectedEvents.length === 0}
+ loading={isImporting}
+ >
+ <Plus className="size-4" />
+ {t('Generate handler flow')}
+ </Button>
</div>
- <Button
- {...adminControl(AdminControl.EVENT_DESTINATIONS_HANDLER_FLOW_RUN)}
- type="button"
- onClick={handleGenerate}
- disabled={isImporting || selectedEvents.length === 0}
- loading={isImporting}
- >
- <Plus className="size-4" />
- {t('Generate handler flow')}
- </Button>
- </div>
+ </SettingsPanel>
);
};
@@ -216,7 +223,7 @@ const HandlerFlowCard = ({ flowId }: { flowId: string }) => {
const { data: flow } = flowHooks.useGetFlow({ flowId });
return (
- <div className="flex w-full items-center gap-3 rounded-xl border p-4">
+ <div className="flex w-full items-center gap-3 rounded-lg border p-4">
<span className="flex size-8 shrink-0 items-center justify-center rounded-md bg-accent-3 text-accent-11">
<Workflow className="size-4" />
</span>
@@ -226,9 +233,11 @@ const HandlerFlowCard = ({ flowId }: { flowId: string }) => {
</span>
</div>
{!isNil(flow) && (
- <Badge variant={isNil(flow.publishedVersionId) ? 'warning' : 'success'}>
+ <StatusDot
+ tone={isNil(flow.publishedVersionId) ? 'warning' : 'success'}
+ >
{isNil(flow.publishedVersionId) ? t('Draft') : t('Published')}
- </Badge>
+ </StatusDot>
)}
<Button
{...adminControl(AdminControl.EVENT_DESTINATIONS_HANDLER_FLOW_LINK)}
diff --git a/packages/web/src/app/routes/platform/infra/event-destinations/index.tsx b/packages/web/src/app/routes/platform/infra/event-destinations/index.tsx
index 127004cfaba..20ebeeaefdd 100644
--- a/packages/web/src/app/routes/platform/infra/event-destinations/index.tsx
+++ b/packages/web/src/app/routes/platform/infra/event-destinations/index.tsx
@@ -13,9 +13,14 @@ import { useCallback, useMemo } from 'react';
import { Link, useNavigate } from 'react-router-dom';
import { toast } from 'sonner';
-import { DashboardPageHeader } from '@/app/components/dashboard-page-header';
+import {
+ AdminDataTable,
+ AdminPage,
+ AdminPageHeader,
+ adminPageResources,
+} from '@/app/components/admin';
import { AnimatedIconButton } from '@/components/custom/animated-icon-button';
-import { DataTable, RowDataWithActions } from '@/components/custom/data-table';
+import { RowDataWithActions } from '@/components/custom/data-table';
import { DataTableColumnHeader } from '@/components/custom/data-table/data-table-column-header';
import { TextWithTooltip } from '@/components/custom/text-with-tooltip';
import { PlusIcon } from '@/components/icons/plus';
@@ -183,12 +188,18 @@ const EventDestinationsPage = () => {
);
return (
- <>
- <DashboardPageHeader
+ <AdminPage>
+ <AdminPageHeader
title={t('Event Streaming')}
+ badge={
+ <span className="text-sm tabular-nums text-gray-11">
+ {t('destinationsCount', { count: destinations.length })}
+ </span>
+ }
description={t(
'Stream every audit event in OpenTelemetry (OTLP) format to Datadog, PostHog, Grafana Loki, or any OTLP backend. Or send it as raw JSON to a webhook or a handler flow.',
)}
+ resources={adminPageResources.eventStreaming}
>
<AnimatedIconButton
{...adminControl(
@@ -201,40 +212,28 @@ const EventDestinationsPage = () => {
>
<Link to={`${EVENT_STREAMING_PATH}/new`}>{t('New Destination')}</Link>
</AnimatedIconButton>
- </DashboardPageHeader>
- <div className="flex w-full flex-col px-4 pb-6">
- <DataTable
- bordered={true}
- columns={columns}
- page={{ data: destinations, next: null, previous: null }}
- isLoading={isLoading}
- isError={isError}
- errorStateEntity={t('destinations')}
- onRetry={eventDestinationsCollectionUtils.refetch}
- hidePagination={true}
- onRowClick={(row, newWindow) =>
- newWindow
- ? openNewWindow(`${EVENT_STREAMING_PATH}/${row.id}`)
- : navigate(`${EVENT_STREAMING_PATH}/${row.id}`)
- }
- toolbarButtons={[
- <span key="count" className="shrink-0 text-xs text-gray-11">
- {t('destinationsCount', { count: destinations.length })}
- </span>,
- ]}
- emptyStateTextTitle={t('No destinations yet')}
- emptyStateTextDescription={t(
- 'Stream every audit event on your platform over OpenTelemetry (OTLP), or send it to a flow.',
- )}
- emptyStateIcon={
- <span className="mb-1 mt-10 flex size-11 items-center justify-center rounded-xl bg-gray-3">
- <Radio className="size-5" />
- </span>
- }
- emptyStateAction={<DestinationStartCards />}
- />
- </div>
- </>
+ </AdminPageHeader>
+ <AdminDataTable
+ columns={columns}
+ page={{ data: destinations, next: null, previous: null }}
+ isLoading={isLoading}
+ isError={isError}
+ errorStateEntity={t('destinations')}
+ onRetry={eventDestinationsCollectionUtils.refetch}
+ hidePagination={true}
+ onRowClick={(row, newWindow) =>
+ newWindow
+ ? openNewWindow(`${EVENT_STREAMING_PATH}/${row.id}`)
+ : navigate(`${EVENT_STREAMING_PATH}/${row.id}`)
+ }
+ emptyStateTextTitle={t('No destinations yet')}
+ emptyStateTextDescription={t(
+ 'Stream every audit event on your platform over OpenTelemetry (OTLP), or send it to a flow.',
+ )}
+ emptyStateIcon={<Radio />}
+ emptyStateAction={<DestinationStartCards />}
+ />
+ </AdminPage>
);
};
diff --git a/packages/web/src/app/routes/platform/infra/health/components/daily-health-strip.tsx b/packages/web/src/app/routes/platform/infra/health/components/daily-health-strip.tsx
index 29c0efa6875..96e1473e915 100644
--- a/packages/web/src/app/routes/platform/infra/health/components/daily-health-strip.tsx
+++ b/packages/web/src/app/routes/platform/infra/health/components/daily-health-strip.tsx
@@ -3,14 +3,8 @@ import dayjs from 'dayjs';
import { t } from 'i18next';
import { ArrowUpRight } from 'lucide-react';
+import { SettingsPanel } from '@/app/components/admin';
import { Button } from '@/components/ui/button';
-import {
- Card,
- CardContent,
- CardDescription,
- CardHeader,
- CardTitle,
-} from '@/components/ui/card';
import { Skeleton } from '@/components/ui/skeleton';
import {
Tooltip,
@@ -34,87 +28,81 @@ export function DailyHealthStrip({ onSeeRuns }: DailyHealthStripProps) {
const days = data?.days ?? [];
return (
- <Card>
- <CardHeader className="pb-2">
- <div className="flex items-start justify-between gap-2">
- <div className="flex flex-col gap-1">
- <CardTitle className="text-base font-medium">
- {t('Daily job health')}
- </CardTitle>
- <CardDescription>
- {t('Stability of platform jobs over the last 30 days.')}
- </CardDescription>
- </div>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button variant="ghost" size="icon-xs" onClick={onSeeRuns}>
- <ArrowUpRight className="h-4 w-4" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>{t('View runs health')}</TooltipContent>
- </Tooltip>
- </div>
- </CardHeader>
- <CardContent>
- {isLoading ? (
- <Skeleton className="h-10 w-full" />
- ) : (
- <div className="flex items-end gap-1 h-10">
- {days.map((day) => {
- const healthy = isHealthy(day);
- return (
- <Tooltip key={day.day}>
- <TooltipTrigger asChild>
- <div
- className={cn(
- 'flex-1 h-full rounded-md transition-colors',
- healthy
- ? 'bg-success-9 hover:bg-success-9/80'
- : 'bg-danger-9 hover:bg-danger-9/80',
- )}
- />
- </TooltipTrigger>
- <TooltipContent className="flex flex-col gap-1.5 min-w-[14rem] p-3 text-sm">
- <span className="text-sm font-semibold">
- {dayjs(day.day).format('MMM DD, YYYY')}
- </span>
- {healthy ? (
- <span className="text-gray-11">{t('Healthy')}</span>
- ) : (
- <div className="flex flex-col gap-1">
- <div className="flex items-center justify-between gap-6">
- <span className="text-gray-11">
- {t('Internal errors')}
- </span>
- <span className="font-medium tabular-nums">
- {day.internalErrors}
- </span>
- </div>
- <div className="flex items-center justify-between gap-6">
- <span className="text-gray-11">
- {t('Affected flows')}
- </span>
- <span className="font-medium tabular-nums">
- {day.affectedFlows}
- </span>
- </div>
- <div className="flex items-center justify-between gap-6">
- <span className="text-gray-11">
- {t('Stuck jobs')}
- </span>
- <span className="font-medium tabular-nums">
- {day.stuckJobs}
- </span>
- </div>
- </div>
+ <SettingsPanel
+ title={t('Daily job health')}
+ description={t('Stability of platform jobs over the last 30 days.')}
+ action={
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ variant="ghost"
+ size="icon-xs"
+ aria-label={t('View runs health')}
+ onClick={onSeeRuns}
+ >
+ <ArrowUpRight className="size-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>{t('View runs health')}</TooltipContent>
+ </Tooltip>
+ }
+ >
+ {isLoading ? (
+ <Skeleton className="h-10 w-full" />
+ ) : (
+ <div className="flex items-end gap-1 h-10">
+ {days.map((day) => {
+ const healthy = isHealthy(day);
+ return (
+ <Tooltip key={day.day}>
+ <TooltipTrigger asChild>
+ <div
+ className={cn(
+ 'flex-1 h-full rounded-md transition-colors',
+ healthy
+ ? 'bg-success-9 hover:bg-success-9/80'
+ : 'bg-danger-9 hover:bg-danger-9/80',
)}
- </TooltipContent>
- </Tooltip>
- );
- })}
- </div>
- )}
- </CardContent>
- </Card>
+ />
+ </TooltipTrigger>
+ <TooltipContent className="flex flex-col gap-1.5 min-w-[14rem] p-3 text-sm">
+ <span className="text-sm font-semibold">
+ {dayjs(day.day).format('MMM DD, YYYY')}
+ </span>
+ {healthy ? (
+ <span className="text-gray-11">{t('Healthy')}</span>
+ ) : (
+ <div className="flex flex-col gap-1">
+ <div className="flex items-center justify-between gap-6">
+ <span className="text-gray-11">
+ {t('Internal errors')}
+ </span>
+ <span className="font-medium tabular-nums">
+ {day.internalErrors}
+ </span>
+ </div>
+ <div className="flex items-center justify-between gap-6">
+ <span className="text-gray-11">
+ {t('Affected flows')}
+ </span>
+ <span className="font-medium tabular-nums">
+ {day.affectedFlows}
+ </span>
+ </div>
+ <div className="flex items-center justify-between gap-6">
+ <span className="text-gray-11">{t('Stuck jobs')}</span>
+ <span className="font-medium tabular-nums">
+ {day.stuckJobs}
+ </span>
+ </div>
+ </div>
+ )}
+ </TooltipContent>
+ </Tooltip>
+ );
+ })}
+ </div>
+ )}
+ </SettingsPanel>
);
}
diff --git a/packages/web/src/app/routes/platform/infra/health/components/internal-errors-table.tsx b/packages/web/src/app/routes/platform/infra/health/components/internal-errors-table.tsx
index 427fc390a6c..3e2285de25f 100644
--- a/packages/web/src/app/routes/platform/infra/health/components/internal-errors-table.tsx
+++ b/packages/web/src/app/routes/platform/infra/health/components/internal-errors-table.tsx
@@ -3,13 +3,7 @@ import { t } from 'i18next';
import { CircleCheck } from 'lucide-react';
import { useNavigate } from 'react-router-dom';
-import {
- Card,
- CardContent,
- CardDescription,
- CardHeader,
- CardTitle,
-} from '@/components/ui/card';
+import { SettingsPanel } from '@/app/components/admin';
import { Skeleton } from '@/components/ui/skeleton';
import {
Table,
@@ -35,71 +29,64 @@ export function InternalErrorsTable({
const total = errors.reduce((sum, error) => sum + error.count, 0);
return (
- <Card>
- <CardHeader className="pb-2">
- <CardTitle className="flex items-center justify-between text-base font-medium">
- <span>{t('Internal errors — impact')}</span>
- {total > 0 && (
- <span className="text-sm font-normal text-gray-11">
- {t('{count} errors', { count: total })}
- </span>
- )}
- </CardTitle>
- <CardDescription>
- {t(
- 'Internal errors are failures inside Activepieces itself (engine or worker), not in your flow logic. Grouped by the project and flow they affected.',
- )}
- </CardDescription>
- </CardHeader>
- <CardContent>
- {isLoading ? (
- <Skeleton className="h-24 w-full" />
- ) : errors.length === 0 ? (
- <div className="flex flex-col items-center justify-center gap-2 py-8 text-gray-11">
- <CircleCheck className="size-8 text-success-11" />
- <p className="text-sm">{t('No internal errors in this period')}</p>
- </div>
- ) : (
- <Table>
- <TableHeader>
- <TableRow>
- <TableHead>{t('Project')}</TableHead>
- <TableHead>{t('Flow')}</TableHead>
- <TableHead className="text-right">{t('Errors')}</TableHead>
- <TableHead className="text-right">{t('Share')}</TableHead>
+ <SettingsPanel
+ title={t('Internal errors — impact')}
+ description={t(
+ 'Internal errors are failures inside Activepieces itself (engine or worker), not in your flow logic. Grouped by the project and flow they affected.',
+ )}
+ action={
+ total > 0 ? (
+ <span className="text-sm text-gray-11">
+ {t('{count} errors', { count: total })}
+ </span>
+ ) : undefined
+ }
+ >
+ {isLoading ? (
+ <Skeleton className="h-24 w-full" />
+ ) : errors.length === 0 ? (
+ <div className="flex flex-col items-center justify-center gap-2 py-8 text-gray-11">
+ <CircleCheck className="size-8 text-success-11" />
+ <p className="text-sm">{t('No internal errors in this period')}</p>
+ </div>
+ ) : (
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead>{t('Project')}</TableHead>
+ <TableHead>{t('Flow')}</TableHead>
+ <TableHead className="text-right">{t('Errors')}</TableHead>
+ <TableHead className="text-right">{t('Share')}</TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {errors.map((error) => (
+ <TableRow
+ key={`${error.projectId}-${error.flowId}`}
+ className="cursor-pointer"
+ onClick={() =>
+ navigate(
+ `/projects/${error.projectId}/runs?flowId=${error.flowId}`,
+ )
+ }
+ >
+ <TableCell className="text-gray-11">
+ {error.projectName}
+ </TableCell>
+ <TableCell className="font-medium">{error.flowName}</TableCell>
+ <TableCell className="text-right tabular-nums">
+ {formatUtils.formatNumber(error.count)}
+ </TableCell>
+ <TableCell className="text-right tabular-nums text-gray-11">
+ {total === 0
+ ? '—'
+ : `${Math.round((error.count / total) * 100)}%`}
+ </TableCell>
</TableRow>
- </TableHeader>
- <TableBody>
- {errors.map((error) => (
- <TableRow
- key={`${error.projectId}-${error.flowId}`}
- className="cursor-pointer"
- onClick={() =>
- navigate(
- `/projects/${error.projectId}/runs?flowId=${error.flowId}`,
- )
- }
- >
- <TableCell className="text-gray-11">
- {error.projectName}
- </TableCell>
- <TableCell className="font-medium">
- {error.flowName}
- </TableCell>
- <TableCell className="text-right tabular-nums">
- {formatUtils.formatNumber(error.count)}
- </TableCell>
- <TableCell className="text-right tabular-nums text-gray-11">
- {total === 0
- ? '—'
- : `${Math.round((error.count / total) * 100)}%`}
- </TableCell>
- </TableRow>
- ))}
- </TableBody>
- </Table>
- )}
- </CardContent>
- </Card>
+ ))}
+ </TableBody>
+ </Table>
+ )}
+ </SettingsPanel>
);
}
diff --git a/packages/web/src/app/routes/platform/infra/health/components/queue-tab.tsx b/packages/web/src/app/routes/platform/infra/health/components/queue-tab.tsx
index 77792795e5e..eb2ed7c293e 100644
--- a/packages/web/src/app/routes/platform/infra/health/components/queue-tab.tsx
+++ b/packages/web/src/app/routes/platform/infra/health/components/queue-tab.tsx
@@ -2,10 +2,9 @@ import { PlatformMetricsLive } from '@activepieces/shared';
import { t } from 'i18next';
import { Activity, Loader2 } from 'lucide-react';
+import { StatCard, StatGrid } from '@/app/components/admin';
import { formatUtils } from '@/lib/format-utils';
-import { MetricCard } from '../../../../impact/summary/metric-card';
-
import { StuckJobsTable } from './stuck-jobs-table';
type QueueTabProps = {
@@ -15,27 +14,23 @@ type QueueTabProps = {
export function QueueTab({ live, isLoading }: QueueTabProps) {
return (
- <div className="flex flex-col gap-4">
- <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
- <MetricCard
- icon={Activity}
- title={t('Running')}
+ <>
+ <StatGrid columns={2}>
+ <StatCard
+ icon={<Activity />}
+ label={t('Running')}
+ info={t('Jobs currently executing on workers')}
value={isLoading ? '—' : formatUtils.formatNumber(live?.running ?? 0)}
- description={t('Jobs currently executing on workers')}
- iconColor="text-swatch-11-mark"
- iconBgColor="bg-swatch-11-surface"
/>
- <MetricCard
- icon={Loader2}
- title={t('Queued')}
+ <StatCard
+ icon={<Loader2 />}
+ label={t('Queued')}
+ info={t('Jobs waiting in the queue')}
value={isLoading ? '—' : formatUtils.formatNumber(live?.queued ?? 0)}
- description={t('Jobs waiting in the queue')}
- iconColor="text-swatch-6-mark"
- iconBgColor="bg-swatch-6-surface"
/>
- </div>
+ </StatGrid>
<StuckJobsTable stuckJobs={live?.stuckJobs} isLoading={isLoading} />
- </div>
+ </>
);
}
diff --git a/packages/web/src/app/routes/platform/infra/health/components/runs-tab.tsx b/packages/web/src/app/routes/platform/infra/health/components/runs-tab.tsx
index e6c6275411c..67b6a4db7d3 100644
--- a/packages/web/src/app/routes/platform/infra/health/components/runs-tab.tsx
+++ b/packages/web/src/app/routes/platform/infra/health/components/runs-tab.tsx
@@ -4,12 +4,11 @@ import { t } from 'i18next';
import { CheckCircle2, ListChecks } from 'lucide-react';
import { ReactNode } from 'react';
+import { StatCard, StatGrid } from '@/app/components/admin';
import { DataFetchErrorState } from '@/components/custom/data-fetch-error-state';
import { formatUtils } from '@/lib/format-utils';
import { cn } from '@/lib/utils';
-import { MetricCard } from '../../../../impact/summary/metric-card';
-
import { InternalErrorsTable } from './internal-errors-table';
import { StatusLineChart } from './status-line-chart';
@@ -46,43 +45,45 @@ export function RunsTab({ report, isLoading, isError, onRetry }: RunsTabProps) {
}
return (
- <div className="flex flex-col gap-4">
- {report && (
- <p className="px-5 text-xs text-gray-11">
- {t('Showing cached data · next refresh after {time}', {
- time: dayjs(report.nextRefreshAt).format('MMM D, h:mm A'),
- })}
- </p>
- )}
- <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
- <MetricCard
- icon={ListChecks}
- title={t('Jobs done')}
- value={
- isLoading ? '—' : formatUtils.formatNumber(summary?.completed ?? 0)
- }
- description={t('Completed jobs (success + failure) in the period')}
- subtitle={
- summary
- ? renderDelta(summary.completed, summary.previousCompleted)
- : undefined
- }
- iconColor="text-swatch-1-mark"
- iconBgColor="bg-swatch-1-surface"
- />
- <MetricCard
- icon={CheckCircle2}
- title={t('Success rate')}
- value={isLoading ? '—' : `${(summary?.successRate ?? 0).toFixed(1)}%`}
- description={t('Share of completed jobs that succeeded')}
- subtitle={
- summary
- ? renderDelta(summary.successRate, summary.previousSuccessRate)
- : undefined
- }
- iconColor="text-swatch-8-mark"
- iconBgColor="bg-swatch-8-surface"
- />
+ <>
+ <div className="flex flex-col gap-2">
+ {report && (
+ <p className="text-xs text-gray-11">
+ {t('Showing cached data · next refresh after {time}', {
+ time: dayjs(report.nextRefreshAt).format('MMM D, h:mm A'),
+ })}
+ </p>
+ )}
+ <StatGrid columns={2}>
+ <StatCard
+ icon={<ListChecks />}
+ label={t('Jobs done')}
+ info={t('Completed jobs (success + failure) in the period')}
+ value={
+ isLoading
+ ? '—'
+ : formatUtils.formatNumber(summary?.completed ?? 0)
+ }
+ hint={
+ summary
+ ? renderDelta(summary.completed, summary.previousCompleted)
+ : undefined
+ }
+ />
+ <StatCard
+ icon={<CheckCircle2 />}
+ label={t('Success rate')}
+ info={t('Share of completed jobs that succeeded')}
+ value={
+ isLoading ? '—' : `${(summary?.successRate ?? 0).toFixed(1)}%`
+ }
+ hint={
+ summary
+ ? renderDelta(summary.successRate, summary.previousSuccessRate)
+ : undefined
+ }
+ />
+ </StatGrid>
</div>
<StatusLineChart data={report?.statusTimeseries} isLoading={isLoading} />
@@ -91,6 +92,6 @@ export function RunsTab({ report, isLoading, isError, onRetry }: RunsTabProps) {
internalErrors={report?.internalErrors}
isLoading={isLoading}
/>
- </div>
+ </>
);
}
diff --git a/packages/web/src/app/routes/platform/infra/health/components/status-line-chart.tsx b/packages/web/src/app/routes/platform/infra/health/components/status-line-chart.tsx
index 78cf70f36a5..f9128ba86c8 100644
--- a/packages/web/src/app/routes/platform/infra/health/components/status-line-chart.tsx
+++ b/packages/web/src/app/routes/platform/infra/health/components/status-line-chart.tsx
@@ -7,7 +7,7 @@ import { LineChart as LineChartIcon } from 'lucide-react';
import { useMemo, useState } from 'react';
import { Area, AreaChart, CartesianGrid, XAxis, YAxis } from 'recharts';
-import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
+import { SettingsPanel } from '@/app/components/admin';
import {
ChartConfig,
ChartContainer,
@@ -83,139 +83,126 @@ export function StatusLineChart({ data, isLoading }: StatusLineChartProps) {
const hasSelection = selectedSeries.length > 0;
return (
- <Card>
- <CardHeader className="pb-2">
- <CardTitle className="text-base font-medium">
- {t('Jobs Per Month')}
- </CardTitle>
- <div className="flex flex-wrap items-center gap-x-4 gap-y-2 pt-1">
- {SERIES.map((item) => (
- <label
- key={item.status}
- className="flex items-center gap-1.5 text-sm cursor-pointer select-none"
- >
- <Checkbox
- checked={selectedStatuses.includes(item.status)}
- onCheckedChange={() => toggleStatus(item.status)}
- />
- <span
- className="size-2.5 rounded-full"
- style={{ backgroundColor: item.color }}
- />
- {t(item.label)}
- </label>
- ))}
+ <SettingsPanel title={t('Jobs Per Month')}>
+ <div className="flex flex-wrap items-center gap-x-4 gap-y-2">
+ {SERIES.map((item) => (
+ <label
+ key={item.status}
+ className="flex cursor-pointer select-none items-center gap-2 text-sm"
+ >
+ <Checkbox
+ checked={selectedStatuses.includes(item.status)}
+ onCheckedChange={() => toggleStatus(item.status)}
+ />
+ <span
+ className="size-2.5 rounded-full"
+ style={{ backgroundColor: item.color }}
+ />
+ {t(item.label)}
+ </label>
+ ))}
+ </div>
+ {isLoading ? (
+ <Skeleton className="h-[300px] w-full" />
+ ) : !hasSelection ? (
+ <div className="flex h-[300px] w-full flex-col items-center justify-center gap-2">
+ <LineChartIcon className="size-10 text-gray-11" />
+ <p className="text-sm text-gray-11">
+ {t('Select at least one status to display')}
+ </p>
+ </div>
+ ) : chartData.length === 0 ? (
+ <div className="flex h-[300px] w-full flex-col items-center justify-center gap-2">
+ <LineChartIcon className="size-10 text-gray-11" />
+ <p className="text-sm text-gray-11">{t('No runs in this period')}</p>
</div>
- </CardHeader>
- <CardContent className="pt-4">
- {isLoading ? (
- <Skeleton className="h-[300px] w-full" />
- ) : !hasSelection ? (
- <div className="flex h-[300px] w-full flex-col items-center justify-center gap-2">
- <LineChartIcon className="size-10 text-gray-11" />
- <p className="text-sm text-gray-11">
- {t('Select at least one status to display')}
- </p>
- </div>
- ) : chartData.length === 0 ? (
- <div className="flex h-[300px] w-full flex-col items-center justify-center gap-2">
- <LineChartIcon className="size-10 text-gray-11" />
- <p className="text-sm text-gray-11">
- {t('No runs in this period')}
- </p>
- </div>
- ) : (
- <ChartContainer
- config={chartConfig}
- className="aspect-auto h-[300px] w-full"
+ ) : (
+ <ChartContainer
+ config={chartConfig}
+ className="aspect-auto h-[300px] w-full"
+ >
+ <AreaChart
+ accessibilityLayer
+ data={chartData}
+ margin={{ left: 0, right: 12, top: 12, bottom: 0 }}
>
- <AreaChart
- accessibilityLayer
- data={chartData}
- margin={{ left: 0, right: 12, top: 12, bottom: 0 }}
- >
- <defs>
- {selectedSeries.map((item) => (
- <linearGradient
- key={item.status}
- id={`status-gradient-${item.status}`}
- x1="0"
- y1="0"
- x2="0"
- y2="1"
- >
- <stop
- offset="0%"
- stopColor={item.color}
- stopOpacity={0.3}
- />
- <stop
- offset="100%"
- stopColor={item.color}
- stopOpacity={0.05}
- />
- </linearGradient>
- ))}
- </defs>
- <CartesianGrid
- vertical={false}
- strokeDasharray="3 3"
- stroke="var(--gray-6)"
- />
- <XAxis
- dataKey="date"
- tickLine={false}
- axisLine={false}
- tickMargin={8}
- minTickGap={32}
- tick={{ fill: 'var(--gray-11)', fontSize: 12 }}
- tickFormatter={(value) =>
- new Date(value).toLocaleDateString('en-US', {
- month: 'short',
- day: 'numeric',
- })
- }
- />
- <YAxis
- tickLine={false}
- axisLine={false}
- tickMargin={8}
- tick={{ fill: 'var(--gray-11)', fontSize: 12 }}
- width={40}
- tickFormatter={(value) =>
- formatUtils.formatNumberCompact(value as number)
- }
- />
- <ChartTooltip
- content={
- <ChartTooltipContent
- labelFormatter={(value) =>
- new Date(value).toLocaleDateString('en-US', {
- month: 'short',
- day: 'numeric',
- year: 'numeric',
- })
- }
- />
- }
- />
+ <defs>
{selectedSeries.map((item) => (
- <Area
+ <linearGradient
key={item.status}
- dataKey={item.status}
- type="monotone"
- stroke={item.color}
- strokeWidth={2}
- fill={`url(#status-gradient-${item.status})`}
- dot={false}
- activeDot={{ r: 4 }}
- />
+ id={`status-gradient-${item.status}`}
+ x1="0"
+ y1="0"
+ x2="0"
+ y2="1"
+ >
+ <stop offset="0%" stopColor={item.color} stopOpacity={0.3} />
+ <stop
+ offset="100%"
+ stopColor={item.color}
+ stopOpacity={0.05}
+ />
+ </linearGradient>
))}
- </AreaChart>
- </ChartContainer>
- )}
- </CardContent>
- </Card>
+ </defs>
+ <CartesianGrid
+ vertical={false}
+ strokeDasharray="3 3"
+ stroke="var(--gray-6)"
+ />
+ <XAxis
+ dataKey="date"
+ tickLine={false}
+ axisLine={false}
+ tickMargin={8}
+ minTickGap={32}
+ tick={{ fill: 'var(--gray-11)', fontSize: 12 }}
+ tickFormatter={(value) =>
+ new Date(value).toLocaleDateString('en-US', {
+ month: 'short',
+ day: 'numeric',
+ })
+ }
+ />
+ <YAxis
+ tickLine={false}
+ axisLine={false}
+ tickMargin={8}
+ tick={{ fill: 'var(--gray-11)', fontSize: 12 }}
+ width={40}
+ tickFormatter={(value) =>
+ formatUtils.formatNumberCompact(value as number)
+ }
+ />
+ <ChartTooltip
+ content={
+ <ChartTooltipContent
+ labelFormatter={(value) =>
+ new Date(value).toLocaleDateString('en-US', {
+ month: 'short',
+ day: 'numeric',
+ year: 'numeric',
+ })
+ }
+ />
+ }
+ />
+ {selectedSeries.map((item) => (
+ <Area
+ key={item.status}
+ dataKey={item.status}
+ type="monotone"
+ stroke={item.color}
+ strokeWidth={2}
+ fill={`url(#status-gradient-${item.status})`}
+ dot={false}
+ activeDot={{ r: 4 }}
+ />
+ ))}
+ </AreaChart>
+ </ChartContainer>
+ )}
+ </SettingsPanel>
);
}
diff --git a/packages/web/src/app/routes/platform/infra/health/components/stuck-jobs-table.tsx b/packages/web/src/app/routes/platform/infra/health/components/stuck-jobs-table.tsx
index fd8a8e3379f..c9ddcd68724 100644
--- a/packages/web/src/app/routes/platform/infra/health/components/stuck-jobs-table.tsx
+++ b/packages/web/src/app/routes/platform/infra/health/components/stuck-jobs-table.tsx
@@ -3,8 +3,8 @@ import { t } from 'i18next';
import { CircleCheck, TriangleAlert } from 'lucide-react';
import { useNavigate } from 'react-router-dom';
+import { SettingsPanel } from '@/app/components/admin';
import { Badge } from '@/components/ui/badge';
-import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import { Skeleton } from '@/components/ui/skeleton';
import {
Table,
@@ -26,59 +26,56 @@ export function StuckJobsTable({ stuckJobs, isLoading }: StuckJobsTableProps) {
const jobs = stuckJobs ?? [];
return (
- <Card>
- <CardHeader className="pb-2">
- <CardTitle className="flex items-center gap-2 text-base font-medium">
- {t('Stuck jobs')}
- {jobs.length > 0 && (
- <Badge variant="destructive" className="gap-1">
- <TriangleAlert className="size-3" />
- {t('{count} stuck', { count: jobs.length })}
- </Badge>
- )}
- </CardTitle>
- </CardHeader>
- <CardContent>
- {isLoading ? (
- <Skeleton className="h-24 w-full" />
- ) : jobs.length === 0 ? (
- <div className="flex flex-col items-center justify-center gap-2 py-8 text-gray-11">
- <CircleCheck className="size-8 text-success-11" />
- <p className="text-sm">{t('No stuck jobs')}</p>
- </div>
- ) : (
- <Table>
- <TableHeader>
- <TableRow>
- <TableHead>{t('Flow')}</TableHead>
- <TableHead>{t('Project')}</TableHead>
- <TableHead>{t('Status')}</TableHead>
+ <SettingsPanel
+ title={t('Stuck jobs')}
+ action={
+ jobs.length > 0 ? (
+ <Badge variant="destructive" className="gap-1">
+ <TriangleAlert className="size-3" />
+ {t('{count} stuck', { count: jobs.length })}
+ </Badge>
+ ) : undefined
+ }
+ >
+ {isLoading ? (
+ <Skeleton className="h-24 w-full" />
+ ) : jobs.length === 0 ? (
+ <div className="flex flex-col items-center justify-center gap-2 py-8 text-gray-11">
+ <CircleCheck className="size-8 text-success-11" />
+ <p className="text-sm">{t('No stuck jobs')}</p>
+ </div>
+ ) : (
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead>{t('Flow')}</TableHead>
+ <TableHead>{t('Project')}</TableHead>
+ <TableHead>{t('Status')}</TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {jobs.map((job) => (
+ <TableRow
+ key={job.flowRunId}
+ className="cursor-pointer"
+ onClick={() =>
+ navigate(`/projects/${job.projectId}/runs/${job.flowRunId}`)
+ }
+ >
+ <TableCell className="font-medium">{job.flowName}</TableCell>
+ <TableCell className="text-gray-11">
+ {job.projectName}
+ </TableCell>
+ <TableCell>
+ <Badge variant="outline">
+ {formatUtils.convertEnumToHumanReadable(job.status)}
+ </Badge>
+ </TableCell>
</TableRow>
- </TableHeader>
- <TableBody>
- {jobs.map((job) => (
- <TableRow
- key={job.flowRunId}
- className="cursor-pointer"
- onClick={() =>
- navigate(`/projects/${job.projectId}/runs/${job.flowRunId}`)
- }
- >
- <TableCell className="font-medium">{job.flowName}</TableCell>
- <TableCell className="text-gray-11">
- {job.projectName}
- </TableCell>
- <TableCell>
- <Badge variant="outline">
- {formatUtils.convertEnumToHumanReadable(job.status)}
- </Badge>
- </TableCell>
- </TableRow>
- ))}
- </TableBody>
- </Table>
- )}
- </CardContent>
- </Card>
+ ))}
+ </TableBody>
+ </Table>
+ )}
+ </SettingsPanel>
);
}
diff --git a/packages/web/src/app/routes/platform/infra/health/components/system-health-tab.tsx b/packages/web/src/app/routes/platform/infra/health/components/system-health-tab.tsx
index 71db35ab3c8..e5d7c362581 100644
--- a/packages/web/src/app/routes/platform/infra/health/components/system-health-tab.tsx
+++ b/packages/web/src/app/routes/platform/infra/health/components/system-health-tab.tsx
@@ -14,13 +14,16 @@ import {
import React from 'react';
import semver from 'semver';
-import { LoadingSpinner } from '@/components/custom/spinner';
+import {
+ SettingsPanel,
+ SettingsRow,
+ StatusDot,
+ StatusTone,
+} from '@/app/components/admin';
import { Alert, AlertDescription } from '@/components/ui/alert';
-import { Card, CardContent } from '@/components/ui/card';
import { healthQueries } from '@/features/platform-admin';
import { flagsHooks } from '@/hooks/flags-hooks';
import { AdminControl, adminControl } from '@/lib/admin-control';
-import { cn } from '@/lib/utils';
import { DailyHealthStrip } from './daily-health-strip';
@@ -164,7 +167,7 @@ export function SystemHealthTab({ onSeeRuns }: SystemHealthTabProps) {
];
return (
- <div className="flex flex-col gap-4">
+ <>
<Alert variant="primary">
<Info />
<AlertDescription className="text-pretty">
@@ -181,24 +184,22 @@ export function SystemHealthTab({ onSeeRuns }: SystemHealthTabProps) {
</a>
</AlertDescription>
</Alert>
- <div className="flex flex-col gap-4">
- <HealthCard
- title={t('App')}
- description={t('API server, UI and webhook routing')}
- icon={<Server className="size-4" />}
- rows={appRows}
- loading={isPending}
- />
- <HealthCard
- title={t('Workers')}
- description={t('Machines that execute your flows')}
- icon={<Boxes className="size-4" />}
- rows={workerRows}
- loading={isPending}
- />
- </div>
+ <HealthCard
+ title={t('App')}
+ description={t('API server, UI and webhook routing')}
+ icon={<Server className="size-4" />}
+ rows={appRows}
+ loading={isPending}
+ />
+ <HealthCard
+ title={t('Workers')}
+ description={t('Machines that execute your flows')}
+ icon={<Boxes className="size-4" />}
+ rows={workerRows}
+ loading={isPending}
+ />
<DailyHealthStrip onSeeRuns={onSeeRuns} />
- </div>
+ </>
);
}
@@ -222,103 +223,62 @@ function HealthCard({
loading: boolean;
}) {
return (
- <Card className="overflow-hidden">
- <div className="flex items-center gap-3 border-b px-4 py-3">
- <div className="flex size-9 shrink-0 items-center justify-center rounded-md bg-gray-3 text-gray-11">
+ <SettingsPanel
+ title={
+ <span className="flex items-center gap-2">
{icon}
- </div>
- <div className="flex-1 min-w-0">
- <p className="text-sm font-semibold leading-tight">{title}</p>
- <p className="text-xs text-gray-11">{description}</p>
- </div>
- </div>
- <CardContent className="divide-y p-0">
- {rows.map((row) => (
- <HealthRowItem key={row.id} row={row} loading={loading} />
- ))}
- </CardContent>
- </Card>
+ {title}
+ </span>
+ }
+ description={description}
+ flush
+ >
+ {rows.map((row) => (
+ <HealthRowItem key={row.id} row={row} loading={loading} />
+ ))}
+ </SettingsPanel>
);
}
function HealthRowItem({ row, loading }: { row: HealthRow; loading: boolean }) {
const status = loading ? 'loading' : row.status;
+ const config = STATUS_CONFIG[status];
return (
- <div className="flex items-center gap-3 px-4 py-3">
- <div
- className={cn(
- 'flex size-8 shrink-0 items-center justify-center rounded-md',
- status === 'failed'
- ? 'bg-danger-3 text-danger-11'
- : status === 'passed'
- ? 'bg-success-3 text-success-11'
- : 'bg-gray-3 text-gray-11',
- )}
- >
- {row.icon}
- </div>
- <div className="flex-1 min-w-0">
- <div className="flex items-center gap-1.5">
- <span className="text-sm font-medium">{row.title}</span>
+ <SettingsRow
+ icon={row.icon}
+ title={
+ <>
+ {row.title}
{row.link && (
<a
{...adminControl(AdminControl.HEALTH_CHECK_DOCS_LINK)}
href={row.link}
target="_blank"
rel="noreferrer"
+ aria-label={t('Open docs')}
className="text-gray-11 hover:text-gray-12"
>
- <ExternalLink className="size-3.5" />
+ <ExternalLink aria-hidden className="size-3.5" />
</a>
)}
- </div>
- <div className="text-xs text-gray-11">{row.message}</div>
- </div>
- <StatusPill status={status} />
- </div>
- );
-}
-
-function StatusPill({ status }: { status: Status }) {
- if (status === 'loading') {
- return (
- <span className="flex items-center gap-1.5 text-xs text-gray-11">
- <LoadingSpinner className="size-3.5" />
- {t('Checking')}
- </span>
- );
- }
- const config = STATUS_CONFIG[status];
- return (
- <span
- className={cn(
- 'flex items-center gap-1.5 text-xs font-medium',
- config.text,
- )}
+ </>
+ }
+ description={row.message}
>
- <span className={cn('size-1.5 rounded-full', config.dot)} />
- {t(config.label)}
- </span>
+ <StatusDot tone={config.tone} pulse={status === 'loading'}>
+ {config.label()}
+ </StatusDot>
+ </SettingsRow>
);
}
-const STATUS_CONFIG = {
- passed: {
- label: 'Passed',
- text: 'text-success-11',
- dot: 'bg-success-10',
- },
- failed: {
- label: 'Needs attention',
- text: 'text-danger-11',
- dot: 'bg-danger-10',
- },
- na: {
- label: 'Not applicable',
- text: 'text-gray-11',
- dot: 'bg-gray-9',
- },
-} as const;
+const STATUS_CONFIG: Record<Status, { label: () => string; tone: StatusTone }> =
+ {
+ loading: { label: () => t('Checking'), tone: 'neutral' },
+ passed: { label: () => t('Passed'), tone: 'success' },
+ failed: { label: () => t('Needs attention'), tone: 'danger' },
+ na: { label: () => t('Not applicable'), tone: 'neutral' },
+ };
type Status = 'passed' | 'failed' | 'na' | 'loading';
diff --git a/packages/web/src/app/routes/platform/infra/health/index.tsx b/packages/web/src/app/routes/platform/infra/health/index.tsx
index 358432252fc..e303713d90d 100644
--- a/packages/web/src/app/routes/platform/infra/health/index.tsx
+++ b/packages/web/src/app/routes/platform/infra/health/index.tsx
@@ -4,7 +4,11 @@ import { Calendar } from 'lucide-react';
import React from 'react';
import { useNavigate, useSearchParams } from 'react-router-dom';
-import { DashboardPageHeader } from '@/app/components/dashboard-page-header';
+import {
+ AdminPage,
+ AdminPageHeader,
+ adminPageResources,
+} from '@/app/components/admin';
import {
Select,
SelectContent,
@@ -61,15 +65,16 @@ export default function SettingsHealthPage({
};
return (
- <div className="flex flex-col w-full max-w-[40rem] mx-auto gap-4 px-4">
- <DashboardPageHeader
+ <AdminPage width="content">
+ <AdminPageHeader
title={t('Health')}
description={t('Check the status of your platform and its components')}
+ resources={adminPageResources.health}
>
{(section === 'runs' || section === 'queue') && (
<Select value={selectedMonth} onValueChange={handleMonthChange}>
<SelectTrigger size="sm" className="w-auto">
- <Calendar className="h-4 w-4" />
+ <Calendar className="size-4" />
<SelectValue />
</SelectTrigger>
<SelectContent side="bottom" align="end">
@@ -81,7 +86,7 @@ export default function SettingsHealthPage({
</SelectContent>
</Select>
)}
- </DashboardPageHeader>
+ </AdminPageHeader>
{section === 'system' && (
<SystemHealthTab
@@ -106,7 +111,7 @@ export default function SettingsHealthPage({
{section === 'queue' && (
<QueueTab live={live} isLoading={isLiveLoading} />
)}
- </div>
+ </AdminPage>
);
}
diff --git a/packages/web/src/app/routes/platform/infra/triggers/index.tsx b/packages/web/src/app/routes/platform/infra/triggers/index.tsx
index e8897d66019..09369134a8e 100644
--- a/packages/web/src/app/routes/platform/infra/triggers/index.tsx
+++ b/packages/web/src/app/routes/platform/infra/triggers/index.tsx
@@ -1,19 +1,25 @@
import { TriggerStatusReport } from '@activepieces/shared';
+import { ColumnDef } from '@tanstack/react-table';
import dayjs from 'dayjs';
import { t } from 'i18next';
import {
- CheckCircle,
- XCircle,
AlertCircle,
+ CheckCircle,
Puzzle,
Hash,
BarChart3,
Clock,
Calendar,
+ XCircle,
} from 'lucide-react';
-import { DashboardPageHeader } from '@/app/components/dashboard-page-header';
-import { DataTable } from '@/components/custom/data-table';
+import {
+ AdminDataTable,
+ AdminPage,
+ AdminPageHeader,
+ adminPageResources,
+} from '@/app/components/admin';
+import { RowDataWithActions } from '@/components/custom/data-table';
import { DataTableColumnHeader } from '@/components/custom/data-table/data-table-column-header';
import {
Tooltip,
@@ -22,7 +28,6 @@ import {
} from '@/components/ui/tooltip';
import { triggerRunHooks } from '@/features/flows';
import { PieceDisplayName, PieceIconWithPieceName } from '@/features/pieces';
-import { cn } from '@/lib/utils';
import { StatusProgressBar, type DayStatus } from './status-progress-bar';
@@ -122,26 +127,13 @@ export default function TriggerHealthPage() {
const getStatusIcon = (statusType: string) => {
switch (statusType) {
case STATUS.SUCCESS:
- return <CheckCircle size={16} className="text-success-11" />;
- case STATUS.WARNING:
- return <AlertCircle size={16} className="text-warning-11" />;
- case STATUS.FAULT:
- return <XCircle size={16} className="text-danger-11" />;
- default:
- return <AlertCircle size={16} className="text-gray-9" />;
- }
- };
-
- const getStatusColor = (statusType: string) => {
- switch (statusType) {
- case STATUS.SUCCESS:
- return 'text-success-11';
+ return <CheckCircle className="size-4 text-success-11" />;
case STATUS.WARNING:
- return 'text-warning-11';
+ return <AlertCircle className="size-4 text-warning-11" />;
case STATUS.FAULT:
- return 'text-danger-11';
+ return <XCircle className="size-4 text-danger-11" />;
default:
- return 'text-gray-11';
+ return <AlertCircle className="size-4 text-gray-11" />;
}
};
@@ -149,14 +141,14 @@ export default function TriggerHealthPage() {
return STATUS_TOOLTIPS[statusType] || 'Unknown status';
};
- const columns = [
+ const columns: ColumnDef<RowDataWithActions<TriggerHealthRow>>[] = [
{
accessorKey: 'pieceDisplayName',
size: 220,
- header: ({ column }: any) => (
+ header: ({ column }) => (
<DataTableColumnHeader column={column} title="Piece" icon={Puzzle} />
),
- cell: ({ row }: any) => {
+ cell: ({ row }) => {
const status = row.original.status;
return (
<div className="flex items-center gap-2">
@@ -165,28 +157,21 @@ export default function TriggerHealthPage() {
showTooltip={false}
size="md"
/>
- <div className="flex flex-col">
- <div className="font-medium flex items-center gap-2">
- <PieceDisplayName pieceName={row.original.id} />
- <Tooltip>
- <TooltipTrigger asChild>
- <span
- className={cn(
- 'flex items-center ml-2',
- getStatusColor(status.type),
- )}
- tabIndex={0}
- aria-label={getStatusTooltip(status.type)}
- style={{ cursor: 'pointer' }}
- >
- {getStatusIcon(status.type)}
- </span>
- </TooltipTrigger>
- <TooltipContent>
- {getStatusTooltip(status.type)}
- </TooltipContent>
- </Tooltip>
- </div>
+ <div className="flex items-center gap-2 font-medium">
+ <PieceDisplayName pieceName={row.original.id} />
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <span
+ role="img"
+ className="flex items-center rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-8"
+ tabIndex={0}
+ aria-label={getStatusTooltip(status.type)}
+ >
+ {getStatusIcon(status.type)}
+ </span>
+ </TooltipTrigger>
+ <TooltipContent>{getStatusTooltip(status.type)}</TooltipContent>
+ </Tooltip>
</div>
</div>
);
@@ -195,75 +180,74 @@ export default function TriggerHealthPage() {
{
accessorKey: 'runs',
size: 160,
- header: ({ column }: any) => (
+ header: ({ column }) => (
<DataTableColumnHeader
column={column}
title="Total Runs (14D)"
icon={Hash}
/>
),
- cell: ({ row }: any) => (
+ cell: ({ row }) => (
<div className="font-medium">{row.original.runs.toLocaleString()}</div>
),
},
{
accessorKey: 'lastResults',
size: 190,
- header: ({ column }: any) => (
+ header: ({ column }) => (
<DataTableColumnHeader
column={column}
title="Last Results"
icon={BarChart3}
/>
),
- cell: ({ row }: any) => (
- <StatusProgressBar days={row.original.lastResults} />
- ),
+ cell: ({ row }) => <StatusProgressBar days={row.original.lastResults} />,
},
{
accessorKey: 'last24Hours',
size: 70,
- header: ({ column }: any) => (
+ header: ({ column }) => (
<DataTableColumnHeader column={column} title="24H" icon={Clock} />
),
- cell: ({ row }: any) => (
- <div className={cn('font-medium')}>{row.original.last24Hours}%</div>
+ cell: ({ row }) => (
+ <div className="font-medium">{row.original.last24Hours}%</div>
),
},
{
accessorKey: 'last7Days',
size: 65,
- header: ({ column }: any) => (
+ header: ({ column }) => (
<DataTableColumnHeader column={column} title="7D" icon={Calendar} />
),
- cell: ({ row }: any) => (
- <div className={cn('font-medium')}>{row.original.last7Days}%</div>
+ cell: ({ row }) => (
+ <div className="font-medium">{row.original.last7Days}%</div>
),
},
{
accessorKey: 'last14Days',
size: 65,
- header: ({ column }: any) => (
+ header: ({ column }) => (
<DataTableColumnHeader column={column} title="14D" icon={Calendar} />
),
- cell: ({ row }: any) => (
- <div className={cn('font-medium')}>{row.original.last14Days}%</div>
+ cell: ({ row }) => (
+ <div className="font-medium">{row.original.last14Days}%</div>
),
},
];
return (
- <div className="flex flex-col w-full gap-4">
- <DashboardPageHeader
+ <AdminPage>
+ <AdminPageHeader
title={t('Trigger Health Status')}
description={t('Monitor the health and performance of your triggers')}
+ resources={adminPageResources.triggers}
/>
- <DataTable
+ <AdminDataTable
emptyStateTextTitle={t('No trigger data available')}
emptyStateTextDescription={t(
'Trigger health information will appear here',
)}
- emptyStateIcon={<CheckCircle className="size-14" />}
+ emptyStateIcon={<CheckCircle />}
hidePagination={true}
columns={columns}
page={{ data: triggerHealthData, previous: '', next: '' }}
@@ -272,6 +256,6 @@ export default function TriggerHealthPage() {
errorStateEntity={t('trigger status')}
onRetry={refetch}
/>
- </div>
+ </AdminPage>
);
}
diff --git a/packages/web/src/app/routes/platform/infra/triggers/status-progress-bar.tsx b/packages/web/src/app/routes/platform/infra/triggers/status-progress-bar.tsx
index 0e1988daf33..4fe01caf625 100644
--- a/packages/web/src/app/routes/platform/infra/triggers/status-progress-bar.tsx
+++ b/packages/web/src/app/routes/platform/infra/triggers/status-progress-bar.tsx
@@ -20,26 +20,21 @@ interface StatusProgressBarProps {
export function StatusProgressBar({ days, className }: StatusProgressBarProps) {
return (
<div className={cn('flex gap-1', className)}>
- {[...days].reverse().map((day, index) => {
+ {[...days].reverse().map((day) => {
const totalRuns = day.success + day.failure;
return (
- <Tooltip key={index}>
+ <Tooltip key={day.date}>
<TooltipTrigger asChild>
<div
className={cn(
- 'w-3 h-6 rounded-md cursor-pointer transition-colors',
- 'hover:scale-110 hover:shadow-xs',
- {
- 'bg-success-9 hover:bg-success-9/80':
- day.status === 'success',
- 'bg-danger-9 hover:bg-danger-9/80': day.status === 'fault',
- 'bg-warning-9 hover:bg-warning-9/80':
- day.status === 'warning',
- },
+ 'h-6 w-3 rounded-sm transition-opacity hover:opacity-80',
+ day.status === 'success' && 'bg-success-10',
+ day.status === 'fault' && 'bg-danger-10',
+ day.status === 'warning' && 'bg-warning-10',
)}
/>
</TooltipTrigger>
- <TooltipContent side="top" align="center" className="text-xs">
+ <TooltipContent side="top" align="center">
<div>
On {day.date}, there were {totalRuns} total runs: {day.success}{' '}
succeeded and {day.failure} failed.
diff --git a/packages/web/src/app/routes/platform/infra/workers/assign-projects-dialog.tsx b/packages/web/src/app/routes/platform/infra/workers/assign-projects-dialog.tsx
index 5fae7cf66f8..b0c92f82934 100644
--- a/packages/web/src/app/routes/platform/infra/workers/assign-projects-dialog.tsx
+++ b/packages/web/src/app/routes/platform/infra/workers/assign-projects-dialog.tsx
@@ -3,6 +3,7 @@ import { t } from 'i18next';
import { Layers, Search } from 'lucide-react';
import { useState } from 'react';
+import { adminLayout } from '@/app/components/admin';
import { TextWithTooltip } from '@/components/custom/text-with-tooltip';
import { Button } from '@/components/ui/button';
import { Checkbox } from '@/components/ui/checkbox';
@@ -30,7 +31,7 @@ export function AssignProjectsDialog({
}: AssignProjectsDialogProps) {
return (
<Dialog open={open} onOpenChange={onOpenChange}>
- <DialogContent className="max-w-lg">
+ <DialogContent className={adminLayout.dialog.md}>
<AssignProjectsContent
key={open ? `open-${groupLabel}` : 'closed'}
groupLabel={groupLabel}
diff --git a/packages/web/src/app/routes/platform/infra/workers/by-group-view.tsx b/packages/web/src/app/routes/platform/infra/workers/by-group-view.tsx
index a9c67a186d2..7457a607172 100644
--- a/packages/web/src/app/routes/platform/infra/workers/by-group-view.tsx
+++ b/packages/web/src/app/routes/platform/infra/workers/by-group-view.tsx
@@ -7,10 +7,12 @@ import { t } from 'i18next';
import { Layers, Plus } from 'lucide-react';
import { useState } from 'react';
+import { AdminEmpty, adminSurface } from '@/app/components/admin';
import { TextWithTooltip } from '@/components/custom/text-with-tooltip';
import { Button } from '@/components/ui/button';
import { WorkerGroupInfo } from '@/features/platform-admin/api/workers-api';
import { AdminControl, adminControl } from '@/lib/admin-control';
+import { cn } from '@/lib/utils';
import { AssignProjectsDialog } from './assign-projects-dialog';
import { ProjectAvatar } from './project-avatar';
@@ -30,12 +32,7 @@ export function ByGroupView({
).sort();
if (allGroupLabels.length === 0) {
- return (
- <div className="flex flex-col items-center justify-center py-16 gap-3 text-gray-11">
- <Layers className="size-10" strokeWidth={1.5} />
- <p className="text-sm">{t('No projects')}</p>
- </div>
- );
+ return <AdminEmpty icon={<Layers />} title={t('No projects')} />;
}
return (
@@ -72,9 +69,14 @@ function GroupCard({ groupLabel, allProjects, workers }: GroupCardProps) {
return (
<>
- <div className="flex w-full flex-col rounded-xl border bg-gray-1 p-5 gap-4 sm:w-[475px]">
- <div className="flex items-center gap-2.5 min-w-0">
- <div className="flex size-7 shrink-0 items-center justify-center rounded-md bg-accent-3 text-accent-11">
+ <div
+ className={cn(
+ adminSurface.card,
+ 'flex w-full flex-col gap-4 p-5 sm:w-[475px]',
+ )}
+ >
+ <div className="flex min-w-0 items-center gap-2">
+ <div className="flex size-7 shrink-0 items-center justify-center rounded-lg bg-accent-3 text-accent-11">
<Layers className="size-4" />
</div>
<TextWithTooltip tooltipMessage={groupLabel}>
@@ -84,8 +86,8 @@ function GroupCard({ groupLabel, allProjects, workers }: GroupCardProps) {
</TextWithTooltip>
</div>
- <div className="flex items-baseline gap-1.5">
- <span className="text-2xl font-semibold leading-tight">
+ <div className="flex items-baseline gap-2">
+ <span className="text-2xl font-semibold text-gray-12">
{onlineWorkerCount}
</span>
<span className="text-sm text-gray-11">
@@ -96,8 +98,8 @@ function GroupCard({ groupLabel, allProjects, workers }: GroupCardProps) {
</span>
</div>
- <div className="border-t pt-4">
- <div className="flex items-center justify-between mb-2.5">
+ <div className="flex flex-col gap-2 border-t pt-4">
+ <div className="flex items-center justify-between">
<span className="text-xs font-medium text-gray-11">
{t('Projects')}
</span>
@@ -115,7 +117,7 @@ function GroupCard({ groupLabel, allProjects, workers }: GroupCardProps) {
{assignedProjects.length === 0 ? (
<p className="text-xs text-gray-11">{t('No projects')}</p>
) : (
- <div className="flex flex-wrap items-center gap-1.5">
+ <div className="flex flex-wrap items-center gap-2">
{assignedProjects.slice(0, 3).map((project) => (
<ProjectChip key={project.id} project={project} />
))}
@@ -141,7 +143,7 @@ function GroupCard({ groupLabel, allProjects, workers }: GroupCardProps) {
function ProjectChip({ project }: { project: ProjectWithLimits }) {
return (
- <div className="inline-flex items-center gap-1 rounded-full border bg-gray-3/40 px-2 py-0.5 text-xs">
+ <div className="inline-flex items-center gap-1 rounded-md border bg-gray-3/40 px-2 py-0.5 text-xs">
<ProjectAvatar project={project} size="sm" />
<TextWithTooltip tooltipMessage={project.displayName}>
<span className="max-w-[100px] truncate">{project.displayName}</span>
diff --git a/packages/web/src/app/routes/platform/infra/workers/by-project-view.tsx b/packages/web/src/app/routes/platform/infra/workers/by-project-view.tsx
index f6e8683a607..a2398240fd2 100644
--- a/packages/web/src/app/routes/platform/infra/workers/by-project-view.tsx
+++ b/packages/web/src/app/routes/platform/infra/workers/by-project-view.tsx
@@ -11,7 +11,8 @@ import React, { useMemo, useState } from 'react';
import { useSearchParams } from 'react-router-dom';
import { toast } from 'sonner';
-import { DataTable, RowDataWithActions } from '@/components/custom/data-table';
+import { AdminDataTable } from '@/app/components/admin';
+import { RowDataWithActions } from '@/components/custom/data-table';
import { TextWithTooltip } from '@/components/custom/text-with-tooltip';
import { Input } from '@/components/ui/input';
import {
@@ -65,7 +66,8 @@ export function ByProjectView({
<div className="relative">
<Search className="absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-gray-11" />
<Input
- className="pl-8 w-[240px]"
+ size="sm"
+ className="w-60 pl-8"
placeholder={t('Search projects')}
defaultValue={displayName ?? ''}
onChange={(e) => {
@@ -89,7 +91,7 @@ export function ByProjectView({
);
return (
- <div className="flex flex-col gap-3">
+ <div className="flex flex-col gap-4">
<p className="flex items-center gap-2 text-sm text-gray-11">
<BarChart3 className="size-4 shrink-0" />
{t(
@@ -97,7 +99,7 @@ export function ByProjectView({
)}
</p>
- <DataTable
+ <AdminDataTable
columns={columns}
page={page}
isLoading={isLoading}
@@ -108,7 +110,7 @@ export function ByProjectView({
emptyStateTextDescription={t(
'Start by creating projects to manage your automation teams',
)}
- emptyStateIcon={<Server className="size-14" />}
+ emptyStateIcon={<Server />}
toolbarButtons={[searchBar]}
/>
</div>
@@ -153,7 +155,7 @@ function buildColumns({
}: {
row: { original: RowDataWithActions<ProjectWithLimits> };
}) => (
- <div className="flex items-center gap-2.5 min-w-0">
+ <div className="flex min-w-0 items-center gap-2">
<ProjectAvatar project={row.original} />
<TextWithTooltip tooltipMessage={row.original.displayName}>
<p className="text-sm font-medium truncate">
@@ -247,7 +249,8 @@ function WorkerGroupCell({
<div className="flex flex-col gap-1">
<Select value={selectValue} onValueChange={handleChange}>
<SelectTrigger
- className={cn('w-[200px]', isOffline && 'border-danger-9')}
+ size="sm"
+ className={cn('w-50', isOffline && 'border-danger-9')}
>
<div className="flex items-center gap-2 min-w-0">
<Cpu
@@ -355,8 +358,9 @@ function ConcurrencyCell({
<Input
type="text"
inputMode="numeric"
+ size="sm"
max={poolSlots > 0 ? poolSlots : undefined}
- className="w-[150px]"
+ className="w-36"
placeholder={concurrencyPlaceholder}
value={concurrencyInput}
onChange={(e) => handleChange(e.target.value)}
diff --git a/packages/web/src/app/routes/platform/infra/workers/index.tsx b/packages/web/src/app/routes/platform/infra/workers/index.tsx
index b66e285c852..920e2a8a394 100644
--- a/packages/web/src/app/routes/platform/infra/workers/index.tsx
+++ b/packages/web/src/app/routes/platform/infra/workers/index.tsx
@@ -19,21 +19,18 @@ import {
import prettyBytes from 'pretty-bytes';
import React from 'react';
-import { DashboardPageHeader } from '@/app/components/dashboard-page-header';
-import LockedFeatureGuard from '@/app/components/locked-feature-guard';
import {
- Alert,
- AlertAction,
- AlertDescription,
- AlertTitle,
-} from '@/components/ui/alert';
+ AdminEmpty,
+ AdminPage,
+ AdminPageHeader,
+ LockedCallout,
+ StatusDot,
+ adminPageResources,
+ adminSurface,
+} from '@/app/components/admin';
+import LockedFeatureGuard from '@/app/components/locked-feature-guard';
+import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';
import { Badge } from '@/components/ui/badge';
-import {
- Card,
- CardContent,
- CardFooter,
- CardHeader,
-} from '@/components/ui/card';
import {
Tooltip,
TooltipContent,
@@ -59,88 +56,87 @@ export default function WorkersPage({ section }: WorkersPageProps) {
const fleetType = workersData?.[0]?.type;
return (
- <div className="flex flex-col w-full gap-4 px-4">
- <DashboardPageHeader
- description={t('Check the health of your workers')}
+ <AdminPage>
+ <AdminPageHeader
title={t('Workers')}
- ></DashboardPageHeader>
+ description={t('Check the health of your workers')}
+ resources={adminPageResources.workers}
+ />
- {section === 'health' && (
- <div className="flex flex-col gap-4 pt-4">
- {isCloud && fleetType === WorkerMachineType.SHARED && (
- <Alert variant="primary">
- <Zap size={16} />
- <AlertTitle>{t('Upgrade to Dedicated Workers')}</AlertTitle>
- <AlertDescription className="text-xs">
- {t(
- 'Your automations run on shared workers where strict sandboxing adds overhead to every execution. Dedicated workers give you your own execution pool that stays warm and ready, so your automations start much faster.',
- )}
- </AlertDescription>
- <AlertAction>
- <RequestTrial
- featureKey="DEDICATED_WORKERS"
- buttonVariant="default"
- buttonSize="xs"
- />
- </AlertAction>
- </Alert>
- )}
- {isCloud && fleetType === WorkerMachineType.DEDICATED && (
- <Alert variant="success">
- <Zap size={16} />
- <AlertTitle>{t('Dedicated Workers Active')}</AlertTitle>
- <AlertDescription className="text-xs">
- {t(
- 'Your workers run exclusively for your platform. The execution pool stays warm with no sandboxing overhead, so your automations start instantly.',
- )}
- </AlertDescription>
- </Alert>
- )}
+ {section === 'health' &&
+ isCloud &&
+ fleetType === WorkerMachineType.SHARED && (
+ <LockedCallout
+ variant="inline"
+ icon={<Zap />}
+ title={t('Upgrade to Dedicated Workers')}
+ description={t(
+ 'Your automations run on shared workers where strict sandboxing adds overhead to every execution. Dedicated workers give you your own execution pool that stays warm and ready, so your automations start much faster.',
+ )}
+ >
+ <RequestTrial
+ featureKey="DEDICATED_WORKERS"
+ buttonVariant="default"
+ buttonSize="sm"
+ />
+ </LockedCallout>
+ )}
+ {section === 'health' &&
+ isCloud &&
+ fleetType === WorkerMachineType.DEDICATED && (
+ <Alert variant="success">
+ <Zap className="size-4" />
+ <AlertTitle>{t('Dedicated Workers Active')}</AlertTitle>
+ <AlertDescription>
+ {t(
+ 'Your workers run exclusively for your platform. The execution pool stays warm with no sandboxing overhead, so your automations start instantly.',
+ )}
+ </AlertDescription>
+ </Alert>
+ )}
- {isLoading && (
- <div className="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-4">
- {[0, 1, 2].map((i) => (
- <Card key={i} className="animate-pulse">
- <CardHeader className="pb-3">
- <div className="flex items-center justify-between">
- <div className="h-4 w-28 bg-gray-3 rounded-md" />
- <div className="h-5 w-16 bg-gray-3 rounded-full" />
- </div>
- </CardHeader>
- <CardContent className="space-y-3">
- <div className="h-3 w-full bg-gray-3 rounded-md" />
- <div className="h-3 w-full bg-gray-3 rounded-md" />
- <div className="h-3 w-full bg-gray-3 rounded-md" />
- </CardContent>
- <CardFooter>
- <div className="h-4 w-full bg-gray-3 rounded-md" />
- </CardFooter>
- </Card>
- ))}
+ {section === 'health' && isLoading && (
+ <div className="grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-3">
+ {[0, 1, 2].map((i) => (
+ <div
+ key={i}
+ className={cn(
+ adminSurface.card,
+ 'flex animate-pulse flex-col gap-4 p-5',
+ )}
+ >
+ <div className="flex items-center justify-between">
+ <div className="h-4 w-28 rounded-md bg-gray-3" />
+ <div className="h-5 w-16 rounded-md bg-gray-3" />
+ </div>
+ <div className="flex flex-col gap-2">
+ <div className="h-3 w-full rounded-md bg-gray-3" />
+ <div className="h-3 w-full rounded-md bg-gray-3" />
+ <div className="h-3 w-full rounded-md bg-gray-3" />
+ </div>
+ <div className="h-4 w-full rounded-md bg-gray-3" />
</div>
- )}
+ ))}
+ </div>
+ )}
- {!isLoading && (workersData ?? []).length === 0 && (
- <div className="flex flex-col items-center justify-center py-16 gap-3 text-gray-11">
- <Server className="size-14" />
- <p className="font-medium text-gray-12">
- {t('No workers found')}
- </p>
- <p className="text-sm text-center max-w-sm">
- {t(
- "You don't have any workers yet. Spin up new workers to execute your automations",
- )}
- </p>
- </div>
- )}
+ {section === 'health' &&
+ !isLoading &&
+ (workersData ?? []).length === 0 && (
+ <AdminEmpty
+ icon={<Server />}
+ title={t('No workers found')}
+ description={t(
+ "You don't have any workers yet. Spin up new workers to execute your automations",
+ )}
+ />
+ )}
- {!isLoading && (workersData ?? []).length > 0 && (
- <div className="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-4">
- {(workersData ?? []).map((worker, index) => (
- <WorkerCard key={worker.id} worker={worker} index={index} />
- ))}
- </div>
- )}
+ {section === 'health' && !isLoading && (workersData ?? []).length > 0 && (
+ <div className="grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-3">
+ {(workersData ?? []).map((worker, index) => (
+ <WorkerCard key={worker.id} worker={worker} index={index} />
+ ))}
</div>
)}
@@ -157,7 +153,7 @@ export default function WorkersPage({ section }: WorkersPageProps) {
<WorkerAssignmentsTab />
</LockedFeatureGuard>
)}
- </div>
+ </AdminPage>
);
}
@@ -167,7 +163,7 @@ function StatBar({ label, value, detail }: StatBarProps) {
return (
<div className="flex items-center gap-2">
- <span className="w-16 text-xs text-gray-11 shrink-0 flex items-center gap-1.5">
+ <span className="flex w-16 shrink-0 items-center gap-2 text-xs text-gray-11">
{label}
</span>
<div className="flex-1 h-2 bg-gray-3 rounded-full overflow-hidden">
@@ -210,77 +206,75 @@ function WorkerCard({ worker, index }: WorkerCardProps) {
const version = workerProps.version ?? 'v0.39.4';
return (
- <Card>
- <CardHeader className="pb-3">
- <div className="flex items-center justify-between gap-2">
- <div className="flex items-center gap-2 min-w-0">
- <Server
- size={18}
- className={cn('shrink-0', {
- 'text-danger-11': !isOnline,
- })}
- />
- <div className="flex flex-col min-w-0">
- <span className="text-sm font-medium truncate">
- Machine #{index + 1}
- </span>
- <span className="text-xs text-gray-11 font-mono">{ip}</span>
- </div>
- </div>
- <div className="flex items-center gap-1.5 shrink-0 flex-wrap justify-end">
- <Tooltip>
- <TooltipTrigger asChild>
- {worker.workerGroupScope === WorkerGroupScope.PROJECT &&
- worker.workerGroupId ? (
- <Badge
- variant="outline"
- className="border-accent-7 bg-accent-3 text-accent-11"
- >
- <Layers className="size-3 shrink-0" />
- {worker.workerGroupId.replaceAll('_', ' ')}
- </Badge>
- ) : (
- <Badge
- variant={
- worker.workerGroupScope === WorkerGroupScope.PLATFORM
- ? 'success'
- : 'secondary'
- }
- >
- {worker.workerGroupScope === WorkerGroupScope.PLATFORM
- ? t('Dedicated')
- : t('Shared')}
- </Badge>
- )}
- </TooltipTrigger>
- <TooltipContent className="max-w-xs">
- {worker.workerGroupScope === WorkerGroupScope.PROJECT &&
- worker.workerGroupId
- ? t(
- 'This worker runs the projects assigned to the {group} group.',
- {
- group: worker.workerGroupId.replaceAll('_', ' '),
- },
- )
- : worker.workerGroupScope === WorkerGroupScope.PLATFORM
- ? t(
- 'This worker runs exclusively for your platform with no sandboxing overhead.',
- )
- : t(
- 'This worker is shared across platforms and uses strict sandboxing for isolation.',
- )}
- </TooltipContent>
- </Tooltip>
- <Badge variant={isOnline ? 'success' : 'destructive'}>
- {t(worker.status.toLowerCase())}
- </Badge>
- <WorkerConfigsPopover workerProps={workerProps} />
- <SandboxesPopover sandboxes={sandboxes} />
+ <div className={cn(adminSurface.card, 'flex flex-col gap-4 p-5')}>
+ <div className="flex items-center justify-between gap-2">
+ <div className="flex items-center gap-2 min-w-0">
+ <Server
+ size={18}
+ className={cn('shrink-0', {
+ 'text-danger-11': !isOnline,
+ })}
+ />
+ <div className="flex flex-col min-w-0">
+ <span className="text-sm font-medium truncate">
+ Machine #{index + 1}
+ </span>
+ <span className="text-xs text-gray-11 font-mono">{ip}</span>
</div>
</div>
- </CardHeader>
+ <div className="flex items-center gap-1.5 shrink-0 flex-wrap justify-end">
+ <Tooltip>
+ <TooltipTrigger asChild>
+ {worker.workerGroupScope === WorkerGroupScope.PROJECT &&
+ worker.workerGroupId ? (
+ <Badge
+ variant="outline"
+ className="border-accent-7 bg-accent-3 text-accent-11"
+ >
+ <Layers className="size-3 shrink-0" />
+ {worker.workerGroupId.replaceAll('_', ' ')}
+ </Badge>
+ ) : (
+ <Badge
+ variant={
+ worker.workerGroupScope === WorkerGroupScope.PLATFORM
+ ? 'success'
+ : 'secondary'
+ }
+ >
+ {worker.workerGroupScope === WorkerGroupScope.PLATFORM
+ ? t('Dedicated')
+ : t('Shared')}
+ </Badge>
+ )}
+ </TooltipTrigger>
+ <TooltipContent className="max-w-xs">
+ {worker.workerGroupScope === WorkerGroupScope.PROJECT &&
+ worker.workerGroupId
+ ? t(
+ 'This worker runs the projects assigned to the {group} group.',
+ {
+ group: worker.workerGroupId.replaceAll('_', ' '),
+ },
+ )
+ : worker.workerGroupScope === WorkerGroupScope.PLATFORM
+ ? t(
+ 'This worker runs exclusively for your platform with no sandboxing overhead.',
+ )
+ : t(
+ 'This worker is shared across platforms and uses strict sandboxing for isolation.',
+ )}
+ </TooltipContent>
+ </Tooltip>
+ <StatusDot tone={isOnline ? 'success' : 'danger'}>
+ {isOnline ? t('Online') : t('Offline')}
+ </StatusDot>
+ <WorkerConfigsPopover workerProps={workerProps} />
+ <SandboxesPopover sandboxes={sandboxes} />
+ </div>
+ </div>
- <CardContent className="space-y-2.5">
+ <div className="flex flex-col gap-2">
<StatBar
label={
<>
@@ -315,10 +309,10 @@ function WorkerCard({ worker, index }: WorkerCardProps) {
binary: true,
})} / ${prettyBytes(diskInfo.total, { binary: true })}`}
/>
- </CardContent>
+ </div>
- <CardFooter className="justify-between pt-0 gap-2">
- <div className="flex items-center gap-3 text-xs text-gray-11 min-w-0">
+ <div className="flex items-center justify-between gap-2">
+ <div className="flex min-w-0 items-center gap-2 text-xs text-gray-11">
<span className="flex items-center gap-1 truncate">
<Clock size={12} className="shrink-0" />
{t('seen')} {timeAgo}
@@ -327,8 +321,8 @@ function WorkerCard({ worker, index }: WorkerCardProps) {
<span className="text-xs text-gray-11 font-mono shrink-0">
{version}
</span>
- </CardFooter>
- </Card>
+ </div>
+ </div>
);
}
diff --git a/packages/web/src/app/routes/platform/infra/workers/worker-assignments-tab.tsx b/packages/web/src/app/routes/platform/infra/workers/worker-assignments-tab.tsx
index 7af05a47195..1d7f6a0be02 100644
--- a/packages/web/src/app/routes/platform/infra/workers/worker-assignments-tab.tsx
+++ b/packages/web/src/app/routes/platform/infra/workers/worker-assignments-tab.tsx
@@ -24,10 +24,10 @@ export function WorkerAssignmentsTab() {
const workers = workersData ?? [];
return (
- <div className="flex flex-col gap-4 pt-4">
+ <>
<Alert variant="primary">
<Info className="size-4" />
- <AlertDescription className="text-sm">
+ <AlertDescription>
{t(
'Worker groups reserve a dedicated queue for the projects you assign. Defined in your deployment with AP_WORKER_GROUP_ID.',
)}{' '}
@@ -36,7 +36,6 @@ export function WorkerAssignmentsTab() {
href="https://www.activepieces.com/docs/install/configure-operate/worker-groups"
target="_blank"
rel="noreferrer"
- className="text-accent-11 underline"
>
{t('Learn more')}
</a>
@@ -68,6 +67,6 @@ export function WorkerAssignmentsTab() {
/>
</TabsContent>
</Tabs>
- </div>
+ </>
);
}
diff --git a/packages/web/src/app/routes/platform/projects/columns.tsx b/packages/web/src/app/routes/platform/projects/columns.tsx
index b12de83a367..742ce5619e0 100644
--- a/packages/web/src/app/routes/platform/projects/columns.tsx
+++ b/packages/web/src/app/routes/platform/projects/columns.tsx
@@ -35,7 +35,7 @@ export const projectsTableColumns = ({
>[] = [
{
accessorKey: 'displayName',
- size: 270,
+ size: 220,
header: ({ column }) => (
<DataTableColumnHeader column={column} title={t('Name')} icon={Tag} />
),
@@ -58,7 +58,7 @@ export const projectsTableColumns = ({
},
{
accessorKey: 'users',
- size: 120,
+ size: 110,
header: ({ column }) => (
<DataTableColumnHeader
column={column}
@@ -82,7 +82,7 @@ export const projectsTableColumns = ({
},
{
accessorKey: 'flows',
- size: 120,
+ size: 110,
header: ({ column }) => (
<DataTableColumnHeader
column={column}
@@ -109,7 +109,7 @@ export const projectsTableColumns = ({
if (platform.plan.embeddingEnabled) {
columns.push({
accessorKey: 'externalId',
- size: 150,
+ size: 130,
header: ({ column }) => (
<DataTableColumnHeader
column={column}
@@ -130,7 +130,7 @@ export const projectsTableColumns = ({
if (platform.plan.globalConnectionsEnabled) {
columns.push({
accessorKey: 'globalConnectionsCount',
- size: 135,
+ size: 170,
header: ({ column }) => (
<DataTableColumnHeader
column={column}
diff --git a/packages/web/src/app/routes/platform/projects/index.tsx b/packages/web/src/app/routes/platform/projects/index.tsx
index 2e85f6d5a3d..b8a660d7b1a 100644
--- a/packages/web/src/app/routes/platform/projects/index.tsx
+++ b/packages/web/src/app/routes/platform/projects/index.tsx
@@ -8,23 +8,18 @@ import { useNavigate, useSearchParams } from 'react-router-dom';
import { toast } from 'sonner';
import { platformApi } from '@/api/platforms-api';
-import { DashboardPageHeader } from '@/app/components/dashboard-page-header';
import {
- DataTable,
- RowDataWithActions,
- BulkAction,
-} from '@/components/custom/data-table';
+ AdminDataTable,
+ AdminPage,
+ AdminPageHeader,
+ SettingsPanel,
+ SettingsRow,
+ adminPageResources,
+} from '@/app/components/admin';
+import { RowDataWithActions, BulkAction } from '@/components/custom/data-table';
import { ConfirmationDeleteDialog } from '@/components/custom/delete-dialog';
import { Button } from '@/components/ui/button';
import { Checkbox } from '@/components/ui/checkbox';
-import {
- Item,
- ItemMedia,
- ItemContent,
- ItemTitle,
- ItemDescription,
- ItemActions,
-} from '@/components/ui/item';
import { Switch } from '@/components/ui/switch';
import {
Tooltip,
@@ -307,17 +302,6 @@ export default function ProjectsPage() {
[selectedRows, currentProject],
);
- const toolbarButtons = useMemo(
- () => [
- <CreateProjectButton
- key="new-project"
- variant="full"
- projects={allProjects}
- />,
- ],
- [allProjects],
- );
-
const errorToastMessage = (error: unknown): string | undefined => {
if (validationUtils.isValidationError(error)) {
console.error(t('Validation error'), error);
@@ -361,42 +345,39 @@ export default function ProjectsPage() {
];
return (
- <div className="flex flex-col w-full">
- <DashboardPageHeader
+ <AdminPage>
+ <AdminPageHeader
title={t('Projects')}
description={t('Manage your automation projects')}
- />
- <div className="px-6 pt-4">
- <Item variant="outline">
- <ItemMedia variant="icon">
- <UserCircle />
- </ItemMedia>
- <ItemContent>
- <ItemTitle>{t('Automatic personal project creation')}</ItemTitle>
- <ItemDescription>
- {t(
- 'Create a personal project for every new user on signup. Turn off if you provision users into team projects manually (e.g. via SSO or SCIM).',
- )}
- </ItemDescription>
- </ItemContent>
- <ItemActions>
- <Switch
- checked={platform.autoCreatePersonalProjects}
- onCheckedChange={(checked) =>
- toggleAutoCreatePersonalProjects(checked)
- }
- disabled={isAutoCreatePersonalProjectsPending}
- {...adminControl(AdminControl.PROJECTS_AUTO_PERSONAL_TOGGLE)}
- />
- </ItemActions>
- </Item>
- </div>
- <DataTable
+ resources={adminPageResources.projects}
+ >
+ <CreateProjectButton variant="full" projects={allProjects} />
+ </AdminPageHeader>
+ <SettingsPanel flush>
+ <SettingsRow
+ icon={<UserCircle />}
+ title={t('Automatic personal project creation')}
+ description={t(
+ 'Create a personal project for every new user on signup. Turn off if you provision users into team projects manually (e.g. via SSO or SCIM).',
+ )}
+ >
+ <Switch
+ aria-label={t('Automatic personal project creation')}
+ checked={platform.autoCreatePersonalProjects}
+ onCheckedChange={(checked) =>
+ toggleAutoCreatePersonalProjects(checked)
+ }
+ disabled={isAutoCreatePersonalProjectsPending}
+ {...adminControl(AdminControl.PROJECTS_AUTO_PERSONAL_TOGGLE)}
+ />
+ </SettingsRow>
+ </SettingsPanel>
+ <AdminDataTable
emptyStateTextTitle={t('No projects found')}
emptyStateTextDescription={t(
'Start by creating projects to manage your automation teams',
)}
- emptyStateIcon={<Package className="size-14" />}
+ emptyStateIcon={<Package />}
onRowClick={async (project) => {
await projectCollectionUtils.setCurrentProject(project.id);
navigate('/');
@@ -433,7 +414,6 @@ export default function ProjectsPage() {
errorStateEntity={t('projects')}
clientPagination={true}
bulkActions={bulkActions}
- toolbarButtons={toolbarButtons}
actions={actions}
/>
<EditProjectDialog
@@ -450,6 +430,6 @@ export default function ProjectsPage() {
}
projectId={editDialogProjectId}
/>
- </div>
+ </AdminPage>
);
}
diff --git a/packages/web/src/app/routes/platform/security/api-keys/index.tsx b/packages/web/src/app/routes/platform/security/api-keys/index.tsx
index bdd542eb768..8f2145ad9be 100644
--- a/packages/web/src/app/routes/platform/security/api-keys/index.tsx
+++ b/packages/web/src/app/routes/platform/security/api-keys/index.tsx
@@ -2,7 +2,14 @@ import { ApiKeyResponseWithoutValue } from '@activepieces/shared';
import { t } from 'i18next';
import { Key, MoreHorizontal, Trash } from 'lucide-react';
-import { CenteredPage } from '@/app/components/centered-page';
+import {
+ AdminEmpty,
+ AdminPage,
+ AdminPageHeader,
+ SettingsPanel,
+ SettingsRow,
+ adminPageResources,
+} from '@/app/components/admin';
import { NewApiKeyDialog } from '@/app/routes/platform/security/api-keys/new-api-key-dialog';
import { AnimatedIconButton } from '@/components/custom/animated-icon-button';
import { ConfirmationDeleteDialog } from '@/components/custom/delete-dialog';
@@ -14,15 +21,6 @@ import {
DropdownMenuItem,
DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu';
-import {
- Item,
- ItemActions,
- ItemContent,
- ItemDescription,
- ItemGroup,
- ItemMedia,
- ItemTitle,
-} from '@/components/ui/item';
import { SkeletonList } from '@/components/ui/skeleton';
import { internalErrorToast } from '@/components/ui/sonner';
import { apiKeyApi, apiKeyQueries } from '@/features/platform-admin';
@@ -39,47 +37,45 @@ const ApiKeysPage = () => {
const keys: ApiKeyResponseWithoutValue[] = isSample
? sampleData.apiKeysPage().data
: data?.data ?? [];
+ const showLoading = isLoading && !isSample;
return (
- <CenteredPage
- title={t('API Keys')}
- description={t('Manage API keys to access Activepieces APIs.')}
- actions={
+ <AdminPage width="content">
+ <AdminPageHeader
+ title={t('API Keys')}
+ description={t('Manage API keys to access Activepieces APIs.')}
+ resources={adminPageResources.apiKeys}
+ >
<NewApiKeyDialog onCreate={() => refetch()}>
<AnimatedIconButton
icon={PlusIcon}
iconSize={16}
- size="sm"
{...adminControl(AdminControl.API_KEYS_API_KEY_OPEN)}
>
{t('New API Key')}
</AnimatedIconButton>
</NewApiKeyDialog>
- }
- >
- {isLoading && !isSample && (
- <SkeletonList numberOfItems={3} className="w-full h-[72px]" />
- )}
+ </AdminPageHeader>
+
+ {showLoading && <SkeletonList numberOfItems={3} className="h-18" />}
- {!isLoading && keys.length === 0 && (
- <div className="flex flex-col items-center gap-3 py-12 text-gray-11">
- <Key className="size-10" />
- <p className="text-sm">
- {t('No API keys yet. Create one to get started.')}
- </p>
- </div>
+ {!showLoading && keys.length === 0 && (
+ <AdminEmpty
+ className="flex-none"
+ icon={<Key />}
+ title={t('No API keys yet. Create one to get started.')}
+ />
)}
- {!isLoading && keys.length > 0 && (
- <ItemGroup className="gap-2">
+ {!showLoading && keys.length > 0 && (
+ <SettingsPanel flush>
{keys.map((apiKey) => (
- <Item key={apiKey.id} variant="outline" size="sm">
- <ItemMedia variant="icon">
- <Key />
- </ItemMedia>
- <ItemContent>
- <ItemTitle>{apiKey.displayName}</ItemTitle>
- <ItemDescription className="text-xs">
+ <SettingsRow
+ key={apiKey.id}
+ icon={<Key />}
+ title={apiKey.displayName}
+ description={
+ <span className="text-xs">
<span className="font-mono">
sk-...{apiKey.truncatedValue}
</span>
@@ -95,49 +91,52 @@ const ApiKeysPage = () => {
) : (
<> · {t('Never used')}</>
)}
- </ItemDescription>
- </ItemContent>
- <ItemActions>
- <DropdownMenu modal={true}>
- <DropdownMenuTrigger asChild>
- <Button variant="ghost" size="icon-sm">
- <MoreHorizontal className="size-4" />
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end">
- <ConfirmationDeleteDialog
- title={t('Revoke API Key')}
- message={t(
- 'Revoking this API key will immediately break any integrations using it. This action cannot be undone.',
+ </span>
+ }
+ >
+ <DropdownMenu modal={true}>
+ <DropdownMenuTrigger asChild>
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ aria-label={t('Actions')}
+ >
+ <MoreHorizontal className="size-4" />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <ConfirmationDeleteDialog
+ title={t('Revoke API Key')}
+ message={t(
+ 'Revoking this API key will immediately break any integrations using it. This action cannot be undone.',
+ )}
+ entityName={t('API Key')}
+ buttonText={t('Revoke')}
+ controlId={AdminControl.API_KEYS_API_KEY_REVOKE_CONFIRM}
+ mutationFn={async () => {
+ await apiKeyApi.delete(apiKey.id);
+ refetch();
+ }}
+ onError={() => internalErrorToast()}
+ >
+ <DropdownMenuItem
+ variant="destructive"
+ onSelect={(e) => e.preventDefault()}
+ {...adminControl(
+ AdminControl.API_KEYS_API_KEY_REVOKE_OPEN,
)}
- entityName={t('API Key')}
- buttonText={t('Revoke')}
- controlId={AdminControl.API_KEYS_API_KEY_REVOKE_CONFIRM}
- mutationFn={async () => {
- await apiKeyApi.delete(apiKey.id);
- refetch();
- }}
- onError={() => internalErrorToast()}
>
- <DropdownMenuItem
- className="text-danger-11 focus:text-danger-11"
- onSelect={(e) => e.preventDefault()}
- {...adminControl(
- AdminControl.API_KEYS_API_KEY_REVOKE_OPEN,
- )}
- >
- <Trash className="size-4 mr-2 text-danger-11" />
- {t('Revoke API Key')}
- </DropdownMenuItem>
- </ConfirmationDeleteDialog>
- </DropdownMenuContent>
- </DropdownMenu>
- </ItemActions>
- </Item>
+ <Trash className="size-4" />
+ {t('Revoke API Key')}
+ </DropdownMenuItem>
+ </ConfirmationDeleteDialog>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </SettingsRow>
))}
- </ItemGroup>
+ </SettingsPanel>
)}
- </CenteredPage>
+ </AdminPage>
);
};
diff --git a/packages/web/src/app/routes/platform/security/api-keys/new-api-key-dialog.tsx b/packages/web/src/app/routes/platform/security/api-keys/new-api-key-dialog.tsx
index 83eaa81f18e..90b8f053da7 100644
--- a/packages/web/src/app/routes/platform/security/api-keys/new-api-key-dialog.tsx
+++ b/packages/web/src/app/routes/platform/security/api-keys/new-api-key-dialog.tsx
@@ -6,6 +6,7 @@ import { useState } from 'react';
import { useForm } from 'react-hook-form';
import { z } from 'zod';
+import { adminLayout } from '@/app/components/admin';
import { CopyToClipboardInput } from '@/components/custom/clipboard/copy-to-clipboard';
import { Button } from '@/components/ui/button';
import {
@@ -67,7 +68,7 @@ export const NewApiKeyDialog = ({
}}
>
<DialogTrigger asChild>{children}</DialogTrigger>
- <DialogContent>
+ <DialogContent className={adminLayout.dialog.md}>
<DialogHeader>
<DialogTitle>
{apiKey ? t('API Key Created') : t('Create API Key')}
diff --git a/packages/web/src/app/routes/platform/security/audit-logs/index.tsx b/packages/web/src/app/routes/platform/security/audit-logs/index.tsx
index 7eb764366d6..1ae595e6a4b 100644
--- a/packages/web/src/app/routes/platform/security/audit-logs/index.tsx
+++ b/packages/web/src/app/routes/platform/security/audit-logs/index.tsx
@@ -29,8 +29,14 @@ import {
import { Fragment, useState } from 'react';
import { Link } from 'react-router-dom';
-import { DashboardPageHeader } from '@/app/components/dashboard-page-header';
-import { DataTable, DataTableFilters } from '@/components/custom/data-table';
+import {
+ AdminDataTable,
+ AdminPage,
+ AdminPageHeader,
+ adminPageResources,
+ adminLayout,
+} from '@/app/components/admin';
+import { DataTableFilters } from '@/components/custom/data-table';
import { DataTableColumnHeader } from '@/components/custom/data-table/data-table-column-header';
import { FormattedDate } from '@/components/custom/formatted-date';
import { SimpleJsonViewer } from '@/components/custom/simple-json-viewer';
@@ -52,6 +58,7 @@ import { projectCollectionUtils } from '@/features/projects';
import { platformHooks } from '@/hooks/platform-hooks';
import { AdminControl, adminControl } from '@/lib/admin-control';
import { formatUtils } from '@/lib/format-utils';
+import { cn } from '@/lib/utils';
import { sampleData } from '../../sample-data';
@@ -121,19 +128,20 @@ export default function AuditLogsPage() {
const rows = isSample ? sampleData.auditEventsPage() : auditLogsData;
return (
- <div className="flex flex-col w-full">
- <DashboardPageHeader
- description={t('Track activities done within your platform')}
+ <AdminPage>
+ <AdminPageHeader
title={t('Audit Logs')}
+ description={t('Track activities done within your platform')}
+ resources={adminPageResources.auditLogs}
>
{!isSample && <AuditLogRetentionButton />}
- </DashboardPageHeader>
- <DataTable
+ </AdminPageHeader>
+ <AdminDataTable
emptyStateTextTitle={t('No audit logs found')}
emptyStateTextDescription={t(
'Come back later when you have some activity to audit',
)}
- emptyStateIcon={<History className="size-14" />}
+ emptyStateIcon={<History />}
filters={filters}
columns={[
{
@@ -256,7 +264,7 @@ export default function AuditLogsPage() {
onRetry={refetch}
/>
<Sheet open={isSheetOpen} onOpenChange={setIsSheetOpen}>
- <SheetContent className="w-[480px] sm:max-w-[480px] flex flex-col p-0">
+ <SheetContent className={cn(adminLayout.sheet.md, 'flex flex-col p-0')}>
<SheetHeader className="px-6 py-4 border-b shrink-0">
<SheetTitle className="text-base">
{formatUtils.convertEnumToHumanReadable(
@@ -333,7 +341,7 @@ export default function AuditLogsPage() {
</div>
</SheetContent>
</Sheet>
- </div>
+ </AdminPage>
);
}
diff --git a/packages/web/src/app/routes/platform/security/embed/index.tsx b/packages/web/src/app/routes/platform/security/embed/index.tsx
index d4e36bd3fcf..44463dfd5ef 100644
--- a/packages/web/src/app/routes/platform/security/embed/index.tsx
+++ b/packages/web/src/app/routes/platform/security/embed/index.tsx
@@ -5,18 +5,15 @@ import {
SigningKey,
} from '@activepieces/shared';
import { t } from 'i18next';
-import {
- ExternalLink,
- Globe,
- Key,
- ListChecks,
- ShieldCheck,
-} from 'lucide-react';
+import { Globe, Key, ListChecks, ShieldCheck } from 'lucide-react';
import { useState } from 'react';
+import {
+ AdminPage,
+ AdminPageHeader,
+ adminPageResources,
+} from '@/app/components/admin';
import { DataFetchErrorState } from '@/components/custom/data-fetch-error-state';
-import { Button } from '@/components/ui/button';
-import { Separator } from '@/components/ui/separator';
import { SkeletonList } from '@/components/ui/skeleton';
import {
embedSubdomainQueries,
@@ -131,32 +128,27 @@ const EmbedPage = () => {
(displayedStep?.kind === 'hostname' || displayedStep?.kind === 'dns');
return (
- <div className="w-full max-w-4/5 2xl:max-w-6xl mx-auto py-6">
- <div className="flex flex-col gap-1">
- <h1 className="text-xl font-medium">{t('Embed Onboarding')}</h1>
- <div className="text-sm text-gray-11">
- {description}
- <Button
- variant="link"
- size="sm"
- className="h-auto p-0 mt-0.5 ml-1"
- asChild
- >
+ <AdminPage width="content">
+ <AdminPageHeader
+ title={t('Embed Onboarding')}
+ description={
+ <>
+ {description}{' '}
<a
{...adminControl(AdminControl.EMBEDDING_DOCS_LINK)}
href="https://www.activepieces.com/docs/embedding/overview"
target="_blank"
rel="noopener noreferrer"
+ className="text-accent-11 underline"
>
{t('Read more')}
- <ExternalLink className="size-3" />
</a>
- </Button>
- </div>
- </div>
- <Separator className="mt-4 mb-12" />
+ </>
+ }
+ resources={adminPageResources.embedding}
+ />
- <div className="grid grid-cols-[16rem_1fr] gap-16">
+ <div className="grid grid-cols-1 gap-6 md:grid-cols-[14rem_1fr]">
<Stepper
steps={steps}
completion={stepCompletion}
@@ -188,7 +180,7 @@ const EmbedPage = () => {
) : null}
</div>
</div>
- </div>
+ </AdminPage>
);
};
diff --git a/packages/web/src/app/routes/platform/security/embed/stepper.tsx b/packages/web/src/app/routes/platform/security/embed/stepper.tsx
index ba527e23aa8..796fd24c64b 100644
--- a/packages/web/src/app/routes/platform/security/embed/stepper.tsx
+++ b/packages/web/src/app/routes/platform/security/embed/stepper.tsx
@@ -1,30 +1,31 @@
import { LucideIcon } from 'lucide-react';
import { ReactNode } from 'react';
+import { SettingsPanel } from '@/app/components/admin';
import { cn } from '@/lib/utils';
export const StepShell = ({
title,
description,
actions,
+ flush,
children,
}: {
title: string;
description: string;
actions?: ReactNode;
+ flush?: boolean;
children: ReactNode;
}) => {
return (
- <div className="flex flex-col gap-8">
- <div className="flex items-start justify-between gap-4">
- <div className="flex flex-col gap-1">
- <h2 className="text-base font-medium">{title}</h2>
- <p className="text-sm text-gray-11">{description}</p>
- </div>
- {actions && <div className="shrink-0">{actions}</div>}
- </div>
+ <SettingsPanel
+ title={title}
+ description={description}
+ action={actions}
+ flush={flush}
+ >
{children}
- </div>
+ </SettingsPanel>
);
};
@@ -90,8 +91,7 @@ export const Stepper = ({
isLocked && 'text-gray-11 cursor-not-allowed opacity-60',
)}
>
- <span className="mr-1">{index + 1}.</span>
- {step.title}
+ {`${index + 1}. ${step.title}`}
</button>
</li>
);
diff --git a/packages/web/src/app/routes/platform/security/embed/steps/signing-keys-step.tsx b/packages/web/src/app/routes/platform/security/embed/steps/signing-keys-step.tsx
index acd247e18df..949fe9b03a1 100644
--- a/packages/web/src/app/routes/platform/security/embed/steps/signing-keys-step.tsx
+++ b/packages/web/src/app/routes/platform/security/embed/steps/signing-keys-step.tsx
@@ -2,6 +2,7 @@ import { SigningKey } from '@activepieces/shared';
import { t } from 'i18next';
import { Key, MoreHorizontal, Trash } from 'lucide-react';
+import { AdminEmpty, SettingsRow } from '@/app/components/admin';
import { ConfirmationDeleteDialog } from '@/components/custom/delete-dialog';
import { Button } from '@/components/ui/button';
import {
@@ -10,15 +11,6 @@ import {
DropdownMenuItem,
DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu';
-import {
- Item,
- ItemActions,
- ItemContent,
- ItemDescription,
- ItemGroup,
- ItemMedia,
- ItemTitle,
-} from '@/components/ui/item';
import { SkeletonList } from '@/components/ui/skeleton';
import { internalErrorToast } from '@/components/ui/sonner';
import { NewSigningKeyDialog, signingKeyApi } from '@/features/platform-admin';
@@ -46,12 +38,12 @@ export const SigningKeysStep = ({
<NewSigningKeyDialog onCreate={refetch}>
<Button
{...adminControl(AdminControl.EMBEDDING_SIGNING_KEY_NEW_OPEN)}
- size="sm"
>
{t('New Signing Key')}
</Button>
</NewSigningKeyDialog>
}
+ flush
>
<SigningKeysList
signingKeys={signingKeys}
@@ -72,79 +64,76 @@ const SigningKeysList = ({
refetch: () => void;
}) => {
if (isLoading) {
- return <SkeletonList numberOfItems={3} className="w-full h-[72px]" />;
+ return (
+ <div className="p-5">
+ <SkeletonList numberOfItems={3} className="w-full h-[72px]" />
+ </div>
+ );
}
if (signingKeys.length === 0) {
return (
- <div className="flex flex-col items-center gap-3 py-12 text-gray-11">
- <Key className="size-10" />
- <p className="text-sm">{t('No signing keys yet')}</p>
- </div>
+ <AdminEmpty
+ framed={false}
+ icon={<Key />}
+ title={t('No signing keys yet')}
+ />
);
}
return (
- <ItemGroup className="gap-2">
+ <>
{signingKeys.map((signingKey) => (
- <Item
+ <SettingsRow
key={signingKey.id}
- variant="outline"
- size="sm"
- className="items-center"
+ icon={<Key />}
+ title={signingKey.displayName}
+ description={
+ <div className="flex flex-col text-xs">
+ <span>
+ {t('Created')}{' '}
+ {formatUtils.formatDateToAgo(new Date(signingKey.created))}
+ </span>
+ <span>kid: {signingKey.id}</span>
+ </div>
+ }
>
- <ItemMedia variant="icon">
- <Key />
- </ItemMedia>
- <ItemContent className="gap-0">
- <ItemTitle className="flex items-center gap-2">
- {signingKey.displayName}
- </ItemTitle>
- <ItemDescription className="text-xs">
- {' ' + t('Created')}{' '}
- {formatUtils.formatDateToAgo(new Date(signingKey.created))}
- <br />
- <span className="text-xs text-gray-11">kid: {signingKey.id}</span>
- </ItemDescription>
- </ItemContent>
- <ItemActions>
- <DropdownMenu modal={true}>
- <DropdownMenuTrigger asChild>
- <Button variant="ghost" size="icon-sm">
- <MoreHorizontal className="size-4" />
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end">
- <ConfirmationDeleteDialog
- title={t('Delete Signing Key')}
- message={t(
- 'Deleting this signing key will invalidate any tokens signed with it.',
+ <DropdownMenu modal={true}>
+ <DropdownMenuTrigger asChild>
+ <Button variant="ghost" size="icon-sm" aria-label={t('Actions')}>
+ <MoreHorizontal />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <ConfirmationDeleteDialog
+ title={t('Delete Signing Key')}
+ message={t(
+ 'Deleting this signing key will invalidate any tokens signed with it.',
+ )}
+ entityName={t('Signing Key')}
+ buttonText={t('Delete')}
+ mutationFn={async () => {
+ await signingKeyApi.delete(signingKey.id);
+ refetch();
+ }}
+ onError={() => internalErrorToast()}
+ controlId={AdminControl.EMBEDDING_SIGNING_KEY_DELETE_CONFIRM}
+ >
+ <DropdownMenuItem
+ {...adminControl(
+ AdminControl.EMBEDDING_SIGNING_KEY_DELETE_OPEN,
)}
- entityName={t('Signing Key')}
- buttonText={t('Delete')}
- mutationFn={async () => {
- await signingKeyApi.delete(signingKey.id);
- refetch();
- }}
- onError={() => internalErrorToast()}
- controlId={AdminControl.EMBEDDING_SIGNING_KEY_DELETE_CONFIRM}
+ className="text-danger-11 focus:text-danger-11"
+ onSelect={(e) => e.preventDefault()}
>
- <DropdownMenuItem
- {...adminControl(
- AdminControl.EMBEDDING_SIGNING_KEY_DELETE_OPEN,
- )}
- className="text-danger-11 focus:text-danger-11"
- onSelect={(e) => e.preventDefault()}
- >
- <Trash className="size-4 mr-2 text-danger-11" />
- {t('Delete Signing Key')}
- </DropdownMenuItem>
- </ConfirmationDeleteDialog>
- </DropdownMenuContent>
- </DropdownMenu>
- </ItemActions>
- </Item>
+ <Trash className="text-danger-11" />
+ {t('Delete Signing Key')}
+ </DropdownMenuItem>
+ </ConfirmationDeleteDialog>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </SettingsRow>
))}
- </ItemGroup>
+ </>
);
};
diff --git a/packages/web/src/app/routes/platform/security/project-role/index.tsx b/packages/web/src/app/routes/platform/security/project-role/index.tsx
index 890c9bb7e1e..2b7e59c449c 100644
--- a/packages/web/src/app/routes/platform/security/project-role/index.tsx
+++ b/packages/web/src/app/routes/platform/security/project-role/index.tsx
@@ -1,6 +1,10 @@
import { t } from 'i18next';
-import { CenteredPage } from '@/app/components/centered-page';
+import {
+ AdminPage,
+ AdminPageHeader,
+ adminPageResources,
+} from '@/app/components/admin';
import { projectRoleQueries } from '@/features/platform-admin';
import { platformHooks } from '@/hooks/platform-hooks';
@@ -17,21 +21,21 @@ const ProjectRolePage = () => {
const roles = isSample ? sampleData.projectRolesPage() : data;
return (
- <CenteredPage
- title={t('Roles & Access')}
- description={t(
- 'Create roles and control what members can do in each project',
- )}
- widthClassName="max-w-4xl"
- className="min-h-full bg-gray-1"
- >
+ <AdminPage width="content">
+ <AdminPageHeader
+ title={t('Roles & Access')}
+ description={t(
+ 'Create roles and control what members can do in each project',
+ )}
+ resources={adminPageResources.roles}
+ />
<RolesCard
projectRoles={roles}
isLoading={isSample ? false : isLoading}
isError={isSample ? false : isError}
refetch={refetch}
/>
- </CenteredPage>
+ </AdminPage>
);
};
diff --git a/packages/web/src/app/routes/platform/security/project-role/platform-roles-list.tsx b/packages/web/src/app/routes/platform/security/project-role/platform-roles-list.tsx
index a45a33cb3b2..555db20b9eb 100644
--- a/packages/web/src/app/routes/platform/security/project-role/platform-roles-list.tsx
+++ b/packages/web/src/app/routes/platform/security/project-role/platform-roles-list.tsx
@@ -1,14 +1,8 @@
import { t } from 'i18next';
import { Link } from 'react-router-dom';
+import { SettingsPanel, SettingsRow } from '@/app/components/admin';
import { Badge } from '@/components/ui/badge';
-import {
- Item,
- ItemContent,
- ItemDescription,
- ItemGroup,
- ItemTitle,
-} from '@/components/ui/item';
import {
Tooltip,
TooltipContent,
@@ -23,22 +17,24 @@ export function PlatformRolesList() {
const { platform } = platformHooks.useCurrentPlatform();
return (
- <div className="flex flex-col gap-3">
- <ItemGroup className="gap-2">
+ <div className="flex flex-col gap-4">
+ <SettingsPanel flush>
{roleCopy
.platformRoles({
personalProjectsEnabled: platform.autoCreatePersonalProjects,
})
.map((platformRole) => (
- <Item
+ <SettingsRow
key={platformRole.role}
- variant="outline"
- size="sm"
- className="flex-nowrap bg-panel"
- >
- <RoleAvatar name={platformRole.label} tone={platformRole.tone} />
- <ItemContent className="min-w-0">
- <ItemTitle className="min-w-0 max-w-full flex-wrap">
+ media={
+ <RoleAvatar
+ name={platformRole.label}
+ tone={platformRole.tone}
+ className="rounded-lg"
+ />
+ }
+ title={
+ <>
{platformRole.label}
<Tooltip>
<TooltipTrigger asChild>
@@ -55,16 +51,14 @@ export function PlatformRolesList() {
</TooltipContent>
</Tooltip>
{platformRole.isDefaultForNewMembers && (
- <Badge variant="info" className="">
- {t('Default for new people')}
- </Badge>
+ <Badge variant="info">{t('Default for new people')}</Badge>
)}
- </ItemTitle>
- <ItemDescription>{platformRole.description}</ItemDescription>
- </ItemContent>
- </Item>
+ </>
+ }
+ description={platformRole.description}
+ />
))}
- </ItemGroup>
+ </SettingsPanel>
<p className="text-xs text-gray-11">
{t("Everyone has exactly one. To change someone's, open")}{' '}
<Link
diff --git a/packages/web/src/app/routes/platform/security/project-role/project-role-dialog.tsx b/packages/web/src/app/routes/platform/security/project-role/project-role-dialog.tsx
index 4046db08b9e..48f2505ae9b 100644
--- a/packages/web/src/app/routes/platform/security/project-role/project-role-dialog.tsx
+++ b/packages/web/src/app/routes/platform/security/project-role/project-role-dialog.tsx
@@ -3,6 +3,7 @@ import { t } from 'i18next';
import { MoreHorizontal, Pencil, Trash, X } from 'lucide-react';
import { ReactNode, useState } from 'react';
+import { adminLayout } from '@/app/components/admin';
import { ConfirmationDeleteDialog } from '@/components/custom/delete-dialog';
import EditableText from '@/components/custom/editable-text';
import { Badge } from '@/components/ui/badge';
@@ -62,7 +63,10 @@ export const ProjectRoleDialog = ({
{children && <DialogTrigger asChild>{children}</DialogTrigger>}
<DialogContent
showCloseButton={false}
- className="@container flex h-[min(39rem,88dvh)] w-[calc(100vw-2rem)] max-w-4xl flex-col gap-0 overflow-hidden p-0"
+ className={cn(
+ adminLayout.dialog.lg,
+ '@container flex h-[min(39rem,88dvh)] w-[calc(100vw-2rem)] flex-col gap-0 overflow-hidden p-0',
+ )}
>
<RoleDialogBody
key={isOpen ? `${projectRole?.id ?? 'new'}-open` : 'closed'}
diff --git a/packages/web/src/app/routes/platform/security/project-role/project-roles-list.tsx b/packages/web/src/app/routes/platform/security/project-role/project-roles-list.tsx
index c3b9df346e3..4be6bf87253 100644
--- a/packages/web/src/app/routes/platform/security/project-role/project-roles-list.tsx
+++ b/packages/web/src/app/routes/platform/security/project-role/project-roles-list.tsx
@@ -4,16 +4,10 @@ import { t } from 'i18next';
import { ChevronRight, Shield } from 'lucide-react';
import { useState } from 'react';
+import { AdminEmpty, SettingsPanel, SettingsRow } from '@/app/components/admin';
import { DataFetchErrorState } from '@/components/custom/data-fetch-error-state';
import { TextWithTooltip } from '@/components/custom/text-with-tooltip';
import { Badge } from '@/components/ui/badge';
-import {
- Item,
- ItemContent,
- ItemDescription,
- ItemGroup,
- ItemTitle,
-} from '@/components/ui/item';
import { SkeletonList } from '@/components/ui/skeleton';
import { roleCopy } from '@/features/members/lib/role-copy';
import { AdminControl, adminControl } from '@/lib/admin-control';
@@ -43,39 +37,37 @@ export function ProjectRolesList({
if (roles.length === 0) {
return (
- <div className="flex flex-col items-center gap-3 py-12 text-gray-11">
- <Shield className="size-10" />
- <p className="text-sm">
- {t('No project roles yet. Create one to get started.')}
- </p>
- </div>
+ <AdminEmpty
+ icon={<Shield />}
+ title={t('No project roles yet. Create one to get started.')}
+ />
);
}
return (
- <div className="flex flex-col gap-3">
- <ItemGroup className="gap-2">
+ <>
+ <SettingsPanel flush>
{roles.map((role) => {
const description = roleCopy.projectRoleSummary({
name: role.name,
permissions: role.permissions,
});
return (
- <Item
+ <SettingsRow
key={role.id}
- variant="outline"
- size="sm"
- className="relative flex-nowrap cursor-pointer bg-panel hover:bg-gray-3 focus-within:border-gray-8 focus-within:ring-[3px] focus-within:ring-gray-8/50"
- >
- <RoleAvatar
- name={role.name}
- tone={roleCopy.projectRoleTone(role.name)}
- />
- <ItemContent className="min-w-0">
- <ItemTitle className="min-w-0 max-w-full">
+ className="relative cursor-pointer first:rounded-t-xl last:rounded-b-xl hover:bg-gray-3 has-focus-visible:bg-gray-3"
+ media={
+ <RoleAvatar
+ name={role.name}
+ tone={roleCopy.projectRoleTone(role.name)}
+ className="rounded-lg"
+ />
+ }
+ title={
+ <>
<button
type="button"
- className="min-w-0 text-left after:absolute after:inset-0 after:content-['']"
+ className="min-w-0 text-left focus-visible:outline-none after:absolute after:inset-0 after:content-['']"
onClick={() => setOpened({ role, tab: 'permissions' })}
{...adminControl(AdminControl.ROLES_ROLE_OPEN)}
>
@@ -87,35 +79,35 @@ export function ProjectRolesList({
variant={
role.type === RoleType.DEFAULT ? 'secondary' : 'info'
}
- className=""
>
{role.type === RoleType.DEFAULT
? t('Built in')
: t('Custom')}
</Badge>
- </ItemTitle>
- <ItemDescription>{description}</ItemDescription>
- </ItemContent>
+ </>
+ }
+ description={description}
+ >
{!isNil(role.userCount) &&
(role.userCount === 0 ? (
- <span className="shrink-0 text-sm tabular-nums text-gray-11">
+ <span className="text-sm tabular-nums text-gray-11">
{t('rolePeopleCount', { count: 0 })}
</span>
) : (
<button
type="button"
- className="relative z-10 shrink-0 text-sm tabular-nums text-accent-11 underline-offset-4 hover:underline"
+ className="relative z-10 text-sm tabular-nums text-accent-11 underline-offset-4 hover:underline"
onClick={() => setOpened({ role, tab: 'people' })}
{...adminControl(AdminControl.ROLES_PEOPLE_OPEN)}
>
{t('rolePeopleCount', { count: role.userCount })}
</button>
))}
- <ChevronRight className="size-4 shrink-0 text-gray-11" />
- </Item>
+ <ChevronRight className="size-4 text-gray-11" />
+ </SettingsRow>
);
})}
- </ItemGroup>
+ </SettingsPanel>
{opened && (
<ProjectRoleDialog
key={`${opened.role.id}-${opened.tab}`}
@@ -134,7 +126,7 @@ export function ProjectRolesList({
}}
/>
)}
- </div>
+ </>
);
}
diff --git a/packages/web/src/app/routes/platform/security/project-role/roles-card.tsx b/packages/web/src/app/routes/platform/security/project-role/roles-card.tsx
index c46dada0901..34b4e6f1622 100644
--- a/packages/web/src/app/routes/platform/security/project-role/roles-card.tsx
+++ b/packages/web/src/app/routes/platform/security/project-role/roles-card.tsx
@@ -36,7 +36,7 @@ export function RolesCard({
const newRoleButton = !platform.plan.customRolesEnabled ? (
<Tooltip>
<TooltipTrigger>
- <AnimatedIconButton icon={PlusIcon} iconSize={16} size="sm" disabled>
+ <AnimatedIconButton icon={PlusIcon} iconSize={16} disabled>
{t('New role')}
</AnimatedIconButton>
</TooltipTrigger>
@@ -49,7 +49,6 @@ export function RolesCard({
<AnimatedIconButton
icon={PlusIcon}
iconSize={16}
- size="sm"
{...adminControl(AdminControl.ROLES_NEW_OPEN)}
>
{t('New role')}
@@ -58,40 +57,37 @@ export function RolesCard({
);
return (
- <section className="flex flex-col gap-4">
- <h2 className="text-base font-medium">{t('Roles')}</h2>
- <Tabs
- value={activeTab}
- onValueChange={(value) => setActiveTab(toRolesTab(value))}
- >
- <div className="flex flex-wrap items-center justify-between gap-3">
- <TabsList>
- <TabsTrigger value="project" className="gap-2">
- {t('Project roles')}
- {!isNil(projectRolesCount) && (
- <span className="text-gray-11">{projectRolesCount}</span>
- )}
- </TabsTrigger>
- <TabsTrigger value="platform" className="gap-2">
- {t('Platform roles')}
- <span className="text-gray-11">{platformRolesCount}</span>
- </TabsTrigger>
- </TabsList>
- {activeTab === 'project' && newRoleButton}
- </div>
- <TabsContent value="project">
- <ProjectRolesList
- projectRoles={projectRoles}
- isLoading={isLoading}
- isError={isError}
- refetch={refetch}
- />
- </TabsContent>
- <TabsContent value="platform">
- <PlatformRolesList />
- </TabsContent>
- </Tabs>
- </section>
+ <Tabs
+ value={activeTab}
+ onValueChange={(value) => setActiveTab(toRolesTab(value))}
+ >
+ <div className="flex flex-wrap items-center justify-between gap-4">
+ <TabsList>
+ <TabsTrigger value="project" className="gap-2">
+ {t('Project roles')}
+ {!isNil(projectRolesCount) && (
+ <span className="text-gray-11">{projectRolesCount}</span>
+ )}
+ </TabsTrigger>
+ <TabsTrigger value="platform" className="gap-2">
+ {t('Platform roles')}
+ <span className="text-gray-11">{platformRolesCount}</span>
+ </TabsTrigger>
+ </TabsList>
+ {activeTab === 'project' && newRoleButton}
+ </div>
+ <TabsContent value="project">
+ <ProjectRolesList
+ projectRoles={projectRoles}
+ isLoading={isLoading}
+ isError={isError}
+ refetch={refetch}
+ />
+ </TabsContent>
+ <TabsContent value="platform">
+ <PlatformRolesList />
+ </TabsContent>
+ </Tabs>
);
}
diff --git a/packages/web/src/app/routes/platform/security/secret-managers/connect-secret-manager-dialog.tsx b/packages/web/src/app/routes/platform/security/secret-managers/connect-secret-manager-dialog.tsx
index 38766c4887c..23851831a80 100644
--- a/packages/web/src/app/routes/platform/security/secret-managers/connect-secret-manager-dialog.tsx
+++ b/packages/web/src/app/routes/platform/security/secret-managers/connect-secret-manager-dialog.tsx
@@ -12,6 +12,7 @@ import { t } from 'i18next';
import { useState } from 'react';
import { useForm } from 'react-hook-form';
+import { adminLayout } from '@/app/components/admin';
import { LogoPlate } from '@/components/custom/logo-plate';
import { Button } from '@/components/ui/button';
import {
@@ -25,7 +26,6 @@ import {
import { Form, FormField, FormItem, FormMessage } from '@/components/ui/form';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
-import { ScrollArea } from '@/components/ui/scroll-area';
import {
Select,
SelectContent,
@@ -59,7 +59,7 @@ const AddEditSecretManagerConnectionDialog = ({
</TooltipTrigger>
<TooltipContent>{t('Edit')}</TooltipContent>
</Tooltip>
- <DialogContent className="max-w-2xl max-h-[90vh] overflow-y-auto">
+ <DialogContent className={adminLayout.dialog.md}>
<DialogHeader>
<DialogTitle>
{connection
@@ -128,134 +128,130 @@ const AddEditSecretManagerForm = ({
className="grid space-y-4"
onSubmit={form.handleSubmit(handleSubmit)}
>
- <ScrollArea className="max-h-[500px]">
- <div className="grid space-y-3">
- {!isEdit && (
- <FormField
- name="providerId"
- render={({ field }) => (
- <FormItem className="space-y-2">
- <Label htmlFor="provider-select" showRequiredIndicator>
- {t('Provider')}
- </Label>
- <Select
- value={field.value ?? ''}
- onValueChange={(val) => {
- const provider = SECRET_MANAGER_PROVIDERS_METADATA.find(
- (p) => p.id === val,
- );
- field.onChange(val);
- if (provider) {
- form.setValue(
- 'config',
- secretManagersUtils.getEmptySecretManagerConfig(
- provider.id,
- ),
- );
- }
- }}
- >
- <SelectTrigger id="provider-select">
- <SelectValue placeholder={t('Select a provider')} />
- </SelectTrigger>
- <SelectContent>
- {SECRET_MANAGER_PROVIDERS_METADATA.map((provider) => (
- <SelectItem key={provider.id} value={provider.id}>
- <div className="flex items-center gap-2">
- <LogoPlate
- src={provider.logo}
- alt={provider.name}
- size="xxs"
- />
- <span>{provider.name}</span>
- </div>
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- <FormMessage />
- </FormItem>
- )}
- />
- )}
-
+ <div className="grid space-y-3">
+ {!isEdit && (
<FormField
- name="name"
+ name="providerId"
render={({ field }) => (
<FormItem className="space-y-2">
- <Label htmlFor="connection-name" showRequiredIndicator>
- {t('Name')}
+ <Label htmlFor="provider-select" showRequiredIndicator>
+ {t('Provider')}
</Label>
- <Input
- {...field}
- id="connection-name"
- placeholder={t('e.g. Production HashiCorp')}
- />
- <FormMessage />
- </FormItem>
- )}
- />
-
- <FormField
- name="scope"
- render={({ field }) => (
- <FormItem className="space-y-2">
- <Label htmlFor="connection-scope" showRequiredIndicator>
- {t('Scope')}
- </Label>
- <Select value={field.value} onValueChange={field.onChange}>
- <SelectTrigger id="connection-scope">
- <SelectValue placeholder={t('Select scope')} />
+ <Select
+ value={field.value ?? ''}
+ onValueChange={(val) => {
+ const provider = SECRET_MANAGER_PROVIDERS_METADATA.find(
+ (p) => p.id === val,
+ );
+ field.onChange(val);
+ if (provider) {
+ form.setValue(
+ 'config',
+ secretManagersUtils.getEmptySecretManagerConfig(
+ provider.id,
+ ),
+ );
+ }
+ }}
+ >
+ <SelectTrigger id="provider-select">
+ <SelectValue placeholder={t('Select a provider')} />
</SelectTrigger>
<SelectContent>
- <SelectItem value={SecretManagerConnectionScope.PLATFORM}>
- {t('Platform')}
- </SelectItem>
- <SelectItem value={SecretManagerConnectionScope.PROJECT}>
- {t('Project')}
- </SelectItem>
+ {SECRET_MANAGER_PROVIDERS_METADATA.map((provider) => (
+ <SelectItem key={provider.id} value={provider.id}>
+ <div className="flex items-center gap-2">
+ <LogoPlate
+ src={provider.logo}
+ alt={provider.name}
+ size="xxs"
+ />
+ <span>{provider.name}</span>
+ </div>
+ </SelectItem>
+ ))}
</SelectContent>
</Select>
<FormMessage />
</FormItem>
)}
/>
+ )}
- {watchedScope === SecretManagerConnectionScope.PROJECT && (
- <ProjectSelector control={form.control} name="projectIds" />
+ <FormField
+ name="name"
+ render={({ field }) => (
+ <FormItem className="space-y-2">
+ <Label htmlFor="connection-name" showRequiredIndicator>
+ {t('Name')}
+ </Label>
+ <Input
+ {...field}
+ id="connection-name"
+ placeholder={t('e.g. Production HashiCorp')}
+ />
+ <FormMessage />
+ </FormItem>
)}
+ />
- {selectedProvider &&
- Object.entries(selectedProvider.fields).map(
- ([fieldId, field]) => (
- <FormField
- key={fieldId}
- name={`config.${fieldId}`}
- render={({ field: formField }) => (
- <FormItem className="space-y-2">
- <Label
- htmlFor={fieldId}
- showRequiredIndicator={!field.optional}
- >
- {field.displayName}
- </Label>
- <div className="flex gap-2 items-center justify-center">
- <Input
- {...formField}
- id={fieldId}
- placeholder={field.placeholder}
- type={field.type}
- value={formField.value}
- />
- </div>
- <FormMessage />
- </FormItem>
- )}
- />
- ),
- )}
- </div>
- </ScrollArea>
+ <FormField
+ name="scope"
+ render={({ field }) => (
+ <FormItem className="space-y-2">
+ <Label htmlFor="connection-scope" showRequiredIndicator>
+ {t('Scope')}
+ </Label>
+ <Select value={field.value} onValueChange={field.onChange}>
+ <SelectTrigger id="connection-scope">
+ <SelectValue placeholder={t('Select scope')} />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value={SecretManagerConnectionScope.PLATFORM}>
+ {t('Platform')}
+ </SelectItem>
+ <SelectItem value={SecretManagerConnectionScope.PROJECT}>
+ {t('Project')}
+ </SelectItem>
+ </SelectContent>
+ </Select>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+
+ {watchedScope === SecretManagerConnectionScope.PROJECT && (
+ <ProjectSelector control={form.control} name="projectIds" />
+ )}
+
+ {selectedProvider &&
+ Object.entries(selectedProvider.fields).map(([fieldId, field]) => (
+ <FormField
+ key={fieldId}
+ name={`config.${fieldId}`}
+ render={({ field: formField }) => (
+ <FormItem className="space-y-2">
+ <Label
+ htmlFor={fieldId}
+ showRequiredIndicator={!field.optional}
+ >
+ {field.displayName}
+ </Label>
+ <div className="flex gap-2 items-center justify-center">
+ <Input
+ {...formField}
+ id={fieldId}
+ placeholder={field.placeholder}
+ type={field.type}
+ value={formField.value}
+ />
+ </div>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ ))}
+ </div>
{form.formState.errors.root?.serverError && (
<FormMessage>
{form.formState.errors.root.serverError.message}
diff --git a/packages/web/src/app/routes/platform/security/secret-managers/index.tsx b/packages/web/src/app/routes/platform/security/secret-managers/index.tsx
index 27f20f79f26..14d309b57aa 100644
--- a/packages/web/src/app/routes/platform/security/secret-managers/index.tsx
+++ b/packages/web/src/app/routes/platform/security/secret-managers/index.tsx
@@ -12,15 +12,19 @@ import {
Trash,
Globe,
Activity,
- XIcon,
} from 'lucide-react';
-import { DashboardPageHeader } from '@/app/components/dashboard-page-header';
+import {
+ AdminDataTable,
+ AdminPage,
+ AdminPageHeader,
+ StatusDot,
+ adminPageResources,
+} from '@/app/components/admin';
import { AnimatedIconButton } from '@/components/custom/animated-icon-button';
-import { DataTable, RowDataWithActions } from '@/components/custom/data-table';
+import { RowDataWithActions } from '@/components/custom/data-table';
import { DataTableColumnHeader } from '@/components/custom/data-table/data-table-column-header';
import { ConfirmationDeleteDialog } from '@/components/custom/delete-dialog';
-import { StatusIconWithText } from '@/components/custom/status-icon-with-text';
import { PlusIcon } from '@/components/icons/plus';
import { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
@@ -120,28 +124,12 @@ const SecretManagersPage = () => {
cell: ({ row }) => {
const { configured, connected } = row.original.connection;
if (!configured) {
- return (
- <Badge variant="outline" className="text-gray-11">
- {t('Not configured')}
- </Badge>
- );
+ return <StatusDot tone="neutral">{t('Not configured')}</StatusDot>;
}
if (connected) {
- return (
- <StatusIconWithText
- icon={Activity}
- text={t('Connected')}
- variant="success"
- />
- );
+ return <StatusDot tone="success">{t('Connected')}</StatusDot>;
}
- return (
- <StatusIconWithText
- icon={XIcon}
- text={t('Disconnected')}
- variant="error"
- />
- );
+ return <StatusDot tone="danger">{t('Disconnected')}</StatusDot>;
},
},
{
@@ -153,7 +141,8 @@ const SecretManagersPage = () => {
<AddEditSecretManagerConnectionDialog connection={connection}>
<Button
variant="ghost"
- size="sm"
+ size="icon-sm"
+ aria-label={t('Edit')}
{...adminControl(
AdminControl.SECRET_MANAGERS_CONNECTION_EDIT_OPEN,
)}
@@ -179,7 +168,8 @@ const SecretManagersPage = () => {
<TooltipTrigger asChild>
<Button
variant="ghost"
- size="sm"
+ size="icon-sm"
+ aria-label={t('Delete')}
{...adminControl(
AdminControl.SECRET_MANAGERS_CONNECTION_DELETE_OPEN,
)}
@@ -198,28 +188,28 @@ const SecretManagersPage = () => {
];
return (
- <div className="flex-col w-full">
- <DashboardPageHeader
+ <AdminPage>
+ <AdminPageHeader
title={t('Secret Managers')}
description={t('Manage Secret Manager connections')}
+ resources={adminPageResources.secretManagers}
>
<AddEditSecretManagerConnectionDialog>
<AnimatedIconButton
icon={PlusIcon}
iconSize={16}
- size="sm"
{...adminControl(AdminControl.SECRET_MANAGERS_CONNECTION_OPEN)}
>
{t('New Connection')}
</AnimatedIconButton>
</AddEditSecretManagerConnectionDialog>
- </DashboardPageHeader>
- <DataTable
+ </AdminPageHeader>
+ <AdminDataTable
emptyStateTextTitle={t('No connections found')}
emptyStateTextDescription={t(
'Add a secret manager connection to manage your secrets',
)}
- emptyStateIcon={<KeyRound className="size-14" />}
+ emptyStateIcon={<KeyRound />}
columns={columns}
page={page}
isLoading={isSample ? false : isLoading}
@@ -228,7 +218,7 @@ const SecretManagersPage = () => {
onRetry={refetchConnections}
hidePagination={true}
/>
- </div>
+ </AdminPage>
);
};
@@ -246,8 +236,9 @@ const SecretManagerClearCacheButton = ({
<TooltipTrigger asChild>
<Button
variant="ghost"
- size="sm"
+ size="icon-sm"
loading={isClearingCache}
+ aria-label={t('Clear Cache')}
onClick={() => clearCache(connection.id)}
{...adminControl(AdminControl.SECRET_MANAGERS_CACHE_RUN)}
>
diff --git a/packages/web/src/app/routes/platform/security/sso/allowed-domain.tsx b/packages/web/src/app/routes/platform/security/sso/allowed-domain.tsx
index fdfe21368d4..8ed0729e66f 100644
--- a/packages/web/src/app/routes/platform/security/sso/allowed-domain.tsx
+++ b/packages/web/src/app/routes/platform/security/sso/allowed-domain.tsx
@@ -12,6 +12,7 @@ import { toast } from 'sonner';
import { z } from 'zod';
import { platformApi } from '@/api/platforms-api';
+import { adminLayout } from '@/app/components/admin';
import { Button } from '@/components/ui/button';
import {
Dialog,
@@ -93,13 +94,13 @@ export const AllowedDomainDialog = ({
{platform.allowedAuthDomains.length > 0 ? t('Update') : t('Enable')}
</Button>
</DialogTrigger>
- <DialogContent>
+ <DialogContent className={adminLayout.dialog.md}>
<DialogHeader>
<DialogTitle>{t('Configure Allowed Domains')}</DialogTitle>
</DialogHeader>
<Form {...form}>
<form
- className="grid space-y-4"
+ className="flex flex-col gap-4"
onSubmit={form.handleSubmit((data) => {
mutate({
allowedAuthDomains: data.allowedAuthDomains.map(
@@ -110,20 +111,18 @@ export const AllowedDomainDialog = ({
});
})}
>
- <div className="flex flex-col gap-1">
- <div className="text-gray-11 text-sm">
- {t(
- 'Enter the allowed domains for the users to authenticate with. An empty list will allow all domains.',
- )}
- </div>
- </div>
+ <p className="text-sm text-gray-11">
+ {t(
+ 'Enter the allowed domains for the users to authenticate with. An empty list will allow all domains.',
+ )}
+ </p>
{fields.map((field, index) => (
<FormField
key={field.id}
name={`allowedAuthDomains.${index}.domain`}
render={({ field }) => (
- <FormItem className="grid space-y-4">
- <div className="flex space-x-2">
+ <FormItem className="space-y-0">
+ <div className="flex gap-2">
<Input
{...field}
id={`allowedAuthDomains.${index}`}
@@ -133,8 +132,10 @@ export const AllowedDomainDialog = ({
type="button"
onClick={() => remove(index)}
variant="outline"
+ size="icon"
+ aria-label={t('Remove')}
>
- <X className="w-4 h-4" />
+ <X />
</Button>
</div>
</FormItem>
@@ -147,7 +148,7 @@ export const AllowedDomainDialog = ({
variant="outline"
size="sm"
>
- <Plus className="size-4" />
+ <Plus />
{t('Add Domain')}
</Button>
{form?.formState?.errors?.root?.serverError && (
diff --git a/packages/web/src/app/routes/platform/security/sso/index.tsx b/packages/web/src/app/routes/platform/security/sso/index.tsx
index 365ce196919..c4a41d0f78d 100644
--- a/packages/web/src/app/routes/platform/security/sso/index.tsx
+++ b/packages/web/src/app/routes/platform/security/sso/index.tsx
@@ -1,20 +1,19 @@
import { SsoDomainVerificationStatus } from '@activepieces/shared';
import { t } from 'i18next';
-import { CheckCircle, LockIcon, MailIcon, Earth } from 'lucide-react';
+import { LockIcon, MailIcon, Earth } from 'lucide-react';
import { toast } from 'sonner';
-import { CenteredPage } from '@/app/components/centered-page';
+import {
+ AdminPage,
+ AdminPageHeader,
+ SettingsPanel,
+ SettingsRow,
+ StatusDot,
+ adminPageResources,
+} from '@/app/components/admin';
import { AllowedDomainDialog } from '@/app/routes/platform/security/sso/allowed-domain';
import { ConfigureSamlDialog } from '@/app/routes/platform/security/sso/saml-dialog';
import { Badge } from '@/components/ui/badge';
-import {
- Item,
- ItemMedia,
- ItemContent,
- ItemTitle,
- ItemDescription,
- ItemActions,
-} from '@/components/ui/item';
import { Switch } from '@/components/ui/switch';
import { ssoMutations } from '@/features/platform-admin';
import { platformHooks } from '@/hooks/platform-hooks';
@@ -30,6 +29,7 @@ const SSOPage = () => {
platform.ssoDomainVerification?.status ===
SsoDomainVerificationStatus.VERIFIED;
const emailAuthEnabled = platform.emailAuthEnabled;
+ const allowedDomains = platform.allowedAuthDomains ?? [];
const { mutate: toggleEmailAuthentication, isPending: isEmailAuthPending } =
ssoMutations.useUpdatePlatformSso({
@@ -50,120 +50,104 @@ const SSOPage = () => {
});
return (
- <CenteredPage
- title={t('Single Sign On')}
- description={t('Manage single sign on providers')}
- >
- <div className="flex flex-col gap-4">
- <Item variant="outline">
- <ItemMedia variant="icon">
- <Earth />
- </ItemMedia>
- <ItemContent>
- <ItemTitle>{t('Allowed Domains')}</ItemTitle>
- <ItemDescription>
+ <AdminPage width="content">
+ <AdminPageHeader
+ title={t('Single Sign On')}
+ description={t('Manage single sign on providers')}
+ resources={adminPageResources.sso}
+ />
+ <SettingsPanel flush>
+ <SettingsRow
+ icon={<Earth />}
+ title={t('Allowed Domains')}
+ description={
+ <div className="flex flex-col gap-2">
{t('Restrict authentication to specific email domains.')}
- </ItemDescription>
- {(platform?.allowedAuthDomains ?? []).length > 0 && (
- <div className="mt-1 gap-2 flex">
- {(platform?.allowedAuthDomains ?? []).map((text, index) => (
- <Badge key={index} variant={'outline'}>
- {text}
- </Badge>
- ))}
- </div>
- )}
- </ItemContent>
- <ItemActions>
- <AllowedDomainDialog platform={platform} refetch={refetch} />
- </ItemActions>
- </Item>
+ {allowedDomains.length > 0 && (
+ <div className="flex flex-wrap gap-2">
+ {allowedDomains.map((domain, index) => (
+ <Badge key={`${domain}-${index}`} variant="outline">
+ {domain}
+ </Badge>
+ ))}
+ </div>
+ )}
+ </div>
+ }
+ >
+ <AllowedDomainDialog platform={platform} refetch={refetch} />
+ </SettingsRow>
- <Item variant="outline">
- <ItemMedia variant="icon">
- <img className="size-6" src={GoogleIcon} alt="icon" />
- </ItemMedia>
- <ItemContent>
- <ItemTitle>Google</ItemTitle>
- <ItemDescription>
- {t("Allow logins through google's single sign-on functionality.")}
- </ItemDescription>
- </ItemContent>
- <ItemActions>
- <Switch
- {...adminControl(AdminControl.SSO_GOOGLE_TOGGLE)}
- checked={platform.googleAuthEnabled}
- onCheckedChange={() =>
- toggleGoogleAuth({
- googleAuthEnabled: !platform.googleAuthEnabled,
- })
- }
- disabled={isGoogleAuthPending}
- />
- </ItemActions>
- </Item>
+ <SettingsRow
+ icon={<img className="size-5" src={GoogleIcon} alt="icon" />}
+ title="Google"
+ description={t(
+ "Allow logins through google's single sign-on functionality.",
+ )}
+ >
+ <Switch
+ {...adminControl(AdminControl.SSO_GOOGLE_TOGGLE)}
+ aria-label="Google"
+ checked={platform.googleAuthEnabled}
+ onCheckedChange={() =>
+ toggleGoogleAuth({
+ googleAuthEnabled: !platform.googleAuthEnabled,
+ })
+ }
+ disabled={isGoogleAuthPending}
+ />
+ </SettingsRow>
- <Item variant="outline">
- <ItemMedia variant="icon">
- <LockIcon />
- </ItemMedia>
- <ItemContent>
- <ItemTitle>{t('SAML 2.0')}</ItemTitle>
- <ItemDescription>
+ <SettingsRow
+ icon={<LockIcon />}
+ title={t('SAML 2.0')}
+ description={
+ <div className="flex flex-col gap-2">
{t(
"Allow logins through saml 2.0's single sign-on functionality.",
)}
- </ItemDescription>
- {platform.ssoDomain && (
- <div className="mt-1 gap-2 flex items-center">
- <Badge variant="outline">{platform.ssoDomain}</Badge>
- {ssoDomainVerified ? (
- <span className="flex items-center gap-1 text-xs text-success-11">
- <CheckCircle className="size-3" />
- {t('Verified')}
- </span>
- ) : (
- <span className="text-xs text-warning-11">
- {t('Pending verification')}
- </span>
- )}
- </div>
- )}
- </ItemContent>
- <ItemActions>
- <ConfigureSamlDialog
- platform={platform}
- refetch={refetch}
- connected={samlConnected}
- />
- </ItemActions>
- </Item>
+ {platform.ssoDomain && (
+ <div className="flex flex-wrap items-center gap-2">
+ <Badge variant="outline">{platform.ssoDomain}</Badge>
+ <StatusDot
+ tone={ssoDomainVerified ? 'success' : 'warning'}
+ className="text-xs text-gray-11"
+ >
+ {ssoDomainVerified
+ ? t('Verified')
+ : t('Pending verification')}
+ </StatusDot>
+ </div>
+ )}
+ </div>
+ }
+ >
+ <ConfigureSamlDialog
+ platform={platform}
+ refetch={refetch}
+ connected={samlConnected}
+ />
+ </SettingsRow>
- <Item variant="outline">
- <ItemMedia variant="icon">
- <MailIcon />
- </ItemMedia>
- <ItemContent>
- <ItemTitle>{t('Allowed Email Login')}</ItemTitle>
- <ItemDescription>
- {t('Allow logins through email and password.')}
- </ItemDescription>
- </ItemContent>
- <ItemActions>
- <Switch
- {...adminControl(AdminControl.SSO_EMAIL_LOGIN_TOGGLE)}
- checked={emailAuthEnabled}
- onCheckedChange={() =>
- toggleEmailAuthentication({
- emailAuthEnabled: !platform.emailAuthEnabled,
- })
- }
- disabled={isEmailAuthPending}
- />
- </ItemActions>
- </Item>
- </div>
- </CenteredPage>
+ <SettingsRow
+ icon={<MailIcon />}
+ title={t('Allowed Email Login')}
+ description={t('Allow logins through email and password.')}
+ >
+ <Switch
+ {...adminControl(AdminControl.SSO_EMAIL_LOGIN_TOGGLE)}
+ aria-label={t('Allowed Email Login')}
+ checked={emailAuthEnabled}
+ onCheckedChange={() =>
+ toggleEmailAuthentication({
+ emailAuthEnabled: !platform.emailAuthEnabled,
+ })
+ }
+ disabled={isEmailAuthPending}
+ />
+ </SettingsRow>
+ </SettingsPanel>
+ </AdminPage>
);
};
diff --git a/packages/web/src/app/routes/platform/security/sso/saml-dialog.tsx b/packages/web/src/app/routes/platform/security/sso/saml-dialog.tsx
index 13486d6cdc9..b363e0343b9 100644
--- a/packages/web/src/app/routes/platform/security/sso/saml-dialog.tsx
+++ b/packages/web/src/app/routes/platform/security/sso/saml-dialog.tsx
@@ -16,6 +16,7 @@ import { toast } from 'sonner';
import { z } from 'zod';
import { platformApi } from '@/api/platforms-api';
+import { adminLayout } from '@/app/components/admin';
import { CopyToClipboardInput } from '@/components/custom/clipboard/copy-to-clipboard';
import { ApMarkdown } from '@/components/custom/markdown';
import { Alert, AlertDescription } from '@/components/ui/alert';
@@ -63,7 +64,7 @@ export const ConfigureSamlDialog = ({
{connected ? t('Edit') : t('Enable')}
</Button>
</DialogTrigger>
- <DialogContent>
+ <DialogContent className={adminLayout.dialog.md}>
{open && (
<SamlWizard
key={open ? 'open' : 'closed'}
@@ -336,7 +337,7 @@ const DomainStep = ({
</DialogFooter>
</form>
<Dialog open={showUpdateWarning} onOpenChange={setShowUpdateWarning}>
- <DialogContent>
+ <DialogContent className={adminLayout.dialog.md}>
<DialogHeader>
<DialogTitle>{t('Update SSO domain?')}</DialogTitle>
</DialogHeader>
diff --git a/packages/web/src/app/routes/platform/setup/ai-capabilities/ai-capability-dialog.tsx b/packages/web/src/app/routes/platform/setup/ai-capabilities/ai-capability-dialog.tsx
index 7b3dc7673fc..c88a597aca1 100644
--- a/packages/web/src/app/routes/platform/setup/ai-capabilities/ai-capability-dialog.tsx
+++ b/packages/web/src/app/routes/platform/setup/ai-capabilities/ai-capability-dialog.tsx
@@ -16,6 +16,7 @@ import { useState } from 'react';
import { useForm } from 'react-hook-form';
import { z } from 'zod';
+import { adminLayout } from '@/app/components/admin';
import { Button } from '@/components/ui/button';
import {
Dialog,
@@ -74,7 +75,7 @@ export function AiCapabilityDialog({
return (
<Dialog open={open} onOpenChange={setOpen}>
<DialogTrigger asChild>{children}</DialogTrigger>
- <DialogContent>
+ <DialogContent className={adminLayout.dialog.md}>
<CapabilityForm
key={open ? 'open' : 'closed'}
capabilityInfo={capabilityInfo}
diff --git a/packages/web/src/app/routes/platform/setup/ai/capabilities-tab/index.tsx b/packages/web/src/app/routes/platform/setup/ai/capabilities-tab/index.tsx
index ea65e582599..471333cbd1e 100644
--- a/packages/web/src/app/routes/platform/setup/ai/capabilities-tab/index.tsx
+++ b/packages/web/src/app/routes/platform/setup/ai/capabilities-tab/index.tsx
@@ -8,6 +8,12 @@ import {
import { t } from 'i18next';
import { Globe, Image, LucideIcon, Search, Trash2 } from 'lucide-react';
+import {
+ AdminPageHeader,
+ StatusDot,
+ adminPageResources,
+ adminSurface,
+} from '@/app/components/admin';
import { DataFetchErrorState } from '@/components/custom/data-fetch-error-state';
import { ConfirmationDeleteDialog } from '@/components/custom/delete-dialog';
import { TextWithTooltip } from '@/components/custom/text-with-tooltip';
@@ -26,7 +32,6 @@ import {
aiCapabilitySources,
AiToolCapabilityInfo,
} from '../../ai-capabilities/catalog';
-import { SectionHeader } from '../components/section-header';
export function CapabilitiesTab() {
const {
@@ -52,14 +57,18 @@ export function CapabilitiesTab() {
});
return (
- <div className="flex flex-col gap-4">
- <SectionHeader
+ <>
+ <AdminPageHeader
title={t('Assistant capabilities')}
- isPageTitle
- count={AI_TOOL_CATALOG.length}
+ badge={
+ <span className="text-sm tabular-nums text-gray-11">
+ {AI_TOOL_CATALOG.length}
+ </span>
+ }
description={t(
'Search and images use your AI provider. Scraping needs a service of its own. Connect a service to use it in place of your provider.',
)}
+ resources={adminPageResources.aiCapabilities}
/>
{isError ? (
<DataFetchErrorState entity={t('AI tools')} onRetry={refetch} />
@@ -91,7 +100,7 @@ export function CapabilitiesTab() {
})}
</div>
)}
- </div>
+ </>
);
}
@@ -134,26 +143,23 @@ function CapabilityCard({
: `${status} · ${chosenModelId}`;
return (
- <div className="group flex flex-col rounded-xl border bg-panel">
- <div className="flex items-start gap-3 p-4 pb-3">
- <div className="flex size-10 shrink-0 items-center justify-center rounded-xl border bg-gray-1">
+ <div className={cn(adminSurface.card, 'group flex flex-col')}>
+ <div className="flex items-start gap-4 px-5 pt-5 pb-2">
+ <div className="flex size-9 shrink-0 items-center justify-center rounded-lg border bg-gray-1">
<Icon className="size-4 text-gray-11" />
</div>
- <div className="flex min-w-0 flex-1 flex-col gap-1.5">
- <p className="truncate text-sm font-medium leading-none">
+ <div className="flex min-w-0 flex-1 flex-col gap-1">
+ <p className="truncate text-sm font-semibold text-gray-12">
{capabilityInfo.name}
</p>
- <span className="flex min-w-0 items-center gap-1.5 text-xs text-gray-11">
- <span
- className={cn('size-1.5 shrink-0 rounded-full', {
- 'bg-success-10': inUse,
- 'border border-gray-8': !inUse,
- })}
- />
+ <StatusDot
+ tone={inUse ? 'success' : 'neutral'}
+ className="text-xs text-gray-11"
+ >
<TextWithTooltip tooltipMessage={statusText}>
<span className="truncate">{statusText}</span>
</TextWithTooltip>
- </span>
+ </StatusDot>
</div>
{config && (
<ConfirmationDeleteDialog
@@ -182,10 +188,10 @@ function CapabilityCard({
</ConfirmationDeleteDialog>
)}
</div>
- <p className="px-4 pb-4 text-sm text-gray-11">
+ <p className="px-5 pb-5 text-sm text-gray-11">
{capabilityInfo.description}
</p>
- <div className="mt-auto flex items-center justify-between gap-4 border-t px-4 py-2.5">
+ <div className="mt-auto flex items-center justify-between gap-4 border-t px-5 py-3">
<span className="text-xs text-gray-11">
{inUse
? t('Available to the assistant')
diff --git a/packages/web/src/app/routes/platform/setup/ai/index.tsx b/packages/web/src/app/routes/platform/setup/ai/index.tsx
index 3c56f88df8a..ace826958ff 100644
--- a/packages/web/src/app/routes/platform/setup/ai/index.tsx
+++ b/packages/web/src/app/routes/platform/setup/ai/index.tsx
@@ -1,6 +1,7 @@
import { ApEdition, ApFlagId } from '@activepieces/shared';
-import { Navigate } from 'react-router-dom';
+import { Navigate, useSearchParams } from 'react-router-dom';
+import { AdminPage } from '@/app/components/admin';
import { flagsHooks } from '@/hooks/flags-hooks';
import { CapabilitiesTab } from './capabilities-tab';
@@ -13,25 +14,24 @@ export default function AIProvidersPage({ section }: AIProvidersPageProps) {
function AICenter({ section }: { section: AISection }) {
const { data: edition } = flagsHooks.useFlag<ApEdition>(ApFlagId.EDITION);
+ const [searchParams] = useSearchParams();
+ const showsSettings =
+ section === 'capabilities' || searchParams.has('config');
if (section === 'capabilities' && edition === ApEdition.COMMUNITY) {
return <Navigate to="/platform/ai" replace />;
}
return (
- <div className="flex w-full flex-1 min-h-0 flex-col overflow-auto">
- <div className="mx-auto flex min-h-full w-full max-w-6xl flex-col px-8 py-6">
- {section === 'providers' ? (
- <div className="flex flex-1 flex-col">
- <ProvidersTab />
- </div>
- ) : section === 'tiers' ? (
- <TiersTab />
- ) : (
- <CapabilitiesTab />
- )}
- </div>
- </div>
+ <AdminPage width={showsSettings ? 'content' : 'full'}>
+ {section === 'providers' ? (
+ <ProvidersTab />
+ ) : section === 'tiers' ? (
+ <TiersTab />
+ ) : (
+ <CapabilitiesTab />
+ )}
+ </AdminPage>
);
}
diff --git a/packages/web/src/app/routes/platform/setup/ai/providers-tab/config-detail.tsx b/packages/web/src/app/routes/platform/setup/ai/providers-tab/config-detail.tsx
index a8fec7124dd..d7052b8073b 100644
--- a/packages/web/src/app/routes/platform/setup/ai/providers-tab/config-detail.tsx
+++ b/packages/web/src/app/routes/platform/setup/ai/providers-tab/config-detail.tsx
@@ -13,10 +13,18 @@ import {
} from '@activepieces/shared';
import { useQuery } from '@tanstack/react-query';
import { t } from 'i18next';
-import { Activity, ChevronLeft, KeyRound, Trash2 } from 'lucide-react';
+import { Activity, KeyRound, Trash2 } from 'lucide-react';
import { useRef, useState } from 'react';
import { z } from 'zod';
+import {
+ AdminPageHeader,
+ AdminSection,
+ DangerZone,
+ SettingsPanel,
+ SettingsRow,
+ adminPageResources,
+} from '@/app/components/admin';
import { ConfirmationDeleteDialog } from '@/components/custom/delete-dialog';
import {
LeaveWithoutSavingDialog,
@@ -43,8 +51,6 @@ import { platformModelTierQueries } from '@/features/platform-admin/hooks/platfo
import { AdminControl, adminControl } from '@/lib/admin-control';
import { formatUtils } from '@/lib/format-utils';
-import { SectionHeader } from '../components/section-header';
-
import { KeyStatusBadge } from './key-status';
import { ManualModelList } from './manual-model-list';
import { ModelSelectionPanel } from './model-selection-panel';
@@ -190,37 +196,26 @@ export function ConfigDetail({
};
return (
- <div className="flex grow flex-col gap-8 pb-4">
- <div className="flex flex-col gap-4">
- <button
- type="button"
- onClick={onBack}
- className="inline-flex w-fit items-center gap-1 text-sm text-gray-11 transition-colors hover:text-gray-12"
- >
- <ChevronLeft className="size-4" />
- {t('Providers')}
- </button>
- <div className="flex items-start gap-3">
- <ProviderLogo info={info} />
- <div className="flex min-w-0 flex-col gap-1">
- <h1 className="truncate text-lg font-semibold leading-none tracking-tight">
- {draft.name}
- </h1>
- <div className="flex flex-wrap items-center gap-2 text-xs text-gray-11">
- <span>{info.name}</span>
- <KeyStatusBadge status={config.status} />
- </div>
- </div>
- </div>
- </div>
+ <>
+ <AdminPageHeader
+ title={draft.name}
+ back={{ label: t('Providers'), to: '/platform/ai' }}
+ badge={<KeyStatusBadge status={config.status} />}
+ description={
+ <span className="flex items-center gap-2">
+ <ProviderLogo info={info} size="sm" />
+ {info.name}
+ </span>
+ }
+ resources={adminPageResources.aiProviders}
+ />
- <section className="flex flex-col gap-3">
- <SectionHeader
- title={t('General')}
- description={t('How this key is labelled and authorised.')}
- />
- <div className="flex flex-col divide-y divide-gray-6/60 rounded-xl border border-gray-6/60">
- <div className="flex flex-col gap-1.5 p-4">
+ <AdminSection
+ title={t('General')}
+ description={t('How this key is labelled and authorised.')}
+ >
+ <SettingsPanel flush>
+ <div className="flex flex-col gap-2 px-5 py-4">
<Label htmlFor="config-name">{t('Name')}</Label>
<Input
id="config-name"
@@ -235,20 +230,11 @@ export function ConfigDetail({
<p className="text-sm text-danger-11">{t(formErrors.required)}</p>
)}
</div>
- <div className="flex items-center justify-between gap-3 p-4">
- <div className="flex min-w-0 items-center gap-3">
- <div className="flex size-9 shrink-0 items-center justify-center rounded-xl bg-gray-3/60">
- <KeyRound className="size-4 text-gray-11" />
- </div>
- <div className="min-w-0">
- <p className="text-sm font-medium leading-none">
- {t('Credentials')}
- </p>
- <p className="mt-1 truncate font-mono text-xs text-gray-11">
- {t('Stored securely')}
- </p>
- </div>
- </div>
+ <SettingsRow
+ icon={<KeyRound />}
+ title={t('Credentials')}
+ description={t('Stored securely')}
+ >
<Button
variant="outline"
size="sm"
@@ -257,21 +243,12 @@ export function ConfigDetail({
>
{t('Replace')}
</Button>
- </div>
- <div className="flex items-center justify-between gap-3 p-4">
- <div className="flex min-w-0 items-center gap-3">
- <div className="flex size-9 shrink-0 items-center justify-center rounded-xl bg-gray-3/60">
- <Activity className="size-4 text-gray-11" />
- </div>
- <div className="min-w-0">
- <p className="text-sm font-medium leading-none">
- {t('Status')}
- </p>
- {statusDetail && (
- <p className="mt-1 text-xs text-gray-11">{statusDetail}</p>
- )}
- </div>
- </div>
+ </SettingsRow>
+ <SettingsRow
+ icon={<Activity />}
+ title={t('Status')}
+ description={statusDetail || undefined}
+ >
<Button
variant="outline"
size="sm"
@@ -281,22 +258,24 @@ export function ConfigDetail({
>
{t('Recheck')}
</Button>
- </div>
- </div>
- </section>
+ </SettingsRow>
+ </SettingsPanel>
+ </AdminSection>
- <section className="flex flex-col gap-3">
- <div className="flex flex-wrap items-end justify-between gap-3">
- <SectionHeader
+ <AdminSection
+ title={
+ <SectionTitle
title={t('Models')}
count={isLoadingModels ? undefined : enabledModelCount}
- description={
- manualModels
- ? t('Model ids exposed through this key.')
- : t('Which of this key’s models the platform may use.')
- }
/>
- {!manualModels && (
+ }
+ description={
+ manualModels
+ ? t('Model ids exposed through this key.')
+ : t('Which of this key’s models the platform may use.')
+ }
+ action={
+ manualModels ? undefined : (
<ScopeTabs
value={draft.modelScope}
onChange={(value) =>
@@ -311,8 +290,9 @@ export function ConfigDetail({
{ value: 'selected', label: t('Only selected') },
]}
/>
- )}
- </div>
+ )
+ }
+ >
{manualModels ? (
<ManualModelList
models={draft.models}
@@ -329,23 +309,25 @@ export function ConfigDetail({
/>
)
)}
- </section>
+ </AdminSection>
- <section className="flex flex-col gap-3">
- <div className="flex flex-wrap items-end justify-between gap-3">
- <SectionHeader
+ <AdminSection
+ title={
+ <SectionTitle
title={t('Project access')}
count={allowedProjectCount}
- description={
- draft.projectScope === 'except'
- ? t(
- 'Every project except these — new projects get access automatically.',
- )
- : draft.projectScope === 'selected'
- ? t('Only these projects can use this key.')
- : t('Every project on this platform can use it.')
- }
/>
+ }
+ description={
+ draft.projectScope === 'except'
+ ? t(
+ 'Every project except these — new projects get access automatically.',
+ )
+ : draft.projectScope === 'selected'
+ ? t('Only these projects can use this key.')
+ : t('Every project on this platform can use it.')
+ }
+ action={
<ScopeTabs
value={draft.projectScope}
onChange={(value) =>
@@ -366,7 +348,8 @@ export function ConfigDetail({
{ value: 'except', label: t('All except') },
]}
/>
- </div>
+ }
+ >
{draft.projectScope !== 'all' && (
<ProjectSelectionPanel
projects={projects}
@@ -374,33 +357,23 @@ export function ConfigDetail({
onChange={(projectIds) => setDraft({ ...draft, projectIds })}
/>
)}
- </section>
+ </AdminSection>
- <section className="flex flex-col gap-3">
- <SectionHeader
- title={t('Danger zone')}
- description={t('Irreversible actions for this key.')}
- />
- <div className="flex items-center justify-between gap-3 rounded-xl border border-danger-6 p-4">
- <div className="min-w-0">
- <p className="text-sm font-medium leading-none">
- {t('Delete this key')}
- </p>
- <p className="mt-1 text-sm text-gray-11">
- {t('Flows and agents that use it will fail.')}
- </p>
- </div>
+ <DangerZone>
+ <SettingsRow
+ title={t('Delete this key')}
+ description={t('Flows and agents that use it will fail.')}
+ >
<Button
- variant="outline"
+ variant="destructive"
size="sm"
- className="shrink-0 gap-2 border-danger-7 text-danger-11 enabled:hover:bg-danger-3 enabled:hover:text-danger-11"
onClick={() => setDeleteOpen(true)}
{...adminControl(AdminControl.AI_PROVIDER_KEY_DELETE_OPEN)}
>
<Trash2 className="size-4" />
{t('Delete')}
</Button>
- </div>
+ </SettingsRow>
<ConfirmationDeleteDialog
open={deleteOpen}
onOpenChange={setDeleteOpen}
@@ -416,7 +389,7 @@ export function ConfigDetail({
onBack();
}}
/>
- </section>
+ </DangerZone>
{dirty && (
<div className="sticky bottom-4 z-20 mt-auto flex justify-center px-4">
@@ -477,7 +450,20 @@ export function ConfigDetail({
onKeepEditing={() => leaveBlocker.reset?.()}
onDiscard={() => leaveBlocker.proceed?.()}
/>
- </div>
+ </>
+ );
+}
+
+function SectionTitle({ title, count }: { title: string; count?: number }) {
+ return (
+ <span className="flex items-baseline gap-2">
+ {title}
+ {count !== undefined && (
+ <span className="text-sm font-normal tabular-nums text-gray-11">
+ {count}
+ </span>
+ )}
+ </span>
);
}
@@ -505,7 +491,7 @@ function ScopeTabs({
}) {
return (
<Select value={value} onValueChange={onChange}>
- <SelectTrigger className="w-44 shrink-0">
+ <SelectTrigger size="sm" className="w-44 shrink-0">
<SelectValue />
</SelectTrigger>
<SelectContent>
diff --git a/packages/web/src/app/routes/platform/setup/ai/providers-tab/connect-provider-dialog.tsx b/packages/web/src/app/routes/platform/setup/ai/providers-tab/connect-provider-dialog.tsx
index 8f69dc89670..9df7dd6edeb 100644
--- a/packages/web/src/app/routes/platform/setup/ai/providers-tab/connect-provider-dialog.tsx
+++ b/packages/web/src/app/routes/platform/setup/ai/providers-tab/connect-provider-dialog.tsx
@@ -12,6 +12,7 @@ import { useState } from 'react';
import { ControllerRenderProps, useForm } from 'react-hook-form';
import { z } from 'zod';
+import { adminLayout } from '@/app/components/admin';
import { DictionaryInput } from '@/components/custom/dictionary-input';
import { ApMarkdown } from '@/components/custom/markdown';
import { Button } from '@/components/ui/button';
@@ -71,7 +72,7 @@ export function ConnectProviderDialog({
}) {
return (
<Dialog open={open} onOpenChange={onOpenChange}>
- <DialogContent className="sm:max-w-xl">
+ <DialogContent className={adminLayout.dialog.md}>
<ConnectProviderForm
key={open ? editing?.id ?? defaultProvider ?? 'new' : 'closed'}
editing={editing}
diff --git a/packages/web/src/app/routes/platform/setup/ai/providers-tab/index.tsx b/packages/web/src/app/routes/platform/setup/ai/providers-tab/index.tsx
index a64f04f82ef..53e9c95a53f 100644
--- a/packages/web/src/app/routes/platform/setup/ai/providers-tab/index.tsx
+++ b/packages/web/src/app/routes/platform/setup/ai/providers-tab/index.tsx
@@ -18,6 +18,15 @@ import { useState } from 'react';
import { useSearchParams } from 'react-router-dom';
import { toast } from 'sonner';
+import {
+ AdminEmpty,
+ AdminPageHeader,
+ AdminSection,
+ SettingsPanel,
+ SettingsRow,
+ adminPageResources,
+ adminSurface,
+} from '@/app/components/admin';
import { PlanFeatureSample } from '@/app/routes/platform/plan-feature-sample';
import { DataFetchErrorState } from '@/components/custom/data-fetch-error-state';
import { ConfirmationDeleteDialog } from '@/components/custom/delete-dialog';
@@ -52,8 +61,6 @@ import { platformHooks } from '@/hooks/platform-hooks';
import { AdminControl, adminControl } from '@/lib/admin-control';
import { cn } from '@/lib/utils';
-import { SectionHeader } from '../components/section-header';
-
import { ConfigDetail } from './config-detail';
import { ConnectProviderDialog } from './connect-provider-dialog';
import { KeyStatusBadge, keyStatusText } from './key-status';
@@ -226,87 +233,85 @@ export function ProvidersTab() {
const page = (
<>
- <div className="flex flex-col gap-6">
- <div className="flex items-start justify-between gap-3">
- <SectionHeader
- title={t('Providers')}
- isPageTitle
- count={configs.length}
- description={
- configs.length === 0
- ? t(
- 'Connect a provider to turn on chat, agents, and AI steps across your platform.',
- )
- : t('Each key has its own models and project access.')
- }
- />
+ <AdminPageHeader
+ title={t('Providers')}
+ badge={
+ <span className="text-sm tabular-nums text-gray-11">
+ {configs.length}
+ </span>
+ }
+ description={
+ configs.length === 0
+ ? t(
+ 'Connect a provider to turn on chat, agents, and AI steps across your platform.',
+ )
+ : t('Each key has its own models and project access.')
+ }
+ resources={adminPageResources.aiProviders}
+ >
+ {!locked && (
+ <Button
+ onClick={() => openConnect()}
+ {...adminControl(AdminControl.AI_PROVIDER_KEY_OPEN)}
+ >
+ <Plus className="size-4" />
+ {t('Add key')}
+ </Button>
+ )}
+ </AdminPageHeader>
+
+ {isProvidersError ? (
+ <DataFetchErrorState entity={t('AI providers')} onRetry={refetch} />
+ ) : configs.length === 0 ? (
+ <EmptyProviders onConnect={openConnect} />
+ ) : (
+ <>
+ {locked && <LockedProvidersAlert />}
{!locked && (
- <Button
- size="sm"
- className="shrink-0"
- onClick={() => openConnect()}
- {...adminControl(AdminControl.AI_PROVIDER_KEY_OPEN)}
+ <ChatProviderRow
+ configs={providers ?? []}
+ value={chatProviderRow?.id ?? null}
+ isSwitching={isSwitchingChatProvider}
+ onChange={selectChatConfig}
+ />
+ )}
+ {connectedProviders.map((provider) => (
+ <ProviderGroup
+ key={provider}
+ provider={provider}
+ configs={configs.filter((config) => config.provider === provider)}
+ projects={projects}
+ locked={locked}
+ onAdd={() => openConnect(provider)}
+ onOpen={openConfig}
+ onDelete={(id) => deleteProvider(id)}
+ />
+ ))}
+ {!locked && available.length > 0 && (
+ <AdminSection
+ title={
+ <span className="flex items-baseline gap-2">
+ {t('Also available')}
+ <span className="text-sm font-normal tabular-nums text-gray-11">
+ {available.length}
+ </span>
+ </span>
+ }
+ description={t('Bring your own API key to connect any of these.')}
>
- <Plus className="size-4" />
- {t('Add key')}
- </Button>
+ <div className="grid grid-cols-1 gap-4 lg:grid-cols-2">
+ {available.map((info) => (
+ <AvailableProviderCard
+ key={info.provider}
+ info={info}
+ onConnect={() => openConnect(info.provider)}
+ />
+ ))}
+ </div>
+ </AdminSection>
)}
- </div>
-
- {isProvidersError ? (
- <DataFetchErrorState entity={t('AI providers')} onRetry={refetch} />
- ) : configs.length === 0 ? (
- <EmptyProviders onConnect={openConnect} />
- ) : (
- <>
- {locked && <LockedProvidersAlert />}
- {!locked && (
- <ChatProviderRow
- configs={providers ?? []}
- value={chatProviderRow?.id ?? null}
- isSwitching={isSwitchingChatProvider}
- onChange={selectChatConfig}
- />
- )}
- <div className="flex flex-col gap-6">
- {connectedProviders.map((provider) => (
- <ProviderGroup
- key={provider}
- provider={provider}
- configs={configs.filter(
- (config) => config.provider === provider,
- )}
- projects={projects}
- locked={locked}
- onAdd={() => openConnect(provider)}
- onOpen={openConfig}
- onDelete={(id) => deleteProvider(id)}
- />
- ))}
- </div>
- {!locked && available.length > 0 && (
- <section className="flex flex-col gap-4 border-t border-gray-6/60 pt-6">
- <SectionHeader
- title={t('Also available')}
- count={available.length}
- description={t(
- 'Bring your own API key to connect any of these.',
- )}
- />
- <div className="grid grid-cols-1 gap-3 lg:grid-cols-2">
- {available.map((info) => (
- <AvailableProviderCard
- key={info.provider}
- info={info}
- onConnect={() => openConnect(info.provider)}
- />
- ))}
- </div>
- </section>
- )}
- </>
- )}
- </div>
+ </>
+ )}
<ConnectProviderDialog
open={dialogOpen}
@@ -319,7 +324,11 @@ export function ProvidersTab() {
);
if (configs.length === 0 && !isProvidersError) {
- return <PlanFeatureSample feature="aiProviders">{page}</PlanFeatureSample>;
+ return (
+ <PlanFeatureSample feature="aiProviders">
+ <div className="flex flex-col gap-6">{page}</div>
+ </PlanFeatureSample>
+ );
}
return page;
}
@@ -380,21 +389,17 @@ function ProviderGroup({
}
return (
- <section
- className={cn(
- 'overflow-hidden rounded-xl border border-gray-6/60 bg-panel',
- CARD_SHADOW,
- )}
- >
- <div className="flex items-center gap-3 px-5 py-4">
- <ProviderLogo info={info} />
- <div className="min-w-0 flex-1">
- <p className="text-sm font-medium leading-none">{info.name}</p>
- <p className="mt-1 text-xs text-gray-11">
- {t('configurationsCount', { count: configs.length })}
- </p>
- </div>
- {!locked && (
+ <SettingsPanel
+ flush
+ title={
+ <span className="flex items-center gap-2">
+ <ProviderLogo info={info} size="sm" />
+ {info.name}
+ </span>
+ }
+ description={t('configurationsCount', { count: configs.length })}
+ action={
+ locked ? undefined : (
<Button
variant="ghost"
size="sm"
@@ -404,24 +409,21 @@ function ProviderGroup({
<Plus className="size-4" />
{t('Add key')}
</Button>
- )}
- </div>
- <div className="border-t border-gray-6/60 px-5 pb-1 pt-3">
- <p className="text-xs font-medium text-gray-11">{t('Keys')}</p>
- </div>
- <div>
- {configs.map((config) => (
- <ConfigRow
- key={config.id}
- config={config}
- projects={projects}
- locked={locked}
- onOpen={() => onOpen(config.id)}
- onDelete={() => onDelete(config.id)}
- />
- ))}
- </div>
- </section>
+ )
+ }
+ >
+ <p className="px-5 py-2 text-xs font-medium text-gray-11">{t('Keys')}</p>
+ {configs.map((config) => (
+ <ConfigRow
+ key={config.id}
+ config={config}
+ projects={projects}
+ locked={locked}
+ onOpen={() => onOpen(config.id)}
+ onDelete={() => onDelete(config.id)}
+ />
+ ))}
+ </SettingsPanel>
);
}
@@ -475,12 +477,12 @@ function ConfigRow({
)}
>
<div className="flex min-w-0 flex-1 flex-col gap-1">
- <div className="flex items-center gap-2">
- <p className="truncate text-sm font-medium leading-none">
+ <div className="flex min-w-0 items-center gap-2">
+ <p className="truncate text-sm font-medium text-gray-12">
{config.name}
</p>
{config.enabledForChat && (
- <span className="shrink-0 rounded-full bg-accent-3 px-2 py-px text-xs font-medium text-accent-11">
+ <span className="shrink-0 rounded-md bg-accent-3 px-2 py-px text-xs font-medium text-accent-11">
{t('Chat')}
</span>
)}
@@ -503,7 +505,7 @@ function ConfigRow({
</div>
{config.projectScope !== 'all' && (
- <div className="flex min-w-0 items-center gap-1.5">
+ <div className="flex min-w-0 items-center gap-2">
<ProjectChips
projects={namedProjects}
excluded={config.projectScope === 'except'}
@@ -609,44 +611,38 @@ function ChatProviderRow({
onChange: (configId: string) => void;
}) {
return (
- <div
- className={cn(
- 'flex items-center gap-3 rounded-xl border border-gray-6/60 bg-panel px-4 py-3',
- CARD_SHADOW,
- )}
- >
- <div className="flex size-9 shrink-0 items-center justify-center rounded-xl bg-gray-3/60">
- <MessageSquare className="size-4 text-gray-11" />
- </div>
- <div className="flex-1 min-w-0">
- <p className="text-sm font-medium leading-none">{t('Chat provider')}</p>
- <p className="text-xs text-gray-11 mt-1">
- {t('Powers the built-in chat for everyone on this platform')}
- </p>
- </div>
- <Select
- value={value ?? undefined}
- onValueChange={onChange}
- disabled={isSwitching}
+ <SettingsPanel flush>
+ <SettingsRow
+ icon={<MessageSquare />}
+ title={t('Chat provider')}
+ description={t(
+ 'Powers the built-in chat for everyone on this platform',
+ )}
>
- <SelectTrigger className="w-52">
- <SelectValue placeholder={t('Select provider')} />
- </SelectTrigger>
- <SelectContent>
- {configs.map((config) => {
- const info = providerInfoOf({ provider: config.provider });
- return (
- <SelectItem key={config.id} value={config.id}>
- <div className="flex items-center gap-2">
- {info && <ProviderLogo info={info} size="sm" />}
- <span className="truncate">{config.name}</span>
- </div>
- </SelectItem>
- );
- })}
- </SelectContent>
- </Select>
- </div>
+ <Select
+ value={value ?? undefined}
+ onValueChange={onChange}
+ disabled={isSwitching}
+ >
+ <SelectTrigger className="w-52">
+ <SelectValue placeholder={t('Select provider')} />
+ </SelectTrigger>
+ <SelectContent>
+ {configs.map((config) => {
+ const info = providerInfoOf({ provider: config.provider });
+ return (
+ <SelectItem key={config.id} value={config.id}>
+ <div className="flex items-center gap-2">
+ {info && <ProviderLogo info={info} size="sm" />}
+ <span className="truncate">{config.name}</span>
+ </div>
+ </SelectItem>
+ );
+ })}
+ </SelectContent>
+ </Select>
+ </SettingsRow>
+ </SettingsPanel>
);
}
@@ -663,30 +659,24 @@ function EmptyProviders({
);
return (
- <div className="flex flex-col gap-6">
- <div className="flex flex-col items-center gap-4 rounded-xl border border-gray-6/60 bg-panel px-6 py-14 text-center">
- <div className="flex size-12 items-center justify-center rounded-xl bg-accent-3">
- <Bot className="size-5 text-accent-11" />
- </div>
- <div className="flex flex-col gap-1">
- <p className="text-base font-semibold tracking-tight">
- {t('Connect your first provider')}
- </p>
- <p className="max-w-md text-sm text-gray-11">
- {t(
- 'Bring an API key, then pick which models and projects can use it. Chat, agents, and AI steps run through it.',
- )}
- </p>
- </div>
- <Button
- onClick={() => onConnect()}
- {...adminControl(AdminControl.AI_PROVIDER_KEY_OPEN)}
- >
- <Plus className="size-4" />
- {t('Connect a provider')}
- </Button>
- </div>
- <div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
+ <>
+ <AdminEmpty
+ icon={<Bot />}
+ title={t('Connect your first provider')}
+ description={t(
+ 'Bring an API key, then pick which models and projects can use it. Chat, agents, and AI steps run through it.',
+ )}
+ action={
+ <Button
+ onClick={() => onConnect()}
+ {...adminControl(AdminControl.AI_PROVIDER_KEY_OPEN)}
+ >
+ <Plus className="size-4" />
+ {t('Connect a provider')}
+ </Button>
+ }
+ />
+ <div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
{recommended.map((info) => (
<AvailableProviderCard
key={info.provider}
@@ -697,11 +687,8 @@ function EmptyProviders({
/>
))}
</div>
- <div className="flex flex-col gap-3">
- <p className="text-xs font-medium text-gray-11">
- {t('Or choose another provider')}
- </p>
- <div className="grid grid-cols-1 gap-3 lg:grid-cols-2">
+ <AdminSection title={t('Or choose another provider')}>
+ <div className="grid grid-cols-1 gap-4 lg:grid-cols-2">
{others.map((info) => (
<AvailableProviderCard
key={info.provider}
@@ -710,8 +697,8 @@ function EmptyProviders({
/>
))}
</div>
- </div>
- </div>
+ </AdminSection>
+ </>
);
}
@@ -727,15 +714,10 @@ function AvailableProviderCard({
onConnect: () => void;
}) {
return (
- <div
- className={cn(
- 'flex items-center gap-3 rounded-xl border border-gray-6/60 bg-panel p-4 transition-colors hover:border-gray-6',
- CARD_SHADOW,
- )}
- >
+ <div className={cn(adminSurface.card, 'flex items-center gap-4 p-5')}>
<ProviderLogo info={info} />
<div className="flex min-w-0 flex-1 flex-col gap-1">
- <p className="truncate text-sm font-medium leading-none">{info.name}</p>
+ <p className="truncate text-sm font-medium text-gray-12">{info.name}</p>
{tagline && <p className="truncate text-xs text-gray-11">{tagline}</p>}
</div>
<Button
@@ -752,60 +734,48 @@ function AvailableProviderCard({
function ProvidersSkeleton() {
return (
- <div className="flex flex-col gap-6">
- <div className="flex items-start justify-between gap-3">
+ <>
+ <div className="flex items-start justify-between gap-4">
<div className="flex flex-col gap-2">
- <Skeleton className="h-5 w-28" />
+ <Skeleton className="h-8 w-40" />
<Skeleton className="h-4 w-72" />
</div>
- <Skeleton className="h-8 w-24 rounded-md" />
+ <Skeleton className="h-9 w-24 rounded-lg" />
</div>
<div
- className={cn(
- 'flex items-center gap-3 rounded-xl border border-gray-6/60 bg-panel px-4 py-3',
- CARD_SHADOW,
- )}
+ className={cn(adminSurface.card, 'flex items-center gap-4 px-5 py-4')}
>
- <Skeleton className="size-9 shrink-0 rounded-xl" />
+ <Skeleton className="size-9 shrink-0 rounded-lg" />
<div className="flex flex-1 flex-col gap-2">
<Skeleton className="h-4 w-32" />
<Skeleton className="h-3 w-64" />
</div>
- <Skeleton className="h-9 w-52 rounded-md" />
+ <Skeleton className="h-9 w-52 rounded-lg" />
</div>
{[0, 1].map((group) => (
<section
key={group}
- className={cn(
- 'overflow-hidden rounded-xl border border-gray-6/60 bg-panel',
- CARD_SHADOW,
- )}
+ className={cn(adminSurface.card, 'flex flex-col overflow-hidden')}
>
- <div className="flex items-center gap-3 px-5 py-4">
- <Skeleton className="size-8 shrink-0 rounded-xl" />
+ <div className="flex items-center gap-4 border-b p-5">
<div className="flex flex-1 flex-col gap-2">
<Skeleton className="h-4 w-24" />
<Skeleton className="h-3 w-20" />
</div>
- <Skeleton className="h-8 w-20 rounded-md" />
- </div>
- <div className="border-t border-gray-6/60 px-5 pb-1 pt-3">
- <Skeleton className="h-3 w-10" />
+ <Skeleton className="h-8 w-20 rounded-lg" />
</div>
{[0, 1].map((row) => (
- <div key={row} className="flex flex-col gap-2 px-5 py-3.5">
+ <div key={row} className="flex flex-col gap-2 px-5 py-4">
<Skeleton className="h-4 w-44" />
<Skeleton className="h-3 w-56" />
</div>
))}
</section>
))}
- </div>
+ </>
);
}
-const CARD_SHADOW = 'shadow-panel';
-
function providerInfoOf({
provider,
}: {
diff --git a/packages/web/src/app/routes/platform/setup/ai/providers-tab/key-status.tsx b/packages/web/src/app/routes/platform/setup/ai/providers-tab/key-status.tsx
index e06b1d56a5a..05315b135da 100644
--- a/packages/web/src/app/routes/platform/setup/ai/providers-tab/key-status.tsx
+++ b/packages/web/src/app/routes/platform/setup/ai/providers-tab/key-status.tsx
@@ -1,22 +1,15 @@
import { isNil } from '@activepieces/core-utils';
import { AiProviderKeyStatus } from '@activepieces/shared';
import { t } from 'i18next';
-import { Check, CloudOff, CreditCard, LucideIcon, X } from 'lucide-react';
-import { StatusIconWithText } from '@/components/custom/status-icon-with-text';
+import { StatusDot, StatusTone } from '@/app/components/admin';
export function KeyStatusBadge({ status }: { status: AiProviderKeyStatus }) {
const badge = badgeOf({ status });
if (isNil(badge)) {
return null;
}
- return (
- <StatusIconWithText
- icon={badge.icon}
- text={badge.text}
- variant={badge.variant}
- />
- );
+ return <StatusDot tone={badge.tone}>{badge.text}</StatusDot>;
}
export function keyStatusText({
@@ -28,23 +21,18 @@ export function keyStatusText({
}
function badgeOf({ status }: { status: AiProviderKeyStatus }): {
- icon: LucideIcon;
text: string;
- variant: 'success' | 'warning' | 'error' | 'secondary';
+ tone: StatusTone;
} | null {
switch (status) {
case 'active':
- return { icon: Check, text: t('Active'), variant: 'success' };
+ return { text: t('Active'), tone: 'success' };
case 'out_of_credits':
- return {
- icon: CreditCard,
- text: t('Out of credits'),
- variant: 'warning',
- };
+ return { text: t('Out of credits'), tone: 'warning' };
case 'rejected':
- return { icon: X, text: t('Key rejected'), variant: 'error' };
+ return { text: t('Key rejected'), tone: 'danger' };
case 'unreachable':
- return { icon: CloudOff, text: t('Unreachable'), variant: 'secondary' };
+ return { text: t('Unreachable'), tone: 'neutral' };
default:
return null;
}
diff --git a/packages/web/src/app/routes/platform/setup/connections/index.tsx b/packages/web/src/app/routes/platform/setup/connections/index.tsx
index c263229699e..e2bc6920b68 100644
--- a/packages/web/src/app/routes/platform/setup/connections/index.tsx
+++ b/packages/web/src/app/routes/platform/setup/connections/index.tsx
@@ -18,7 +18,14 @@ import {
import { useMemo, useState } from 'react';
import { useLocation } from 'react-router-dom';
-import { DashboardPageHeader } from '@/app/components/dashboard-page-header';
+import {
+ AdminDataTable,
+ AdminPage,
+ AdminPageHeader,
+ StatusDot,
+ StatusTone,
+ adminPageResources,
+} from '@/app/components/admin';
import { NewConnectionDialog } from '@/app/connections/new-connection-dialog';
import { ReconnectButtonDialog } from '@/app/connections/reconnect-button-dialog';
import { AnimatedIconButton } from '@/components/custom/animated-icon-button';
@@ -26,7 +33,6 @@ import { CopyTextTooltip } from '@/components/custom/clipboard/copy-text-tooltip
import {
BulkAction,
CURSOR_QUERY_PARAM,
- DataTable,
DataTableFilters,
LIMIT_QUERY_PARAM,
RowDataWithActions,
@@ -38,14 +44,12 @@ import {
DefaultTag,
DeleteConnectionWarning,
} from '@/components/custom/global-connection-utils';
-import { StatusIconWithText } from '@/components/custom/status-icon-with-text';
import { PlusIcon } from '@/components/icons/plus';
import { Button } from '@/components/ui/button';
import {
EditGlobalConnectionDialog,
globalConnectionsMutations,
globalConnectionsQueries,
- appConnectionUtils,
} from '@/features/connections';
import { PieceIconWithPieceName } from '@/features/pieces';
import { useAuthorization } from '@/hooks/authorization-hooks';
@@ -129,20 +133,11 @@ const GlobalConnectionsTable = () => {
icon={Activity}
/>
),
- cell: ({ row }) => {
- const status = row.original.status;
- const { variant, icon: Icon } =
- appConnectionUtils.getStatusIcon(status);
- return (
- <div className="text-left">
- <StatusIconWithText
- icon={Icon}
- text={formatUtils.convertEnumToReadable(status)}
- variant={variant}
- />
- </div>
- );
- },
+ cell: ({ row }) => (
+ <StatusDot tone={CONNECTION_STATUS_TONE[row.original.status]}>
+ {formatUtils.convertEnumToReadable(row.original.status)}
+ </StatusDot>
+ ),
},
{
accessorKey: 'updated',
@@ -296,41 +291,35 @@ const GlobalConnectionsTable = () => {
[bulkDeleteGlobalConnections, selectedRows],
);
- const toolbarButtons = useMemo(
- () => [
- <NewConnectionDialog
- key="new-connection"
- isGlobalConnection={true}
- onConnectionCreated={() => {
- setRefresh(refresh + 1);
- refetchGlobalConnections();
- }}
- >
- <AnimatedIconButton
- icon={PlusIcon}
- iconSize={16}
- size="sm"
- {...adminControl(AdminControl.CONNECTIONS_CONNECTION_OPEN)}
- >
- {t('New Connection')}
- </AnimatedIconButton>
- </NewConnectionDialog>,
- ],
- [refresh],
- );
-
return (
- <div className="flex-col w-full">
- <DashboardPageHeader
- description={t('Manage platform-wide connections to external systems.')}
+ <AdminPage>
+ <AdminPageHeader
title={t('Global Connections')}
- />
- <DataTable
+ description={t('Manage platform-wide connections to external systems.')}
+ resources={adminPageResources.globalConnections}
+ >
+ <NewConnectionDialog
+ isGlobalConnection={true}
+ onConnectionCreated={() => {
+ setRefresh(refresh + 1);
+ refetchGlobalConnections();
+ }}
+ >
+ <AnimatedIconButton
+ icon={PlusIcon}
+ iconSize={16}
+ {...adminControl(AdminControl.CONNECTIONS_CONNECTION_OPEN)}
+ >
+ {t('New Connection')}
+ </AnimatedIconButton>
+ </NewConnectionDialog>
+ </AdminPageHeader>
+ <AdminDataTable
emptyStateTextTitle={t('No global connections found')}
emptyStateTextDescription={t(
'Create a global connection that can be shared to multiple projects',
)}
- emptyStateIcon={<Globe className="size-14" />}
+ emptyStateIcon={<Globe />}
columns={columns}
page={isSample ? sampleData.globalConnectionsPage() : globalConnections}
isLoading={isSample ? false : isLoadingGlobalConnections}
@@ -341,10 +330,15 @@ const GlobalConnectionsTable = () => {
selectColumn={true}
onSelectedRowsChange={setSelectedRows}
bulkActions={bulkActions}
- toolbarButtons={toolbarButtons}
/>
- </div>
+ </AdminPage>
);
};
+const CONNECTION_STATUS_TONE: Record<AppConnectionStatus, StatusTone> = {
+ [AppConnectionStatus.ACTIVE]: 'success',
+ [AppConnectionStatus.ERROR]: 'danger',
+ [AppConnectionStatus.MISSING]: 'neutral',
+};
+
export { GlobalConnectionsTable };
diff --git a/packages/web/src/app/routes/platform/setup/general/appearance-section.tsx b/packages/web/src/app/routes/platform/setup/general/appearance-section.tsx
index 47c6a75b212..11c6f8a269d 100644
--- a/packages/web/src/app/routes/platform/setup/general/appearance-section.tsx
+++ b/packages/web/src/app/routes/platform/setup/general/appearance-section.tsx
@@ -1,8 +1,11 @@
import { isNil } from '@activepieces/core-utils';
import {
+ ApEdition,
+ ApFlagId,
brandColors,
formErrors,
HEX_COLOR_PATTERN,
+ PlatformAdminSurface,
ThemeHexColor,
PlatformThemeColors,
StatusColors,
@@ -11,46 +14,58 @@ import {
import { zodResolver } from '@hookform/resolvers/zod';
import { useMutation, useQueryClient } from '@tanstack/react-query';
import { t } from 'i18next';
-import { useEffect, useRef, useState } from 'react';
+import { Gem, ExternalLink } from 'lucide-react';
+import { ReactNode, useEffect, useState } from 'react';
import { useForm } from 'react-hook-form';
import { toast } from 'sonner';
import { z } from 'zod';
import { platformApi } from '@/api/platforms-api';
-import { FeatureBanner } from '@/app/components/feature-banner';
+import {
+ AdminPage,
+ SaveBar,
+ SaveBarLock,
+ SettingsPanel,
+ SettingsRow,
+} from '@/app/components/admin';
import { ColorPicker } from '@/components/custom/color-picker';
+import { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
import {
Form,
+ FormControl,
FormField,
FormItem,
FormLabel,
FormMessage,
} from '@/components/ui/form';
import { Input } from '@/components/ui/input';
-import {
- Item,
- ItemContent,
- ItemDescription,
- ItemFooter,
- ItemTitle,
-} from '@/components/ui/item';
-import { Label } from '@/components/ui/label';
+import { TIER_LABELS, useUpgradeClick } from '@/features/billing';
import { flagsHooks } from '@/hooks/flags-hooks';
import { platformHooks } from '@/hooks/platform-hooks';
import { AdminControl, adminControl } from '@/lib/admin-control';
import { brandSeed } from '@/lib/brand-seed';
+import { BrandImageField } from './brand-image-field';
import { ColorPreview, ColorTone } from './color-preview';
-export const AppearanceSection = () => {
+export const AppearanceSection = ({
+ header,
+ children,
+}: AppearanceSectionProps) => {
const queryClient = useQueryClient();
const { platform } = platformHooks.useCurrentPlatform();
const branding = flagsHooks.useWebsiteBranding();
+ const { data: edition } = flagsHooks.useFlag<ApEdition>(ApFlagId.EDITION);
+ const { data: maxFileSizeMb } = flagsHooks.useFlag<number>(
+ ApFlagId.MAX_FILE_SIZE_MB,
+ );
+ const upgradeClick = useUpgradeClick();
const brandingLocked = !platform.plan.customAppearanceEnabled;
- const initialColor = HEX_COLOR_PATTERN.test(platform.primaryColor)
- ? platform.primaryColor
- : branding.colors.primary.default;
+ const initialColor =
+ !brandingLocked && HEX_COLOR_PATTERN.test(platform.primaryColor)
+ ? platform.primaryColor
+ : branding.colors.primary.default;
const storedStatusColors = brandingLocked
? branding.statusColors
@@ -83,9 +98,6 @@ export const AppearanceSection = () => {
const savedColor = branding.colors.primary.default;
useEffect(() => {
- if (brandingLocked) {
- return;
- }
brandSeed.setPreview({
primaryColor: HEX_COLOR_PATTERN.test(previewColor)
? previewColor
@@ -97,14 +109,7 @@ export const AppearanceSection = () => {
},
});
return () => brandSeed.clearPreview();
- }, [
- brandingLocked,
- previewColor,
- previewDanger,
- previewWarning,
- previewSuccess,
- savedColor,
- ]);
+ }, [previewColor, previewDanger, previewWarning, previewSuccess, savedColor]);
const statusLabels: Record<StatusScale, string> = {
danger: t('Danger'),
@@ -112,26 +117,27 @@ export const AppearanceSection = () => {
success: t('Success'),
};
- const [fileInputsKey, setFileInputsKey] = useState(0);
- const [hasChosenFiles, setHasChosenFiles] = useState(false);
- const { isDirty, errors } = form.formState;
+ const [images, setImages] = useState<BrandImages>(EMPTY_IMAGES);
+ const { isDirty, errors, dirtyFields } = form.formState;
const hasFieldErrors = Object.keys(errors).some((field) => field !== 'root');
- const hasChanges = isDirty || hasChosenFiles;
- const clearChosenFiles = () => {
- setHasChosenFiles(false);
- setFileInputsKey((key) => key + 1);
+ const imagesChanged = Object.values(images).some((file) => !isNil(file));
+ const hasChanges = isDirty || imagesChanged;
+ const nameDirty = dirtyFields.name === true;
+ const brandingDirty =
+ imagesChanged ||
+ dirtyFields.color === true ||
+ Object.values(dirtyFields.statusColors ?? {}).some(Boolean);
+ const previewingLockedBranding = brandingLocked && brandingDirty;
+ const tierLabel = TIER_LABELS[BRANDING_TIER];
+ const [imageFieldsKey, setImageFieldsKey] = useState(0);
+ const clearImages = () => {
+ setImages(EMPTY_IMAGES);
+ setImageFieldsKey((key) => key + 1);
};
- const logoRef = useRef<HTMLInputElement>(null);
- const iconRef = useRef<HTMLInputElement>(null);
- const faviconRef = useRef<HTMLInputElement>(null);
-
const { mutate: updatePlatform, isPending } = useMutation({
mutationFn: async () => {
form.clearErrors('root.serverError');
- const logo = logoRef.current?.files?.[0];
- const icon = iconRef.current?.files?.[0];
- const favicon = faviconRef.current?.files?.[0];
const { name, color, statusColors } = form.getValues();
const formdata = new FormData();
@@ -149,9 +155,10 @@ export const AppearanceSection = () => {
}),
),
);
- if (logo) formdata.append('fullLogo', logo);
- if (icon) formdata.append('logoIcon', icon);
- if (favicon) formdata.append('favIcon', favicon);
+ BRAND_IMAGES.forEach(({ kind, field }) => {
+ const file = images[kind];
+ if (file) formdata.append(field, file);
+ });
}
await platformApi.updateWithFormData(formdata, platform.id);
@@ -161,8 +168,12 @@ export const AppearanceSection = () => {
]);
},
onSuccess: () => {
- clearChosenFiles();
toast.success(t('Your changes have been saved.'), { duration: 3000 });
+ if (brandingLocked) {
+ form.resetField('name', { defaultValue: form.getValues('name') });
+ return;
+ }
+ clearImages();
form.reset(form.getValues());
},
onError: () => {
@@ -173,87 +184,182 @@ export const AppearanceSection = () => {
},
});
+ const lockedSave: SaveBarLock | undefined = previewingLockedBranding
+ ? {
+ message: t("Branding preview isn't saved"),
+ canSaveRest: nameDirty,
+ action:
+ edition === ApEdition.COMMUNITY ? (
+ <Button type="button" asChild>
+ <a
+ href={ENTERPRISE_DOCUMENTATION_URL}
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ {t('Read the docs')}
+ <ExternalLink />
+ </a>
+ </Button>
+ ) : (
+ <Button
+ type="button"
+ onClick={() =>
+ upgradeClick({
+ feature: 'BRANDING',
+ tier: BRANDING_TIER,
+ surface: PlatformAdminSurface.SAMPLE,
+ })
+ }
+ >
+ <Gem />
+ {t('Upgrade to save')}
+ </Button>
+ ),
+ }
+ : undefined;
+
return (
- <div className="grid gap-4">
- <Form {...form}>
- <form
- className="grid space-y-4 mt-4"
- onSubmit={form.handleSubmit(() => updatePlatform())}
+ <Form {...form}>
+ <form
+ className="flex flex-1 flex-col"
+ onSubmit={(event) => {
+ if (!brandingLocked) {
+ form.handleSubmit(() => updatePlatform())(event);
+ return;
+ }
+ event.preventDefault();
+ if (previewingLockedBranding && !nameDirty) return;
+ form
+ .trigger('name')
+ .then((nameIsValid) => {
+ if (nameIsValid) updatePlatform();
+ })
+ .catch(() => undefined);
+ }}
+ >
+ <AdminPage
+ width="content"
+ footer={
+ <SaveBar
+ width="content"
+ dirty={previewingLockedBranding ? nameDirty : hasChanges}
+ canDiscard={hasChanges}
+ saving={isPending}
+ disabled={brandingLocked ? !!errors.name : hasFieldErrors}
+ status={
+ form.formState.errors.root?.serverError ? (
+ <FormMessage>
+ {form.formState.errors.root.serverError.message}
+ </FormMessage>
+ ) : undefined
+ }
+ locked={lockedSave}
+ saveLabel={previewingLockedBranding ? t('Save name') : undefined}
+ onDiscard={() => {
+ form.reset();
+ clearImages();
+ }}
+ saveControl={AdminControl.GENERAL_APPEARANCE_SUBMIT}
+ />
+ }
>
- <div className="max-w-[600px] grid space-y-4">
+ {header}
+ <SettingsPanel title={t('Platform')} flush>
<FormField
+ control={form.control}
name="name"
- render={({ field }) => (
- <FormItem className="grid space-y-2">
- <FormLabel htmlFor="name">{t('Platform Name')}</FormLabel>
- <Input
- {...field}
- required
- id="name"
- placeholder={t('Platform Name')}
- />
- <FormMessage />
+ render={({ field, fieldState }) => (
+ <FormItem className="space-y-0">
+ <SettingsRow
+ title={
+ <FormLabel htmlFor="name">{t('Platform Name')}</FormLabel>
+ }
+ description={
+ fieldState.error ? (
+ <FormMessage />
+ ) : (
+ t('Shown in the sidebar, emails and the sign-in page.')
+ )
+ }
+ >
+ <FormControl>
+ <Input
+ {...field}
+ required
+ id="name"
+ placeholder={t('Platform Name')}
+ className="w-full sm:w-64"
+ />
+ </FormControl>
+ </SettingsRow>
</FormItem>
)}
/>
+ </SettingsPanel>
- {brandingLocked && (
- <FeatureBanner
- message={t(
- 'Your logo, colors and favicon are part of custom branding.',
- )}
- />
- )}
-
- <div className="grid space-y-2">
- <Label htmlFor="logoFile">{t('Logo')}</Label>
- <Input
- type="file"
- key={fileInputsKey}
- ref={logoRef}
- onChange={() => setHasChosenFiles(true)}
- defaultFileName={platform.fullLogoUrl}
- accept="image/*"
- id="logoFile"
- disabled={brandingLocked}
- />
- </div>
- <div className="grid space-y-2">
- <Label htmlFor="iconFile">{t('Icon')}</Label>
- <Input
- type="file"
- key={fileInputsKey}
- ref={iconRef}
- onChange={() => setHasChosenFiles(true)}
- defaultFileName={platform.logoIconUrl}
- accept="image/*"
- id="iconFile"
- disabled={brandingLocked}
- />
- </div>
- <div className="grid space-y-2">
- <Label htmlFor="faviconFile">{t('Favicon')}</Label>
- <Input
- type="file"
- key={fileInputsKey}
- ref={faviconRef}
- onChange={() => setHasChosenFiles(true)}
- defaultFileName={platform.favIconUrl}
- accept="image/*"
- id="faviconFile"
- disabled={brandingLocked}
+ <SettingsPanel
+ title={t('Branding')}
+ description={
+ brandingLocked
+ ? t(
+ 'Try your logo and colors here. The preview is only for you and is not saved until you upgrade.',
+ )
+ : t(
+ 'Your logo and colors replace ours everywhere, including sign-in and emails.',
+ )
+ }
+ action={
+ !brandingLocked ? undefined : edition === ApEdition.COMMUNITY ? (
+ <Badge variant="info">
+ <Gem />
+ {t('{tier} plan', { tier: tierLabel })}
+ </Badge>
+ ) : (
+ <Button
+ {...adminControl(AdminControl.GENERAL_BRANDING_UPGRADE_OPEN)}
+ type="button"
+ size="sm"
+ variant="outline"
+ onClick={() =>
+ upgradeClick({
+ feature: 'BRANDING',
+ tier: BRANDING_TIER,
+ surface: PlatformAdminSurface.SAMPLE,
+ })
+ }
+ >
+ <Gem />
+ {t('Upgrade to {tier}', { tier: tierLabel })}
+ </Button>
+ )
+ }
+ >
+ {BRAND_IMAGES.map((image) => (
+ <BrandImageField
+ key={`${image.kind}-${imageFieldsKey}`}
+ id={`brand-${image.kind}`}
+ label={image.title()}
+ hint={image.hint()}
+ wide={image.kind === 'logo'}
+ currentUrl={platform[image.urlKey]}
+ file={images[image.kind]}
+ maxSizeMb={maxFileSizeMb ?? DEFAULT_MAX_FILE_SIZE_MB}
+ onFileChange={(file) =>
+ setImages((previous) => ({ ...previous, [image.kind]: file }))
+ }
/>
- </div>
-
- <Item variant="outline">
- <ItemContent>
- <ItemTitle>{t('Colors')}</ItemTitle>
- <ItemDescription>
+ ))}
+ <div className="flex flex-col gap-4 border-t border-gray-6 pt-4">
+ <div className="flex flex-col gap-1">
+ <span className="text-sm font-medium text-gray-12">
+ {t('Colors')}
+ </span>
+ <span className="text-sm text-gray-11">
{t('Your brand and status colors.')}
- </ItemDescription>
- </ItemContent>
- <ItemFooter className="@container block">
- <div className="grid grid-cols-1 gap-3 @lg:grid-cols-2">
+ </span>
+ </div>
+ <div className="@container">
+ <div className="grid grid-cols-1 gap-4 @lg:grid-cols-2">
<FormField
control={form.control}
name="color"
@@ -267,7 +373,6 @@ export const AppearanceSection = () => {
field.value.toLowerCase() ===
brandColors.defaultPrimaryColor()
}
- disabled={brandingLocked}
onChange={field.onChange}
onReset={() =>
field.onChange(brandColors.defaultPrimaryColor())
@@ -289,7 +394,6 @@ export const AppearanceSection = () => {
scale,
})}
isDefault={isNil(field.value)}
- disabled={brandingLocked}
onChange={field.onChange}
onReset={() => field.onChange(undefined)}
/>
@@ -297,49 +401,13 @@ export const AppearanceSection = () => {
/>
))}
</div>
- </ItemFooter>
- </Item>
-
- {form?.formState?.errors?.root?.serverError && (
- <FormMessage>
- {form.formState.errors.root.serverError.message}
- </FormMessage>
- )}
- <div className="flex items-center justify-between gap-3 pt-2">
- <span className="text-sm text-gray-11">
- {hasChanges && (
- <span className="flex items-center gap-2">
- <span className="size-2 rounded-full bg-warning-9" />
- {t('You have unsaved changes')}
- </span>
- )}
- </span>
- <div className="flex gap-2">
- <Button
- type="button"
- variant="outline"
- disabled={!hasChanges || isPending}
- onClick={() => {
- form.reset();
- clearChosenFiles();
- }}
- >
- {t('Cancel')}
- </Button>
- <Button
- {...adminControl(AdminControl.GENERAL_APPEARANCE_SUBMIT)}
- type="submit"
- loading={isPending}
- disabled={!hasChanges || hasFieldErrors}
- >
- {t('Save')}
- </Button>
</div>
</div>
- </div>
- </form>
- </Form>
- </div>
+ </SettingsPanel>
+ {children}
+ </AdminPage>
+ </form>
+ </Form>
);
};
@@ -349,18 +417,16 @@ const ColorRow = ({
color,
defaultColor,
isDefault,
- disabled,
onChange,
onReset,
}: ColorRowProps) => {
const shownColor = color ?? defaultColor;
return (
- <FormItem className="flex flex-col gap-3 space-y-0 rounded-xl border border-gray-6 p-3">
+ <FormItem className="flex flex-col gap-4 space-y-0 rounded-lg border border-gray-6 p-4">
<div className="flex items-center gap-3">
<ColorPicker
side="top"
aria-label={label}
- disabled={disabled}
value={shownColor}
onChange={onChange}
className="shrink-0"
@@ -378,7 +444,7 @@ const ColorRow = ({
variant="ghost"
size="sm"
aria-label={t('Reset {name}', { name: label })}
- disabled={disabled || isDefault}
+ disabled={isDefault}
onClick={onReset}
>
{t('Reset')}
@@ -414,13 +480,59 @@ const PlatformAppearanceSchema = z.object({
type PlatformAppearanceSchema = z.infer<typeof PlatformAppearanceSchema>;
+const BRANDING_TIER = 'enterprise';
+const DEFAULT_MAX_FILE_SIZE_MB = 25;
+const ENTERPRISE_DOCUMENTATION_URL =
+ 'https://www.activepieces.com/docs/install/configuration/overview#enterprise-edition-optional';
+const EMPTY_IMAGES: BrandImages = { logo: null, icon: null, favicon: null };
+
+const BRAND_IMAGES: BrandImageSpec[] = [
+ {
+ kind: 'logo',
+ field: 'fullLogo',
+ urlKey: 'fullLogoUrl',
+ title: () => t('Logo'),
+ hint: () => t('The full logo in the sidebar, emails and the sign-in page.'),
+ },
+ {
+ kind: 'icon',
+ field: 'logoIcon',
+ urlKey: 'logoIconUrl',
+ title: () => t('Icon'),
+ hint: () => t('The square mark used where the full logo does not fit.'),
+ },
+ {
+ kind: 'favicon',
+ field: 'favIcon',
+ urlKey: 'favIconUrl',
+ title: () => t('Favicon'),
+ hint: () => t('The small icon in the browser tab.'),
+ },
+];
+
+type BrandImageKind = 'logo' | 'icon' | 'favicon';
+
+type BrandImages = Record<BrandImageKind, File | null>;
+
+type BrandImageSpec = {
+ kind: BrandImageKind;
+ field: 'fullLogo' | 'logoIcon' | 'favIcon';
+ urlKey: 'fullLogoUrl' | 'logoIconUrl' | 'favIconUrl';
+ title: () => string;
+ hint: () => string;
+};
+
+type AppearanceSectionProps = {
+ header?: ReactNode;
+ children?: ReactNode;
+};
+
type ColorRowProps = {
tone: ColorTone;
label: string;
color: string | undefined;
defaultColor: string;
isDefault: boolean;
- disabled: boolean;
onChange: (color: string | undefined) => void;
onReset: () => void;
};
diff --git a/packages/web/src/app/routes/platform/setup/general/brand-image-field.tsx b/packages/web/src/app/routes/platform/setup/general/brand-image-field.tsx
new file mode 100644
index 00000000000..5a2f6d8a70e
--- /dev/null
+++ b/packages/web/src/app/routes/platform/setup/general/brand-image-field.tsx
@@ -0,0 +1,185 @@
+import { t } from 'i18next';
+import { ImageUp, RotateCcw } from 'lucide-react';
+import { useEffect, useRef, useState } from 'react';
+
+import { Button } from '@/components/ui/button';
+import { cn } from '@/lib/utils';
+
+export const BrandImageField = ({
+ id,
+ label,
+ hint,
+ wide,
+ currentUrl,
+ file,
+ maxSizeMb,
+ disabled,
+ onFileChange,
+}: BrandImageFieldProps) => {
+ const inputRef = useRef<HTMLInputElement>(null);
+ const [dragging, setDragging] = useState(false);
+ const [error, setError] = useState<string | null>(null);
+ const previewUrl = useObjectUrl(file);
+ const shownUrl = previewUrl ?? (currentUrl || null);
+ const hintId = `${id}-hint`;
+ const labelId = `${id}-label`;
+ const errorId = `${id}-error`;
+
+ const accept = (candidate: File | undefined) => {
+ if (!candidate) return;
+ if (!candidate.type.startsWith('image/')) {
+ setError(t('Choose an image file (PNG, JPG, SVG, WebP or ICO).'));
+ return;
+ }
+ if (candidate.size > maxSizeMb * 1024 * 1024) {
+ setError(t('This file is larger than {size} MB.', { size: maxSizeMb }));
+ return;
+ }
+ setError(null);
+ onFileChange(candidate);
+ };
+
+ return (
+ <div className="flex flex-col gap-2">
+ <div className="flex items-baseline justify-between gap-2">
+ <span id={labelId} className="text-sm font-medium text-gray-12">
+ {label}
+ </span>
+ {file && (
+ <span className="truncate text-xs text-gray-11">
+ {file.name} · {formatSize(file.size)}
+ </span>
+ )}
+ </div>
+ <div
+ data-dragging={dragging || undefined}
+ className={cn(
+ 'grid grid-cols-[auto_minmax(0,1fr)] items-center gap-4 rounded-lg border border-dashed border-gray-7 p-4 transition-colors sm:grid-cols-[auto_minmax(0,1fr)_auto]',
+ 'data-dragging:border-accent-8 data-dragging:bg-accent-2',
+ disabled && 'opacity-50',
+ )}
+ onDragOver={(event) => {
+ if (disabled) return;
+ event.preventDefault();
+ setDragging(true);
+ }}
+ onDragLeave={() => setDragging(false)}
+ onDrop={(event) => {
+ event.preventDefault();
+ setDragging(false);
+ if (disabled) return;
+ accept(event.dataTransfer.files?.[0]);
+ }}
+ >
+ <div
+ data-theme="light"
+ className={cn(
+ 'flex h-14 shrink-0 items-center justify-center overflow-hidden rounded-md border border-gray-6 bg-gray-1 p-2',
+ wide ? 'w-40' : 'w-14',
+ )}
+ >
+ {shownUrl ? (
+ <img
+ src={shownUrl}
+ alt={label}
+ className="max-h-full max-w-full object-contain"
+ />
+ ) : (
+ <ImageUp className="size-5 text-gray-9" />
+ )}
+ </div>
+ <div id={hintId} className="flex min-w-0 flex-col gap-1">
+ <span className="text-sm text-gray-11">{hint}</span>
+ <span className="text-xs text-gray-11">
+ {t(
+ 'PNG, JPG, SVG, WebP or ICO up to {size} MB. You can also drop a file here.',
+ {
+ size: maxSizeMb,
+ },
+ )}
+ </span>
+ </div>
+ <div className="col-span-2 flex shrink-0 items-center gap-2 sm:col-span-1">
+ {file && (
+ <Button
+ type="button"
+ variant="ghost"
+ size="sm"
+ disabled={disabled}
+ onClick={() => {
+ setError(null);
+ onFileChange(null);
+ }}
+ >
+ <RotateCcw />
+ {t('Undo')}
+ </Button>
+ )}
+ <Button
+ id={id}
+ type="button"
+ variant="outline"
+ size="sm"
+ disabled={disabled}
+ aria-labelledby={`${id} ${labelId}`}
+ aria-describedby={error ? `${hintId} ${errorId}` : hintId}
+ onClick={() => inputRef.current?.click()}
+ >
+ <ImageUp />
+ {shownUrl ? t('Replace') : t('Upload')}
+ </Button>
+ <input
+ ref={inputRef}
+ type="file"
+ accept="image/*"
+ className="hidden"
+ tabIndex={-1}
+ aria-hidden
+ disabled={disabled}
+ onChange={(event) => {
+ accept(event.target.files?.[0]);
+ event.target.value = '';
+ }}
+ />
+ </div>
+ </div>
+ {error && (
+ <span id={errorId} role="alert" className="text-xs text-danger-11">
+ {error}
+ </span>
+ )}
+ </div>
+ );
+};
+
+function useObjectUrl(file: File | null): string | null {
+ const [url, setUrl] = useState<string | null>(null);
+ useEffect(() => {
+ if (!file) {
+ setUrl(null);
+ return;
+ }
+ const next = URL.createObjectURL(file);
+ setUrl(next);
+ return () => URL.revokeObjectURL(next);
+ }, [file]);
+ return url;
+}
+
+function formatSize(bytes: number): string {
+ if (bytes < 1024) return `${bytes} B`;
+ if (bytes < 1024 * 1024) return `${Math.round(bytes / 1024)} KB`;
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
+}
+
+type BrandImageFieldProps = {
+ id: string;
+ label: string;
+ hint: string;
+ wide?: boolean;
+ currentUrl: string;
+ file: File | null;
+ maxSizeMb: number;
+ disabled?: boolean;
+ onFileChange: (file: File | null) => void;
+};
diff --git a/packages/web/src/app/routes/platform/setup/general/danger-zone-section.tsx b/packages/web/src/app/routes/platform/setup/general/danger-zone-section.tsx
index 6b0accd3272..b51ec1ffb1e 100644
--- a/packages/web/src/app/routes/platform/setup/general/danger-zone-section.tsx
+++ b/packages/web/src/app/routes/platform/setup/general/danger-zone-section.tsx
@@ -3,6 +3,7 @@ import { t } from 'i18next';
import { Trash2 } from 'lucide-react';
import { useState } from 'react';
+import { DangerZone, SettingsRow } from '@/app/components/admin';
import { Button } from '@/components/ui/button';
import { platformHooks } from '@/hooks/platform-hooks';
import { AdminControl, adminControl } from '@/lib/admin-control';
@@ -15,37 +16,38 @@ export const DangerZoneSection = ({ platformName }: DangerZoneSectionProps) => {
const hasSubscription = hasActiveSubscription(platform.plan.plan);
return (
- <div className="flex flex-col gap-3">
- <h2 className="text-base font-semibold">{t('Danger zone')}</h2>
- <div className="flex flex-wrap items-center justify-between gap-4 rounded-xl border px-4 py-3.5">
- <div className="flex min-w-0 flex-col gap-0.5">
- <span className="text-sm font-medium">{t('Delete platform')}</span>
- <span className="text-sm text-gray-11">
+ <DangerZone>
+ <SettingsRow
+ title={t('Delete platform')}
+ description={
+ <>
{t('Once deleted, your platform cannot be recovered.')}
{hasSubscription
? ` ${t(
'Cancel your subscription before deleting this platform.',
)}`
: ''}
- </span>
- </div>
+ </>
+ }
+ >
<Button
{...adminControl(AdminControl.GENERAL_PLATFORM_DELETE_OPEN)}
+ type="button"
variant="destructive"
size="sm"
disabled={hasSubscription}
onClick={() => setIsDeleteOpen(true)}
>
- <Trash2 className="size-3.5" />
+ <Trash2 />
{t('Delete platform')}
</Button>
- </div>
+ </SettingsRow>
<DeletePlatformDialog
platformName={platformName}
open={isDeleteOpen}
onOpenChange={setIsDeleteOpen}
/>
- </div>
+ </DangerZone>
);
};
diff --git a/packages/web/src/app/routes/platform/setup/general/delete-platform-dialog.tsx b/packages/web/src/app/routes/platform/setup/general/delete-platform-dialog.tsx
index d78962d39ce..be47636b310 100644
--- a/packages/web/src/app/routes/platform/setup/general/delete-platform-dialog.tsx
+++ b/packages/web/src/app/routes/platform/setup/general/delete-platform-dialog.tsx
@@ -5,6 +5,7 @@ import { t } from 'i18next';
import { useForm } from 'react-hook-form';
import { z } from 'zod';
+import { adminLayout } from '@/app/components/admin';
import { Button } from '@/components/ui/button';
import {
Dialog,
@@ -32,7 +33,7 @@ export const DeletePlatformDialog = ({
onOpenChange,
}: DeletePlatformDialogProps) => (
<Dialog open={open} onOpenChange={onOpenChange}>
- <DialogContent>
+ <DialogContent className={adminLayout.dialog.sm}>
<DeletePlatformForm
key={open ? 'open' : 'closed'}
platformName={platformName}
@@ -73,7 +74,12 @@ const DeletePlatformForm = ({
return (
<Form {...form}>
- <form onSubmit={form.handleSubmit(() => deletePlatform())}>
+ <form
+ onSubmit={(event) => {
+ event.stopPropagation();
+ form.handleSubmit(() => deletePlatform())(event);
+ }}
+ >
<DialogHeader>
<DialogTitle>{t('Delete platform')}</DialogTitle>
<DialogDescription className="flex flex-col gap-3">
diff --git a/packages/web/src/app/routes/platform/setup/general/index.tsx b/packages/web/src/app/routes/platform/setup/general/index.tsx
index 6e0cfd91b63..926dbd9ffdb 100644
--- a/packages/web/src/app/routes/platform/setup/general/index.tsx
+++ b/packages/web/src/app/routes/platform/setup/general/index.tsx
@@ -1,9 +1,8 @@
import { ApEdition, ApFlagId } from '@activepieces/shared';
import { t } from 'i18next';
-import { CenteredPage } from '@/app/components/centered-page';
+import { AdminPageHeader, adminPageResources } from '@/app/components/admin';
import { AppearanceSection } from '@/app/routes/platform/setup/general/appearance-section';
-import { Separator } from '@/components/ui/separator';
import { flagsHooks } from '@/hooks/flags-hooks';
import { platformHooks } from '@/hooks/platform-hooks';
import { userHooks } from '@/hooks/user-hooks';
@@ -19,17 +18,16 @@ export const GeneralPage = () => {
edition === ApEdition.CLOUD && platform.ownerId === user?.id;
return (
- <CenteredPage
- title={t('General')}
- description={t('Your platform name, branding and general settings.')}
+ <AppearanceSection
+ header={
+ <AdminPageHeader
+ title={t('General')}
+ description={t('Your platform name, branding and general settings.')}
+ resources={adminPageResources.general}
+ />
+ }
>
- <AppearanceSection />
- {canDeletePlatform && (
- <>
- <Separator className="my-8" />
- <DangerZoneSection platformName={platform.name} />
- </>
- )}
- </CenteredPage>
+ {canDeletePlatform && <DangerZoneSection platformName={platform.name} />}
+ </AppearanceSection>
);
};
diff --git a/packages/web/src/app/routes/platform/setup/mcp/index.tsx b/packages/web/src/app/routes/platform/setup/mcp/index.tsx
index 1c2e51a60bb..7d1b46fdadc 100644
--- a/packages/web/src/app/routes/platform/setup/mcp/index.tsx
+++ b/packages/web/src/app/routes/platform/setup/mcp/index.tsx
@@ -1,7 +1,11 @@
import { t } from 'i18next';
import { Link } from 'react-router-dom';
-import { CenteredPage } from '@/app/components/centered-page';
+import {
+ AdminPage,
+ AdminPageHeader,
+ adminPageResources,
+} from '@/app/components/admin';
import { McpToolTierList } from '@/app/components/project-settings/mcp-server/tool-tiers/mcp-tool-tier-list';
import { ActivityFeed } from '@/app/routes/mcp-server/activity/activity-feed';
import { DataFetchErrorState } from '@/components/custom/data-fetch-error-state';
@@ -13,39 +17,37 @@ import { platformMcpHooks } from './platform-mcp-hooks';
export default function PlatformMcpPage({ section }: PlatformMcpPageProps) {
const { platform } = platformHooks.useCurrentPlatform();
return (
- <CenteredPage
- widthClassName={section === 'activity' ? 'max-w-[1198px]' : undefined}
- showHeaderSeparator={false}
- title={section === 'access' ? t('MCP Tools') : t('MCP Activity')}
- description={
- section === 'access' ? (
- <>
- {t(
- "Choose which tools MCP clients can use in every project and in AI Chat. Clients act with the signed-in user's permissions.",
- )}
- {platform.plan.projectRolesEnabled && (
- <>
- {' '}
- <Link
- to="/platform/users/roles"
- className="text-accent-11 underline underline-offset-4"
- >
- {t('Manage roles')}
- </Link>
- </>
- )}
- </>
- ) : (
- t(
- 'Piece actions run by MCP clients, like Claude and Cursor. Other tool calls are not logged.',
+ <AdminPage width={section === 'activity' ? 'full' : 'content'}>
+ <AdminPageHeader
+ title={section === 'access' ? t('MCP Tools') : t('MCP Activity')}
+ resources={adminPageResources.mcp}
+ description={
+ section === 'access' ? (
+ <>
+ {t(
+ "Choose which tools MCP clients can use in every project and in AI Chat. Clients act with the signed-in user's permissions.",
+ )}
+ {platform.plan.projectRolesEnabled && (
+ <>
+ {' '}
+ <Link
+ to="/platform/users/roles"
+ className="text-accent-11 underline underline-offset-4"
+ >
+ {t('Manage roles')}
+ </Link>
+ </>
+ )}
+ </>
+ ) : (
+ t(
+ 'Piece actions run by MCP clients, like Claude and Cursor. Other tool calls are not logged.',
+ )
)
- )
- }
- >
- <div className="pb-6">
- {section === 'access' ? <AccessContent /> : <ActivityContent />}
- </div>
- </CenteredPage>
+ }
+ />
+ {section === 'access' ? <AccessContent /> : <ActivityContent />}
+ </AdminPage>
);
}
@@ -85,12 +87,14 @@ function AccessContent() {
function ActivityContent() {
return (
- <ActivityFeed
- emptyStateTitle={t('No activity yet')}
- emptyStateDescription={t(
- 'When an MCP client runs a piece action, it appears here.',
- )}
- />
+ <div className="flex flex-col">
+ <ActivityFeed
+ emptyStateTitle={t('No activity yet')}
+ emptyStateDescription={t(
+ 'When an MCP client runs a piece action, it appears here.',
+ )}
+ />
+ </div>
);
}
diff --git a/packages/web/src/app/routes/platform/setup/pieces/customize-selector-dialog.tsx b/packages/web/src/app/routes/platform/setup/pieces/customize-selector-dialog.tsx
index b7237e1c1cc..26d7d858673 100644
--- a/packages/web/src/app/routes/platform/setup/pieces/customize-selector-dialog.tsx
+++ b/packages/web/src/app/routes/platform/setup/pieces/customize-selector-dialog.tsx
@@ -9,7 +9,7 @@ import { t } from 'i18next';
import {
CheckIcon,
ChevronDownIcon,
- Crown,
+ Gem,
EyeIcon,
EyeOffIcon,
GripVerticalIcon,
@@ -22,6 +22,7 @@ import {
import { ReactNode, useMemo, useState } from 'react';
import { toast } from 'sonner';
+import { adminLayout } from '@/app/components/admin';
import { ConfirmationDeleteDialog } from '@/components/custom/delete-dialog';
import { useTelemetry } from '@/components/providers/telemetry-provider';
import { Button } from '@/components/ui/button';
@@ -98,7 +99,7 @@ export const CustomizeSelectorDialog = ({
gate.open();
}}
>
- <Crown className="size-3.5 shrink-0 text-accent-11" />
+ <Gem className="size-3.5 shrink-0 text-accent-11" />
{t('Customize Selector')}
</Button>
{gate.dialog}
@@ -114,13 +115,13 @@ export const CustomizeSelectorDialog = ({
variant="outline"
size="sm"
>
- <Settings2Icon className="size-4 mr-2" />
+ <Settings2Icon />
{t('Customize Selector')}
</Button>
</SheetTrigger>
<SheetContent
side="right"
- className="w-full sm:max-w-lg flex flex-col gap-0 p-0"
+ className={cn(adminLayout.sheet.md, 'flex flex-col gap-0 p-0')}
>
<SelectorTabsEditor
key={open ? 'open' : 'closed'}
diff --git a/packages/web/src/app/routes/platform/setup/pieces/download-pieces-report.tsx b/packages/web/src/app/routes/platform/setup/pieces/download-pieces-report.tsx
index e5add772d87..1a0bf8c9ba1 100644
--- a/packages/web/src/app/routes/platform/setup/pieces/download-pieces-report.tsx
+++ b/packages/web/src/app/routes/platform/setup/pieces/download-pieces-report.tsx
@@ -40,7 +40,7 @@ const DownloadPiecesReportButton = () => {
loading={isPending}
size={'sm'}
>
- <Download className="w-4 h-4 mr-2" />
+ <Download />
{t('Download Report')}
</Button>
);
diff --git a/packages/web/src/app/routes/platform/setup/pieces/index.tsx b/packages/web/src/app/routes/platform/setup/pieces/index.tsx
index aa881c24c2f..deb56902578 100644
--- a/packages/web/src/app/routes/platform/setup/pieces/index.tsx
+++ b/packages/web/src/app/routes/platform/setup/pieces/index.tsx
@@ -18,14 +18,19 @@ import { useMemo } from 'react';
import { useSearchParams } from 'react-router-dom';
import { toast } from 'sonner';
-import { DashboardPageHeader } from '@/app/components/dashboard-page-header';
+import {
+ AdminDataTable,
+ AdminPage,
+ AdminPageHeader,
+ adminPageResources,
+} from '@/app/components/admin';
import { CustomizeSelectorDialog } from '@/app/routes/platform/setup/pieces/customize-selector-dialog';
import { DownloadPiecesReportButton } from '@/app/routes/platform/setup/pieces/download-pieces-report';
import { PieceActions } from '@/app/routes/platform/setup/pieces/piece-actions';
import { PiecesLockedBanner } from '@/app/routes/platform/setup/pieces/pieces-locked-banner';
import { SyncPiecesButton } from '@/app/routes/platform/setup/pieces/sync-pieces';
import { ConfigurePieceOAuth2Dialog } from '@/app/routes/platform/setup/pieces/update-oauth2-dialog';
-import { DataTable, RowDataWithActions } from '@/components/custom/data-table';
+import { RowDataWithActions } from '@/components/custom/data-table';
import { DataTableColumnHeader } from '@/components/custom/data-table/data-table-column-header';
import { ConfirmationDeleteDialog } from '@/components/custom/delete-dialog';
import { Button } from '@/components/ui/button';
@@ -179,22 +184,28 @@ export const PiecesListTab = () => {
);
return (
- <>
- <DashboardPageHeader
+ <AdminPage fill>
+ <AdminPageHeader
title={t('Pieces')}
description={t('Manage the pieces that are available to your users')}
- />
+ resources={adminPageResources.pieces}
+ >
+ <InstallPieceDialog
+ onInstallPiece={() => refetchPieces()}
+ scope={PieceScope.PLATFORM}
+ />
+ </AdminPageHeader>
<PiecesLockedBanner
message={t(
"Showing and hiding pieces needs a higher plan. You can browse the catalog, but changes won't stick.",
)}
/>
- <DataTable
+ <AdminDataTable
emptyStateTextTitle={t('No pieces found')}
emptyStateTextDescription={t(
'Start by installing pieces that you want to use in your automations',
)}
- emptyStateIcon={<Package className="size-14" />}
+ emptyStateIcon={<Package />}
columns={columns}
filters={[
{
@@ -217,16 +228,11 @@ export const PiecesListTab = () => {
<CustomizeSelectorDialog key="customize" isEnabled={isEnabled} />,
<DownloadPiecesReportButton key="download-report" />,
<SyncPiecesButton key="sync" />,
- <InstallPieceDialog
- key="install"
- onInstallPiece={() => refetchPieces()}
- scope={PieceScope.PLATFORM}
- />,
]}
virtualizeRows={true}
hidePagination={true}
/>
- </>
+ </AdminPage>
);
};
diff --git a/packages/web/src/app/routes/platform/setup/pieces/piece-sets/confirm-excluding-required-actions.tsx b/packages/web/src/app/routes/platform/setup/pieces/piece-sets/confirm-excluding-required-actions.tsx
index 547e2d1e421..77067b972f4 100644
--- a/packages/web/src/app/routes/platform/setup/pieces/piece-sets/confirm-excluding-required-actions.tsx
+++ b/packages/web/src/app/routes/platform/setup/pieces/piece-sets/confirm-excluding-required-actions.tsx
@@ -1,5 +1,6 @@
import { t } from 'i18next';
+import { adminLayout } from '@/app/components/admin';
import { Button } from '@/components/ui/button';
import {
Dialog,
@@ -33,7 +34,7 @@ export function ConfirmExcludingRequiredActionsDialog({
open={excludedRequiredActions !== null}
onOpenChange={(open) => !open && onCancel()}
>
- <DialogContent className="sm:max-w-md">
+ <DialogContent className={adminLayout.dialog.sm}>
{excludedRequiredActions && (
<ConfirmExcludingRequiredActionsContent
excludedRequiredActions={excludedRequiredActions}
diff --git a/packages/web/src/app/routes/platform/setup/pieces/piece-sets/create-piece-set-dialog.tsx b/packages/web/src/app/routes/platform/setup/pieces/piece-sets/create-piece-set-dialog.tsx
index efe19d27d52..15380443701 100644
--- a/packages/web/src/app/routes/platform/setup/pieces/piece-sets/create-piece-set-dialog.tsx
+++ b/packages/web/src/app/routes/platform/setup/pieces/piece-sets/create-piece-set-dialog.tsx
@@ -6,6 +6,7 @@ import { useState } from 'react';
import { useForm } from 'react-hook-form';
import { z } from 'zod';
+import { adminLayout } from '@/app/components/admin';
import { Button } from '@/components/ui/button';
import {
Dialog,
@@ -116,11 +117,11 @@ export const CreatePieceSetDialog = ({
{...adminControl(AdminControl.PIECE_SETS_CREATE_OPEN)}
disabled={!isEnabled}
>
- <Plus className="size-4 mr-1" />
+ <Plus />
{t('New Piece Set')}
</Button>
</DialogTrigger>
- <DialogContent>
+ <DialogContent className={adminLayout.dialog.md}>
<DialogHeader>
<DialogTitle>{t('Create Piece Set')}</DialogTitle>
</DialogHeader>
diff --git a/packages/web/src/app/routes/platform/setup/pieces/piece-sets/duplicate-piece-set-dialog.tsx b/packages/web/src/app/routes/platform/setup/pieces/piece-sets/duplicate-piece-set-dialog.tsx
index 49f01259d3c..902e8a3a0a4 100644
--- a/packages/web/src/app/routes/platform/setup/pieces/piece-sets/duplicate-piece-set-dialog.tsx
+++ b/packages/web/src/app/routes/platform/setup/pieces/piece-sets/duplicate-piece-set-dialog.tsx
@@ -4,6 +4,7 @@ import { t } from 'i18next';
import { useForm } from 'react-hook-form';
import { z } from 'zod';
+import { adminLayout } from '@/app/components/admin';
import { Button } from '@/components/ui/button';
import {
Dialog,
@@ -104,7 +105,7 @@ export const DuplicatePieceSetDialog = ({
}: DuplicatePieceSetDialogProps) => {
return (
<Dialog open={open} onOpenChange={onOpenChange}>
- <DialogContent>
+ <DialogContent className={adminLayout.dialog.sm}>
<DialogHeader>
<DialogTitle>{t('Duplicate Piece Set')}</DialogTitle>
</DialogHeader>
diff --git a/packages/web/src/app/routes/platform/setup/pieces/piece-sets/edit-piece-set-dialog.tsx b/packages/web/src/app/routes/platform/setup/pieces/piece-sets/edit-piece-set-dialog.tsx
index 5f3c63efbc5..543943635cb 100644
--- a/packages/web/src/app/routes/platform/setup/pieces/piece-sets/edit-piece-set-dialog.tsx
+++ b/packages/web/src/app/routes/platform/setup/pieces/piece-sets/edit-piece-set-dialog.tsx
@@ -4,6 +4,7 @@ import { t } from 'i18next';
import { useForm } from 'react-hook-form';
import { z } from 'zod';
+import { adminLayout } from '@/app/components/admin';
import { Button } from '@/components/ui/button';
import {
Dialog,
@@ -141,7 +142,7 @@ export const EditPieceSetDialog = ({
}: EditPieceSetDialogProps) => {
return (
<Dialog open={open} onOpenChange={onOpenChange}>
- <DialogContent>
+ <DialogContent className={adminLayout.dialog.md}>
<DialogHeader>
<DialogTitle>{t('Edit Piece Set')}</DialogTitle>
</DialogHeader>
diff --git a/packages/web/src/app/routes/platform/setup/pieces/piece-sets/piece-actions-and-triggers-sheet.tsx b/packages/web/src/app/routes/platform/setup/pieces/piece-sets/piece-actions-and-triggers-sheet.tsx
index 20ba8bd550c..76df070461f 100644
--- a/packages/web/src/app/routes/platform/setup/pieces/piece-sets/piece-actions-and-triggers-sheet.tsx
+++ b/packages/web/src/app/routes/platform/setup/pieces/piece-sets/piece-actions-and-triggers-sheet.tsx
@@ -10,6 +10,7 @@ import { Loader2 } from 'lucide-react';
import { useState } from 'react';
import { useForm } from 'react-hook-form';
+import { adminLayout } from '@/app/components/admin';
import { DataFetchErrorState } from '@/components/custom/data-fetch-error-state';
import { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
@@ -51,7 +52,7 @@ export const PieceActionsAndTriggersSheet = ({
}: PieceActionsAndTriggersSheetProps) => {
return (
<Sheet open={open} onOpenChange={onOpenChange}>
- <SheetContent className="w-[600px] sm:max-w-[600px] flex flex-col p-0">
+ <SheetContent className={cn(adminLayout.sheet.md, 'flex flex-col p-0')}>
<PieceActionsAndTriggersSheetBody
key={pieceName}
pieceName={pieceName}
diff --git a/packages/web/src/app/routes/platform/setup/pieces/piece-sets/piece-select.tsx b/packages/web/src/app/routes/platform/setup/pieces/piece-sets/piece-select.tsx
index 0052daec37b..0fc87281ae4 100644
--- a/packages/web/src/app/routes/platform/setup/pieces/piece-sets/piece-select.tsx
+++ b/packages/web/src/app/routes/platform/setup/pieces/piece-sets/piece-select.tsx
@@ -27,8 +27,6 @@ export function PieceSelect({
}) {
const [open, setOpen] = useState(false);
const [search, setSearch] = useState('');
- const [popoverContainer, setPopoverContainer] =
- useState<HTMLDivElement | null>(null);
const selectedPiece = pieces.find((piece) => piece.name === value);
const matchingPieces = pieces.filter((piece) =>
piece.displayName.toLowerCase().includes(search.toLowerCase()),
@@ -39,102 +37,97 @@ export function PieceSelect({
);
return (
- <div ref={setPopoverContainer}>
- <Popover
- open={open}
- onOpenChange={(isOpen) => {
- setOpen(isOpen);
- setSearch('');
- }}
- >
- <PopoverTrigger asChild>
- <Button
- variant="outline"
- role="combobox"
- aria-expanded={open}
- disabled={loading}
- className="w-full justify-start gap-2 font-normal"
- >
- {selectedPiece ? (
- <>
- <PieceIcon
- size="xs"
- border={true}
- displayName={selectedPiece.displayName}
- logoUrl={selectedPiece.logoUrl}
- showTooltip={false}
- />
- <span className="flex-1 truncate text-left">
- {selectedPiece.displayName}
- </span>
- </>
- ) : (
- <span className="flex-1 text-left text-gray-11">
- {t('Select a piece')}
- </span>
- )}
- <ChevronsUpDown className="size-4 shrink-0 opacity-50" />
- </Button>
- </PopoverTrigger>
- <PopoverContent
- container={popoverContainer}
- className="w-[var(--radix-popover-trigger-width)] p-0"
+ <Popover
+ open={open}
+ onOpenChange={(isOpen) => {
+ setOpen(isOpen);
+ setSearch('');
+ }}
+ >
+ <PopoverTrigger asChild>
+ <Button
+ variant="outline"
+ role="combobox"
+ aria-expanded={open}
+ disabled={loading}
+ className="w-full justify-start gap-2 font-normal"
>
- <div className="border-b p-2">
- <Input
- autoFocus
- value={search}
- placeholder={t('Search pieces')}
- onChange={(event) => setSearch(event.target.value)}
- />
- </div>
- {matchingPieces.length === 0 ? (
- <div className="px-3 py-4 text-sm text-gray-11">
- {t('No pieces found')}
- </div>
+ {selectedPiece ? (
+ <>
+ <PieceIcon
+ size="xs"
+ border={true}
+ displayName={selectedPiece.displayName}
+ logoUrl={selectedPiece.logoUrl}
+ showTooltip={false}
+ />
+ <span className="flex-1 truncate text-left">
+ {selectedPiece.displayName}
+ </span>
+ </>
) : (
- <div style={{ height: listHeight }}>
- <VirtualizedScrollArea
- items={matchingPieces}
- estimateSize={() => ITEM_HEIGHT}
- getItemKey={(index) => matchingPieces[index].name}
- overscan={10}
- renderItem={(piece) => (
- <button
- type="button"
- onClick={() => {
- onChange(piece.name);
- setOpen(false);
- }}
+ <span className="flex-1 text-left text-gray-11">
+ {t('Select a piece')}
+ </span>
+ )}
+ <ChevronsUpDown className="size-4 shrink-0 opacity-50" />
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent className="w-[var(--radix-popover-trigger-width)] p-0">
+ <div className="border-b p-2">
+ <Input
+ autoFocus
+ value={search}
+ placeholder={t('Search pieces')}
+ onChange={(event) => setSearch(event.target.value)}
+ />
+ </div>
+ {matchingPieces.length === 0 ? (
+ <div className="px-3 py-4 text-sm text-gray-11">
+ {t('No pieces found')}
+ </div>
+ ) : (
+ <div style={{ height: listHeight }}>
+ <VirtualizedScrollArea
+ items={matchingPieces}
+ estimateSize={() => ITEM_HEIGHT}
+ getItemKey={(index) => matchingPieces[index].name}
+ overscan={10}
+ renderItem={(piece) => (
+ <button
+ type="button"
+ onClick={() => {
+ onChange(piece.name);
+ setOpen(false);
+ }}
+ className={cn(
+ 'flex h-full w-full items-center gap-2 px-3 text-sm hover:bg-gray-4',
+ piece.name === value && 'bg-gray-4',
+ )}
+ >
+ <PieceIcon
+ size="xs"
+ border={true}
+ displayName={piece.displayName}
+ logoUrl={piece.logoUrl}
+ showTooltip={false}
+ />
+ <span className="flex-1 truncate text-left">
+ {piece.displayName}
+ </span>
+ <Check
className={cn(
- 'flex h-full w-full items-center gap-2 px-3 text-sm hover:bg-gray-4',
- piece.name === value && 'bg-gray-4',
+ 'size-4 shrink-0',
+ piece.name === value ? 'opacity-100' : 'opacity-0',
)}
- >
- <PieceIcon
- size="xs"
- border={true}
- displayName={piece.displayName}
- logoUrl={piece.logoUrl}
- showTooltip={false}
- />
- <span className="flex-1 truncate text-left">
- {piece.displayName}
- </span>
- <Check
- className={cn(
- 'size-4 shrink-0',
- piece.name === value ? 'opacity-100' : 'opacity-0',
- )}
- />
- </button>
- )}
- />
- </div>
- )}
- </PopoverContent>
- </Popover>
- </div>
+ />
+ </button>
+ )}
+ />
+ </div>
+ )}
+ </PopoverContent>
+ </Popover>
);
}
diff --git a/packages/web/src/app/routes/platform/setup/pieces/piece-sets/piece-set-details-page.tsx b/packages/web/src/app/routes/platform/setup/pieces/piece-sets/piece-set-details-page.tsx
index da80d3f7c78..6986e0099ae 100644
--- a/packages/web/src/app/routes/platform/setup/pieces/piece-sets/piece-set-details-page.tsx
+++ b/packages/web/src/app/routes/platform/setup/pieces/piece-sets/piece-set-details-page.tsx
@@ -4,19 +4,23 @@ import {
PieceSet,
} from '@activepieces/shared';
import { t } from 'i18next';
-import { ArrowLeft, Layers, Loader2 } from 'lucide-react';
-import { Navigate, useNavigate, useParams } from 'react-router-dom';
+import { Loader2 } from 'lucide-react';
+import { Navigate, useParams } from 'react-router-dom';
-import { DashboardPageHeader } from '@/app/components/dashboard-page-header';
+import {
+ AdminPage,
+ AdminPageHeader,
+ SettingsPanel,
+ SettingsRow,
+ adminPageResources,
+} from '@/app/components/admin';
import { Badge } from '@/components/ui/badge';
-import { Button } from '@/components/ui/button';
import { Switch } from '@/components/ui/switch';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { pieceSetMutations, pieceSetQueries } from '@/features/piece-sets';
import { piecesHooks } from '@/features/pieces';
import { platformHooks } from '@/hooks/platform-hooks';
import { AdminControl, adminControl } from '@/lib/admin-control';
-import { cn, DASHBOARD_CONTENT_PADDING_X } from '@/lib/utils';
import { PieceSetPiecesTable } from './piece-set-pieces-table';
import { PieceSetProjectsDialog } from './piece-set-projects-dialog';
@@ -25,7 +29,6 @@ import { useRequiredActionsGroupedByPiece } from './use-required-actions-grouped
const PieceSetDetailsPage = () => {
const { id } = useParams<{ id: string }>();
- const navigate = useNavigate();
const { platform } = platformHooks.useCurrentPlatform();
const { data: pieceSet, isLoading } = pieceSetQueries.usePieceSet(id ?? '');
const { pieces, isLoading: piecesLoading } = piecesHooks.usePieces({
@@ -62,98 +65,74 @@ const PieceSetDetailsPage = () => {
}
return (
- <>
- <DashboardPageHeader
- title={
- <div className="flex items-center gap-2">
- <Button
- variant="ghost"
- size="sm"
- onClick={() => navigate('/platform/pieces/piece-sets')}
- className="p-1 h-auto"
- >
- <ArrowLeft className="size-4" />
- </Button>
- <Layers className="size-5" />
- <span>{pieceSet.name}</span>
- {pieceSet.isDefault && (
- <Badge variant="secondary">{t('Default')}</Badge>
- )}
- </div>
+ <AdminPage fill>
+ <AdminPageHeader
+ back={{ label: t('Piece Sets'), to: '/platform/pieces/piece-sets' }}
+ title={pieceSet.name}
+ badge={
+ pieceSet.isDefault && (
+ <Badge variant="secondary">{t('Default')}</Badge>
+ )
}
description={t(
'Determine which actions and triggers assigned projects can add to their flows.',
)}
+ resources={adminPageResources.pieces}
/>
<Tabs
defaultValue="pieces"
- className="mx-auto w-full flex flex-col flex-1 min-h-0 gap-0"
+ className="flex min-h-0 w-full flex-1 flex-col gap-6"
>
- <div className={cn('pt-3 shrink-0', DASHBOARD_CONTENT_PADDING_X)}>
- <TabsList
- variant="outline"
- className="w-full justify-start border-b border-gray-6"
- >
- <TabsTrigger variant="outline" value="pieces">
- {t('Pieces')}
- </TabsTrigger>
- <TabsTrigger variant="outline" value="requiredActions">
- {t('Required actions')}
- <RequiredActionsCountBadge pieceSet={pieceSet} />
- </TabsTrigger>
- </TabsList>
- </div>
+ <TabsList
+ variant="outline"
+ className="w-full shrink-0 justify-start border-b border-gray-6"
+ >
+ <TabsTrigger variant="outline" value="pieces">
+ {t('Pieces')}
+ </TabsTrigger>
+ <TabsTrigger variant="outline" value="requiredActions">
+ {t('Required actions')}
+ <RequiredActionsCountBadge pieceSet={pieceSet} />
+ </TabsTrigger>
+ </TabsList>
<TabsContent
value="pieces"
- className="flex-1 min-h-0 flex flex-col data-[state=inactive]:hidden mt-0"
+ className="mt-0 flex min-h-0 flex-1 flex-col gap-6 data-[state=inactive]:hidden"
>
- <div className="p-4 pb-0 shrink-0 flex flex-col gap-3">
- <div className="flex flex-wrap items-center gap-x-4 gap-y-3 rounded-xl border bg-gray-3/40 px-3.5 py-3">
- <div className="flex items-center gap-2">
- <span className="text-xs font-semibold">{t('Assigned')}</span>
- <PieceSetProjectsDialog pieceSet={pieceSet} />
- </div>
-
- <div className="self-stretch w-px bg-gray-6" />
-
- <div className="flex items-center gap-2">
- <span className="text-xs font-semibold">
- {t('Auto-Include')}
- </span>
- <AutoIncludePill
- label={t('New pieces')}
- checked={
- pieceSet.config.pieces.mode ===
- PieceSelectionMode.INCLUDE_ALL
- }
- disabled={piecesLoading}
- onCheckedChange={handleToggle}
- />
- </div>
-
- <span className="text-xs text-gray-11">
- {t(
- 'Applies only to pieces that don’t exist yet — actions are governed per piece below.',
- )}
- </span>
- </div>
- </div>
-
- <div className="flex-1 min-h-0 flex flex-col">
- <PieceSetPiecesTable pieceSet={pieceSet} />
- </div>
+ <SettingsPanel flush className="shrink-0">
+ <SettingsRow title={t('Assigned projects')}>
+ <PieceSetProjectsDialog pieceSet={pieceSet} />
+ </SettingsRow>
+ <SettingsRow
+ title={t('Include new pieces')}
+ description={t(
+ 'Applies only to pieces that don’t exist yet — actions are governed per piece below.',
+ )}
+ >
+ <Switch
+ {...adminControl(AdminControl.PIECE_SETS_NEW_PIECES_TOGGLE)}
+ aria-label={t('Include new pieces')}
+ checked={
+ pieceSet.config.pieces.mode === PieceSelectionMode.INCLUDE_ALL
+ }
+ disabled={piecesLoading}
+ onCheckedChange={handleToggle}
+ />
+ </SettingsRow>
+ </SettingsPanel>
+ <PieceSetPiecesTable pieceSet={pieceSet} />
</TabsContent>
<TabsContent
value="requiredActions"
- className="flex-1 min-h-0 flex flex-col data-[state=inactive]:hidden"
+ className="mt-0 flex min-h-0 flex-1 flex-col data-[state=inactive]:hidden"
>
<RequiredActionsTab pieceSet={pieceSet} />
</TabsContent>
</Tabs>
- </>
+ </AdminPage>
);
};
@@ -190,36 +169,5 @@ function RequiredActionsCountBadge({ pieceSet }: { pieceSet: PieceSet }) {
);
}
-function AutoIncludePill({
- label,
- checked,
- disabled,
- onCheckedChange,
-}: {
- label: string;
- checked: boolean;
- disabled: boolean;
- onCheckedChange: (value: boolean) => void;
-}) {
- return (
- <label
- className={cn(
- 'inline-flex h-8 cursor-pointer select-none items-center gap-2 rounded-xl border bg-gray-1 px-3 text-sm font-medium transition-colors',
- checked && 'border-accent-7 bg-accent-3 text-accent-11',
- disabled && 'cursor-not-allowed opacity-60',
- )}
- >
- <Switch
- {...adminControl(AdminControl.PIECE_SETS_NEW_PIECES_TOGGLE)}
- size="sm"
- checked={checked}
- disabled={disabled}
- onCheckedChange={onCheckedChange}
- />
- {label}
- </label>
- );
-}
-
PieceSetDetailsPage.displayName = 'PieceSetDetailsPage';
export { PieceSetDetailsPage };
diff --git a/packages/web/src/app/routes/platform/setup/pieces/piece-sets/piece-set-pieces-table.tsx b/packages/web/src/app/routes/platform/setup/pieces/piece-sets/piece-set-pieces-table.tsx
index b8b13c4cb56..640d9b0c8f7 100644
--- a/packages/web/src/app/routes/platform/setup/pieces/piece-sets/piece-set-pieces-table.tsx
+++ b/packages/web/src/app/routes/platform/setup/pieces/piece-sets/piece-set-pieces-table.tsx
@@ -13,7 +13,8 @@ import {
import { useCallback, useMemo, useState } from 'react';
import { toast } from 'sonner';
-import { DataTable, RowDataWithActions } from '@/components/custom/data-table';
+import { AdminDataTable } from '@/app/components/admin';
+import { RowDataWithActions } from '@/components/custom/data-table';
import { DataTableColumnHeader } from '@/components/custom/data-table/data-table-column-header';
import { DataTableSelectPopover } from '@/components/custom/data-table/data-table-select-popover';
import { Badge } from '@/components/ui/badge';
@@ -273,12 +274,12 @@ export const PieceSetPiecesTable = ({ pieceSet }: PieceSetPiecesTableProps) => {
return (
<>
- <DataTable
+ <AdminDataTable
emptyStateTextTitle={t('No pieces found')}
emptyStateTextDescription={t(
'Start by installing pieces that you want to use in your automations',
)}
- emptyStateIcon={<Package className="size-14" />}
+ emptyStateIcon={<Package />}
columns={columns}
filters={[
{
diff --git a/packages/web/src/app/routes/platform/setup/pieces/piece-sets/piece-set-projects-dialog.tsx b/packages/web/src/app/routes/platform/setup/pieces/piece-sets/piece-set-projects-dialog.tsx
index d90d6961390..9930d6be8bb 100644
--- a/packages/web/src/app/routes/platform/setup/pieces/piece-sets/piece-set-projects-dialog.tsx
+++ b/packages/web/src/app/routes/platform/setup/pieces/piece-sets/piece-set-projects-dialog.tsx
@@ -10,6 +10,7 @@ import { ChevronDown } from 'lucide-react';
import { useMemo, useState } from 'react';
import { toast } from 'sonner';
+import { adminLayout } from '@/app/components/admin';
import { Button } from '@/components/ui/button';
import { Checkbox } from '@/components/ui/checkbox';
import {
@@ -255,7 +256,7 @@ export const PieceSetProjectsDialog = ({
<ChevronDown className="size-3.5 text-gray-11 shrink-0" />
</Button>
</DialogTrigger>
- <DialogContent>
+ <DialogContent className={adminLayout.dialog.md}>
<AssignProjectsForm
key={open ? 'open' : 'closed'}
pieceSet={pieceSet}
diff --git a/packages/web/src/app/routes/platform/setup/pieces/piece-sets/piece-sets-tab.tsx b/packages/web/src/app/routes/platform/setup/pieces/piece-sets/piece-sets-tab.tsx
index 00637ca7eb5..21f3496a093 100644
--- a/packages/web/src/app/routes/platform/setup/pieces/piece-sets/piece-sets-tab.tsx
+++ b/packages/web/src/app/routes/platform/setup/pieces/piece-sets/piece-sets-tab.tsx
@@ -14,11 +14,16 @@ import {
import { useMemo, useState } from 'react';
import { useNavigate, useSearchParams } from 'react-router-dom';
-import { DashboardPageHeader } from '@/app/components/dashboard-page-header';
+import {
+ AdminDataTable,
+ AdminPage,
+ AdminPageHeader,
+ StatusDot,
+ adminPageResources,
+} from '@/app/components/admin';
import { PiecesLockedBanner } from '@/app/routes/platform/setup/pieces/pieces-locked-banner';
import {
CURSOR_QUERY_PARAM,
- DataTable,
RowDataWithActions,
} from '@/components/custom/data-table';
import { DataTableColumnHeader } from '@/components/custom/data-table/data-table-column-header';
@@ -103,9 +108,9 @@ export const PieceSetsTab = () => {
const includesNewPieces =
row.original.config.pieces.mode === PieceSelectionMode.INCLUDE_ALL;
return (
- <Badge variant={includesNewPieces ? 'success' : 'outline'}>
+ <StatusDot tone={includesNewPieces ? 'success' : 'neutral'}>
{includesNewPieces ? t('Yes') : t('No')}
- </Badge>
+ </StatusDot>
);
},
},
@@ -169,20 +174,23 @@ export const PieceSetsTab = () => {
);
return (
- <>
- <DashboardPageHeader
+ <AdminPage>
+ <AdminPageHeader
title={t('Piece Sets')}
description={t(
'A piece set decides which pieces (actions/triggers) a project can see. It can also set required actions that a flow must include before it can be published.',
)}
- />
+ resources={adminPageResources.pieces}
+ >
+ <CreatePieceSetDialog onCreated={() => refetch()} />
+ </AdminPageHeader>
<PiecesLockedBanner message={t('Piece sets need a higher plan.')} />
- <DataTable
+ <AdminDataTable
emptyStateTextTitle={t('No piece sets found')}
emptyStateTextDescription={t(
'Create a piece set to control which pieces are available to specific projects',
)}
- emptyStateIcon={<Layers className="size-14" />}
+ emptyStateIcon={<Layers />}
columns={columns}
filters={[
{
@@ -205,9 +213,6 @@ export const PieceSetsTab = () => {
onRowClick={(pieceSet) =>
navigate(`/platform/pieces/piece-sets/${pieceSet.id}`)
}
- toolbarButtons={[
- <CreatePieceSetDialog key="create" onCreated={() => refetch()} />,
- ]}
/>
{duplicatingSet && (
<DuplicatePieceSetDialog
@@ -230,6 +235,6 @@ export const PieceSetsTab = () => {
currentKey={editingSet.key ?? null}
/>
)}
- </>
+ </AdminPage>
);
};
diff --git a/packages/web/src/app/routes/platform/setup/pieces/piece-sets/required-actions-tab.tsx b/packages/web/src/app/routes/platform/setup/pieces/piece-sets/required-actions-tab.tsx
index 95eb3012ad4..8af4d8e2a0f 100644
--- a/packages/web/src/app/routes/platform/setup/pieces/piece-sets/required-actions-tab.tsx
+++ b/packages/web/src/app/routes/platform/setup/pieces/piece-sets/required-actions-tab.tsx
@@ -17,6 +17,12 @@ import {
} from 'lucide-react';
import { useState } from 'react';
+import {
+ AdminEmpty,
+ AdminSection,
+ adminSurface,
+ adminLayout,
+} from '@/app/components/admin';
import { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
import { Checkbox } from '@/components/ui/checkbox';
@@ -37,7 +43,7 @@ import {
} from '@/components/ui/tooltip';
import { pieceSetMutations } from '@/features/piece-sets';
import { PieceIcon, piecesHooks } from '@/features/pieces';
-import { cn, DASHBOARD_CONTENT_PADDING_X } from '@/lib/utils';
+import { cn } from '@/lib/utils';
import { ModeRadioCards } from './mode-radio-cards';
import { PieceSelect } from './piece-select';
@@ -83,12 +89,7 @@ export function RequiredActionsTab({ pieceSet }: { pieceSet: PieceSet }) {
});
return (
- <div
- className={cn(
- 'flex flex-1 min-h-0 max-w-3xl flex-col gap-5',
- DASHBOARD_CONTENT_PADDING_X,
- )}
- >
+ <div className="flex min-h-0 max-w-3xl flex-1 flex-col gap-6">
<ModeRadioCards
title={t('Publishing flows rule')}
value={requiredActions.mode}
@@ -116,36 +117,34 @@ export function RequiredActionsTab({ pieceSet }: { pieceSet: PieceSet }) {
}
/>
- <div className="flex flex-1 min-h-0 flex-col gap-3">
- <div className="flex items-center gap-2">
- <div className="flex flex-1 flex-col gap-0.5">
- <span className="text-sm font-semibold">
- {t('Required actions')}
- </span>
- {requiredActionsGroupedByPiece.length > 0 && (
- <span className="text-sm text-gray-11">
- {t('requiredActionsAcrossPieces', {
- actionCount: actionsInLatestPieceVersionCount,
- pieceCount: requiredActionsGroupedByPiece.length,
- })}
- </span>
- )}
- </div>
+ <AdminSection
+ className="min-h-0 flex-1"
+ title={t('Required actions')}
+ description={
+ requiredActionsGroupedByPiece.length > 0
+ ? t('requiredActionsAcrossPieces', {
+ actionCount: actionsInLatestPieceVersionCount,
+ pieceCount: requiredActionsGroupedByPiece.length,
+ })
+ : undefined
+ }
+ action={
<Button
variant="outline"
onClick={() => setEditDialog({ open: true, pieceName: null })}
>
- <Plus className="size-4" />
+ <Plus />
{t('Add actions')}
</Button>
- </div>
+ }
+ >
{isLoading ? (
<div className="flex justify-center py-10">
<Loader2 className="size-6 animate-spin text-gray-11" />
</div>
) : requiredActionsGroupedByPiece.length > 0 ? (
<ScrollArea className="flex-1 min-h-0">
- <div className="flex flex-col gap-3 pr-3">
+ <div className="flex flex-col gap-4 pr-3">
{requiredActionsGroupedByPiece.map((group) => (
<PieceRequiredActionsCard
key={group.pieceName}
@@ -164,23 +163,21 @@ export function RequiredActionsTab({ pieceSet }: { pieceSet: PieceSet }) {
</div>
</ScrollArea>
) : (
- <div className="flex flex-col items-center gap-2 rounded-xl border border-dashed px-4 py-10 text-center">
- <ListChecks className="size-8 text-gray-11" />
- <span className="text-sm font-medium">
- {t('No required actions')}
- </span>
- <span className="max-w-sm text-sm text-gray-11">
- {requiredActions.mode === RequiredActionsMode.ALL
+ <AdminEmpty
+ icon={<ListChecks />}
+ title={t('No required actions')}
+ description={
+ requiredActions.mode === RequiredActionsMode.ALL
? t(
'Choose actions that flows in projects assigned to this set must include before they can publish.',
)
: t(
'Choose actions that flows in projects assigned to this set must include at least one of before they can publish.',
- )}
- </span>
- </div>
+ )
+ }
+ />
)}
- </div>
+ </AdminSection>
<Dialog
open={editDialog.open}
@@ -188,7 +185,7 @@ export function RequiredActionsTab({ pieceSet }: { pieceSet: PieceSet }) {
setEditDialog((current) => ({ ...current, open }))
}
>
- <DialogContent className="sm:max-w-md">
+ <DialogContent className={adminLayout.dialog.md}>
<EditRequiredActionsDialogContent
key={editDialog.open ? 'open' : 'closed'}
pieceSet={pieceSet}
@@ -219,8 +216,8 @@ function PieceRequiredActionsCard({
group.actions.length - actionNamesNotInLatestPieceVersion.length;
return (
- <div className="overflow-hidden rounded-xl border shadow-xs">
- <div className="flex flex-col gap-3 px-4 py-3">
+ <div className={cn(adminSurface.card, 'overflow-hidden')}>
+ <div className="flex flex-col gap-4 p-5">
<div className="flex items-center gap-3">
<PieceIcon
size="sm"
@@ -292,7 +289,7 @@ function PieceRequiredActionsCard({
</div>
</div>
{actionNamesNotInLatestPieceVersion.length > 0 && (
- <div className="flex items-center gap-2 border-t bg-gray-3/50 px-4 py-2.5 text-sm text-gray-11">
+ <div className="flex items-center gap-2 border-t bg-gray-3/50 px-5 py-3 text-sm text-gray-11">
<Info className="size-4 shrink-0" />
<span className="flex-1">
{t('actionsNotInLatestPieceVersion', {
diff --git a/packages/web/src/app/routes/platform/setup/pieces/pieces-locked-banner.tsx b/packages/web/src/app/routes/platform/setup/pieces/pieces-locked-banner.tsx
index 4b269e000fa..0e6fb179f59 100644
--- a/packages/web/src/app/routes/platform/setup/pieces/pieces-locked-banner.tsx
+++ b/packages/web/src/app/routes/platform/setup/pieces/pieces-locked-banner.tsx
@@ -8,11 +8,7 @@ export function PiecesLockedBanner({ message }: PiecesLockedBannerProps) {
return null;
}
- return (
- <div className="px-6 shrink-0 pb-4">
- <FeatureBanner message={message} />
- </div>
- );
+ return <FeatureBanner message={message} className="shrink-0" />;
}
export type PiecesLockedBannerProps = {
diff --git a/packages/web/src/app/routes/platform/setup/pieces/sync-pieces.tsx b/packages/web/src/app/routes/platform/setup/pieces/sync-pieces.tsx
index 0782c8eaab0..6531ecaa0ef 100644
--- a/packages/web/src/app/routes/platform/setup/pieces/sync-pieces.tsx
+++ b/packages/web/src/app/routes/platform/setup/pieces/sync-pieces.tsx
@@ -23,7 +23,7 @@ const SyncPiecesButton = () => {
loading={isPending}
size={'sm'}
>
- <RefreshCcw className="w-4 h-4 mr-2" /> Sync from Cloud
+ <RefreshCcw /> Sync from Cloud
</Button>
)}
</>
diff --git a/packages/web/src/app/routes/platform/setup/pieces/update-oauth2-dialog.tsx b/packages/web/src/app/routes/platform/setup/pieces/update-oauth2-dialog.tsx
index 5d5ce2add36..439e0973363 100644
--- a/packages/web/src/app/routes/platform/setup/pieces/update-oauth2-dialog.tsx
+++ b/packages/web/src/app/routes/platform/setup/pieces/update-oauth2-dialog.tsx
@@ -6,6 +6,7 @@ import { useState, forwardRef } from 'react';
import { useForm } from 'react-hook-form';
import { z } from 'zod';
+import { adminLayout } from '@/app/components/admin';
import { Button } from '@/components/ui/button';
import {
Dialog,
@@ -106,7 +107,7 @@ export const ConfigurePieceOAuth2Dialog = forwardRef<
</TooltipContent>
</Tooltip>
</DialogTrigger>
- <DialogContent>
+ <DialogContent className={adminLayout.dialog.md}>
<DialogTitle>{t('Configure OAuth2 App')}</DialogTitle>
<Form {...form}>
diff --git a/packages/web/src/app/routes/platform/setup/templates/create-template-dialog.tsx b/packages/web/src/app/routes/platform/setup/templates/create-template-dialog.tsx
index 41a297c38e1..9eb74ce3809 100644
--- a/packages/web/src/app/routes/platform/setup/templates/create-template-dialog.tsx
+++ b/packages/web/src/app/routes/platform/setup/templates/create-template-dialog.tsx
@@ -10,6 +10,7 @@ import { useState } from 'react';
import { useForm } from 'react-hook-form';
import { z } from 'zod';
+import { adminLayout } from '@/app/components/admin';
import { Button } from '@/components/ui/button';
import {
Dialog,
@@ -123,7 +124,7 @@ export const CreateTemplateDialog = ({
}}
>
<DialogTrigger asChild>{children}</DialogTrigger>
- <DialogContent>
+ <DialogContent className={adminLayout.dialog.md}>
<DialogHeader>
<DialogTitle>{t('Create New Template')}</DialogTitle>
</DialogHeader>
diff --git a/packages/web/src/app/routes/platform/setup/templates/index.tsx b/packages/web/src/app/routes/platform/setup/templates/index.tsx
index 3dcbebd8a5d..db61ee96b10 100644
--- a/packages/web/src/app/routes/platform/setup/templates/index.tsx
+++ b/packages/web/src/app/routes/platform/setup/templates/index.tsx
@@ -7,13 +7,14 @@ import { useState, useMemo } from 'react';
import { useSearchParams } from 'react-router-dom';
import { toast } from 'sonner';
-import { DashboardPageHeader } from '@/app/components/dashboard-page-header';
-import { AnimatedIconButton } from '@/components/custom/animated-icon-button';
import {
- DataTable,
- RowDataWithActions,
- BulkAction,
-} from '@/components/custom/data-table';
+ AdminDataTable,
+ AdminPage,
+ AdminPageHeader,
+ adminPageResources,
+} from '@/app/components/admin';
+import { AnimatedIconButton } from '@/components/custom/animated-icon-button';
+import { RowDataWithActions, BulkAction } from '@/components/custom/data-table';
import { DataTableColumnHeader } from '@/components/custom/data-table/data-table-column-header';
import { ConfirmationDeleteDialog } from '@/components/custom/delete-dialog';
import { FormattedDate } from '@/components/custom/formatted-date';
@@ -197,36 +198,31 @@ const PlatformTemplatesPage = () => {
[selectedRows, bulkDeleteMutation],
);
- const toolbarButtons = useMemo(
- () => [
- <CreateTemplateDialog key="new-template" onDone={() => refetch()}>
- <AnimatedIconButton
- {...adminControl(AdminControl.TEMPLATES_NEW_OPEN)}
- icon={PlusIcon}
- iconSize={16}
- size="sm"
- >
- {t('New Template')}
- </AnimatedIconButton>
- </CreateTemplateDialog>,
- ],
- [refetch],
- );
-
return (
- <div className="flex flex-col w-full">
- <DashboardPageHeader
+ <AdminPage>
+ <AdminPageHeader
+ title={t('Templates')}
description={t(
'Convert the most common automations into reusable templates',
)}
- title={t('Templates')}
- />
- <DataTable
+ resources={adminPageResources.templates}
+ >
+ <CreateTemplateDialog onDone={() => refetch()}>
+ <AnimatedIconButton
+ {...adminControl(AdminControl.TEMPLATES_NEW_OPEN)}
+ icon={PlusIcon}
+ iconSize={16}
+ >
+ {t('New Template')}
+ </AnimatedIconButton>
+ </CreateTemplateDialog>
+ </AdminPageHeader>
+ <AdminDataTable
emptyStateTextTitle={t('No templates found')}
emptyStateTextDescription={t(
'Create a template for your user to inspire them',
)}
- emptyStateIcon={<FileText className="size-14" />}
+ emptyStateIcon={<FileText />}
columns={columnsWithCheckbox}
page={isSample ? sampleData.templatesPage() : data}
hidePagination={true}
@@ -235,7 +231,6 @@ const PlatformTemplatesPage = () => {
errorStateEntity={t('templates')}
onRetry={refetch}
bulkActions={bulkActions}
- toolbarButtons={toolbarButtons}
actions={[
(row) => {
return (
@@ -264,7 +259,7 @@ const PlatformTemplatesPage = () => {
},
]}
/>
- </div>
+ </AdminPage>
);
};
diff --git a/packages/web/src/app/routes/platform/setup/templates/update-template-dialog.tsx b/packages/web/src/app/routes/platform/setup/templates/update-template-dialog.tsx
index f3c9c1d88a5..30512350af8 100644
--- a/packages/web/src/app/routes/platform/setup/templates/update-template-dialog.tsx
+++ b/packages/web/src/app/routes/platform/setup/templates/update-template-dialog.tsx
@@ -10,6 +10,7 @@ import { useState } from 'react';
import { useForm } from 'react-hook-form';
import { z } from 'zod';
+import { adminLayout } from '@/app/components/admin';
import { Button } from '@/components/ui/button';
import {
Dialog,
@@ -115,7 +116,7 @@ export const UpdateTemplateDialog = ({
}}
>
<DialogTrigger asChild>{children}</DialogTrigger>
- <DialogContent>
+ <DialogContent className={adminLayout.dialog.md}>
<DialogHeader>
<DialogTitle>{t('Update Template')}</DialogTitle>
</DialogHeader>
diff --git a/packages/web/src/app/routes/platform/users/actions/update-user-dialog.tsx b/packages/web/src/app/routes/platform/users/actions/update-user-dialog.tsx
index 67db2fcf59a..86ada85ecac 100644
--- a/packages/web/src/app/routes/platform/users/actions/update-user-dialog.tsx
+++ b/packages/web/src/app/routes/platform/users/actions/update-user-dialog.tsx
@@ -10,6 +10,7 @@ import { useState } from 'react';
import { Resolver, useForm } from 'react-hook-form';
import { platformUserApi } from '@/api/platform-user-api';
+import { adminLayout } from '@/app/components/admin';
import { Button } from '@/components/ui/button';
import {
Dialog,
@@ -69,7 +70,7 @@ export const UpdateUserDialog = ({
}}
>
<DialogTrigger asChild>{children}</DialogTrigger>
- <DialogContent>
+ <DialogContent className={adminLayout.dialog.sm}>
<DialogHeader>
<DialogTitle>{t('Update User Role')}</DialogTitle>
</DialogHeader>
diff --git a/packages/web/src/app/routes/platform/users/columns.tsx b/packages/web/src/app/routes/platform/users/columns.tsx
index 96b9f3cb60f..65e2a8b3902 100644
--- a/packages/web/src/app/routes/platform/users/columns.tsx
+++ b/packages/web/src/app/routes/platform/users/columns.tsx
@@ -12,6 +12,7 @@ import {
Hash,
} from 'lucide-react';
+import { StatusDot } from '@/app/components/admin';
import { RowDataWithActions } from '@/components/custom/data-table';
import { DataTableColumnHeader } from '@/components/custom/data-table/data-table-column-header';
import { TruncatedColumnTextValue } from '@/components/custom/data-table/truncated-column-text-value';
@@ -21,6 +22,7 @@ import {
TooltipContent,
TooltipTrigger,
} from '@/components/ui/tooltip';
+import { cn } from '@/lib/utils';
import { UserRowData } from './index';
@@ -31,7 +33,7 @@ type ColumnDefWithAccessorKey = ColumnDef<RowDataWithActions<UserRowData>> & {
export const createUsersTableColumns = (): ColumnDefWithAccessorKey[] => [
{
accessorKey: 'identity',
- size: 320,
+ size: 260,
header: ({ column }) => (
<DataTableColumnHeader
column={column}
@@ -51,7 +53,7 @@ export const createUsersTableColumns = (): ColumnDefWithAccessorKey[] => [
{isInvitation && (
<Tooltip>
<TooltipTrigger>
- <Info className="h-4 w-4 text-warning-11" />
+ <Info className="size-4 text-gray-11" />
</TooltipTrigger>
<TooltipContent>
<p>{t('Pending Invitation')}</p>
@@ -59,9 +61,10 @@ export const createUsersTableColumns = (): ColumnDefWithAccessorKey[] => [
</Tooltip>
)}
<div
- className={`flex flex-col gap-0.5 ${
- isInvitation ? 'text-warning-11' : ''
- }`}
+ className={cn(
+ 'flex flex-col gap-0.5',
+ isInvitation && 'text-gray-11',
+ )}
>
{showEmail && (
<div className="flex items-center gap-1.5">
@@ -91,7 +94,7 @@ export const createUsersTableColumns = (): ColumnDefWithAccessorKey[] => [
},
{
accessorKey: 'name',
- size: 210,
+ size: 170,
header: ({ column }) => (
<DataTableColumnHeader column={column} title={t('Name')} icon={Tag} />
),
@@ -179,14 +182,12 @@ export const createUsersTableColumns = (): ColumnDefWithAccessorKey[] => [
),
cell: ({ row }) => {
if (row.original.type === 'invitation') {
- return <div className="text-left text-warning-11">{t('Pending')}</div>;
+ return <StatusDot tone="warning">{t('Pending')}</StatusDot>;
}
- return (
- <div className="text-left">
- {row.original.data.status === UserStatus.ACTIVE
- ? t('Activated')
- : t('Deactivated')}
- </div>
+ return row.original.data.status === UserStatus.ACTIVE ? (
+ <StatusDot tone="success">{t('Activated')}</StatusDot>
+ ) : (
+ <StatusDot tone="neutral">{t('Deactivated')}</StatusDot>
);
},
},
diff --git a/packages/web/src/app/routes/platform/users/index.tsx b/packages/web/src/app/routes/platform/users/index.tsx
index dc05f4a3dbd..fc7f95f8fa5 100644
--- a/packages/web/src/app/routes/platform/users/index.tsx
+++ b/packages/web/src/app/routes/platform/users/index.tsx
@@ -4,11 +4,15 @@ import {
UserWithMetaInformation,
} from '@activepieces/shared';
import { t } from 'i18next';
-import { Crown, User } from 'lucide-react';
+import { Gem, User } from 'lucide-react';
import { useMemo, useState } from 'react';
-import { DashboardPageHeader } from '@/app/components/dashboard-page-header';
-import { DataTable } from '@/components/custom/data-table';
+import {
+ AdminDataTable,
+ AdminPage,
+ AdminPageHeader,
+ adminPageResources,
+} from '@/app/components/admin';
import { UserRoundPlusIcon } from '@/components/icons/user-round-plus';
import { Button } from '@/components/ui/button';
import { internalErrorToast } from '@/components/ui/sonner';
@@ -122,68 +126,63 @@ export default function UsersPage() {
const columns = createUsersTableColumns();
return (
- <>
- <div className="flex flex-col w-full">
- <DashboardPageHeader
- title={t('Users')}
- description={t(
- 'Manage, delete, activate and deactivate users on platform',
- )}
- />
- <DataTable
- emptyStateTextTitle={t('No users found')}
- emptyStateTextDescription={t('Start inviting users to your project')}
- emptyStateIcon={<User className="size-14" />}
- columns={columns}
- page={{
- data: combinedData,
- next: usersData?.next || null,
- previous: usersData?.previous || null,
+ <AdminPage>
+ <AdminPageHeader
+ title={t('Users')}
+ description={t(
+ 'Manage, delete, activate and deactivate users on platform',
+ )}
+ resources={adminPageResources.users}
+ >
+ <Button
+ {...adminControl(AdminControl.USERS_INVITE_OPEN)}
+ onClick={() => {
+ if (ensureSeatsAvailable(1)) {
+ setInviteOpen(true);
+ }
}}
- hidePagination={true}
- isLoading={isLoading}
- isError={isError}
- errorStateEntity={t('users')}
- onRetry={refetch}
- toolbarButtons={[
- <Button
- key="invite"
- className="gap-2"
- size="sm"
- {...adminControl(AdminControl.USERS_INVITE_OPEN)}
- onClick={() => {
- if (ensureSeatsAvailable(1)) {
- setInviteOpen(true);
- }
- }}
- >
- {isOutOfSeats ? (
- <Crown className="size-4 shrink-0 text-on-accent/90" />
- ) : (
- <UserRoundPlusIcon size={16} />
- )}
- <span className="text-sm font-medium">{t('Invite')}</span>
- </Button>,
- ]}
- actions={[
- (row) => (
- <UserActions
- row={row}
- isUpdatingStatus={isUpdatingStatus}
- onDelete={handleDelete}
- onToggleStatus={handleToggleStatus}
- onUpdate={refetch}
- />
- ),
- ]}
- />
- </div>
+ >
+ {isOutOfSeats ? (
+ <Gem className="text-on-accent/90" />
+ ) : (
+ <UserRoundPlusIcon size={16} />
+ )}
+ {t('Invite')}
+ </Button>
+ </AdminPageHeader>
+ <AdminDataTable
+ emptyStateTextTitle={t('No users found')}
+ emptyStateTextDescription={t('Start inviting users to your project')}
+ emptyStateIcon={<User />}
+ columns={columns}
+ page={{
+ data: combinedData,
+ next: usersData?.next || null,
+ previous: usersData?.previous || null,
+ }}
+ hidePagination={true}
+ isLoading={isLoading}
+ isError={isError}
+ errorStateEntity={t('users')}
+ onRetry={refetch}
+ actions={[
+ (row) => (
+ <UserActions
+ row={row}
+ isUpdatingStatus={isUpdatingStatus}
+ onDelete={handleDelete}
+ onToggleStatus={handleToggleStatus}
+ onUpdate={refetch}
+ />
+ ),
+ ]}
+ />
<InviteUserDialog
open={inviteOpen}
setOpen={setInviteOpen}
onInviteSuccess={refetch}
/>
{seatLimitDialog}
- </>
+ </AdminPage>
);
}
diff --git a/packages/web/src/components/custom/data-table/data-table-bulk-actions.tsx b/packages/web/src/components/custom/data-table/data-table-bulk-actions.tsx
index f8999e9e706..c4a69135cba 100644
--- a/packages/web/src/components/custom/data-table/data-table-bulk-actions.tsx
+++ b/packages/web/src/components/custom/data-table/data-table-bulk-actions.tsx
@@ -22,31 +22,34 @@ export function DataTableBulkActions<TData>({
resetSelection,
}: DataTableBulkActionsProps<TData>) {
return (
- <AnimatePresence>
- {selectedRows.length > 0 && (
- <motion.div
- initial={{ y: 80, opacity: 0 }}
- animate={{ y: 0, opacity: 1 }}
- exit={{ y: 80, opacity: 0 }}
- transition={{ type: 'spring', damping: 25, stiffness: 300 }}
- className="fixed bottom-6 left-1/2 -translate-x-1/2 z-50"
- >
- <div className="flex items-center gap-3 bg-panel border rounded-xl shadow-lg p-2">
- {actions.map((action, index) => (
- <React.Fragment key={index}>
- {action.render(selectedRows, resetSelection)}
- </React.Fragment>
- ))}
- <div className="border-l h-6 mx-1" />
- <span className="text-sm text-gray-11">
- {t('{count} selected', { count: selectedRows.length })}
- </span>
- <Button variant="ghost" size="icon-sm" onClick={resetSelection}>
- <X className="h-4 w-4" />
- </Button>
- </div>
- </motion.div>
- )}
- </AnimatePresence>
+ <>
+ {selectedRows.length > 0 && <div aria-hidden className="h-20 shrink-0" />}
+ <AnimatePresence>
+ {selectedRows.length > 0 && (
+ <motion.div
+ initial={{ y: 80, opacity: 0 }}
+ animate={{ y: 0, opacity: 1 }}
+ exit={{ y: 80, opacity: 0 }}
+ transition={{ type: 'spring', damping: 25, stiffness: 300 }}
+ className="fixed bottom-6 left-1/2 -translate-x-1/2 z-50"
+ >
+ <div className="flex items-center gap-3 bg-panel border rounded-xl shadow-lg p-2">
+ {actions.map((action, index) => (
+ <React.Fragment key={index}>
+ {action.render(selectedRows, resetSelection)}
+ </React.Fragment>
+ ))}
+ <div className="border-l h-6 mx-1" />
+ <span className="text-sm text-gray-11">
+ {t('{count} selected', { count: selectedRows.length })}
+ </span>
+ <Button variant="ghost" size="icon-sm" onClick={resetSelection}>
+ <X className="h-4 w-4" />
+ </Button>
+ </div>
+ </motion.div>
+ )}
+ </AnimatePresence>
+ </>
);
}
diff --git a/packages/web/src/components/custom/data-table/index.tsx b/packages/web/src/components/custom/data-table/index.tsx
index ed2a6006a8e..9455ee57d6c 100644
--- a/packages/web/src/components/custom/data-table/index.tsx
+++ b/packages/web/src/components/custom/data-table/index.tsx
@@ -100,6 +100,8 @@ interface DataTableProps<
isRowSelectionDisabled?: (row: RowDataWithActions<TData>) => boolean;
virtualizeRows?: boolean;
bordered?: boolean;
+ frameClassName?: string;
+ toolbarClassName?: string;
}
export type DataTableFilters<Keys extends string> = DataTableFilterProps & {
@@ -142,6 +144,8 @@ export function DataTable<
clientPagination = false,
clientFiltering = false,
bordered = false,
+ frameClassName,
+ toolbarClassName,
getRowClassName,
isRowSelectionDisabled,
virtualizeRows = false,
@@ -360,7 +364,9 @@ export function DataTable<
{((filters && filters.length > 0) ||
(customFilters && customFilters.length > 0) ||
(toolbarButtons && toolbarButtons.length > 0)) && (
- <DataTableToolbar className={bordered ? 'px-0' : undefined}>
+ <DataTableToolbar
+ className={toolbarClassName ?? (bordered ? 'px-0' : undefined)}
+ >
<div className="w-full flex items-center justify-between">
<div className="flex items-center space-x-2">
{filters &&
@@ -396,7 +402,10 @@ export function DataTable<
'flex-1 min-h-0 overflow-auto': virtualizeRows,
},
bordered &&
- 'rounded-xl border [&_thead]:border-t-0 [&_tbody>tr:last-child]:border-b-0',
+ cn(
+ 'rounded-xl border [&_thead]:border-t-0 [&_tbody>tr:last-child]:border-b-0',
+ frameClassName,
+ ),
)}
>
<Table
@@ -746,3 +755,5 @@ export function DataTable<
const STICKY_HEADER_CLASS_NAME =
'sticky top-0 z-10 border-t-0 bg-[color-mix(in_srgb,var(--gray-3)_70%,var(--gray-1))] shadow-[inset_0_1px_0_var(--gray-6),inset_0_-1px_0_var(--gray-6)] [&>tr]:border-b-0';
+
+export type { DataTableProps };
diff --git a/packages/web/src/components/ui/dialog.tsx b/packages/web/src/components/ui/dialog.tsx
index 5cbc0b961e3..781d8462e9c 100644
--- a/packages/web/src/components/ui/dialog.tsx
+++ b/packages/web/src/components/ui/dialog.tsx
@@ -3,6 +3,7 @@ import { Dialog as DialogPrimitive } from 'radix-ui';
import * as React from 'react';
import { Button } from '@/components/ui/button';
+import { ModalLayer } from '@/components/ui/modal-layer';
import { cn } from '@/lib/utils';
function Dialog({
@@ -65,7 +66,7 @@ function DialogContent({
)}
{...props}
>
- {children}
+ <ModalLayer>{children}</ModalLayer>
{showCloseButton && (
<DialogPrimitive.Close
data-slot="dialog-close"
diff --git a/packages/web/src/components/ui/modal-layer.tsx b/packages/web/src/components/ui/modal-layer.tsx
new file mode 100644
index 00000000000..df6fa0ae59b
--- /dev/null
+++ b/packages/web/src/components/ui/modal-layer.tsx
@@ -0,0 +1,15 @@
+import { createContext, ReactNode, useContext } from 'react';
+
+export function ModalLayer({ children }: { children: ReactNode }) {
+ return (
+ <ModalLayerContext.Provider value={true}>
+ {children}
+ </ModalLayerContext.Provider>
+ );
+}
+
+export function useInsideModalLayer(): boolean {
+ return useContext(ModalLayerContext);
+}
+
+const ModalLayerContext = createContext(false);
diff --git a/packages/web/src/components/ui/popover.tsx b/packages/web/src/components/ui/popover.tsx
index 0140979e413..a85ed1c8d15 100644
--- a/packages/web/src/components/ui/popover.tsx
+++ b/packages/web/src/components/ui/popover.tsx
@@ -1,12 +1,21 @@
import { Popover as PopoverPrimitive } from 'radix-ui';
import * as React from 'react';
+import { useInsideModalLayer } from '@/components/ui/modal-layer';
import { cn } from '@/lib/utils';
function Popover({
+ modal,
...props
}: React.ComponentProps<typeof PopoverPrimitive.Root>) {
- return <PopoverPrimitive.Root data-slot="popover" {...props} />;
+ const insideModalLayer = useInsideModalLayer();
+ return (
+ <PopoverPrimitive.Root
+ data-slot="popover"
+ modal={modal ?? insideModalLayer}
+ {...props}
+ />
+ );
}
function PopoverTrigger({
diff --git a/packages/web/src/components/ui/sheet.tsx b/packages/web/src/components/ui/sheet.tsx
index d4cf9718749..5349ab80267 100644
--- a/packages/web/src/components/ui/sheet.tsx
+++ b/packages/web/src/components/ui/sheet.tsx
@@ -4,6 +4,7 @@ import { XIcon } from 'lucide-react';
import { Dialog as SheetPrimitive } from 'radix-ui';
import * as React from 'react';
+import { ModalLayer } from '@/components/ui/modal-layer';
import { cn } from '@/lib/utils';
function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
@@ -76,7 +77,7 @@ function SheetContent({
)}
{...props}
>
- {children}
+ <ModalLayer>{children}</ModalLayer>
{!hideCloseButton && (
<SheetPrimitive.Close className="absolute top-4 right-4 rounded-md opacity-70 ring-offset-gray-1 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-gray-8 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-gray-3">
<XIcon className="size-4" />
diff --git a/packages/web/src/features/billing/components/feature-usage/auto-recharge-card.tsx b/packages/web/src/features/billing/components/feature-usage/auto-recharge-card.tsx
index 6412f56f465..1b053182ad3 100644
--- a/packages/web/src/features/billing/components/feature-usage/auto-recharge-card.tsx
+++ b/packages/web/src/features/billing/components/feature-usage/auto-recharge-card.tsx
@@ -11,6 +11,7 @@ import { type ReactNode, useState } from 'react';
import { Button } from '@/components/ui/button';
import { Switch } from '@/components/ui/switch';
import { AdminControl, adminControl } from '@/lib/admin-control';
+import { cn } from '@/lib/utils';
import { billingMutations } from '../../hooks/billing-hooks';
import { DetailRow } from '../detail-row';
@@ -21,6 +22,7 @@ export const AutoRechargeCard = ({
feature,
hasCard,
note,
+ className,
}: AutoRechargeCardProps) => {
const autoTopUp = feature.autoTopUp;
const queryClient = useQueryClient();
@@ -47,7 +49,12 @@ export const AutoRechargeCard = ({
// "add payment method" CTA instead of the toggle. Once the card is saved, the toggle appears.
if (!hasCard) {
return (
- <div className="flex flex-col gap-3 rounded-xl border bg-panel p-5">
+ <div
+ className={cn(
+ 'flex flex-col gap-4 rounded-xl border bg-panel p-5',
+ className,
+ )}
+ >
<span className="text-sm font-medium text-gray-12">
{t('Enable auto recharge')}
</span>
@@ -72,8 +79,13 @@ export const AutoRechargeCard = ({
}
return (
- <div className="flex flex-col gap-4 rounded-xl border bg-panel p-5">
- <div className="flex items-center gap-3">
+ <div
+ className={cn(
+ 'flex flex-col gap-4 rounded-xl border bg-panel p-5',
+ className,
+ )}
+ >
+ <div className="flex items-center gap-2">
<Switch
{...adminControl(AdminControl.BILLING_AUTO_RECHARGE_TOGGLE)}
checked={enabled}
@@ -115,7 +127,7 @@ export const AutoRechargeCard = ({
className="self-start"
onClick={() => setIsDialogOpen(true)}
>
- <Pencil className="mr-2 size-4" />
+ <Pencil className="size-4" />
{t('Edit')}
</Button>
</>
@@ -134,4 +146,5 @@ type AutoRechargeCardProps = {
feature: ConsumableBillableFeature;
hasCard: boolean;
note?: ReactNode;
+ className?: string;
};
diff --git a/packages/web/src/features/billing/components/feature-usage/credits-card.tsx b/packages/web/src/features/billing/components/feature-usage/credits-card.tsx
index df5a7fe9bee..0c1bc6cd31b 100644
--- a/packages/web/src/features/billing/components/feature-usage/credits-card.tsx
+++ b/packages/web/src/features/billing/components/feature-usage/credits-card.tsx
@@ -5,12 +5,13 @@ import { t } from 'i18next';
import { Clock } from 'lucide-react';
import { Progress } from '@/components/ui/progress';
+import { cn } from '@/lib/utils';
import { billingUtils, CreditsResetLine } from '../../utils/billing-utils';
const CARD_DATE_FORMAT = 'D MMM YYYY, h:mm A';
-export const CreditsCard = ({ info }: CreditsCardProps) => {
+export const CreditsCard = ({ info, className }: CreditsCardProps) => {
const { plan, usage } = info;
const remaining = usage.creditsRemaining;
const isUnlimited = isNil(remaining);
@@ -26,17 +27,17 @@ export const CreditsCard = ({ info }: CreditsCardProps) => {
(info.billingPortalAvailable ? info.autumnPlanName : t('Free'));
return (
- <div className="flex flex-col rounded-xl border bg-panel">
+ <div className={cn('flex flex-col rounded-xl border bg-panel', className)}>
<div className="flex flex-col gap-3 p-5">
- <span className="text-gray-11 text-sm">
+ <span className="text-sm text-gray-11">
{isUnlimited ? t('Credits used') : t('Included in plan')}
</span>
<div className="flex items-start justify-between gap-4">
- <div className="flex items-baseline gap-1.5">
+ <div className="flex items-baseline gap-2">
<span className="text-3xl font-semibold text-gray-12">
{Math.floor(isUnlimited ? used : total).toLocaleString()}
</span>
- <span className="text-gray-11">{t('credits')}</span>
+ <span className="text-sm text-gray-11">{t('credits')}</span>
</div>
</div>
{!isUnlimited && (
@@ -51,7 +52,7 @@ export const CreditsCard = ({ info }: CreditsCardProps) => {
)}
</div>
{!isNil(footer) && (
- <div className="flex flex-col gap-1 border-t p-4 text-sm text-gray-11">
+ <div className="flex flex-col gap-1 border-t px-5 py-4 text-sm text-gray-11">
<div className="flex items-center gap-2">
<Clock className="size-4 shrink-0" />
<span>
@@ -91,4 +92,5 @@ function resolveFooter(
type CreditsCardProps = {
info: PlatformBillingInformation;
+ className?: string;
};
diff --git a/packages/web/src/features/billing/components/feature-usage/feature-usage-cards.tsx b/packages/web/src/features/billing/components/feature-usage/feature-usage-cards.tsx
index 2ff298871f6..4de996e8c4b 100644
--- a/packages/web/src/features/billing/components/feature-usage/feature-usage-cards.tsx
+++ b/packages/web/src/features/billing/components/feature-usage/feature-usage-cards.tsx
@@ -12,6 +12,7 @@ import {
usageIndicatorClass,
usageTrackClass,
} from '@/components/ui/progress';
+import { cn } from '@/lib/utils';
import { billingUtils } from '../../utils/billing-utils';
@@ -19,20 +20,32 @@ const HIDE_WHEN_UNLIMITED = ['active-flows', 'team-projects'];
export function FeatureUsageCards({
platformSubscription,
+ cardClassName,
}: {
platformSubscription: PlatformBillingInformation;
+ cardClassName?: string;
}) {
const metrics = resolveUsageMetrics(platformSubscription);
return (
- <div className="grid grid-cols-1 items-start gap-4 sm:grid-cols-2">
+ <div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
{metrics.map((metric) => (
- <UsageMetricCard key={metric.key} metric={metric} />
+ <UsageMetricCard
+ key={metric.key}
+ metric={metric}
+ className={cardClassName}
+ />
))}
</div>
);
}
-function UsageMetricCard({ metric }: { metric: UsageMetric }) {
+function UsageMetricCard({
+ metric,
+ className,
+}: {
+ metric: UsageMetric;
+ className?: string;
+}) {
const Icon = metric.icon;
const isUnlimited = isNil(metric.included);
const percent = billingUtils.percentUsed({
@@ -41,9 +54,14 @@ function UsageMetricCard({ metric }: { metric: UsageMetric }) {
});
return (
- <div className="flex flex-col gap-4 rounded-xl bg-gray-3/30 p-5">
+ <div
+ className={cn(
+ 'flex flex-col gap-4 rounded-xl bg-gray-3/30 p-5',
+ className,
+ )}
+ >
<div className="flex items-center gap-2">
- <span className="flex size-7 items-center justify-center rounded-md border bg-gray-1 text-gray-11">
+ <span className="flex size-7 items-center justify-center rounded-lg border bg-gray-1 text-gray-11">
<Icon className="size-4" />
</span>
<span className="text-sm font-medium text-gray-12">
@@ -74,7 +92,7 @@ function UsageMetricCard({ metric }: { metric: UsageMetric }) {
</div>
{!isUnlimited && (
- <div className="flex flex-col gap-1.5">
+ <div className="flex flex-col gap-2">
<Progress
value={percent}
className={usageTrackClass(percent / 100)}
diff --git a/packages/web/src/features/billing/components/feature-usage/projects-usage-table.tsx b/packages/web/src/features/billing/components/feature-usage/projects-usage-table.tsx
index 9d43b6c66ff..7a497b6720c 100644
--- a/packages/web/src/features/billing/components/feature-usage/projects-usage-table.tsx
+++ b/packages/web/src/features/billing/components/feature-usage/projects-usage-table.tsx
@@ -21,9 +21,11 @@ import { projectCollectionUtils } from '@/features/projects';
export function ProjectsUsageTable({
platformId,
enabled = true,
+ frameClassName,
}: {
platformId: string;
enabled?: boolean;
+ frameClassName?: string;
}) {
const [range, setRange] = useState<{ from: Date; to: Date }>(() => ({
from: dayjs().subtract(30, 'day').startOf('day').toDate(),
@@ -50,8 +52,8 @@ export function ProjectsUsageTable({
return (
<div className="flex flex-col gap-4">
- <div className="flex items-center justify-between gap-2">
- <h2 className="text-base font-semibold">
+ <div className="flex flex-wrap items-end justify-between gap-x-4 gap-y-2">
+ <h2 className="text-base font-semibold text-gray-12">
{t('Credits Usage by Project')}
</h2>
<DateTimePickerWithRange
@@ -66,6 +68,8 @@ export function ProjectsUsageTable({
/>
</div>
<DataTable
+ bordered={frameClassName !== undefined}
+ frameClassName={frameClassName}
columns={COLUMNS}
page={page}
isLoading={isLoading}
diff --git a/packages/web/src/features/billing/components/feature-usage/users-card.tsx b/packages/web/src/features/billing/components/feature-usage/users-card.tsx
index 547d1cf76eb..57e66a7671e 100644
--- a/packages/web/src/features/billing/components/feature-usage/users-card.tsx
+++ b/packages/web/src/features/billing/components/feature-usage/users-card.tsx
@@ -9,13 +9,14 @@ import { useState } from 'react';
import { Button } from '@/components/ui/button';
import { AdminControl, adminControl } from '@/lib/admin-control';
+import { cn } from '@/lib/utils';
import { billingUtils } from '../../utils/billing-utils';
import { DetailRow } from '../detail-row';
import { ManageSeatsDialog } from './manage-seats-dialog';
-export const UsersCard = ({ info, feature }: UsersCardProps) => {
+export const UsersCard = ({ info, feature, className }: UsersCardProps) => {
const { usage, includedSeats, additionalSeats } = info;
const used = usage.users;
const hasAdditionalSeats = !isNil(additionalSeats) && additionalSeats > 0;
@@ -28,8 +29,13 @@ export const UsersCard = ({ info, feature }: UsersCardProps) => {
const [isDialogOpen, setIsDialogOpen] = useState(false);
return (
- <div className="flex flex-col gap-4 rounded-xl border bg-panel p-5">
- <span className="text-lg font-semibold text-gray-12">
+ <div
+ className={cn(
+ 'flex flex-col gap-4 rounded-xl border bg-panel p-5',
+ className,
+ )}
+ >
+ <span className="text-base font-semibold text-gray-12">
{isNil(effectiveTotal)
? t('{used} seats', { used: used.toLocaleString() })
: t('{used}/{total} seats', {
@@ -39,7 +45,7 @@ export const UsersCard = ({ info, feature }: UsersCardProps) => {
</span>
{hasInvitedSeats && (
- <div className="flex flex-col gap-1.5 text-sm">
+ <div className="flex flex-col gap-2 text-sm">
<DetailRow
label={t('Active')}
value={usage.activeUsers.toLocaleString()}
@@ -52,7 +58,7 @@ export const UsersCard = ({ info, feature }: UsersCardProps) => {
)}
{hasAdditionalSeats && !capBinds && (
- <div className="flex flex-col gap-1.5 text-sm">
+ <div className="flex flex-col gap-2 text-sm">
<DetailRow
label={t('Plan seats')}
value={included.toLocaleString()}
@@ -84,12 +90,12 @@ export const UsersCard = ({ info, feature }: UsersCardProps) => {
>
{hasAdditionalSeats ? (
<>
- <Pencil className="mr-2 size-4" />
+ <Pencil className="size-4" />
{t('Manage Seats')}
</>
) : (
<>
- <Plus className="mr-2 size-4" />
+ <Plus className="size-4" />
{t('Add Seats')}
</>
)}
@@ -112,4 +118,5 @@ export const UsersCard = ({ info, feature }: UsersCardProps) => {
type UsersCardProps = {
info: PlatformBillingInformation;
feature: SeatsBillableFeature;
+ className?: string;
};
diff --git a/packages/web/src/features/billing/hooks/use-feature-gate.tsx b/packages/web/src/features/billing/hooks/use-feature-gate.tsx
index f657bd3b582..ba255bc1468 100644
--- a/packages/web/src/features/billing/hooks/use-feature-gate.tsx
+++ b/packages/web/src/features/billing/hooks/use-feature-gate.tsx
@@ -4,7 +4,7 @@ import {
PlatformAdminSurface,
} from '@activepieces/shared';
import { t } from 'i18next';
-import { Check, Crown, ExternalLink } from 'lucide-react';
+import { Check, Gem, ExternalLink } from 'lucide-react';
import { ReactNode, useState } from 'react';
import { Badge } from '@/components/ui/badge';
@@ -31,7 +31,7 @@ export function useFeatureGate({ locked, feature }: UseFeatureGateParams) {
return {
locked,
crown: locked ? (
- <Crown className="size-3.5 shrink-0 text-on-accent/90" />
+ <Gem className="size-3.5 shrink-0 text-on-accent/90" />
) : null,
open: () => setOpen(true),
dialog: (
diff --git a/packages/web/src/features/projects/components/create-project-button.tsx b/packages/web/src/features/projects/components/create-project-button.tsx
index 07e32baeee9..22855f3b88c 100644
--- a/packages/web/src/features/projects/components/create-project-button.tsx
+++ b/packages/web/src/features/projects/components/create-project-button.tsx
@@ -1,6 +1,6 @@
import { ProjectWithLimits, TelemetryEventName } from '@activepieces/shared';
import { t } from 'i18next';
-import { Crown, Plus } from 'lucide-react';
+import { Gem, Plus } from 'lucide-react';
import React from 'react';
import { AnimatedIconButton } from '@/components/custom/animated-icon-button';
@@ -111,7 +111,7 @@ function triggerFor({ variant, className, crown, locked }: TriggerForParams) {
className={cn('hover:bg-gray-4', className)}
{...control}
>
- {locked ? <Crown className="text-accent-11" /> : <Plus />}
+ {locked ? <Gem className="text-accent-11" /> : <Plus />}
</Button>
);
case 'full':
@@ -142,7 +142,7 @@ function triggerFor({ variant, className, crown, locked }: TriggerForParams) {
{...control}
>
{locked ? (
- <Crown className="size-4 text-accent-11" />
+ <Gem className="size-4 text-accent-11" />
) : (
<Plus className="size-4" />
)}
diff --git a/packages/web/src/features/projects/components/new-project-dialog.tsx b/packages/web/src/features/projects/components/new-project-dialog.tsx
index a6c8e1f41ad..3bf863dd023 100644
--- a/packages/web/src/features/projects/components/new-project-dialog.tsx
+++ b/packages/web/src/features/projects/components/new-project-dialog.tsx
@@ -7,7 +7,7 @@ import {
import { zodResolver } from '@hookform/resolvers/zod';
import { useQueryClient } from '@tanstack/react-query';
import { t } from 'i18next';
-import { Crown } from 'lucide-react';
+import { Gem } from 'lucide-react';
import { useState } from 'react';
import { useForm } from 'react-hook-form';
import { z } from 'zod';
@@ -320,7 +320,9 @@ const NewProjectForm = ({
form.handleSubmit(handleCreate)(e);
}}
>
- {gate?.locked === true && <Crown className="size-3.5 shrink-0" />}
+ {gate?.locked === true && (
+ <Gem className="size-3.5 shrink-0 text-on-accent/90" />
+ )}
{t('Create Project')}
</Button>
</DialogFooter>
diff --git a/packages/web/src/lib/admin-control.ts b/packages/web/src/lib/admin-control.ts
index 06f0ef4889b..180ebefacf2 100644
--- a/packages/web/src/lib/admin-control.ts
+++ b/packages/web/src/lib/admin-control.ts
@@ -96,6 +96,7 @@ export enum AdminControl {
EVENT_DESTINATIONS_WEBHOOK_TEST_RUN = 'event-destinations.webhook-test.run',
GENERAL_APPEARANCE_SUBMIT = 'general.appearance.submit',
GENERAL_COLOUR_RESET_RUN = 'general.colour-reset.run',
+ GENERAL_BRANDING_UPGRADE_OPEN = 'general.branding-upgrade.open',
GENERAL_PLATFORM_DELETE_CONFIRM = 'general.platform-delete.confirm',
GENERAL_PLATFORM_DELETE_OPEN = 'general.platform-delete.open',
HEALTH_CHECK_DOCS_LINK = 'health.check-docs.link',
diff --git a/packages/web/src/styles.css b/packages/web/src/styles.css
index 925d9dead55..83cb2d8f15d 100644
--- a/packages/web/src/styles.css
+++ b/packages/web/src/styles.css
@@ -1241,3 +1241,18 @@
@media (prefers-reduced-motion: reduce) {
.recurring-chip-gradient { animation: none; }
}
+
+@layer base {
+ :root,
+ [data-theme='light'] {
+ --admin-page: oklch(97.9% 0 0);
+ --admin-surface: var(--panel);
+ --admin-card-border: var(--gray-6);
+ }
+
+ [data-theme='dark'] {
+ --admin-page: var(--gray-1);
+ --admin-surface: var(--panel);
+ --admin-card-border: var(--gray-6);
+ }
+}
diff --git a/packages/web/test/app/billing/feature-gating.test.tsx b/packages/web/test/app/billing/feature-gating.test.tsx
index e39682de097..167b056f4fc 100644
--- a/packages/web/test/app/billing/feature-gating.test.tsx
+++ b/packages/web/test/app/billing/feature-gating.test.tsx
@@ -17,8 +17,8 @@ vi.mock('i18next', () => ({ t: (key: string) => key }));
vi.mock('lucide-react', async (importOriginal) => ({
...(await importOriginal<Record<string, unknown>>()),
- Crown: (props: Record<string, unknown>) =>
- React.createElement('span', { ...props, 'data-testid': 'crown' }),
+ Gem: (props: Record<string, unknown>) =>
+ React.createElement('span', { ...props, 'data-testid': 'gem' }),
}));
vi.mock('@/hooks/platform-hooks', () => ({
@@ -131,28 +131,28 @@ beforeEach(() => {
});
describe('create project gating', () => {
- it('crowns the button when the plan includes no team projects', () => {
+ it('marks the button with a gem when the plan includes no team projects', () => {
teamProjectsLimit = 0;
renderWithQueryClient(
<CreateProjectButton variant="full" projects={usedTeamProjects(0)} />,
);
- expect(screen.getByTestId('crown')).toBeDefined();
+ expect(screen.getByTestId('gem')).toBeDefined();
});
- it('crowns the button when the team project allowance is used up', () => {
+ it('marks the button with a gem when the team project allowance is used up', () => {
teamProjectsLimit = 3;
renderWithQueryClient(
<CreateProjectButton variant="full" projects={usedTeamProjects(3)} />,
);
- expect(screen.getByTestId('crown')).toBeDefined();
+ expect(screen.getByTestId('gem')).toBeDefined();
});
- it('crowns every variant, including the sidebar rail', () => {
+ it('marks every variant with a gem, including the sidebar rail', () => {
teamProjectsLimit = 0;
renderWithQueryClient(
<CreateProjectButton variant="icon" projects={usedTeamProjects(0)} />,
);
- expect(screen.getByTestId('crown')).toBeDefined();
+ expect(screen.getByTestId('gem')).toBeDefined();
});
it('refuses on the click instead of after the form is filled in', () => {
diff --git a/packages/web/test/app/components/admin/admin-page-header.test.tsx b/packages/web/test/app/components/admin/admin-page-header.test.tsx
new file mode 100644
index 00000000000..538ea821223
--- /dev/null
+++ b/packages/web/test/app/components/admin/admin-page-header.test.tsx
@@ -0,0 +1,50 @@
+/**
+ * @vitest-environment jsdom
+ */
+import { cleanup, render, screen } from '@testing-library/react';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { AdminPageHeader } from '@/app/components/admin';
+
+const state = vi.hoisted(() => ({ hidePageHeader: false }));
+
+vi.mock('i18next', () => ({ t: (key: string) => key }));
+
+vi.mock('@/components/providers/embed-provider', () => ({
+ useEmbedding: () => ({
+ embedState: { isEmbedded: true, hidePageHeader: state.hidePageHeader },
+ }),
+}));
+
+function renderHeader() {
+ render(
+ <AdminPageHeader title="Users" description="Manage users">
+ <button type="button">Invite</button>
+ </AdminPageHeader>,
+ );
+}
+
+beforeEach(() => {
+ state.hidePageHeader = false;
+});
+
+afterEach(cleanup);
+
+describe('AdminPageHeader', () => {
+ it('shows the title and page actions', () => {
+ renderHeader();
+
+ expect(screen.getByRole('heading', { name: 'Users' })).toBeDefined();
+ expect(screen.getByRole('button', { name: 'Invite' })).toBeDefined();
+ });
+
+ it('keeps page actions when an embedding hides the page header', () => {
+ state.hidePageHeader = true;
+
+ renderHeader();
+
+ expect(screen.queryByRole('heading', { name: 'Users' })).toBeNull();
+ expect(screen.queryByText('Manage users')).toBeNull();
+ expect(screen.getByRole('button', { name: 'Invite' })).toBeDefined();
+ });
+});
diff --git a/packages/web/test/app/routes/platform/setup/ai/config-detail-save.test.tsx b/packages/web/test/app/routes/platform/setup/ai/config-detail-save.test.tsx
index 6b3b97da5c6..9869f2a7a0b 100644
--- a/packages/web/test/app/routes/platform/setup/ai/config-detail-save.test.tsx
+++ b/packages/web/test/app/routes/platform/setup/ai/config-detail-save.test.tsx
@@ -24,6 +24,7 @@ import {
import * as React from 'react';
import { act } from 'react';
import { createRoot, type Root } from 'react-dom/client';
+import { MemoryRouter } from 'react-router-dom';
import { beforeEach, describe, expect, it, vi } from 'vitest';
const selectMock = vi.hoisted(() => ({
@@ -166,23 +167,25 @@ describe('ConfigDetail save (manual models)', () => {
onSave = vi.fn().mockResolvedValue({ error: null });
act(() => {
root.render(
- <ConfigDetail
- config={gatewayConfig}
- info={{
- provider: AIProviderName.CLOUDFLARE_GATEWAY,
- name: 'Cloudflare AI Gateway',
- markdown: '',
- logoUrl: '',
- }}
- projects={[]}
- isSaving={false}
- onSave={onSave}
- onDelete={async () => undefined}
- onReplaceCredentials={() => undefined}
- isRechecking={false}
- onRecheck={() => undefined}
- onBack={() => undefined}
- />,
+ <MemoryRouter>
+ <ConfigDetail
+ config={gatewayConfig}
+ info={{
+ provider: AIProviderName.CLOUDFLARE_GATEWAY,
+ name: 'Cloudflare AI Gateway',
+ markdown: '',
+ logoUrl: '',
+ }}
+ projects={[]}
+ isSaving={false}
+ onSave={onSave}
+ onDelete={async () => undefined}
+ onReplaceCredentials={() => undefined}
+ isRechecking={false}
+ onRecheck={() => undefined}
+ onBack={() => undefined}
+ />
+ </MemoryRouter>,
);
});
};
diff --git a/packages/web/test/app/routes/platform/setup/general/appearance-section.test.tsx b/packages/web/test/app/routes/platform/setup/general/appearance-section.test.tsx
index 1bdeab106d8..59717f372ae 100644
--- a/packages/web/test/app/routes/platform/setup/general/appearance-section.test.tsx
+++ b/packages/web/test/app/routes/platform/setup/general/appearance-section.test.tsx
@@ -17,6 +17,7 @@ const state = vi.hoisted(() => ({
toastSuccess: vi.fn(),
invalidate: vi.fn(async (_filters: unknown) => undefined),
saving: Promise.resolve() as Promise<unknown>,
+ upgradeClick: vi.fn(),
}));
vi.mock('i18next', () => ({
@@ -67,6 +68,7 @@ vi.mock('@/hooks/platform-hooks', () => ({
vi.mock('@/hooks/flags-hooks', () => ({
flagsHooks: {
queryKey: ['flags'],
+ useFlag: () => ({ data: undefined }),
useWebsiteBranding: () => ({
colors: {
avatar: '#515151',
@@ -119,8 +121,9 @@ vi.mock('@/app/routes/platform/setup/general/color-preview', () => ({
ColorPreview: () => null,
}));
-vi.mock('@/app/components/feature-banner', () => ({
- FeatureBanner: () => null,
+vi.mock('@/features/billing', () => ({
+ TIER_LABELS: { enterprise: 'Enterprise' },
+ useUpgradeClick: () => state.upgradeClick,
}));
import { AppearanceSection } from '@/app/routes/platform/setup/general/appearance-section';
@@ -197,6 +200,10 @@ function hasUnsavedNotice(): boolean {
return container.textContent?.includes('You have unsaved changes') ?? false;
}
+function hasText({ text }: { text: string }): boolean {
+ return container.textContent?.includes(text) ?? false;
+}
+
function submitButton(): HTMLButtonElement {
const button = container.querySelector<HTMLButtonElement>(
'button[type="submit"]',
@@ -445,6 +452,68 @@ describe('AppearanceSection', () => {
});
});
+describe('AppearanceSection on a plan without branding', () => {
+ beforeEach(() => {
+ state.update.mockReset();
+ state.update.mockResolvedValue(undefined);
+ state.upgradeClick.mockClear();
+ state.saving = Promise.resolve();
+ state.customAppearanceEnabled = false;
+ state.primaryColor = '#6e41e2';
+ state.brandColor = '#6e41e2';
+ state.themeColors = null;
+ state.statusColors = {};
+ });
+
+ afterEach(() => {
+ act(() => root.unmount());
+ container.remove();
+ });
+
+ it('lets the admin try a colour and turns save into upgrade', async () => {
+ await render();
+ await type({ selector: 'input[aria-label="colour"]', value: '#123456' });
+ expect(hasText({ text: "Branding preview isn't saved" })).toBe(true);
+ expect(container.querySelector('button[type="submit"]')).toBeNull();
+ expect(buttonNamed({ name: 'Cancel' }).disabled).toBe(false);
+ await act(async () => {
+ buttonNamed({ name: 'Upgrade to save' }).click();
+ });
+ expect(state.upgradeClick).toHaveBeenCalledWith(
+ expect.objectContaining({ feature: 'BRANDING', tier: 'enterprise' }),
+ );
+ });
+
+ it('saves the name even when a previewed status colour is incomplete', async () => {
+ await render();
+ const statusColour = colourInputs()[1];
+ await act(async () => {
+ setInputValue({ input: statusColour, value: '#ff' });
+ });
+ await type({ selector: '#name', value: 'Contoso' });
+ expect(submitButton().disabled).toBe(false);
+ await save();
+ await act(async () => {
+ await state.saving;
+ });
+ const fields = sentFields();
+ expect(fields.name).toBe('Contoso');
+ expect(fields.themeColors).toBeUndefined();
+ });
+
+ it('still saves a name change while branding is only previewed', async () => {
+ await render();
+ await type({ selector: 'input[aria-label="colour"]', value: '#123456' });
+ await type({ selector: '#name', value: 'Contoso' });
+ expect(submitButton().textContent === 'Save name').toBe(true);
+ await save();
+ const fields = sentFields();
+ expect(fields.name).toBe('Contoso');
+ expect(fields.primaryColor).toBeUndefined();
+ expect(fields.themeColors).toBeUndefined();
+ });
+});
+
type MutationOptions = {
mutationFn: () => Promise<unknown>;
onSuccess: (data: unknown) => void;
diff --git a/packages/web/test/components/ui/popover-in-dialog.test.tsx b/packages/web/test/components/ui/popover-in-dialog.test.tsx
new file mode 100644
index 00000000000..12323300e50
--- /dev/null
+++ b/packages/web/test/components/ui/popover-in-dialog.test.tsx
@@ -0,0 +1,110 @@
+/**
+ * @vitest-environment jsdom
+ */
+/* eslint-disable jest-dom/prefer-in-document, jest-dom/prefer-to-have-attribute, testing-library/no-node-access -- @testing-library/jest-dom is not a dependency of packages/web */
+import { readdirSync, readFileSync, statSync } from 'node:fs';
+import path from 'node:path';
+
+import { render, screen } from '@testing-library/react';
+import { describe, expect, it } from 'vitest';
+
+import { adminLayout } from '@/app/components/admin/admin-layout';
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogTitle,
+} from '@/components/ui/dialog';
+import {
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from '@/components/ui/popover';
+import { Sheet, SheetContent, SheetTitle } from '@/components/ui/sheet';
+
+function OpenPicker({ modal }: { modal?: boolean }) {
+ return (
+ <Popover open modal={modal}>
+ <PopoverTrigger>{'Pick'}</PopoverTrigger>
+ <PopoverContent>{'Picker list'}</PopoverContent>
+ </Popover>
+ );
+}
+
+function isHiddenFromReaders(element: Element): boolean {
+ return element.closest('[aria-hidden="true"]') !== null;
+}
+
+describe('popovers inside dialogs', () => {
+ it('render outside the scrolling dialog and own the scroll lock', () => {
+ render(
+ <Dialog open>
+ <DialogContent className={adminLayout.dialog.sm}>
+ <DialogTitle>{'Add required actions'}</DialogTitle>
+ <DialogDescription>{'Pick a piece'}</DialogDescription>
+ <OpenPicker />
+ </DialogContent>
+ </Dialog>,
+ );
+ const list = screen.getByText('Picker list');
+ expect(list.closest('[data-slot="dialog-content"]')).toBeNull();
+ expect(isHiddenFromReaders(list)).toBe(false);
+ expect(isHiddenFromReaders(screen.getByText('Add required actions'))).toBe(
+ true,
+ );
+ });
+
+ it('do the same inside sheets', () => {
+ render(
+ <Sheet open>
+ <SheetContent>
+ <SheetTitle>{'Edit'}</SheetTitle>
+ <OpenPicker />
+ </SheetContent>
+ </Sheet>,
+ );
+ const list = screen.getByText('Picker list');
+ expect(list.closest('[data-slot="sheet-content"]')).toBeNull();
+ expect(isHiddenFromReaders(screen.getByText('Edit'))).toBe(true);
+ });
+
+ it('stay non-modal outside a dialog', () => {
+ render(
+ <>
+ <p>{'Page body'}</p>
+ <OpenPicker />
+ </>,
+ );
+ expect(isHiddenFromReaders(screen.getByText('Page body'))).toBe(false);
+ });
+});
+
+describe('popover portals', () => {
+ it('never render into a container that could clip them', () => {
+ const offenders = sourceFiles(SRC)
+ .filter((file) => !CONTAINER_ALLOWED.has(path.relative(SRC, file)))
+ .filter((file) => PORTAL_INTO_CONTAINER.test(readFileSync(file, 'utf8')))
+ .map((file) => path.relative(SRC, file));
+ expect(offenders).toEqual([]);
+ });
+});
+
+function sourceFiles(directory: string): string[] {
+ return readdirSync(directory).flatMap((entry) => {
+ const full = path.join(directory, entry);
+ if (statSync(full).isDirectory()) {
+ return sourceFiles(full);
+ }
+ return full.endsWith('.tsx') ? [full] : [];
+ });
+}
+
+const SRC = path.resolve(__dirname, '../../../src');
+
+const PORTAL_INTO_CONTAINER =
+ /<(?:Popover|Select|DropdownMenu|DropdownMenuSub|HoverCard|Tooltip|ContextMenu|Menubar)Content\b(?:(?!<\w)[\s\S]){0,600}?\scontainer=/;
+
+const CONTAINER_ALLOWED = new Set([
+ 'app/builder/flow-canvas/nodes/note-node/note-tools.tsx',
+ 'components/custom/markdown-input/tools.tsx',
+]);