@agent-native/dispatch 0.15.17 → 0.15.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/provider-api-register.d.ts +7 -7
- package/dist/components/agents-panel.js +1 -1
- package/dist/components/agents-panel.js.map +1 -1
- package/dist/components/dispatch-control-plane.d.ts.map +1 -1
- package/dist/components/dispatch-control-plane.js +1 -1
- package/dist/components/dispatch-control-plane.js.map +1 -1
- package/dist/components/layout/Layout.d.ts.map +1 -1
- package/dist/components/layout/Layout.js +13 -9
- package/dist/components/layout/Layout.js.map +1 -1
- package/dist/components/messaging-setup-panel.js +1 -1
- package/dist/components/messaging-setup-panel.js.map +1 -1
- package/dist/components/task-queue-health.js +1 -1
- package/dist/components/task-queue-health.js.map +1 -1
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/card.js +1 -1
- package/dist/components/ui/card.js.map +1 -1
- package/dist/components/workspace-app-card.js +1 -1
- package/dist/components/workspace-app-card.js.map +1 -1
- package/dist/components/workspace-template-card.js +1 -1
- package/dist/components/workspace-template-card.js.map +1 -1
- package/dist/routes/pages/$appId.js +1 -1
- package/dist/routes/pages/$appId.js.map +1 -1
- package/dist/routes/pages/agents.js +1 -1
- package/dist/routes/pages/agents.js.map +1 -1
- package/dist/routes/pages/approval.js +4 -4
- package/dist/routes/pages/approval.js.map +1 -1
- package/dist/routes/pages/approvals.js +2 -2
- package/dist/routes/pages/approvals.js.map +1 -1
- package/dist/routes/pages/apps.$appId.js +1 -1
- package/dist/routes/pages/apps.$appId.js.map +1 -1
- package/dist/routes/pages/apps.js +3 -3
- package/dist/routes/pages/apps.js.map +1 -1
- package/dist/routes/pages/audit.js +1 -1
- package/dist/routes/pages/audit.js.map +1 -1
- package/dist/routes/pages/automations.js +1 -1
- package/dist/routes/pages/automations.js.map +1 -1
- package/dist/routes/pages/destinations.js +2 -2
- package/dist/routes/pages/destinations.js.map +1 -1
- package/dist/routes/pages/dreams.js +5 -5
- package/dist/routes/pages/dreams.js.map +1 -1
- package/dist/routes/pages/identities.js +1 -1
- package/dist/routes/pages/identities.js.map +1 -1
- package/dist/routes/pages/integrations.js +2 -2
- package/dist/routes/pages/integrations.js.map +1 -1
- package/dist/routes/pages/metrics.js +4 -4
- package/dist/routes/pages/metrics.js.map +1 -1
- package/dist/routes/pages/thread-debug.js +5 -5
- package/dist/routes/pages/thread-debug.js.map +1 -1
- package/dist/routes/pages/vault.js +3 -3
- package/dist/routes/pages/vault.js.map +1 -1
- package/dist/routes/pages/workspace.d.ts.map +1 -1
- package/dist/routes/pages/workspace.js +3 -3
- package/dist/routes/pages/workspace.js.map +1 -1
- package/package.json +3 -3
- package/src/components/agents-panel.tsx +1 -1
- package/src/components/dispatch-control-plane.tsx +1 -4
- package/src/components/layout/Layout.spec.tsx +7 -5
- package/src/components/layout/Layout.tsx +77 -38
- package/src/components/messaging-setup-panel.tsx +1 -1
- package/src/components/task-queue-health.tsx +1 -1
- package/src/components/ui/button.tsx +1 -2
- package/src/components/ui/card.tsx +1 -1
- package/src/components/workspace-app-card.tsx +1 -1
- package/src/components/workspace-template-card.tsx +2 -2
- package/src/routes/pages/$appId.tsx +1 -1
- package/src/routes/pages/agents.tsx +1 -1
- package/src/routes/pages/approval.tsx +4 -4
- package/src/routes/pages/approvals.tsx +2 -2
- package/src/routes/pages/apps.$appId.tsx +1 -1
- package/src/routes/pages/apps.tsx +3 -3
- package/src/routes/pages/audit.tsx +1 -1
- package/src/routes/pages/automations.tsx +1 -1
- package/src/routes/pages/destinations.tsx +2 -2
- package/src/routes/pages/dreams.tsx +5 -5
- package/src/routes/pages/identities.tsx +2 -2
- package/src/routes/pages/integrations.tsx +2 -2
- package/src/routes/pages/metrics.tsx +4 -4
- package/src/routes/pages/thread-debug.tsx +6 -6
- package/src/routes/pages/vault.tsx +3 -3
- package/src/routes/pages/workspace.tsx +3 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-app-card.js","sourceRoot":"","sources":["../../src/components/workspace-app-card.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,cAAc,GACf,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,UAAU,EACV,YAAY,EACZ,SAAS,EACT,SAAS,GACV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EACL,oBAAoB,EACpB,gBAAgB,GAEjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;A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,GAAG,CAC/C,CAAC,CAAC,CAAC,CACF,KAAC,gBAAgB,IAAC,IAAI,EAAE,EAAE,EAAE,SAAS,EAAC,MAAM,GAAG,CAChD,aAEM,IACL,IACF,EAEL,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CACtB,YAAG,SAAS,EAAC,iDAAiD,YAC3D,QAAQ,CAAC,WAAW,GACnB,CACL,CAAC,CAAC,CAAC,IAAI,EAEP,SAAS,CAAC,CAAC,CAAC,CACX,KAAC,yBAAyB,IACxB,KAAK,EAAE,GAAG,CAAC,EAAE,EACb,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC,CAAC,CAAC,IAAI,KA9DH,QAAQ,CAAC,EAAE,CA+DZ,CACP,CAAC;gCACJ,CAAC,CAAC,GACE,CACP,IACG,EACN,KAAC,YAAY,cACX,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,qBAE1C,GACI,IACD,IACT,CACV,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,GAAY;IAClC,IAAI,GAAG,YAAY,KAAK;QAAE,OAAO,GAAG,CAAC,OAAO,CAAC;IAC7C,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;AACrB,CAAC","sourcesContent":["import {\n useActionMutation,\n useActionQuery,\n} from \"@agent-native/core/client/hooks\";\nimport {\n IconChevronDown,\n IconChevronRight,\n IconClockHour4,\n IconDots,\n IconEdit,\n IconEye,\n IconEyeOff,\n IconFileText,\n IconWorld,\n IconTrash,\n} from \"@tabler/icons-react\";\nimport { useEffect, useState, type FormEvent } from \"react\";\nimport { toast } from \"sonner\";\n\nimport { cn } from \"../lib/utils\";\nimport {\n isPendingBuilderHref,\n workspaceAppHref,\n type WorkspaceAppSummary,\n} from \"../lib/workspace-apps\";\nimport { ActionQueryError } from \"./action-query-error\";\nimport { AppKeysPopover } from \"./app-keys-popover\";\nimport { Badge } from \"./ui/badge\";\nimport { Button } from \"./ui/button\";\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n DialogTrigger,\n} from \"./ui/dialog\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from \"./ui/dropdown-menu\";\nimport { Input } from \"./ui/input\";\nimport { Label } from \"./ui/label\";\nimport { Textarea } from \"./ui/textarea\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"./ui/tooltip\";\nimport { AppResourceEffectiveStack } from \"./workspace-resource-effective-stack\";\n\nconst APP_CARD_ACTION_CLASS =\n \"size-7 rounded-md p-0 text-muted-foreground transition-[background-color,color] hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:bg-accent data-[state=open]:text-foreground\";\n\nexport function WorkspaceAppCard({\n app,\n className,\n}: {\n app: WorkspaceAppSummary;\n className?: string;\n}) {\n const href = workspaceAppHref(app);\n const openInNewTab = isPendingBuilderHref(app);\n const isPending = app.status === \"pending\";\n const pendingLabel = app.statusLabel || \"Builder branch\";\n const isArchived = !!app.archived;\n const audience = app.audience ?? \"internal\";\n const [editOpen, setEditOpen] = useState(false);\n const [draftName, setDraftName] = useState(app.name);\n const [draftDescription, setDraftDescription] = useState(\n app.description || \"\",\n );\n\n useEffect(() => {\n if (editOpen) return;\n setDraftName(app.name);\n setDraftDescription(app.description || \"\");\n }, [app.description, app.name, editOpen]);\n\n const archive = useActionMutation(\"archive-workspace-app\", {\n onError: (err) =>\n toast.error(`Could not hide ${app.name}: ${stringifyError(err)}`),\n });\n const unarchive = useActionMutation(\"unarchive-workspace-app\", {\n onError: (err) =>\n toast.error(`Could not restore ${app.name}: ${stringifyError(err)}`),\n });\n const removePending = useActionMutation(\"remove-pending-workspace-app\", {\n onError: (err) =>\n toast.error(`Could not remove ${app.name}: ${stringifyError(err)}`),\n });\n const updateMetadata = useActionMutation(\"update-workspace-app-metadata\", {\n onSuccess: () => {\n toast.success(`Updated ${draftName.trim() || app.name}`);\n setEditOpen(false);\n },\n onError: (err) =>\n toast.error(`Could not update ${app.name}: ${stringifyError(err)}`),\n });\n\n const handleArchive = () => {\n archive.mutate({ appId: app.id });\n toast.success(`Hid ${app.name} from the Apps list`);\n };\n const handleUnarchive = () => {\n unarchive.mutate({ appId: app.id });\n toast.success(`Restored ${app.name} to the Apps list`);\n };\n const handleRemovePending = () => {\n removePending.mutate({ appId: app.id });\n toast.success(`Removed pending ${app.name}`);\n };\n const handleMetadataSubmit = (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n const name = draftName.trim();\n if (!name) {\n toast.error(\"App name is required.\");\n return;\n }\n updateMetadata.mutate({\n appId: app.id,\n name,\n description: draftDescription.trim(),\n });\n };\n\n return (\n <div\n aria-disabled={!href}\n className={cn(\n \"group relative rounded-xl border border-border/60 bg-card/40 p-4 transition-[background-color,border-color] hover:border-foreground/20 hover:bg-accent/15 focus-within:border-foreground/20 focus-within:bg-accent/15 aria-disabled:opacity-60\",\n isArchived && \"opacity-70\",\n className,\n )}\n >\n {href ? (\n <a\n href={href}\n target={openInNewTab ? \"_blank\" : undefined}\n rel={openInNewTab ? \"noreferrer\" : undefined}\n aria-label={`Open ${app.name}`}\n className=\"absolute inset-0 z-0 rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\"\n />\n ) : null}\n\n <div className=\"pointer-events-none relative z-10 flex h-full min-w-0 items-start justify-between gap-3\">\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex min-w-0 flex-wrap items-center gap-1.5\">\n <h3 className=\"min-w-0 flex-1 truncate text-sm font-semibold text-foreground\">\n {app.name}\n </h3>\n {isPending ? (\n <Badge\n variant=\"outline\"\n className=\"shrink-0 gap-1 border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300\"\n >\n <IconClockHour4 size={12} />\n {pendingLabel}\n </Badge>\n ) : null}\n {isArchived ? (\n <Badge variant=\"outline\" className=\"shrink-0 gap-1\">\n <IconEyeOff size={12} />\n Hidden\n </Badge>\n ) : null}\n {audience === \"public\" ? (\n <Badge variant=\"outline\" className=\"shrink-0 gap-1\">\n <IconWorld size={12} />\n Public\n </Badge>\n ) : null}\n </div>\n <p className=\"mt-1 truncate font-mono text-[11px] text-muted-foreground\">\n {app.path}\n </p>\n {isPending && app.branchName ? (\n <p className=\"mt-1 truncate text-xs text-muted-foreground\">\n Builder branch: {app.branchName}\n </p>\n ) : null}\n {app.description ? (\n <p className=\"mt-2 min-h-10 line-clamp-2 text-[13px] leading-5 text-muted-foreground\">\n {app.description}\n </p>\n ) : null}\n </div>\n <div className=\"flex shrink-0 items-center gap-1\">\n {!isPending && !isArchived ? (\n <div className=\"pointer-events-auto\">\n <AppResourcesDialog app={app} />\n </div>\n ) : null}\n {!isPending && !isArchived ? (\n <div className=\"pointer-events-auto\">\n <AppKeysPopover appId={app.id} appName={app.name} />\n </div>\n ) : null}\n <div className=\"pointer-events-auto\">\n <DropdownMenu>\n <Tooltip>\n <TooltipTrigger asChild>\n <DropdownMenuTrigger asChild>\n <button\n type=\"button\"\n aria-label={`More actions for ${app.name}`}\n className={cn(\n APP_CARD_ACTION_CLASS,\n \"inline-flex cursor-pointer items-center justify-center\",\n )}\n onClick={(e) => e.stopPropagation()}\n >\n <IconDots size={15} />\n </button>\n </DropdownMenuTrigger>\n </TooltipTrigger>\n <TooltipContent>More actions</TooltipContent>\n </Tooltip>\n <DropdownMenuContent align=\"end\" className=\"w-44\">\n <DropdownMenuItem\n onSelect={(event) => {\n event.preventDefault();\n setEditOpen(true);\n }}\n >\n <IconEdit size={14} className=\"mr-2\" />\n Edit details\n </DropdownMenuItem>\n {isPending ? (\n <DropdownMenuItem\n onSelect={handleRemovePending}\n className=\"text-red-600 focus:text-red-600 dark:text-red-400 dark:focus:text-red-400\"\n >\n <IconTrash size={14} className=\"mr-2\" />\n Remove from list\n </DropdownMenuItem>\n ) : isArchived ? (\n <DropdownMenuItem onSelect={handleUnarchive}>\n <IconEye size={14} className=\"mr-2\" />\n Restore to list\n </DropdownMenuItem>\n ) : (\n <DropdownMenuItem onSelect={handleArchive}>\n <IconEyeOff size={14} className=\"mr-2\" />\n Hide from list\n </DropdownMenuItem>\n )}\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n </div>\n </div>\n <Dialog open={editOpen} onOpenChange={setEditOpen}>\n <DialogContent>\n <DialogHeader>\n <DialogTitle>Edit app details</DialogTitle>\n </DialogHeader>\n <form className=\"space-y-4\" onSubmit={handleMetadataSubmit}>\n <div className=\"space-y-2\">\n <Label htmlFor={`app-name-${app.id}`}>Name</Label>\n <Input\n id={`app-name-${app.id}`}\n value={draftName}\n maxLength={120}\n onChange={(event) => setDraftName(event.target.value)}\n />\n </div>\n <div className=\"space-y-2\">\n <Label htmlFor={`app-description-${app.id}`}>Description</Label>\n <Textarea\n id={`app-description-${app.id}`}\n value={draftDescription}\n maxLength={500}\n rows={4}\n onChange={(event) => setDraftDescription(event.target.value)}\n />\n </div>\n <DialogFooter>\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => setEditOpen(false)}\n >\n Cancel\n </Button>\n <Button type=\"submit\" disabled={updateMetadata.isPending}>\n {updateMetadata.isPending ? \"Saving...\" : \"Save\"}\n </Button>\n </DialogFooter>\n </form>\n </DialogContent>\n </Dialog>\n </div>\n );\n}\n\nfunction AppResourcesDialog({ app }: { app: WorkspaceAppSummary }) {\n const [open, setOpen] = useState(false);\n const [inspectedResourceId, setInspectedResourceId] = useState<string | null>(\n null,\n );\n const query = useActionQuery(\n \"list-workspace-resources-for-app\",\n { appId: app.id },\n { enabled: open },\n );\n const { data, isLoading } = query;\n\n const resources = ((data as any)?.resources ?? []) as any[];\n const counts = (data as any)?.counts;\n\n return (\n <Dialog\n open={open}\n onOpenChange={(nextOpen) => {\n setOpen(nextOpen);\n if (!nextOpen) setInspectedResourceId(null);\n }}\n >\n <Tooltip>\n <TooltipTrigger asChild>\n <DialogTrigger asChild>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n aria-label={`View agent resources for ${app.name}`}\n className={APP_CARD_ACTION_CLASS}\n onClick={(e) => e.stopPropagation()}\n >\n <IconFileText size={14} />\n </Button>\n </DialogTrigger>\n </TooltipTrigger>\n <TooltipContent>View agent resources</TooltipContent>\n </Tooltip>\n <DialogContent className=\"max-w-2xl\">\n <DialogHeader>\n <DialogTitle>{app.name} agent resources</DialogTitle>\n <DialogDescription>\n Workspace-scope agent resources are inherited at runtime. App shared\n and personal resources can override them locally.\n </DialogDescription>\n </DialogHeader>\n <div className=\"space-y-4\">\n <div className=\"rounded-lg border bg-muted/30 px-3 py-2 text-xs leading-relaxed text-muted-foreground\">\n All-app agent resources live once at workspace scope and are read by\n each app agent when it builds context. Nothing is copied into this\n app.\n </div>\n\n <div className=\"flex flex-wrap items-center gap-2\">\n <Badge variant=\"secondary\">{counts?.total ?? 0} total</Badge>\n <Badge variant=\"outline\">\n {counts?.workspace ?? counts?.global ?? 0} workspace\n </Badge>\n <Badge variant=\"outline\">{counts?.granted ?? 0} granted</Badge>\n <Badge variant=\"outline\">\n {counts?.autoLoaded ?? 0} auto-loaded\n </Badge>\n </div>\n\n {query.isError ? (\n <ActionQueryError\n error={query.error}\n onRetry={() => void query.refetch()}\n />\n ) : isLoading ? (\n <div className=\"space-y-2\">\n <div className=\"h-14 rounded-lg border bg-muted/30\" />\n <div className=\"h-14 rounded-lg border bg-muted/30\" />\n <div className=\"h-14 rounded-lg border bg-muted/30\" />\n </div>\n ) : resources.length === 0 ? (\n <div className=\"rounded-lg border border-dashed px-4 py-8 text-center text-sm text-muted-foreground\">\n No workspace or granted resources are visible to this app yet.\n </div>\n ) : (\n <div className=\"max-h-[420px] space-y-2 overflow-y-auto pr-1\">\n {resources.map((resource) => {\n const inspected = inspectedResourceId === resource.id;\n return (\n <div\n key={resource.id}\n className=\"rounded-lg border px-3 py-3\"\n >\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"min-w-0\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <span className=\"text-sm font-medium text-foreground\">\n {resource.name}\n </span>\n <Badge variant=\"secondary\">{resource.kind}</Badge>\n <Badge variant=\"outline\">\n {resource.source === \"workspace\"\n ? \"All apps\"\n : \"Granted\"}\n </Badge>\n {resource.autoLoaded ? (\n <Badge variant=\"outline\">Auto-loaded</Badge>\n ) : null}\n </div>\n <div className=\"mt-1 truncate font-mono text-xs text-muted-foreground\">\n {resource.path}\n </div>\n </div>\n <div className=\"flex shrink-0 flex-col items-end gap-2\">\n {resource.source === \"grant\" ? (\n <div className=\"text-right text-[11px] text-muted-foreground\">\n Selected grant\n </div>\n ) : null}\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-7 px-2 text-xs\"\n onClick={(event) => {\n event.stopPropagation();\n setInspectedResourceId(\n inspected ? null : resource.id,\n );\n }}\n >\n {inspected ? (\n <IconChevronDown size={14} className=\"mr-1\" />\n ) : (\n <IconChevronRight size={14} className=\"mr-1\" />\n )}\n Stack\n </Button>\n </div>\n </div>\n\n {resource.description ? (\n <p className=\"mt-2 line-clamp-2 text-xs text-muted-foreground\">\n {resource.description}\n </p>\n ) : null}\n\n {inspected ? (\n <AppResourceEffectiveStack\n appId={app.id}\n resource={resource}\n />\n ) : null}\n </div>\n );\n })}\n </div>\n )}\n </div>\n <DialogFooter>\n <Button type=\"button\" onClick={() => setOpen(false)}>\n Done\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n}\n\nfunction stringifyError(err: unknown): string {\n if (err instanceof Error) return err.message;\n return String(err);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"workspace-app-card.js","sourceRoot":"","sources":["../../src/components/workspace-app-card.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,cAAc,GACf,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,QAA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AC,WAAW,GACnB,CACL,CAAC,CAAC,CAAC,IAAI,EAEP,SAAS,CAAC,CAAC,CAAC,CACX,KAAC,yBAAyB,IACxB,KAAK,EAAE,GAAG,CAAC,EAAE,EACb,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC,CAAC,CAAC,IAAI,KA9DH,QAAQ,CAAC,EAAE,CA+DZ,CACP,CAAC;gCACJ,CAAC,CAAC,GACE,CACP,IACG,EACN,KAAC,YAAY,cACX,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,qBAE1C,GACI,IACD,IACT,CACV,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,GAAY;IAClC,IAAI,GAAG,YAAY,KAAK;QAAE,OAAO,GAAG,CAAC,OAAO,CAAC;IAC7C,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;AACrB,CAAC","sourcesContent":["import {\n useActionMutation,\n useActionQuery,\n} from \"@agent-native/core/client/hooks\";\nimport {\n IconChevronDown,\n IconChevronRight,\n IconClockHour4,\n IconDots,\n IconEdit,\n IconEye,\n IconEyeOff,\n IconFileText,\n IconWorld,\n IconTrash,\n} from \"@tabler/icons-react\";\nimport { useEffect, useState, type FormEvent } from \"react\";\nimport { toast } from \"sonner\";\n\nimport { cn } from \"../lib/utils\";\nimport {\n isPendingBuilderHref,\n workspaceAppHref,\n type WorkspaceAppSummary,\n} from \"../lib/workspace-apps\";\nimport { ActionQueryError } from \"./action-query-error\";\nimport { AppKeysPopover } from \"./app-keys-popover\";\nimport { Badge } from \"./ui/badge\";\nimport { Button } from \"./ui/button\";\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n DialogTrigger,\n} from \"./ui/dialog\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from \"./ui/dropdown-menu\";\nimport { Input } from \"./ui/input\";\nimport { Label } from \"./ui/label\";\nimport { Textarea } from \"./ui/textarea\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"./ui/tooltip\";\nimport { AppResourceEffectiveStack } from \"./workspace-resource-effective-stack\";\n\nconst APP_CARD_ACTION_CLASS =\n \"size-7 rounded-md p-0 text-muted-foreground transition-[background-color,color] hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:bg-accent data-[state=open]:text-foreground\";\n\nexport function WorkspaceAppCard({\n app,\n className,\n}: {\n app: WorkspaceAppSummary;\n className?: string;\n}) {\n const href = workspaceAppHref(app);\n const openInNewTab = isPendingBuilderHref(app);\n const isPending = app.status === \"pending\";\n const pendingLabel = app.statusLabel || \"Builder branch\";\n const isArchived = !!app.archived;\n const audience = app.audience ?? \"internal\";\n const [editOpen, setEditOpen] = useState(false);\n const [draftName, setDraftName] = useState(app.name);\n const [draftDescription, setDraftDescription] = useState(\n app.description || \"\",\n );\n\n useEffect(() => {\n if (editOpen) return;\n setDraftName(app.name);\n setDraftDescription(app.description || \"\");\n }, [app.description, app.name, editOpen]);\n\n const archive = useActionMutation(\"archive-workspace-app\", {\n onError: (err) =>\n toast.error(`Could not hide ${app.name}: ${stringifyError(err)}`),\n });\n const unarchive = useActionMutation(\"unarchive-workspace-app\", {\n onError: (err) =>\n toast.error(`Could not restore ${app.name}: ${stringifyError(err)}`),\n });\n const removePending = useActionMutation(\"remove-pending-workspace-app\", {\n onError: (err) =>\n toast.error(`Could not remove ${app.name}: ${stringifyError(err)}`),\n });\n const updateMetadata = useActionMutation(\"update-workspace-app-metadata\", {\n onSuccess: () => {\n toast.success(`Updated ${draftName.trim() || app.name}`);\n setEditOpen(false);\n },\n onError: (err) =>\n toast.error(`Could not update ${app.name}: ${stringifyError(err)}`),\n });\n\n const handleArchive = () => {\n archive.mutate({ appId: app.id });\n toast.success(`Hid ${app.name} from the Apps list`);\n };\n const handleUnarchive = () => {\n unarchive.mutate({ appId: app.id });\n toast.success(`Restored ${app.name} to the Apps list`);\n };\n const handleRemovePending = () => {\n removePending.mutate({ appId: app.id });\n toast.success(`Removed pending ${app.name}`);\n };\n const handleMetadataSubmit = (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n const name = draftName.trim();\n if (!name) {\n toast.error(\"App name is required.\");\n return;\n }\n updateMetadata.mutate({\n appId: app.id,\n name,\n description: draftDescription.trim(),\n });\n };\n\n return (\n <div\n aria-disabled={!href}\n className={cn(\n \"group relative rounded-xl bg-card/40 p-4 transition-[background-color] hover:bg-accent/15 focus-within:bg-accent/15 aria-disabled:opacity-60\",\n isArchived && \"opacity-70\",\n className,\n )}\n >\n {href ? (\n <a\n href={href}\n target={openInNewTab ? \"_blank\" : undefined}\n rel={openInNewTab ? \"noreferrer\" : undefined}\n aria-label={`Open ${app.name}`}\n className=\"absolute inset-0 z-0 rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\"\n />\n ) : null}\n\n <div className=\"pointer-events-none relative z-10 flex h-full min-w-0 items-start justify-between gap-3\">\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex min-w-0 flex-wrap items-center gap-1.5\">\n <h3 className=\"min-w-0 flex-1 truncate text-sm font-semibold text-foreground\">\n {app.name}\n </h3>\n {isPending ? (\n <Badge\n variant=\"outline\"\n className=\"shrink-0 gap-1 border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300\"\n >\n <IconClockHour4 size={12} />\n {pendingLabel}\n </Badge>\n ) : null}\n {isArchived ? (\n <Badge variant=\"outline\" className=\"shrink-0 gap-1\">\n <IconEyeOff size={12} />\n Hidden\n </Badge>\n ) : null}\n {audience === \"public\" ? (\n <Badge variant=\"outline\" className=\"shrink-0 gap-1\">\n <IconWorld size={12} />\n Public\n </Badge>\n ) : null}\n </div>\n <p className=\"mt-1 truncate font-mono text-[11px] text-muted-foreground\">\n {app.path}\n </p>\n {isPending && app.branchName ? (\n <p className=\"mt-1 truncate text-xs text-muted-foreground\">\n Builder branch: {app.branchName}\n </p>\n ) : null}\n {app.description ? (\n <p className=\"mt-2 min-h-10 line-clamp-2 text-[13px] leading-5 text-muted-foreground\">\n {app.description}\n </p>\n ) : null}\n </div>\n <div className=\"flex shrink-0 items-center gap-1\">\n {!isPending && !isArchived ? (\n <div className=\"pointer-events-auto\">\n <AppResourcesDialog app={app} />\n </div>\n ) : null}\n {!isPending && !isArchived ? (\n <div className=\"pointer-events-auto\">\n <AppKeysPopover appId={app.id} appName={app.name} />\n </div>\n ) : null}\n <div className=\"pointer-events-auto\">\n <DropdownMenu>\n <Tooltip>\n <TooltipTrigger asChild>\n <DropdownMenuTrigger asChild>\n <button\n type=\"button\"\n aria-label={`More actions for ${app.name}`}\n className={cn(\n APP_CARD_ACTION_CLASS,\n \"inline-flex cursor-pointer items-center justify-center\",\n )}\n onClick={(e) => e.stopPropagation()}\n >\n <IconDots size={15} />\n </button>\n </DropdownMenuTrigger>\n </TooltipTrigger>\n <TooltipContent>More actions</TooltipContent>\n </Tooltip>\n <DropdownMenuContent align=\"end\" className=\"w-44\">\n <DropdownMenuItem\n onSelect={(event) => {\n event.preventDefault();\n setEditOpen(true);\n }}\n >\n <IconEdit size={14} className=\"mr-2\" />\n Edit details\n </DropdownMenuItem>\n {isPending ? (\n <DropdownMenuItem\n onSelect={handleRemovePending}\n className=\"text-red-600 focus:text-red-600 dark:text-red-400 dark:focus:text-red-400\"\n >\n <IconTrash size={14} className=\"mr-2\" />\n Remove from list\n </DropdownMenuItem>\n ) : isArchived ? (\n <DropdownMenuItem onSelect={handleUnarchive}>\n <IconEye size={14} className=\"mr-2\" />\n Restore to list\n </DropdownMenuItem>\n ) : (\n <DropdownMenuItem onSelect={handleArchive}>\n <IconEyeOff size={14} className=\"mr-2\" />\n Hide from list\n </DropdownMenuItem>\n )}\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n </div>\n </div>\n <Dialog open={editOpen} onOpenChange={setEditOpen}>\n <DialogContent>\n <DialogHeader>\n <DialogTitle>Edit app details</DialogTitle>\n </DialogHeader>\n <form className=\"space-y-4\" onSubmit={handleMetadataSubmit}>\n <div className=\"space-y-2\">\n <Label htmlFor={`app-name-${app.id}`}>Name</Label>\n <Input\n id={`app-name-${app.id}`}\n value={draftName}\n maxLength={120}\n onChange={(event) => setDraftName(event.target.value)}\n />\n </div>\n <div className=\"space-y-2\">\n <Label htmlFor={`app-description-${app.id}`}>Description</Label>\n <Textarea\n id={`app-description-${app.id}`}\n value={draftDescription}\n maxLength={500}\n rows={4}\n onChange={(event) => setDraftDescription(event.target.value)}\n />\n </div>\n <DialogFooter>\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => setEditOpen(false)}\n >\n Cancel\n </Button>\n <Button type=\"submit\" disabled={updateMetadata.isPending}>\n {updateMetadata.isPending ? \"Saving...\" : \"Save\"}\n </Button>\n </DialogFooter>\n </form>\n </DialogContent>\n </Dialog>\n </div>\n );\n}\n\nfunction AppResourcesDialog({ app }: { app: WorkspaceAppSummary }) {\n const [open, setOpen] = useState(false);\n const [inspectedResourceId, setInspectedResourceId] = useState<string | null>(\n null,\n );\n const query = useActionQuery(\n \"list-workspace-resources-for-app\",\n { appId: app.id },\n { enabled: open },\n );\n const { data, isLoading } = query;\n\n const resources = ((data as any)?.resources ?? []) as any[];\n const counts = (data as any)?.counts;\n\n return (\n <Dialog\n open={open}\n onOpenChange={(nextOpen) => {\n setOpen(nextOpen);\n if (!nextOpen) setInspectedResourceId(null);\n }}\n >\n <Tooltip>\n <TooltipTrigger asChild>\n <DialogTrigger asChild>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n aria-label={`View agent resources for ${app.name}`}\n className={APP_CARD_ACTION_CLASS}\n onClick={(e) => e.stopPropagation()}\n >\n <IconFileText size={14} />\n </Button>\n </DialogTrigger>\n </TooltipTrigger>\n <TooltipContent>View agent resources</TooltipContent>\n </Tooltip>\n <DialogContent className=\"max-w-2xl\">\n <DialogHeader>\n <DialogTitle>{app.name} agent resources</DialogTitle>\n <DialogDescription>\n Workspace-scope agent resources are inherited at runtime. App shared\n and personal resources can override them locally.\n </DialogDescription>\n </DialogHeader>\n <div className=\"space-y-4\">\n <div className=\"rounded-lg border bg-muted/30 px-3 py-2 text-xs leading-relaxed text-muted-foreground\">\n All-app agent resources live once at workspace scope and are read by\n each app agent when it builds context. Nothing is copied into this\n app.\n </div>\n\n <div className=\"flex flex-wrap items-center gap-2\">\n <Badge variant=\"secondary\">{counts?.total ?? 0} total</Badge>\n <Badge variant=\"outline\">\n {counts?.workspace ?? counts?.global ?? 0} workspace\n </Badge>\n <Badge variant=\"outline\">{counts?.granted ?? 0} granted</Badge>\n <Badge variant=\"outline\">\n {counts?.autoLoaded ?? 0} auto-loaded\n </Badge>\n </div>\n\n {query.isError ? (\n <ActionQueryError\n error={query.error}\n onRetry={() => void query.refetch()}\n />\n ) : isLoading ? (\n <div className=\"space-y-2\">\n <div className=\"h-14 rounded-lg border bg-muted/30\" />\n <div className=\"h-14 rounded-lg border bg-muted/30\" />\n <div className=\"h-14 rounded-lg border bg-muted/30\" />\n </div>\n ) : resources.length === 0 ? (\n <div className=\"rounded-lg border border-dashed px-4 py-8 text-center text-sm text-muted-foreground\">\n No workspace or granted resources are visible to this app yet.\n </div>\n ) : (\n <div className=\"max-h-[420px] space-y-2 overflow-y-auto pr-1\">\n {resources.map((resource) => {\n const inspected = inspectedResourceId === resource.id;\n return (\n <div\n key={resource.id}\n className=\"rounded-lg border px-3 py-3\"\n >\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"min-w-0\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <span className=\"text-sm font-medium text-foreground\">\n {resource.name}\n </span>\n <Badge variant=\"secondary\">{resource.kind}</Badge>\n <Badge variant=\"outline\">\n {resource.source === \"workspace\"\n ? \"All apps\"\n : \"Granted\"}\n </Badge>\n {resource.autoLoaded ? (\n <Badge variant=\"outline\">Auto-loaded</Badge>\n ) : null}\n </div>\n <div className=\"mt-1 truncate font-mono text-xs text-muted-foreground\">\n {resource.path}\n </div>\n </div>\n <div className=\"flex shrink-0 flex-col items-end gap-2\">\n {resource.source === \"grant\" ? (\n <div className=\"text-right text-[11px] text-muted-foreground\">\n Selected grant\n </div>\n ) : null}\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-7 px-2 text-xs\"\n onClick={(event) => {\n event.stopPropagation();\n setInspectedResourceId(\n inspected ? null : resource.id,\n );\n }}\n >\n {inspected ? (\n <IconChevronDown size={14} className=\"mr-1\" />\n ) : (\n <IconChevronRight size={14} className=\"mr-1\" />\n )}\n Stack\n </Button>\n </div>\n </div>\n\n {resource.description ? (\n <p className=\"mt-2 line-clamp-2 text-xs text-muted-foreground\">\n {resource.description}\n </p>\n ) : null}\n\n {inspected ? (\n <AppResourceEffectiveStack\n appId={app.id}\n resource={resource}\n />\n ) : null}\n </div>\n );\n })}\n </div>\n )}\n </div>\n <DialogFooter>\n <Button type=\"button\" onClick={() => setOpen(false)}>\n Done\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n}\n\nfunction stringifyError(err: unknown): string {\n if (err instanceof Error) return err.message;\n return String(err);\n}\n"]}
|
|
@@ -84,7 +84,7 @@ export function WorkspaceTemplateCard({ template, defaultAppId, labels: labelOve
|
|
|
84
84
|
appId: trimmedAppId,
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
|
-
return (_jsxs(Card, { className: cn("flex h-full flex-col
|
|
87
|
+
return (_jsxs(Card, { className: cn("flex h-full flex-col bg-card/40 shadow-none transition-[background-color] hover:bg-accent/15", className), children: [_jsx(CardHeader, { className: "gap-2 p-4", children: _jsxs("div", { className: "flex items-start justify-between gap-3", children: [_jsxs("div", { className: "flex min-w-0 items-start gap-2.5", children: [_jsx("span", { className: "mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-md bg-muted/40 text-muted-foreground", children: _jsx(IconFileText, { size: 16 }) }), _jsxs("div", { className: "min-w-0", children: [_jsx(CardTitle, { className: "truncate text-sm font-semibold", children: template.name }), template.source || template.sourceDescription ? (_jsxs(CardDescription, { className: "mt-1 truncate text-xs", children: [_jsxs("span", { className: "font-medium text-foreground/70", children: [labels.source, ":"] }), " ", template.sourceDescription || template.source] })) : null] })] }), isInstalled ? (_jsxs(Badge, { variant: "outline", className: "shrink-0 gap-1 border-primary/30 bg-primary/5 text-primary", children: [_jsx(IconCircleCheck, { size: 13 }), labels.installed] })) : null] }) }), _jsxs(CardContent, { className: "flex flex-1 flex-col gap-3 p-4 pt-0", children: [template.description ? (_jsx("p", { className: "line-clamp-3 text-[13px] leading-5 text-muted-foreground", children: template.description })) : null, setupNote ? (_jsxs(Alert, { className: "border-border/60 bg-muted/25 px-3 py-2 [&>svg]:left-3 [&>svg]:top-2.5", children: [_jsx(IconPlugConnected, { size: 15 }), _jsxs(AlertDescription, { className: "text-xs leading-5", children: [_jsxs("span", { className: "font-medium text-foreground/80", children: [labels.integrationSetup, ":"] }), " ", setupNote] })] })) : null] }), _jsxs(CardFooter, { className: "flex flex-wrap justify-between gap-2 p-4 pt-0", children: [liveUrl ? (_jsx(Button, { variant: "link", size: "sm", className: "h-8 px-0", asChild: true, children: _jsxs("a", { href: liveUrl, target: "_blank", rel: "noreferrer", children: [labels.viewLiveApp, _jsx(IconExternalLink, {})] }) })) : (_jsx("span", {})), _jsxs(Dialog, { open: open, onOpenChange: (nextOpen) => {
|
|
88
88
|
if (!remix.isPending)
|
|
89
89
|
setOpen(nextOpen);
|
|
90
90
|
}, children: [_jsx(DialogTrigger, { asChild: true, children: _jsxs(Button, { type: "button", size: "sm", children: [_jsx(IconCopy, {}), labels.remix] }) }), _jsxs(DialogContent, { className: "max-w-md", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: template.name }), _jsx(DialogDescription, { children: labels.appIdDescription })] }), _jsxs("form", { className: "flex flex-col gap-4", onSubmit: (event) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-template-card.js","sourceRoot":"","sources":["../../src/components/workspace-template-card.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,IAAI,EACJ,WAAW,EACX,eAAe,EACf,UAAU,EACV,UAAU,EACV,SAAS,GACV,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAuCvC,MAAM,cAAc,GAA4B;IAC9C,KAAK,EAAE,QAAQ;IACf,gBAAgB,EAAE,mDAAmD;IACrE,MAAM,EAAE,QAAQ;IAChB,gBAAgB,EAAE,mBAAmB;IACrC,SAAS,EAAE,WAAW;IACtB,KAAK,EAAE,sBAAsB;IAC7B,QAAQ,EAAE,WAAW;IACrB,YAAY,EAAE,uCAAuC;IACrD,UAAU,EAAE,+BAA+B;IAC3C,aAAa,EAAE,qBAAqB;I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C;AAED,MAAM,UAAU,yBAAyB,CAAC,EACxC,SAAS,EAAE,MAAM,EACjB,KAAK,EACL,YAAY,EACZ,MAAM,EACN,SAAS,EACT,aAAa,EACb,cAAc,GACiB;IAC/B,MAAM,SAAS,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAE3C,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAExC,OAAO,CACL,mBAAS,SAAS,EAAE,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,aACrD,KAAK,CAAC,CAAC,CAAC,cAAK,SAAS,EAAC,uBAAuB,YAAE,KAAK,GAAO,CAAC,CAAC,CAAC,IAAI,EACpE,cAAK,SAAS,EAAC,2BAA2B,YACvC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAC3B,KAAC,qBAAqB,IAEpB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,aAAa,EACxB,cAAc,EAAE,cAAc,IALzB,aAAa,CAAC,QAAQ,CAAC,CAM5B,CACH,CAAC,GACE,IACE,CACX,CAAC;AACJ,CAAC","sourcesContent":["import { useActionMutation } from \"@agent-native/core/client/hooks\";\nimport {\n IconArrowUpRight,\n IconCircleCheck,\n IconCopy,\n IconExternalLink,\n IconFileText,\n IconPlugConnected,\n} from \"@tabler/icons-react\";\nimport { useEffect, useMemo, useState, type ReactNode } from \"react\";\nimport { toast } from \"sonner\";\n\nimport { cn } from \"../lib/utils\";\nimport { Alert, AlertDescription } from \"./ui/alert\";\nimport { Badge } from \"./ui/badge\";\nimport { Button } from \"./ui/button\";\nimport {\n Card,\n CardContent,\n CardDescription,\n CardFooter,\n CardHeader,\n CardTitle,\n} from \"./ui/card\";\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n DialogTrigger,\n} from \"./ui/dialog\";\nimport { Input } from \"./ui/input\";\nimport { Label } from \"./ui/label\";\nimport { Spinner } from \"./ui/spinner\";\n\nexport interface CuratedWorkspaceTemplate {\n id?: string | null;\n templateId?: string | null;\n appId?: string | null;\n name: string;\n description?: string | null;\n source?: string | null;\n sourceDescription?: string | null;\n integrationSetup?: string | null;\n setupNote?: string | null;\n installed?: boolean | null;\n installedAppId?: string | null;\n liveUrl?: string | null;\n productUrl?: string | null;\n}\n\nexport type CuratedWorkspaceTemplatesResult =\n | CuratedWorkspaceTemplate[]\n | {\n templates: CuratedWorkspaceTemplate[];\n };\n\nexport interface WorkspaceTemplateLabels {\n appId: string;\n appIdDescription: string;\n cancel: string;\n integrationSetup: string;\n installed: string;\n remix: string;\n remixing: string;\n remixSuccess: string;\n remixError: string;\n appIdRequired: string;\n source: string;\n viewLiveApp: string;\n}\n\nconst DEFAULT_LABELS: WorkspaceTemplateLabels = {\n appId: \"App ID\",\n appIdDescription: \"Choose the URL-safe id for the new workspace app.\",\n cancel: \"Cancel\",\n integrationSetup: \"Integration setup\",\n installed: \"Installed\",\n remix: \"Remix into workspace\",\n remixing: \"Remixing…\",\n remixSuccess: \"Template remixed into your workspace.\",\n remixError: \"Could not remix this template\",\n appIdRequired: \"App ID is required.\",\n source: \"Source\",\n viewLiveApp: \"View the live app\",\n};\n\nexport interface WorkspaceTemplateCardProps {\n template: CuratedWorkspaceTemplate;\n defaultAppId?: string;\n labels?: Partial<WorkspaceTemplateLabels>;\n className?: string;\n onRemixSuccess?: (\n result: unknown,\n template: CuratedWorkspaceTemplate,\n ) => void;\n}\n\nfunction slugifyAppId(value: string): string {\n return (\n value\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\")\n .slice(0, 48) || \"new-app\"\n );\n}\n\nfunction templateIdFor(template: CuratedWorkspaceTemplate): string {\n return template.templateId || template.id || template.appId || template.name;\n}\n\nfunction defaultAppIdFor(\n template: CuratedWorkspaceTemplate,\n defaultAppId?: string,\n): string {\n if (defaultAppId) return slugifyAppId(defaultAppId);\n const sourceId = slugifyAppId(template.appId || template.name);\n return `${sourceId}-remix`;\n}\n\nfunction stringifyError(error: unknown): string {\n if (error instanceof Error && error.message) return error.message;\n if (typeof error === \"string\") return error;\n return \"Unknown error\";\n}\n\nfunction mergeLabels(\n labels?: Partial<WorkspaceTemplateLabels>,\n): WorkspaceTemplateLabels {\n return { ...DEFAULT_LABELS, ...labels };\n}\n\nexport function WorkspaceTemplateCard({\n template,\n defaultAppId,\n labels: labelOverrides,\n className,\n onRemixSuccess,\n}: WorkspaceTemplateCardProps) {\n const labels = useMemo(() => mergeLabels(labelOverrides), [labelOverrides]);\n const [open, setOpen] = useState(false);\n const [appId, setAppId] = useState(() =>\n defaultAppIdFor(template, defaultAppId),\n );\n const isInstalled = Boolean(template.installed || template.installedAppId);\n const liveUrl = template.liveUrl || template.productUrl;\n const setupNote = template.integrationSetup || template.setupNote;\n const remix = useActionMutation(\"remix-workspace-template\", {\n onSuccess: (result) => {\n toast.success(labels.remixSuccess);\n setOpen(false);\n onRemixSuccess?.(result, template);\n },\n onError: (error) =>\n toast.error(`${labels.remixError}: ${stringifyError(error)}`),\n });\n\n useEffect(() => {\n if (open) {\n setAppId(defaultAppIdFor(template, defaultAppId));\n }\n }, [defaultAppId, open, template]);\n\n function submitRemix() {\n const trimmedAppId = appId.trim();\n if (!trimmedAppId) {\n toast.error(labels.appIdRequired);\n return;\n }\n\n remix.mutate({\n templateId: templateIdFor(template),\n appId: trimmedAppId,\n });\n }\n\n return (\n <Card\n className={cn(\n \"flex h-full flex-col border-border/60 bg-card/40 shadow-none transition-[background-color,border-color] hover:border-foreground/20 hover:bg-accent/15\",\n className,\n )}\n >\n <CardHeader className=\"gap-2 p-4\">\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"flex min-w-0 items-start gap-2.5\">\n <span className=\"mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-md border border-border/70 bg-muted/40 text-muted-foreground\">\n <IconFileText size={16} />\n </span>\n <div className=\"min-w-0\">\n <CardTitle className=\"truncate text-sm font-semibold\">\n {template.name}\n </CardTitle>\n {template.source || template.sourceDescription ? (\n <CardDescription className=\"mt-1 truncate text-xs\">\n <span className=\"font-medium text-foreground/70\">\n {labels.source}:\n </span>{\" \"}\n {template.sourceDescription || template.source}\n </CardDescription>\n ) : null}\n </div>\n </div>\n {isInstalled ? (\n <Badge\n variant=\"outline\"\n className=\"shrink-0 gap-1 border-primary/30 bg-primary/5 text-primary\"\n >\n <IconCircleCheck size={13} />\n {labels.installed}\n </Badge>\n ) : null}\n </div>\n </CardHeader>\n\n <CardContent className=\"flex flex-1 flex-col gap-3 p-4 pt-0\">\n {template.description ? (\n <p className=\"line-clamp-3 text-[13px] leading-5 text-muted-foreground\">\n {template.description}\n </p>\n ) : null}\n\n {setupNote ? (\n <Alert className=\"border-border/60 bg-muted/25 px-3 py-2 [&>svg]:left-3 [&>svg]:top-2.5\">\n <IconPlugConnected size={15} />\n <AlertDescription className=\"text-xs leading-5\">\n <span className=\"font-medium text-foreground/80\">\n {labels.integrationSetup}:\n </span>{\" \"}\n {setupNote}\n </AlertDescription>\n </Alert>\n ) : null}\n </CardContent>\n\n <CardFooter className=\"flex flex-wrap justify-between gap-2 p-4 pt-0\">\n {liveUrl ? (\n <Button variant=\"link\" size=\"sm\" className=\"h-8 px-0\" asChild>\n <a href={liveUrl} target=\"_blank\" rel=\"noreferrer\">\n {labels.viewLiveApp}\n <IconExternalLink />\n </a>\n </Button>\n ) : (\n <span />\n )}\n\n <Dialog\n open={open}\n onOpenChange={(nextOpen) => {\n if (!remix.isPending) setOpen(nextOpen);\n }}\n >\n <DialogTrigger asChild>\n <Button type=\"button\" size=\"sm\">\n <IconCopy />\n {labels.remix}\n </Button>\n </DialogTrigger>\n <DialogContent className=\"max-w-md\">\n <DialogHeader>\n <DialogTitle>{template.name}</DialogTitle>\n <DialogDescription>{labels.appIdDescription}</DialogDescription>\n </DialogHeader>\n <form\n className=\"flex flex-col gap-4\"\n onSubmit={(event) => {\n event.preventDefault();\n submitRemix();\n }}\n >\n <div className=\"flex flex-col gap-2\">\n <Label\n htmlFor={`workspace-template-app-id-${templateIdFor(template)}`}\n >\n {labels.appId}\n </Label>\n <Input\n id={`workspace-template-app-id-${templateIdFor(template)}`}\n value={appId}\n autoComplete=\"off\"\n onChange={(event) => setAppId(event.target.value)}\n disabled={remix.isPending}\n />\n </div>\n <DialogFooter>\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => setOpen(false)}\n disabled={remix.isPending}\n >\n {labels.cancel}\n </Button>\n <Button type=\"submit\" disabled={remix.isPending}>\n {remix.isPending ? <Spinner /> : <IconArrowUpRight />}\n {remix.isPending ? labels.remixing : labels.remix}\n </Button>\n </DialogFooter>\n </form>\n </DialogContent>\n </Dialog>\n </CardFooter>\n </Card>\n );\n}\n\nexport interface WorkspaceTemplatesSectionProps {\n templates: CuratedWorkspaceTemplatesResult;\n title?: ReactNode;\n defaultAppId?: string;\n labels?: Partial<WorkspaceTemplateLabels>;\n className?: string;\n cardClassName?: string;\n onRemixSuccess?: (\n result: unknown,\n template: CuratedWorkspaceTemplate,\n ) => void;\n}\n\nfunction getTemplateItems(\n result: CuratedWorkspaceTemplatesResult,\n): CuratedWorkspaceTemplate[] {\n return Array.isArray(result) ? result : result.templates;\n}\n\nexport function WorkspaceTemplatesSection({\n templates: result,\n title,\n defaultAppId,\n labels,\n className,\n cardClassName,\n onRemixSuccess,\n}: WorkspaceTemplatesSectionProps) {\n const templates = getTemplateItems(result);\n\n if (templates.length === 0) return null;\n\n return (\n <section className={cn(\"flex flex-col gap-3\", className)}>\n {title ? <div className=\"text-sm font-semibold\">{title}</div> : null}\n <div className=\"grid gap-3 md:grid-cols-2\">\n {templates.map((template) => (\n <WorkspaceTemplateCard\n key={templateIdFor(template)}\n template={template}\n defaultAppId={defaultAppId}\n labels={labels}\n className={cardClassName}\n onRemixSuccess={onRemixSuccess}\n />\n ))}\n </div>\n </section>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"workspace-template-card.js","sourceRoot":"","sources":["../../src/components/workspace-template-card.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,IAAI,EACJ,WAAW,EACX,eAAe,EACf,UAAU,EACV,UAAU,EACV,SAAS,GACV,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAuCvC,MAAM,cAAc,GAA4B;IAC9C,KAAK,EAAE,QAAQ;IACf,gBAAgB,EAAE,mDAAmD;IACrE,MAAM,EAAE,QAAQ;IAChB,gBAAgB,EAAE,mBAAmB;IACrC,SAAS,EAAE,WAAW;IACtB,KAAK,EAAE,sBAAsB;IAC7B,QAAQ,EAAE,WAAW;IACrB,YAAY,EAAE,uCAAuC;IACrD,UAAU,EAAE,+BAA+B;IAC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SAAS,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,EACxC,SAAS,EAAE,MAAM,EACjB,KAAK,EACL,YAAY,EACZ,MAAM,EACN,SAAS,EACT,aAAa,EACb,cAAc,GACiB;IAC/B,MAAM,SAAS,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAE3C,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAExC,OAAO,CACL,mBAAS,SAAS,EAAE,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,aACrD,KAAK,CAAC,CAAC,CAAC,cAAK,SAAS,EAAC,uBAAuB,YAAE,KAAK,GAAO,CAAC,CAAC,CAAC,IAAI,EACpE,cAAK,SAAS,EAAC,2BAA2B,YACvC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAC3B,KAAC,qBAAqB,IAEpB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,aAAa,EACxB,cAAc,EAAE,cAAc,IALzB,aAAa,CAAC,QAAQ,CAAC,CAM5B,CACH,CAAC,GACE,IACE,CACX,CAAC;AACJ,CAAC","sourcesContent":["import { useActionMutation } from \"@agent-native/core/client/hooks\";\nimport {\n IconArrowUpRight,\n IconCircleCheck,\n IconCopy,\n IconExternalLink,\n IconFileText,\n IconPlugConnected,\n} from \"@tabler/icons-react\";\nimport { useEffect, useMemo, useState, type ReactNode } from \"react\";\nimport { toast } from \"sonner\";\n\nimport { cn } from \"../lib/utils\";\nimport { Alert, AlertDescription } from \"./ui/alert\";\nimport { Badge } from \"./ui/badge\";\nimport { Button } from \"./ui/button\";\nimport {\n Card,\n CardContent,\n CardDescription,\n CardFooter,\n CardHeader,\n CardTitle,\n} from \"./ui/card\";\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n DialogTrigger,\n} from \"./ui/dialog\";\nimport { Input } from \"./ui/input\";\nimport { Label } from \"./ui/label\";\nimport { Spinner } from \"./ui/spinner\";\n\nexport interface CuratedWorkspaceTemplate {\n id?: string | null;\n templateId?: string | null;\n appId?: string | null;\n name: string;\n description?: string | null;\n source?: string | null;\n sourceDescription?: string | null;\n integrationSetup?: string | null;\n setupNote?: string | null;\n installed?: boolean | null;\n installedAppId?: string | null;\n liveUrl?: string | null;\n productUrl?: string | null;\n}\n\nexport type CuratedWorkspaceTemplatesResult =\n | CuratedWorkspaceTemplate[]\n | {\n templates: CuratedWorkspaceTemplate[];\n };\n\nexport interface WorkspaceTemplateLabels {\n appId: string;\n appIdDescription: string;\n cancel: string;\n integrationSetup: string;\n installed: string;\n remix: string;\n remixing: string;\n remixSuccess: string;\n remixError: string;\n appIdRequired: string;\n source: string;\n viewLiveApp: string;\n}\n\nconst DEFAULT_LABELS: WorkspaceTemplateLabels = {\n appId: \"App ID\",\n appIdDescription: \"Choose the URL-safe id for the new workspace app.\",\n cancel: \"Cancel\",\n integrationSetup: \"Integration setup\",\n installed: \"Installed\",\n remix: \"Remix into workspace\",\n remixing: \"Remixing…\",\n remixSuccess: \"Template remixed into your workspace.\",\n remixError: \"Could not remix this template\",\n appIdRequired: \"App ID is required.\",\n source: \"Source\",\n viewLiveApp: \"View the live app\",\n};\n\nexport interface WorkspaceTemplateCardProps {\n template: CuratedWorkspaceTemplate;\n defaultAppId?: string;\n labels?: Partial<WorkspaceTemplateLabels>;\n className?: string;\n onRemixSuccess?: (\n result: unknown,\n template: CuratedWorkspaceTemplate,\n ) => void;\n}\n\nfunction slugifyAppId(value: string): string {\n return (\n value\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\")\n .slice(0, 48) || \"new-app\"\n );\n}\n\nfunction templateIdFor(template: CuratedWorkspaceTemplate): string {\n return template.templateId || template.id || template.appId || template.name;\n}\n\nfunction defaultAppIdFor(\n template: CuratedWorkspaceTemplate,\n defaultAppId?: string,\n): string {\n if (defaultAppId) return slugifyAppId(defaultAppId);\n const sourceId = slugifyAppId(template.appId || template.name);\n return `${sourceId}-remix`;\n}\n\nfunction stringifyError(error: unknown): string {\n if (error instanceof Error && error.message) return error.message;\n if (typeof error === \"string\") return error;\n return \"Unknown error\";\n}\n\nfunction mergeLabels(\n labels?: Partial<WorkspaceTemplateLabels>,\n): WorkspaceTemplateLabels {\n return { ...DEFAULT_LABELS, ...labels };\n}\n\nexport function WorkspaceTemplateCard({\n template,\n defaultAppId,\n labels: labelOverrides,\n className,\n onRemixSuccess,\n}: WorkspaceTemplateCardProps) {\n const labels = useMemo(() => mergeLabels(labelOverrides), [labelOverrides]);\n const [open, setOpen] = useState(false);\n const [appId, setAppId] = useState(() =>\n defaultAppIdFor(template, defaultAppId),\n );\n const isInstalled = Boolean(template.installed || template.installedAppId);\n const liveUrl = template.liveUrl || template.productUrl;\n const setupNote = template.integrationSetup || template.setupNote;\n const remix = useActionMutation(\"remix-workspace-template\", {\n onSuccess: (result) => {\n toast.success(labels.remixSuccess);\n setOpen(false);\n onRemixSuccess?.(result, template);\n },\n onError: (error) =>\n toast.error(`${labels.remixError}: ${stringifyError(error)}`),\n });\n\n useEffect(() => {\n if (open) {\n setAppId(defaultAppIdFor(template, defaultAppId));\n }\n }, [defaultAppId, open, template]);\n\n function submitRemix() {\n const trimmedAppId = appId.trim();\n if (!trimmedAppId) {\n toast.error(labels.appIdRequired);\n return;\n }\n\n remix.mutate({\n templateId: templateIdFor(template),\n appId: trimmedAppId,\n });\n }\n\n return (\n <Card\n className={cn(\n \"flex h-full flex-col bg-card/40 shadow-none transition-[background-color] hover:bg-accent/15\",\n className,\n )}\n >\n <CardHeader className=\"gap-2 p-4\">\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"flex min-w-0 items-start gap-2.5\">\n <span className=\"mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-md bg-muted/40 text-muted-foreground\">\n <IconFileText size={16} />\n </span>\n <div className=\"min-w-0\">\n <CardTitle className=\"truncate text-sm font-semibold\">\n {template.name}\n </CardTitle>\n {template.source || template.sourceDescription ? (\n <CardDescription className=\"mt-1 truncate text-xs\">\n <span className=\"font-medium text-foreground/70\">\n {labels.source}:\n </span>{\" \"}\n {template.sourceDescription || template.source}\n </CardDescription>\n ) : null}\n </div>\n </div>\n {isInstalled ? (\n <Badge\n variant=\"outline\"\n className=\"shrink-0 gap-1 border-primary/30 bg-primary/5 text-primary\"\n >\n <IconCircleCheck size={13} />\n {labels.installed}\n </Badge>\n ) : null}\n </div>\n </CardHeader>\n\n <CardContent className=\"flex flex-1 flex-col gap-3 p-4 pt-0\">\n {template.description ? (\n <p className=\"line-clamp-3 text-[13px] leading-5 text-muted-foreground\">\n {template.description}\n </p>\n ) : null}\n\n {setupNote ? (\n <Alert className=\"border-border/60 bg-muted/25 px-3 py-2 [&>svg]:left-3 [&>svg]:top-2.5\">\n <IconPlugConnected size={15} />\n <AlertDescription className=\"text-xs leading-5\">\n <span className=\"font-medium text-foreground/80\">\n {labels.integrationSetup}:\n </span>{\" \"}\n {setupNote}\n </AlertDescription>\n </Alert>\n ) : null}\n </CardContent>\n\n <CardFooter className=\"flex flex-wrap justify-between gap-2 p-4 pt-0\">\n {liveUrl ? (\n <Button variant=\"link\" size=\"sm\" className=\"h-8 px-0\" asChild>\n <a href={liveUrl} target=\"_blank\" rel=\"noreferrer\">\n {labels.viewLiveApp}\n <IconExternalLink />\n </a>\n </Button>\n ) : (\n <span />\n )}\n\n <Dialog\n open={open}\n onOpenChange={(nextOpen) => {\n if (!remix.isPending) setOpen(nextOpen);\n }}\n >\n <DialogTrigger asChild>\n <Button type=\"button\" size=\"sm\">\n <IconCopy />\n {labels.remix}\n </Button>\n </DialogTrigger>\n <DialogContent className=\"max-w-md\">\n <DialogHeader>\n <DialogTitle>{template.name}</DialogTitle>\n <DialogDescription>{labels.appIdDescription}</DialogDescription>\n </DialogHeader>\n <form\n className=\"flex flex-col gap-4\"\n onSubmit={(event) => {\n event.preventDefault();\n submitRemix();\n }}\n >\n <div className=\"flex flex-col gap-2\">\n <Label\n htmlFor={`workspace-template-app-id-${templateIdFor(template)}`}\n >\n {labels.appId}\n </Label>\n <Input\n id={`workspace-template-app-id-${templateIdFor(template)}`}\n value={appId}\n autoComplete=\"off\"\n onChange={(event) => setAppId(event.target.value)}\n disabled={remix.isPending}\n />\n </div>\n <DialogFooter>\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => setOpen(false)}\n disabled={remix.isPending}\n >\n {labels.cancel}\n </Button>\n <Button type=\"submit\" disabled={remix.isPending}>\n {remix.isPending ? <Spinner /> : <IconArrowUpRight />}\n {remix.isPending ? labels.remixing : labels.remix}\n </Button>\n </DialogFooter>\n </form>\n </DialogContent>\n </Dialog>\n </CardFooter>\n </Card>\n );\n}\n\nexport interface WorkspaceTemplatesSectionProps {\n templates: CuratedWorkspaceTemplatesResult;\n title?: ReactNode;\n defaultAppId?: string;\n labels?: Partial<WorkspaceTemplateLabels>;\n className?: string;\n cardClassName?: string;\n onRemixSuccess?: (\n result: unknown,\n template: CuratedWorkspaceTemplate,\n ) => void;\n}\n\nfunction getTemplateItems(\n result: CuratedWorkspaceTemplatesResult,\n): CuratedWorkspaceTemplate[] {\n return Array.isArray(result) ? result : result.templates;\n}\n\nexport function WorkspaceTemplatesSection({\n templates: result,\n title,\n defaultAppId,\n labels,\n className,\n cardClassName,\n onRemixSuccess,\n}: WorkspaceTemplatesSectionProps) {\n const templates = getTemplateItems(result);\n\n if (templates.length === 0) return null;\n\n return (\n <section className={cn(\"flex flex-col gap-3\", className)}>\n {title ? <div className=\"text-sm font-semibold\">{title}</div> : null}\n <div className=\"grid gap-3 md:grid-cols-2\">\n {templates.map((template) => (\n <WorkspaceTemplateCard\n key={templateIdFor(template)}\n template={template}\n defaultAppId={defaultAppId}\n labels={labels}\n className={cardClassName}\n onRemixSuccess={onRemixSuccess}\n />\n ))}\n </div>\n </section>\n );\n}\n"]}
|
|
@@ -106,7 +106,7 @@ export default function WorkspaceAppCatchAllRoute() {
|
|
|
106
106
|
if ((isLoading && !app) || (app && app.status !== "pending" && href)) {
|
|
107
107
|
return (_jsx("div", { className: "flex h-screen w-full items-center justify-center", children: _jsx(Spinner, { className: "size-8" }) }));
|
|
108
108
|
}
|
|
109
|
-
return (_jsx(DispatchShell, { title: app?.name || t("dispatch.pages.pageNotFound"), description: t("dispatch.pages.pageNotFoundDescription"), children: _jsxs("div", { className: "max-w-2xl rounded-lg
|
|
109
|
+
return (_jsx(DispatchShell, { title: app?.name || t("dispatch.pages.pageNotFound"), description: t("dispatch.pages.pageNotFoundDescription"), children: _jsxs("div", { className: "max-w-2xl rounded-lg bg-card p-5", children: [_jsx(Button, { asChild: true, size: "sm", variant: "ghost", className: "-ml-2 mb-4", children: _jsxs(Link, { to: appPath("/overview"), children: [_jsx(IconArrowLeft, { size: 15, className: "mr-1.5" }), t("dispatch.nav.overview")] }) }), app?.status === "pending" ? (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("h2", { className: "text-base font-semibold text-foreground", children: app.name }), _jsxs(Badge, { variant: "outline", className: "gap-1 border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300", children: [_jsx(IconClockHour4, { size: 12 }), t("dispatch.pages.building")] })] }), _jsxs("p", { className: "text-sm text-muted-foreground", children: [t("dispatch.pages.appBuildingPrefix"), " ", _jsx("span", { className: "font-mono text-foreground", children: app.path }), " ", t("dispatch.pages.appBuildingSuffix")] }), app.branchName ? (_jsx("p", { className: "text-xs text-muted-foreground", children: t("dispatch.pages.branch", { branch: app.branchName }) })) : null, app.builderUrl ? (_jsx(Button, { asChild: true, children: _jsxs("a", { href: withBuilderUtmTrackingParams(app.builderUrl, {
|
|
110
110
|
campaign: "product",
|
|
111
111
|
content: "dispatch_branch",
|
|
112
112
|
}), target: "_blank", rel: "noreferrer", children: [t("dispatch.pages.openBuilderBranch"), _jsx(IconArrowUpRight, { size: 15, className: "ml-1.5" })] }) })) : null] })) : (_jsxs("div", { className: "space-y-3", children: [_jsx("h2", { className: "text-base font-semibold text-foreground", children: t("dispatch.pages.pageNotFound") }), _jsxs("p", { className: "text-sm text-muted-foreground", children: [_jsxs("span", { className: "font-mono text-foreground", children: ["/", appId] }), " isn't", t("dispatch.pages.notDispatchOrWorkspaceApp")] }), _jsx(Button, { asChild: true, children: _jsx(Link, { to: appPath("/apps"), children: t("dispatch.pages.browseApps") }) })] }))] }) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"$appId.js","sourceRoot":"","sources":["../../../src/routes/pages/$appId.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EAAE,4BAA4B,EAAE,MAAM,iDAAiD,CAAC;AAC/F,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,SAAS,GAGV,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EACL,gBAAgB,GAEjB,MAAM,0BAA0B,CAAC;AAElC,MAAM,UAAU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CAAC,CAAC,CAAC,CAChB,YAAG,SAAS,EAAC,+BAA+B,YACzC,CAAC,CAAC,uBAAuB,EAAE,EAAE,MAAM,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC,GACrD,CACL,CAAC,CAAC,CAAC,IAAI,EACP,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAChB,KAAC,MAAM,IAAC,OAAO,kBACb,aACE,IAAI,EAAE,4BAA4B,CAAC,GAAG,CAAC,UAAU,EAAE;oCACjD,QAAQ,EAAE,SAAS;oCACnB,OAAO,EAAE,iBAAiB;iCAC3B,CAAC,EACF,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,YAAY,aAEf,CAAC,CAAC,kCAAkC,CAAC,EACtC,KAAC,gBAAgB,IAAC,IAAI,EAAE,EAAE,EAAE,SAAS,EAAC,QAAQ,GAAG,IAC/C,GACG,CACV,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC,CAAC,CAAC,CACF,eAAK,SAAS,EAAC,WAAW,aACxB,aAAI,SAAS,EAAC,yCAAyC,YACpD,CAAC,CAAC,6BAA6B,CAAC,GAC9B,EACL,aAAG,SAAS,EAAC,+BAA+B,aAC1C,gBAAM,SAAS,EAAC,2BAA2B,kBAAG,KAAK,IAAQ,YAC1D,CAAC,CAAC,0CAA0C,CAAC,IAC5C,EACJ,KAAC,MAAM,IAAC,OAAO,kBACb,KAAC,IAAI,IAAC,EAAE,EAAE,OAAO,CAAC,OAAO,CAAC,YACvB,CAAC,CAAC,2BAA2B,CAAC,GAC1B,GACA,IACL,CACP,IACG,GACQ,CACjB,CAAC;AACJ,CAAC","sourcesContent":["import { appPath } from \"@agent-native/core/client/api-path\";\nimport { useActionQuery } from \"@agent-native/core/client/hooks\";\nimport { useT } from \"@agent-native/core/client/i18n\";\nimport { withBuilderUtmTrackingParams } from \"@agent-native/core/shared/builder-link-tracking\";\nimport {\n IconArrowLeft,\n IconArrowUpRight,\n IconClockHour4,\n} from \"@tabler/icons-react\";\nimport { useEffect, useMemo } from \"react\";\nimport {\n Link,\n Navigate,\n redirect,\n useParams,\n type ClientLoaderFunctionArgs,\n type LoaderFunctionArgs,\n} from \"react-router\";\n\nimport { ActionQueryError } from \"../../components/action-query-error\";\nimport { DispatchShell } from \"../../components/dispatch-shell\";\nimport { Badge } from \"../../components/ui/badge\";\nimport { Button } from \"../../components/ui/button\";\nimport { Spinner } from \"../../components/ui/spinner\";\nimport { resolveServerCatchAllTarget } from \"../../lib/catch-all-target\";\nimport {\n workspaceAppHref,\n type WorkspaceAppSummary,\n} from \"../../lib/workspace-apps\";\n\nexport function meta() {\n return [{ title: \"Workspace app - Dispatch\" }];\n}\n\n/**\n * Catch-all for `/dispatch/<segment>` paths that don't match an explicit\n * Dispatch route. When `<segment>` is the id of a workspace app sibling\n * (e.g. `/dispatch/todo` after Builder.io routes a \"navigate to /todo\"\n * call through Dispatch's mount point), bounce to the absolute `/<appId>`\n * so the user lands on the actual app instead of a 404 inside Dispatch.\n *\n * Server-side redirect: we resolve the workspace app manifest via the\n * shared `loadWorkspaceAppsManifest()` helper, which checks the\n * `AGENT_NATIVE_WORKSPACE_APPS_JSON` env var, then the\n * `.agent-native/workspace-apps.json` file written by `workspace-deploy.ts`,\n * then a live filesystem scan of `apps/` for local dev. We then throw\n * `redirect(\"/<appId>\")`. React Router 7 does not prepend the basename to\n * absolute paths returned from a loader, so the redirect escapes Dispatch's\n * `/dispatch` mount cleanly.\n *\n * Why a catch-all instead of fixing the agent prompt: Builder.io currently\n * resolves \"navigate to /todo\" relative to Dispatch's mount, sending the\n * user to /dispatch/todo. The same wrong path then gets captured as the\n * OAuth callbackURL, so Google sign-in completes back at /dispatch/todo\n * and looks broken. This route fixes both the post-creation navigation\n * and the OAuth round-trip from a single place.\n *\n * Built-in template fallback: when no workspace manifest is available\n * (framework dev with each template on its own port, hosted dispatch with\n * no sibling apps), redirect to the matching first-party template's deploy\n * URL — `http://localhost:<devPort>` in dev, `https://<id>.agent-native.com`\n * in production. Without this, a user visiting `/forms` on dispatch is\n * forced to sign in (auth guard) and then lands on this route's \"Page not\n * found\" pane after the post-login reload.\n *\n * `appId === \"dispatch\"` short-circuit: when the segment matches Dispatch\n * itself (e.g. `/dispatch/dispatch`), we go straight to the overview rather\n * than chaining through `/dispatch` (which polled `useActionQuery` re-fired\n * `window.location.assign` against and looped forever in production).\n */\nfunction dispatchSelfRedirect(appId: string | undefined): string | null {\n if (appId === \"dispatch\") return appPath(\"/overview\");\n return null;\n}\n\nexport async function loader({ params }: LoaderFunctionArgs) {\n const appId = params.appId;\n if (!appId) return null;\n const selfTarget = dispatchSelfRedirect(appId);\n if (selfTarget) throw redirect(selfTarget);\n const target = await resolveServerCatchAllTarget(appId);\n if (target) throw redirect(target);\n return null;\n}\n\nexport async function clientLoader({\n params,\n serverLoader,\n}: ClientLoaderFunctionArgs) {\n const selfTarget = dispatchSelfRedirect(params.appId);\n if (selfTarget) throw redirect(selfTarget);\n // Defer to the server loader so the built-in template fallback runs on\n // SPA navigations too (e.g. clicking a `/<template-id>` link inside\n // dispatch). Without this the client side would only check the workspace\n // apps query, which never lists the static first-party templates and so\n // the user would land on the \"Page not found\" pane.\n return serverLoader();\n}\n\nexport default function WorkspaceAppCatchAllRoute() {\n const t = useT();\n const { appId } = useParams();\n const appsQuery = useActionQuery(\"list-workspace-apps\", {\n includeAgentCards: false,\n });\n const { data: apps = [], isLoading } = appsQuery;\n const app = useMemo(\n () =>\n (apps as WorkspaceAppSummary[]).find((item) => item.id === appId) ?? null,\n [appId, apps],\n );\n const href = app ? workspaceAppHref(app) : null;\n const isSelfReference = appId === \"dispatch\";\n\n useEffect(() => {\n if (isSelfReference) return;\n if (!app || app.status === \"pending\" || !href) return;\n window.location.assign(href);\n }, [app, href, isSelfReference]);\n\n if (isSelfReference) {\n return <Navigate to={appPath(\"/overview\")} replace />;\n }\n\n if (appsQuery.isError) {\n return (\n <DispatchShell\n title={t(\"dispatch.pages.dataLoadFailed\")}\n description={t(\"dispatch.pages.pageNotFoundDescription\")}\n >\n <ActionQueryError\n error={appsQuery.error}\n onRetry={() => void appsQuery.refetch()}\n />\n </DispatchShell>\n );\n }\n\n if ((isLoading && !app) || (app && app.status !== \"pending\" && href)) {\n return (\n <div className=\"flex h-screen w-full items-center justify-center\">\n <Spinner className=\"size-8\" />\n </div>\n );\n }\n\n return (\n <DispatchShell\n title={app?.name || t(\"dispatch.pages.pageNotFound\")}\n description={t(\"dispatch.pages.pageNotFoundDescription\")}\n >\n <div className=\"max-w-2xl rounded-lg border bg-card p-5\">\n <Button asChild size=\"sm\" variant=\"ghost\" className=\"-ml-2 mb-4\">\n <Link to={appPath(\"/overview\")}>\n <IconArrowLeft size={15} className=\"mr-1.5\" />\n {t(\"dispatch.nav.overview\")}\n </Link>\n </Button>\n\n {app?.status === \"pending\" ? (\n <div className=\"space-y-4\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <h2 className=\"text-base font-semibold text-foreground\">\n {app.name}\n </h2>\n <Badge\n variant=\"outline\"\n className=\"gap-1 border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300\"\n >\n <IconClockHour4 size={12} />\n {t(\"dispatch.pages.building\")}\n </Badge>\n </div>\n <p className=\"text-sm text-muted-foreground\">\n {t(\"dispatch.pages.appBuildingPrefix\")}{\" \"}\n <span className=\"font-mono text-foreground\">{app.path}</span>{\" \"}\n {t(\"dispatch.pages.appBuildingSuffix\")}\n </p>\n {app.branchName ? (\n <p className=\"text-xs text-muted-foreground\">\n {t(\"dispatch.pages.branch\", { branch: app.branchName })}\n </p>\n ) : null}\n {app.builderUrl ? (\n <Button asChild>\n <a\n href={withBuilderUtmTrackingParams(app.builderUrl, {\n campaign: \"product\",\n content: \"dispatch_branch\",\n })}\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n {t(\"dispatch.pages.openBuilderBranch\")}\n <IconArrowUpRight size={15} className=\"ml-1.5\" />\n </a>\n </Button>\n ) : null}\n </div>\n ) : (\n <div className=\"space-y-3\">\n <h2 className=\"text-base font-semibold text-foreground\">\n {t(\"dispatch.pages.pageNotFound\")}\n </h2>\n <p className=\"text-sm text-muted-foreground\">\n <span className=\"font-mono text-foreground\">/{appId}</span> isn't\n {t(\"dispatch.pages.notDispatchOrWorkspaceApp\")}\n </p>\n <Button asChild>\n <Link to={appPath(\"/apps\")}>\n {t(\"dispatch.pages.browseApps\")}\n </Link>\n </Button>\n </div>\n )}\n </div>\n </DispatchShell>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"$appId.js","sourceRoot":"","sources":["../../../src/routes/pages/$appId.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EAAE,4BAA4B,EAAE,MAAM,iDAAiD,CAAC;AAC/F,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,SAAS,GAGV,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EACL,gBAAgB,GAEjB,MAAM,0BAA0B,CAAC;AAElC,MAAM,UAAU,IAAI;IAClB,OAAO,CAAC,EAAE,KAAK,EAAE,0BAA0B,EAAE,CAAC,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CAAC,uBAAuB,EAAE,EAAE,MAAM,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC,GACrD,CACL,CAAC,CAAC,CAAC,IAAI,EACP,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAChB,KAAC,MAAM,IAAC,OAAO,kBACb,aACE,IAAI,EAAE,4BAA4B,CAAC,GAAG,CAAC,UAAU,EAAE;oCACjD,QAAQ,EAAE,SAAS;oCACnB,OAAO,EAAE,iBAAiB;iCAC3B,CAAC,EACF,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,YAAY,aAEf,CAAC,CAAC,kCAAkC,CAAC,EACtC,KAAC,gBAAgB,IAAC,IAAI,EAAE,EAAE,EAAE,SAAS,EAAC,QAAQ,GAAG,IAC/C,GACG,CACV,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC,CAAC,CAAC,CACF,eAAK,SAAS,EAAC,WAAW,aACxB,aAAI,SAAS,EAAC,yCAAyC,YACpD,CAAC,CAAC,6BAA6B,CAAC,GAC9B,EACL,aAAG,SAAS,EAAC,+BAA+B,aAC1C,gBAAM,SAAS,EAAC,2BAA2B,kBAAG,KAAK,IAAQ,YAC1D,CAAC,CAAC,0CAA0C,CAAC,IAC5C,EACJ,KAAC,MAAM,IAAC,OAAO,kBACb,KAAC,IAAI,IAAC,EAAE,EAAE,OAAO,CAAC,OAAO,CAAC,YACvB,CAAC,CAAC,2BAA2B,CAAC,GAC1B,GACA,IACL,CACP,IACG,GACQ,CACjB,CAAC;AACJ,CAAC","sourcesContent":["import { appPath } from \"@agent-native/core/client/api-path\";\nimport { useActionQuery } from \"@agent-native/core/client/hooks\";\nimport { useT } from \"@agent-native/core/client/i18n\";\nimport { withBuilderUtmTrackingParams } from \"@agent-native/core/shared/builder-link-tracking\";\nimport {\n IconArrowLeft,\n IconArrowUpRight,\n IconClockHour4,\n} from \"@tabler/icons-react\";\nimport { useEffect, useMemo } from \"react\";\nimport {\n Link,\n Navigate,\n redirect,\n useParams,\n type ClientLoaderFunctionArgs,\n type LoaderFunctionArgs,\n} from \"react-router\";\n\nimport { ActionQueryError } from \"../../components/action-query-error\";\nimport { DispatchShell } from \"../../components/dispatch-shell\";\nimport { Badge } from \"../../components/ui/badge\";\nimport { Button } from \"../../components/ui/button\";\nimport { Spinner } from \"../../components/ui/spinner\";\nimport { resolveServerCatchAllTarget } from \"../../lib/catch-all-target\";\nimport {\n workspaceAppHref,\n type WorkspaceAppSummary,\n} from \"../../lib/workspace-apps\";\n\nexport function meta() {\n return [{ title: \"Workspace app - Dispatch\" }];\n}\n\n/**\n * Catch-all for `/dispatch/<segment>` paths that don't match an explicit\n * Dispatch route. When `<segment>` is the id of a workspace app sibling\n * (e.g. `/dispatch/todo` after Builder.io routes a \"navigate to /todo\"\n * call through Dispatch's mount point), bounce to the absolute `/<appId>`\n * so the user lands on the actual app instead of a 404 inside Dispatch.\n *\n * Server-side redirect: we resolve the workspace app manifest via the\n * shared `loadWorkspaceAppsManifest()` helper, which checks the\n * `AGENT_NATIVE_WORKSPACE_APPS_JSON` env var, then the\n * `.agent-native/workspace-apps.json` file written by `workspace-deploy.ts`,\n * then a live filesystem scan of `apps/` for local dev. We then throw\n * `redirect(\"/<appId>\")`. React Router 7 does not prepend the basename to\n * absolute paths returned from a loader, so the redirect escapes Dispatch's\n * `/dispatch` mount cleanly.\n *\n * Why a catch-all instead of fixing the agent prompt: Builder.io currently\n * resolves \"navigate to /todo\" relative to Dispatch's mount, sending the\n * user to /dispatch/todo. The same wrong path then gets captured as the\n * OAuth callbackURL, so Google sign-in completes back at /dispatch/todo\n * and looks broken. This route fixes both the post-creation navigation\n * and the OAuth round-trip from a single place.\n *\n * Built-in template fallback: when no workspace manifest is available\n * (framework dev with each template on its own port, hosted dispatch with\n * no sibling apps), redirect to the matching first-party template's deploy\n * URL — `http://localhost:<devPort>` in dev, `https://<id>.agent-native.com`\n * in production. Without this, a user visiting `/forms` on dispatch is\n * forced to sign in (auth guard) and then lands on this route's \"Page not\n * found\" pane after the post-login reload.\n *\n * `appId === \"dispatch\"` short-circuit: when the segment matches Dispatch\n * itself (e.g. `/dispatch/dispatch`), we go straight to the overview rather\n * than chaining through `/dispatch` (which polled `useActionQuery` re-fired\n * `window.location.assign` against and looped forever in production).\n */\nfunction dispatchSelfRedirect(appId: string | undefined): string | null {\n if (appId === \"dispatch\") return appPath(\"/overview\");\n return null;\n}\n\nexport async function loader({ params }: LoaderFunctionArgs) {\n const appId = params.appId;\n if (!appId) return null;\n const selfTarget = dispatchSelfRedirect(appId);\n if (selfTarget) throw redirect(selfTarget);\n const target = await resolveServerCatchAllTarget(appId);\n if (target) throw redirect(target);\n return null;\n}\n\nexport async function clientLoader({\n params,\n serverLoader,\n}: ClientLoaderFunctionArgs) {\n const selfTarget = dispatchSelfRedirect(params.appId);\n if (selfTarget) throw redirect(selfTarget);\n // Defer to the server loader so the built-in template fallback runs on\n // SPA navigations too (e.g. clicking a `/<template-id>` link inside\n // dispatch). Without this the client side would only check the workspace\n // apps query, which never lists the static first-party templates and so\n // the user would land on the \"Page not found\" pane.\n return serverLoader();\n}\n\nexport default function WorkspaceAppCatchAllRoute() {\n const t = useT();\n const { appId } = useParams();\n const appsQuery = useActionQuery(\"list-workspace-apps\", {\n includeAgentCards: false,\n });\n const { data: apps = [], isLoading } = appsQuery;\n const app = useMemo(\n () =>\n (apps as WorkspaceAppSummary[]).find((item) => item.id === appId) ?? null,\n [appId, apps],\n );\n const href = app ? workspaceAppHref(app) : null;\n const isSelfReference = appId === \"dispatch\";\n\n useEffect(() => {\n if (isSelfReference) return;\n if (!app || app.status === \"pending\" || !href) return;\n window.location.assign(href);\n }, [app, href, isSelfReference]);\n\n if (isSelfReference) {\n return <Navigate to={appPath(\"/overview\")} replace />;\n }\n\n if (appsQuery.isError) {\n return (\n <DispatchShell\n title={t(\"dispatch.pages.dataLoadFailed\")}\n description={t(\"dispatch.pages.pageNotFoundDescription\")}\n >\n <ActionQueryError\n error={appsQuery.error}\n onRetry={() => void appsQuery.refetch()}\n />\n </DispatchShell>\n );\n }\n\n if ((isLoading && !app) || (app && app.status !== \"pending\" && href)) {\n return (\n <div className=\"flex h-screen w-full items-center justify-center\">\n <Spinner className=\"size-8\" />\n </div>\n );\n }\n\n return (\n <DispatchShell\n title={app?.name || t(\"dispatch.pages.pageNotFound\")}\n description={t(\"dispatch.pages.pageNotFoundDescription\")}\n >\n <div className=\"max-w-2xl rounded-lg bg-card p-5\">\n <Button asChild size=\"sm\" variant=\"ghost\" className=\"-ml-2 mb-4\">\n <Link to={appPath(\"/overview\")}>\n <IconArrowLeft size={15} className=\"mr-1.5\" />\n {t(\"dispatch.nav.overview\")}\n </Link>\n </Button>\n\n {app?.status === \"pending\" ? (\n <div className=\"space-y-4\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <h2 className=\"text-base font-semibold text-foreground\">\n {app.name}\n </h2>\n <Badge\n variant=\"outline\"\n className=\"gap-1 border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300\"\n >\n <IconClockHour4 size={12} />\n {t(\"dispatch.pages.building\")}\n </Badge>\n </div>\n <p className=\"text-sm text-muted-foreground\">\n {t(\"dispatch.pages.appBuildingPrefix\")}{\" \"}\n <span className=\"font-mono text-foreground\">{app.path}</span>{\" \"}\n {t(\"dispatch.pages.appBuildingSuffix\")}\n </p>\n {app.branchName ? (\n <p className=\"text-xs text-muted-foreground\">\n {t(\"dispatch.pages.branch\", { branch: app.branchName })}\n </p>\n ) : null}\n {app.builderUrl ? (\n <Button asChild>\n <a\n href={withBuilderUtmTrackingParams(app.builderUrl, {\n campaign: \"product\",\n content: \"dispatch_branch\",\n })}\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n {t(\"dispatch.pages.openBuilderBranch\")}\n <IconArrowUpRight size={15} className=\"ml-1.5\" />\n </a>\n </Button>\n ) : null}\n </div>\n ) : (\n <div className=\"space-y-3\">\n <h2 className=\"text-base font-semibold text-foreground\">\n {t(\"dispatch.pages.pageNotFound\")}\n </h2>\n <p className=\"text-sm text-muted-foreground\">\n <span className=\"font-mono text-foreground\">/{appId}</span> isn't\n {t(\"dispatch.pages.notDispatchOrWorkspaceApp\")}\n </p>\n <Button asChild>\n <Link to={appPath(\"/apps\")}>\n {t(\"dispatch.pages.browseApps\")}\n </Link>\n </Button>\n </div>\n )}\n </div>\n </DispatchShell>\n );\n}\n"]}
|
|
@@ -64,7 +64,7 @@ function DispatchMcpAccessPanel() {
|
|
|
64
64
|
toast.error(t("dispatch.pages.mcpUrlCopyFailed"));
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
return (_jsxs("section", { className: "rounded-2xl
|
|
67
|
+
return (_jsxs("section", { className: "rounded-2xl bg-card p-5", children: [_jsxs("div", { className: "flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex items-center gap-2 text-sm font-medium text-foreground", children: [_jsx(IconPlugConnected, { size: 16 }), t("dispatch.pages.unifiedMcpGateway")] }), _jsxs("div", { className: "mt-1 max-w-2xl text-sm text-muted-foreground", children: [t("dispatch.pages.unifiedMcpGatewayDescription"), " ", _jsx("code", { children: "list_apps" }), ", ", _jsx("code", { children: "ask_app" }), ", and", " ", _jsx("code", { children: "open_app" }), "."] })] }), _jsxs("div", { className: "flex items-center gap-3 rounded-xl border px-3 py-2", children: [_jsxs("div", { children: [_jsx("div", { className: "text-xs font-medium text-foreground", children: access.mode === "all-apps"
|
|
68
68
|
? t("dispatch.pages.allApps")
|
|
69
69
|
: t("dispatch.pages.selectedApps") }), _jsx("div", { className: "text-xs text-muted-foreground", children: isLoading
|
|
70
70
|
? t("dispatch.pages.loading")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../../../src/routes/pages/agents.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,cAAc,GACf,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAg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OAAO,EAAE,GACzC,CACH,CAAC,CAAC,CAAC,CACF,KAAC,WAAW,IACV,MAAM,EAAE,CAAC,WAAW,CAAC,IAAI,IAAI,EAAE,CAAqB,EACpD,SAAS,EAAE,WAAW,CAAC,OAAO,GAC9B,CACH,IACG,GACQ,CACjB,CAAC;AACJ,CAAC","sourcesContent":["import {\n useActionMutation,\n useActionQuery,\n} from \"@agent-native/core/client/hooks\";\nimport { useT } from \"@agent-native/core/client/i18n\";\nimport { IconCheck, IconCopy, IconPlugConnected } from \"@tabler/icons-react\";\nimport { useMemo, useState } from \"react\";\nimport { toast } from \"sonner\";\n\nimport { ActionQueryError } from \"../../components/action-query-error\";\nimport {\n AgentsPanel,\n type ConnectedAgent,\n} from \"../../components/agents-panel\";\nimport { DispatchShell } from \"../../components/dispatch-shell\";\nimport { Button } from \"../../components/ui/button\";\nimport { Input } from \"../../components/ui/input\";\nimport { Switch } from \"../../components/ui/switch\";\n\nexport function meta() {\n return [{ title: \"Agents — Dispatch\" }];\n}\n\ninterface McpAccessApp {\n id: string;\n name: string;\n description: string;\n url: string;\n color: string;\n granted: boolean;\n}\n\ntype McpAccessMode = \"all-apps\" | \"selected-apps\";\n\ninterface McpAccessState {\n mode: McpAccessMode;\n selectedAppIds: string[];\n}\n\nfunction dispatchMcpUrl(): string {\n const path = \"/mcp\";\n if (typeof window === \"undefined\") return path;\n return new URL(path, window.location.origin).href;\n}\n\nfunction DispatchMcpAccessPanel() {\n const t = useT();\n const { data, isLoading, isError, error, refetch } = useActionQuery(\n \"list-mcp-app-access\",\n {},\n );\n const [optimistic, setOptimistic] = useState<McpAccessState | null>(null);\n const saveAccess = useActionMutation(\"set-mcp-app-access\", {\n onSuccess: () => {\n setOptimistic(null);\n toast.success(t(\"dispatch.pages.mcpAccessUpdated\"));\n },\n onError: (error) => {\n setOptimistic(null);\n toast.error(error.message);\n },\n });\n\n const apps = ((data as { apps?: McpAccessApp[] } | undefined)?.apps ??\n []) as McpAccessApp[];\n const access =\n optimistic ??\n ({\n mode: ((data as { mode?: McpAccessMode } | undefined)?.mode ??\n \"all-apps\") as McpAccessMode,\n selectedAppIds:\n (data as { selectedAppIds?: string[] } | undefined)?.selectedAppIds ??\n [],\n } satisfies McpAccessState);\n const selected = useMemo(\n () => new Set(access.selectedAppIds),\n [access.selectedAppIds],\n );\n const grantedCount =\n access.mode === \"all-apps\" ? apps.length : access.selectedAppIds.length;\n const mcpUrl = dispatchMcpUrl();\n\n function persist(next: McpAccessState) {\n setOptimistic(next);\n saveAccess.mutate(next);\n }\n\n function toggleApp(appId: string) {\n const next = selected.has(appId)\n ? access.selectedAppIds.filter((id) => id !== appId)\n : [...access.selectedAppIds, appId];\n persist({ mode: \"selected-apps\", selectedAppIds: next });\n }\n\n async function copyUrl() {\n try {\n await navigator.clipboard.writeText(mcpUrl);\n toast.success(t(\"dispatch.pages.mcpUrlCopied\"));\n } catch {\n toast.error(t(\"dispatch.pages.mcpUrlCopyFailed\"));\n }\n }\n\n return (\n <section className=\"rounded-2xl border bg-card p-5\">\n <div className=\"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between\">\n <div className=\"min-w-0\">\n <div className=\"flex items-center gap-2 text-sm font-medium text-foreground\">\n <IconPlugConnected size={16} />\n {t(\"dispatch.pages.unifiedMcpGateway\")}\n </div>\n <div className=\"mt-1 max-w-2xl text-sm text-muted-foreground\">\n {t(\"dispatch.pages.unifiedMcpGatewayDescription\")}{\" \"}\n <code>list_apps</code>, <code>ask_app</code>, and{\" \"}\n <code>open_app</code>.\n </div>\n </div>\n <div className=\"flex items-center gap-3 rounded-xl border px-3 py-2\">\n <div>\n <div className=\"text-xs font-medium text-foreground\">\n {access.mode === \"all-apps\"\n ? t(\"dispatch.pages.allApps\")\n : t(\"dispatch.pages.selectedApps\")}\n </div>\n <div className=\"text-xs text-muted-foreground\">\n {isLoading\n ? t(\"dispatch.pages.loading\")\n : t(\"dispatch.pages.grantedCount\", { count: grantedCount })}\n </div>\n </div>\n <Switch\n checked={access.mode === \"all-apps\"}\n disabled={saveAccess.isPending || apps.length === 0}\n onCheckedChange={(checked) =>\n persist({\n mode: checked ? \"all-apps\" : \"selected-apps\",\n selectedAppIds: checked\n ? access.selectedAppIds\n : apps.map((app) => app.id),\n })\n }\n aria-label={t(\"dispatch.pages.exposeAllAppsMcp\")}\n />\n </div>\n </div>\n\n <div className=\"mt-4 flex flex-col gap-2 sm:flex-row\">\n <Input readOnly value={mcpUrl} className=\"font-mono text-xs\" />\n <Button type=\"button\" variant=\"outline\" onClick={copyUrl}>\n <IconCopy size={15} />\n {t(\"dispatch.pages.copyUrl\")}\n </Button>\n </div>\n\n {isError ? (\n <ActionQueryError\n className=\"mt-4\"\n error={error}\n onRetry={() => void refetch()}\n />\n ) : access.mode === \"selected-apps\" ? (\n <div className=\"mt-4 grid gap-2 sm:grid-cols-2 xl:grid-cols-3\">\n {apps.map((app) => {\n const isSelected = selected.has(app.id);\n return (\n <button\n key={app.id}\n type=\"button\"\n disabled={\n saveAccess.isPending &&\n optimistic?.selectedAppIds.includes(app.id) !== isSelected\n }\n onClick={() => toggleApp(app.id)}\n className=\"flex min-h-[76px] items-start gap-3 rounded-xl border bg-muted/20 px-3 py-3 text-left transition hover:bg-muted/40 disabled:cursor-not-allowed disabled:opacity-60\"\n aria-pressed={isSelected}\n >\n <span\n className=\"mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-xs font-bold text-white\"\n style={{ backgroundColor: app.color }}\n >\n {app.name.charAt(0).toUpperCase()}\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"flex items-center gap-2 text-sm font-medium text-foreground\">\n {app.name}\n {isSelected ? (\n <IconCheck size={14} className=\"text-emerald-500\" />\n ) : null}\n </span>\n <span className=\"mt-1 line-clamp-2 block text-xs text-muted-foreground\">\n {app.description || app.url}\n </span>\n </span>\n </button>\n );\n })}\n </div>\n ) : null}\n </section>\n );\n}\n\nexport default function AgentsRoute() {\n const t = useT();\n const agentsQuery = useActionQuery(\"list-connected-agents\", {});\n\n return (\n <DispatchShell\n title={t(\"dispatch.nav.agents\")}\n description={t(\"dispatch.pages.agentsDescription\")}\n >\n <div className=\"space-y-4\">\n <DispatchMcpAccessPanel />\n {agentsQuery.isError ? (\n <ActionQueryError\n error={agentsQuery.error}\n onRetry={() => void agentsQuery.refetch()}\n />\n ) : (\n <AgentsPanel\n agents={(agentsQuery.data || []) as ConnectedAgent[]}\n onRefresh={agentsQuery.refetch}\n />\n )}\n </div>\n </DispatchShell>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../../../src/routes/pages/agents.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,cAAc,GACf,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EACL,WAAW,GAEZ,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD,MAAM,UAAU,IAAI;IAClB,OAAO,CAAC,EAAE,KAAK,EAAE,mBAAmB,EAAE,CAAC,CAAC;AAC1C,CAAC;AAkBD,SAAS,cAAc;IACrB,MAAM,IAAI,GAAG,MAAM,CAAC;IACpB,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO,IAAI,CAAC;IA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IAAI,IACA,CACX,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,WAAW;IACjC,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC;IACjB,MAAM,WAAW,GAAG,cAAc,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAC;IAEhE,OAAO,CACL,KAAC,aAAa,IACZ,KAAK,EAAE,CAAC,CAAC,qBAAqB,CAAC,EAC/B,WAAW,EAAE,CAAC,CAAC,kCAAkC,CAAC,YAElD,eAAK,SAAS,EAAC,WAAW,aACxB,KAAC,sBAAsB,KAAG,EACzB,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CACrB,KAAC,gBAAgB,IACf,KAAK,EAAE,WAAW,CAAC,KAAK,EACxB,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,WAAW,CAAC,OAAO,EAAE,GACzC,CACH,CAAC,CAAC,CAAC,CACF,KAAC,WAAW,IACV,MAAM,EAAE,CAAC,WAAW,CAAC,IAAI,IAAI,EAAE,CAAqB,EACpD,SAAS,EAAE,WAAW,CAAC,OAAO,GAC9B,CACH,IACG,GACQ,CACjB,CAAC;AACJ,CAAC","sourcesContent":["import {\n useActionMutation,\n useActionQuery,\n} from \"@agent-native/core/client/hooks\";\nimport { useT } from \"@agent-native/core/client/i18n\";\nimport { IconCheck, IconCopy, IconPlugConnected } from \"@tabler/icons-react\";\nimport { useMemo, useState } from \"react\";\nimport { toast } from \"sonner\";\n\nimport { ActionQueryError } from \"../../components/action-query-error\";\nimport {\n AgentsPanel,\n type ConnectedAgent,\n} from \"../../components/agents-panel\";\nimport { DispatchShell } from \"../../components/dispatch-shell\";\nimport { Button } from \"../../components/ui/button\";\nimport { Input } from \"../../components/ui/input\";\nimport { Switch } from \"../../components/ui/switch\";\n\nexport function meta() {\n return [{ title: \"Agents — Dispatch\" }];\n}\n\ninterface McpAccessApp {\n id: string;\n name: string;\n description: string;\n url: string;\n color: string;\n granted: boolean;\n}\n\ntype McpAccessMode = \"all-apps\" | \"selected-apps\";\n\ninterface McpAccessState {\n mode: McpAccessMode;\n selectedAppIds: string[];\n}\n\nfunction dispatchMcpUrl(): string {\n const path = \"/mcp\";\n if (typeof window === \"undefined\") return path;\n return new URL(path, window.location.origin).href;\n}\n\nfunction DispatchMcpAccessPanel() {\n const t = useT();\n const { data, isLoading, isError, error, refetch } = useActionQuery(\n \"list-mcp-app-access\",\n {},\n );\n const [optimistic, setOptimistic] = useState<McpAccessState | null>(null);\n const saveAccess = useActionMutation(\"set-mcp-app-access\", {\n onSuccess: () => {\n setOptimistic(null);\n toast.success(t(\"dispatch.pages.mcpAccessUpdated\"));\n },\n onError: (error) => {\n setOptimistic(null);\n toast.error(error.message);\n },\n });\n\n const apps = ((data as { apps?: McpAccessApp[] } | undefined)?.apps ??\n []) as McpAccessApp[];\n const access =\n optimistic ??\n ({\n mode: ((data as { mode?: McpAccessMode } | undefined)?.mode ??\n \"all-apps\") as McpAccessMode,\n selectedAppIds:\n (data as { selectedAppIds?: string[] } | undefined)?.selectedAppIds ??\n [],\n } satisfies McpAccessState);\n const selected = useMemo(\n () => new Set(access.selectedAppIds),\n [access.selectedAppIds],\n );\n const grantedCount =\n access.mode === \"all-apps\" ? apps.length : access.selectedAppIds.length;\n const mcpUrl = dispatchMcpUrl();\n\n function persist(next: McpAccessState) {\n setOptimistic(next);\n saveAccess.mutate(next);\n }\n\n function toggleApp(appId: string) {\n const next = selected.has(appId)\n ? access.selectedAppIds.filter((id) => id !== appId)\n : [...access.selectedAppIds, appId];\n persist({ mode: \"selected-apps\", selectedAppIds: next });\n }\n\n async function copyUrl() {\n try {\n await navigator.clipboard.writeText(mcpUrl);\n toast.success(t(\"dispatch.pages.mcpUrlCopied\"));\n } catch {\n toast.error(t(\"dispatch.pages.mcpUrlCopyFailed\"));\n }\n }\n\n return (\n <section className=\"rounded-2xl bg-card p-5\">\n <div className=\"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between\">\n <div className=\"min-w-0\">\n <div className=\"flex items-center gap-2 text-sm font-medium text-foreground\">\n <IconPlugConnected size={16} />\n {t(\"dispatch.pages.unifiedMcpGateway\")}\n </div>\n <div className=\"mt-1 max-w-2xl text-sm text-muted-foreground\">\n {t(\"dispatch.pages.unifiedMcpGatewayDescription\")}{\" \"}\n <code>list_apps</code>, <code>ask_app</code>, and{\" \"}\n <code>open_app</code>.\n </div>\n </div>\n <div className=\"flex items-center gap-3 rounded-xl border px-3 py-2\">\n <div>\n <div className=\"text-xs font-medium text-foreground\">\n {access.mode === \"all-apps\"\n ? t(\"dispatch.pages.allApps\")\n : t(\"dispatch.pages.selectedApps\")}\n </div>\n <div className=\"text-xs text-muted-foreground\">\n {isLoading\n ? t(\"dispatch.pages.loading\")\n : t(\"dispatch.pages.grantedCount\", { count: grantedCount })}\n </div>\n </div>\n <Switch\n checked={access.mode === \"all-apps\"}\n disabled={saveAccess.isPending || apps.length === 0}\n onCheckedChange={(checked) =>\n persist({\n mode: checked ? \"all-apps\" : \"selected-apps\",\n selectedAppIds: checked\n ? access.selectedAppIds\n : apps.map((app) => app.id),\n })\n }\n aria-label={t(\"dispatch.pages.exposeAllAppsMcp\")}\n />\n </div>\n </div>\n\n <div className=\"mt-4 flex flex-col gap-2 sm:flex-row\">\n <Input readOnly value={mcpUrl} className=\"font-mono text-xs\" />\n <Button type=\"button\" variant=\"outline\" onClick={copyUrl}>\n <IconCopy size={15} />\n {t(\"dispatch.pages.copyUrl\")}\n </Button>\n </div>\n\n {isError ? (\n <ActionQueryError\n className=\"mt-4\"\n error={error}\n onRetry={() => void refetch()}\n />\n ) : access.mode === \"selected-apps\" ? (\n <div className=\"mt-4 grid gap-2 sm:grid-cols-2 xl:grid-cols-3\">\n {apps.map((app) => {\n const isSelected = selected.has(app.id);\n return (\n <button\n key={app.id}\n type=\"button\"\n disabled={\n saveAccess.isPending &&\n optimistic?.selectedAppIds.includes(app.id) !== isSelected\n }\n onClick={() => toggleApp(app.id)}\n className=\"flex min-h-[76px] items-start gap-3 rounded-xl border bg-muted/20 px-3 py-3 text-left transition hover:bg-muted/40 disabled:cursor-not-allowed disabled:opacity-60\"\n aria-pressed={isSelected}\n >\n <span\n className=\"mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-xs font-bold text-white\"\n style={{ backgroundColor: app.color }}\n >\n {app.name.charAt(0).toUpperCase()}\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"flex items-center gap-2 text-sm font-medium text-foreground\">\n {app.name}\n {isSelected ? (\n <IconCheck size={14} className=\"text-emerald-500\" />\n ) : null}\n </span>\n <span className=\"mt-1 line-clamp-2 block text-xs text-muted-foreground\">\n {app.description || app.url}\n </span>\n </span>\n </button>\n );\n })}\n </div>\n ) : null}\n </section>\n );\n}\n\nexport default function AgentsRoute() {\n const t = useT();\n const agentsQuery = useActionQuery(\"list-connected-agents\", {});\n\n return (\n <DispatchShell\n title={t(\"dispatch.nav.agents\")}\n description={t(\"dispatch.pages.agentsDescription\")}\n >\n <div className=\"space-y-4\">\n <DispatchMcpAccessPanel />\n {agentsQuery.isError ? (\n <ActionQueryError\n error={agentsQuery.error}\n onRetry={() => void agentsQuery.refetch()}\n />\n ) : (\n <AgentsPanel\n agents={(agentsQuery.data || []) as ConnectedAgent[]}\n onRefresh={agentsQuery.refetch}\n />\n )}\n </div>\n </DispatchShell>\n );\n}\n"]}
|
|
@@ -36,21 +36,21 @@ export default function ApprovalPreviewRoute() {
|
|
|
36
36
|
const inEmbed = isInAgentEmbed();
|
|
37
37
|
const approval = approvals?.find((item) => item.id === id) ?? null;
|
|
38
38
|
if (!id) {
|
|
39
|
-
return (_jsx("div", { className: "flex min-h-screen items-center justify-center bg-background p-6", children: _jsxs("div", { className: "w-full max-w-md rounded-2xl
|
|
39
|
+
return (_jsx("div", { className: "flex min-h-screen items-center justify-center bg-background p-6", children: _jsxs("div", { className: "w-full max-w-md rounded-2xl bg-card p-6 text-center", children: [_jsx(IconAlertCircle, { size: 32, className: "mx-auto mb-3 text-muted-foreground" }), _jsx("p", { className: "text-sm font-medium text-foreground", children: "No approval id provided" }), _jsxs("p", { className: "mt-1 text-xs text-muted-foreground", children: ["Add ", _jsx("code", { className: "rounded bg-muted px-1", children: "?id=<id>" }), " to the URL."] })] }) }));
|
|
40
40
|
}
|
|
41
41
|
if (isLoading) {
|
|
42
|
-
return (_jsx("div", { className: "flex min-h-screen items-start justify-center bg-background p-6", children: _jsx("div", { className: "w-full max-w-md space-y-4", children: _jsxs("div", { className: "rounded-2xl
|
|
42
|
+
return (_jsx("div", { className: "flex min-h-screen items-start justify-center bg-background p-6", children: _jsx("div", { className: "w-full max-w-md space-y-4", children: _jsxs("div", { className: "rounded-2xl bg-card p-5", children: [_jsxs("div", { className: "flex items-start gap-3", children: [_jsx(Skeleton, { className: "h-9 w-9 shrink-0 rounded-xl" }), _jsxs("div", { className: "min-w-0 flex-1 space-y-2", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx(Skeleton, { className: "h-4 w-40" }), _jsx(Skeleton, { className: "h-5 w-20 rounded-full" })] }), _jsx(Skeleton, { className: "h-3 w-32" })] })] }), _jsxs("div", { className: "mt-4 space-y-2 rounded-xl border bg-muted/30 px-4 py-3", children: [_jsxs("div", { className: "flex justify-between gap-4", children: [_jsx(Skeleton, { className: "h-3 w-20" }), _jsx(Skeleton, { className: "h-3 w-24" })] }), _jsxs("div", { className: "flex justify-between gap-4", children: [_jsx(Skeleton, { className: "h-3 w-20" }), _jsx(Skeleton, { className: "h-3 w-28" })] }), _jsxs("div", { className: "flex justify-between gap-4", children: [_jsx(Skeleton, { className: "h-3 w-16" }), _jsx(Skeleton, { className: "h-3 w-32" })] })] }), _jsxs("div", { className: "mt-4 flex gap-2", children: [_jsx(Skeleton, { className: "h-8 flex-1 rounded-md" }), _jsx(Skeleton, { className: "h-8 flex-1 rounded-md" })] })] }) }) }));
|
|
43
43
|
}
|
|
44
44
|
if (approvalsQuery.isError) {
|
|
45
45
|
return (_jsx("div", { className: "flex min-h-screen items-start justify-center bg-background p-6", children: _jsx("div", { className: "w-full max-w-md", children: _jsx(ActionQueryError, { error: approvalsQuery.error, onRetry: () => void approvalsQuery.refetch() }) }) }));
|
|
46
46
|
}
|
|
47
47
|
if (!approval) {
|
|
48
|
-
return (_jsx("div", { className: "flex min-h-screen items-center justify-center bg-background p-6", children: _jsxs("div", { className: "w-full max-w-md rounded-2xl
|
|
48
|
+
return (_jsx("div", { className: "flex min-h-screen items-center justify-center bg-background p-6", children: _jsxs("div", { className: "w-full max-w-md rounded-2xl bg-card p-6 text-center", children: [_jsx(IconAlertCircle, { size: 32, className: "mx-auto mb-3 text-muted-foreground" }), _jsx("p", { className: "text-sm font-medium text-foreground", children: "Approval not found" }), _jsxs("p", { className: "mt-1 text-xs text-muted-foreground", children: ["The approval with id", " ", _jsx("code", { className: "rounded bg-muted px-1", children: id }), " does not exist."] }), inEmbed && (_jsxs(Button, { size: "sm", variant: "outline", className: "mt-4 gap-1.5", onClick: () => postNavigate(appPath("/approvals")), children: [_jsx(IconArrowUpRight, { size: 14 }), "View all approvals"] }))] }) }));
|
|
49
49
|
}
|
|
50
50
|
const isPending = approval.status === "pending";
|
|
51
51
|
const beforeValue = parseApprovalValue(approval.beforeValue);
|
|
52
52
|
const afterValue = parseApprovalValue(approval.afterValue);
|
|
53
|
-
return (_jsx("div", { className: "flex min-h-screen items-start justify-center bg-background p-6", children: _jsxs("div", { className: "w-full max-w-2xl space-y-4", children: [_jsxs("div", { className: "rounded-2xl
|
|
53
|
+
return (_jsx("div", { className: "flex min-h-screen items-start justify-center bg-background p-6", children: _jsxs("div", { className: "w-full max-w-2xl space-y-4", children: [_jsxs("div", { className: "rounded-2xl bg-card p-5", children: [_jsxs("div", { className: "flex items-start gap-3", children: [_jsx("div", { className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border bg-muted text-foreground", children: _jsx(IconShieldCheck, { size: 17 }) }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("span", { className: "text-sm font-semibold text-foreground", children: approval.summary }), _jsx(StatusBadge, { status: approval.status })] }), _jsxs("div", { className: "mt-1 text-xs text-muted-foreground", children: ["Requested by", " ", _jsx("span", { className: "font-medium text-foreground", children: approval.requestedBy })] })] })] }), _jsxs("div", { className: "mt-4 space-y-2 rounded-xl border bg-muted/30 px-4 py-3 text-xs", children: [_jsxs("div", { className: "flex justify-between gap-4", children: [_jsx("span", { className: "text-muted-foreground", children: "Change type" }), _jsx("span", { className: "font-mono font-medium text-foreground", children: approval.changeType })] }), _jsxs("div", { className: "flex justify-between gap-4", children: [_jsx("span", { className: "text-muted-foreground", children: "Target type" }), _jsx("span", { className: "font-mono font-medium text-foreground", children: approval.targetType })] }), approval.targetId && (_jsxs("div", { className: "flex justify-between gap-4", children: [_jsx("span", { className: "text-muted-foreground", children: "Target id" }), _jsx("span", { className: "truncate font-mono font-medium text-foreground", children: approval.targetId })] })), approval.reviewedBy && (_jsxs("div", { className: "flex justify-between gap-4", children: [_jsx("span", { className: "text-muted-foreground", children: "Reviewed by" }), _jsx("span", { className: "font-medium text-foreground", children: approval.reviewedBy })] }))] }), (beforeValue !== null || afterValue !== null) && (_jsxs("div", { className: "mt-4 grid gap-3 md:grid-cols-2", children: [_jsx(ApprovalValueBlock, { label: "Before", value: beforeValue }), _jsx(ApprovalValueBlock, { label: "After", value: afterValue })] })), isPending && (_jsxs("div", { className: "mt-4 flex gap-2", children: [_jsxs(Button, { size: "sm", className: "flex-1", disabled: approve.isPending || reject.isPending, onClick: () => approve.mutate({ id: approval.id }), children: [_jsx(IconCheck, { size: 14, className: "mr-1.5" }), "Approve"] }), _jsxs(Button, { size: "sm", variant: "outline", className: "flex-1", disabled: approve.isPending || reject.isPending, onClick: () => reject.mutate({
|
|
54
54
|
id: approval.id,
|
|
55
55
|
reason: "Rejected in dispatch UI",
|
|
56
56
|
}), children: [_jsx(IconX, { size: 14, className: "mr-1.5" }), "Reject"] })] }))] }), inEmbed && (_jsx("div", { className: "flex justify-end", children: _jsxs(Button, { size: "sm", variant: "ghost", className: "gap-1.5 text-muted-foreground", onClick: () => postNavigate(appPath("/approvals")), children: [_jsx(IconArrowUpRight, { size: 14 }), "Open in app"] }) }))] }) }));
|