From bbe39ef72f3dde37e58b447e4d10bf3abee8c0e2 Mon Sep 17 00:00:00 2001 From: Stephen Date: Wed, 20 May 2026 14:03:40 -0700 Subject: [PATCH 1/3] feat(task-card): edit details and output rich-text fields in the UI The task_card editor only exposed title, task_id, status, and sources. Slack's task_card block also accepts rich-text `details` and `output` fields, but the only way to set them was to drop in a palette variant that already included them. Add togglable rich-text sections for both, backed by the existing rich-text editor, with add/remove affordances that map cleanly to the optional payload shape. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/components/editors/task-card-editor.tsx | 83 ++++++++++++++++++++- 1 file changed, 79 insertions(+), 4 deletions(-) diff --git a/src/components/editors/task-card-editor.tsx b/src/components/editors/task-card-editor.tsx index 30abfab..55a8ffb 100644 --- a/src/components/editors/task-card-editor.tsx +++ b/src/components/editors/task-card-editor.tsx @@ -1,19 +1,27 @@ import { Plus, Trash2 } from 'lucide-react'; +import type { RichTextBlock } from 'slack-web-api-client'; import { Button } from '../../lib/ui/button'; import { Input } from '../../lib/ui/input'; import { Label } from '../../lib/ui/label'; import { RadioGroup, RadioGroupItem } from '../../lib/ui/radio-group'; import type { TaskCardBlock, TaskCardStatus, UrlSourceElement } from '../../types'; import { EditorField } from './field'; +import { RichTextEditor } from './rich-text-editor'; import type { BlockEditorProps } from './types'; const STATUSES: readonly TaskCardStatus[] = ['pending', 'in_progress', 'complete', 'error'] as const; +const EMPTY_RICH_TEXT: RichTextBlock = { + type: 'rich_text', + elements: [{ type: 'rich_text_section', elements: [{ type: 'text', text: '' }] }] +}; + /** - * Editor form for task_card blocks. Edits the task id, title, status, and - * the cited sources list. The rich-text `details` and `output` fields - * round-trip through the payload but are not editable in the visual - * builder — palette variants that include them keep them on save. + * Editor form for task_card blocks. Edits the task id, title, status, + * the cited sources list, and the optional rich-text `details` and + * `output` fields. Details and output are togglable — adding one swaps + * in an empty rich_text block; removing one drops the field from the + * payload. * @param props - editor props * @param props.block - the task_card block to edit * @param props.onChange - called with the updated block payload @@ -62,6 +70,20 @@ export function TaskCardEditor({ block, onChange }: BlockEditorProps + onChange({ ...block, details: next })} + /> + + onChange({ ...block, output: next })} + /> + onChange({ ...block, sources: next.length > 0 ? next : undefined })} @@ -70,6 +92,59 @@ export function TaskCardEditor({ block, onChange }: BlockEditorProps void; +}) { + if (!value) { + return ( +
+ + + {help &&

{help}

} +
+ ); + } + return ( +
+
+ + +
+ + {help &&

{help}

} +
+ ); +} + /** * Sub-editor for the task card's `sources` list. Each source is a * `{ text, url }` pair Slack renders as a labeled link beneath the card. From c00b88f58aaf44e4d8727bb1237b97d4803fd544 Mon Sep 17 00:00:00 2001 From: Stephen Date: Wed, 20 May 2026 14:06:26 -0700 Subject: [PATCH 2/3] style(task-card): apply biome formatter to the new Button block Co-Authored-By: Claude Opus 4.7 (1M context) --- src/components/editors/task-card-editor.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/editors/task-card-editor.tsx b/src/components/editors/task-card-editor.tsx index 55a8ffb..1d93571 100644 --- a/src/components/editors/task-card-editor.tsx +++ b/src/components/editors/task-card-editor.tsx @@ -119,7 +119,13 @@ function RichTextField({ return (
- {help &&

{help}

} From 2f94f2d20f563262e2a6cd2a087b4caf92f213f7 Mon Sep 17 00:00:00 2001 From: Stephen Date: Wed, 20 May 2026 14:10:15 -0700 Subject: [PATCH 3/3] docs(task-card): match field help text to Slack's task_card block docs Replace the editor's hand-written help strings with the exact phrasing from docs.slack.dev so the menu reads like the upstream reference (task_id, title, status, details, output, sources). Co-Authored-By: Claude Opus 4.7 (1M context) --- src/components/editors/task-card-editor.tsx | 22 ++++++++------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/components/editors/task-card-editor.tsx b/src/components/editors/task-card-editor.tsx index 1d93571..e542802 100644 --- a/src/components/editors/task-card-editor.tsx +++ b/src/components/editors/task-card-editor.tsx @@ -31,7 +31,7 @@ export function TaskCardEditor({ block, onChange }: BlockEditorProps - + - + - + onChange({ ...block, status: v as TaskCardStatus })} @@ -72,14 +68,14 @@ export function TaskCardEditor({ block, onChange }: BlockEditorProps onChange({ ...block, details: next })} /> onChange({ ...block, output: next })} /> @@ -177,11 +173,9 @@ function SourcesField({ return (
Sources - {sources.length === 0 ? ( -

- No sources. Add one to cite a document or link beneath the card. -

- ) : null} +

+ Array of URL source elements used to generate a response. +

{sources.map((src, idx) => (