@emberai-engg/task-board 0.3.6 → 0.4.0
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/README.md +121 -71
- package/dist/index.d.mts +561 -2
- package/dist/index.d.ts +561 -2
- package/dist/index.js +3458 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3400 -35
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +64 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# @emberai-engg/task-board
|
|
2
2
|
|
|
3
|
-
Reusable Kanban task board component with built-in create/detail UI
|
|
3
|
+
Reusable Kanban task board component with built-in create/detail UI, threaded
|
|
4
|
+
discussions with highlight-to-comment, structured outstanding questions, file
|
|
5
|
+
attachments backed by Google Cloud Storage, and a WYSIWYG markdown editor.
|
|
4
6
|
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
@@ -8,9 +10,10 @@ Reusable Kanban task board component with built-in create/detail UI.
|
|
|
8
10
|
npm install @emberai-engg/task-board
|
|
9
11
|
```
|
|
10
12
|
|
|
11
|
-
## Quick Start
|
|
13
|
+
## Quick Start — list page only (slide-over detail)
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
The default `<TaskBoard>` ships with a built-in `<TaskDetailPanel>` slide-over
|
|
16
|
+
that opens when a task card is clicked.
|
|
14
17
|
|
|
15
18
|
```tsx
|
|
16
19
|
import { TaskBoardProvider, TaskBoard } from '@emberai-engg/task-board';
|
|
@@ -23,17 +26,8 @@ function App() {
|
|
|
23
26
|
return (
|
|
24
27
|
<TaskBoardProvider
|
|
25
28
|
apiClient={apiClient}
|
|
26
|
-
user={
|
|
27
|
-
|
|
28
|
-
name: user.name,
|
|
29
|
-
email: user.email,
|
|
30
|
-
apps: user.apps,
|
|
31
|
-
is_internal: user.is_internal,
|
|
32
|
-
is_reviewer: user.is_reviewer,
|
|
33
|
-
}}
|
|
34
|
-
projects={[
|
|
35
|
-
{ slug: 'my-project', name: 'My Project' },
|
|
36
|
-
]}
|
|
29
|
+
user={user}
|
|
30
|
+
projects={[{ slug: 'my-project', name: 'My Project' }]}
|
|
37
31
|
>
|
|
38
32
|
<TaskBoard onShareFeedback={() => router.push('/feedback')} />
|
|
39
33
|
</TaskBoardProvider>
|
|
@@ -41,14 +35,63 @@ function App() {
|
|
|
41
35
|
}
|
|
42
36
|
```
|
|
43
37
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
-
|
|
38
|
+
## Quick Start — list + dedicated detail route
|
|
39
|
+
|
|
40
|
+
For larger workflows (description sections, outstanding questions, attachments,
|
|
41
|
+
threads with highlight-to-comment), pair `<TaskBoard>` on the list route with
|
|
42
|
+
`<TaskDetailView>` on a separate detail route.
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
// app/task-board/page.tsx
|
|
46
|
+
function TaskBoardPage() {
|
|
47
|
+
const router = useRouter();
|
|
48
|
+
return (
|
|
49
|
+
<TaskBoardProvider apiClient={apiClient} user={user} projects={projects}>
|
|
50
|
+
<TaskBoard
|
|
51
|
+
onTaskOpen={(task) => router.push(`/task-board/${task.id}?project=${task.project_slug}`)}
|
|
52
|
+
/>
|
|
53
|
+
</TaskBoardProvider>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// app/task-board/[taskId]/page.tsx
|
|
58
|
+
function TaskDetailPage({ params }: { params: { taskId: string } }) {
|
|
59
|
+
const router = useRouter();
|
|
60
|
+
return (
|
|
61
|
+
<TaskBoardProvider apiClient={apiClient} user={user} projects={projects}>
|
|
62
|
+
<TaskDetailView
|
|
63
|
+
taskId={params.taskId}
|
|
64
|
+
onBack={() => router.push('/task-board')}
|
|
65
|
+
onNavigateToTask={(id, slug) => router.push(`/task-board/${id}?project=${slug}`)}
|
|
66
|
+
onDeleted={() => router.push('/task-board')}
|
|
67
|
+
/>
|
|
68
|
+
</TaskBoardProvider>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
When `onTaskOpen` is set, `<TaskBoard>` skips its built-in slide-over panel —
|
|
74
|
+
the consumer owns navigation.
|
|
75
|
+
|
|
76
|
+
## What the detail page gives you
|
|
77
|
+
|
|
78
|
+
- **Inline-editable title**, click-to-edit
|
|
79
|
+
- **Status / priority / share / delete** in the header
|
|
80
|
+
- **Four description sections** (Problem, User Story, Proposed Behavior,
|
|
81
|
+
Acceptance Criteria), each with a Draft/Approved toggle
|
|
82
|
+
- **WYSIWYG markdown editor** — bold/italic, H2, bullet/numbered lists with
|
|
83
|
+
multi-line support and auto-incrementing numbers, blockquote, inline code,
|
|
84
|
+
@mentions. Stores markdown on disk via `mdToHtml`/`htmlToMd` round-trip.
|
|
85
|
+
- **Outstanding Questions** — structured list with awaiting/answered status,
|
|
86
|
+
per-question replies, mark-answered/reopen, author-only delete
|
|
87
|
+
- **Attachments** — three groups (Images / Files / Links & recordings), GCS
|
|
88
|
+
upload, signed read URLs, hover-to-delete
|
|
89
|
+
- **Threads panel** — Threads + Activity tabs, collapse toggle (persisted),
|
|
90
|
+
active/completed filter, per-thread title and complete/reopen, thread
|
|
91
|
+
composer with attachments and public/internal toggle
|
|
92
|
+
- **Highlight-to-comment** — select text in a description section to attach a
|
|
93
|
+
thread anchor; clicking the anchor pill scrolls back to the section and
|
|
94
|
+
pulses it
|
|
52
95
|
|
|
53
96
|
## Props / Config Reference
|
|
54
97
|
|
|
@@ -63,6 +106,7 @@ This gives you:
|
|
|
63
106
|
| `priorities` | `PriorityConfig[]` | No | Priority levels |
|
|
64
107
|
| `tags` | `TagConfig[]` | No | Predefined tags |
|
|
65
108
|
| `apiBasePath` | `string` | No | API prefix (defaults to `/api/v1/taskboard`) |
|
|
109
|
+
| `internalLabel` | `string` | No | Label on internal-only comment chips. Defaults to `"Internal"`. |
|
|
66
110
|
| `features` | `object` | No | Feature flags for enabling/disabling features |
|
|
67
111
|
| `onTaskCreate` | `(task) => void` | No | Callback on task creation |
|
|
68
112
|
| `onTaskUpdate` | `(task) => void` | No | Callback on task update |
|
|
@@ -76,52 +120,32 @@ This gives you:
|
|
|
76
120
|
| `className` | `string` | CSS class for the outer container |
|
|
77
121
|
| `headerActions` | `ReactNode` | Additional buttons in the header |
|
|
78
122
|
| `onShareFeedback` | `() => void` | Callback for Share Feedback button. Hidden if omitted. |
|
|
79
|
-
| `onTaskOpen` | `(task) => void` |
|
|
80
|
-
| `renderTaskDetail` | `function` | Override for task detail panel (built-in used if omitted) |
|
|
123
|
+
| `onTaskOpen` | `(task) => void` | When provided, the built-in slide-over panel is suppressed and the consumer owns navigation. |
|
|
124
|
+
| `renderTaskDetail` | `function` | Override for task detail panel (built-in slide-over used if omitted) |
|
|
81
125
|
| `renderCreateTask` | `function` | Override for create task modal (built-in used if omitted) |
|
|
82
126
|
|
|
83
|
-
###
|
|
84
|
-
|
|
85
|
-
If you need custom create/detail UI, pass render props:
|
|
86
|
-
|
|
87
|
-
```tsx
|
|
88
|
-
<TaskBoard
|
|
89
|
-
renderCreateTask={({ projectSlug, defaultStatus, onClose, onCreate }) => (
|
|
90
|
-
<MyCustomCreateModal ... />
|
|
91
|
-
)}
|
|
92
|
-
renderTaskDetail={({ task, onClose, onUpdate }) => (
|
|
93
|
-
<MyCustomDetailPanel ... />
|
|
94
|
-
)}
|
|
95
|
-
/>
|
|
96
|
-
```
|
|
127
|
+
### `TaskDetailView`
|
|
97
128
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
// Use hooks independently
|
|
108
|
-
function MyCustomUI() {
|
|
109
|
-
const { createTask, moveTask } = useTaskActions(tasks, setTasks, fetchTasks);
|
|
110
|
-
// ...
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// Use small components
|
|
114
|
-
<PriorityBadge priority="high" />
|
|
115
|
-
<UserAvatar name="John Smith" size="sm" showTooltip />
|
|
116
|
-
```
|
|
129
|
+
| Prop | Type | Description |
|
|
130
|
+
|------|------|-------------|
|
|
131
|
+
| `taskId` | `string` | Required. The task to show. |
|
|
132
|
+
| `onBack` | `() => void` | Callback for the back link. Use this for SPA routing. |
|
|
133
|
+
| `backHref` | `string` | href for the back link if `onBack` is omitted. |
|
|
134
|
+
| `breadcrumb` | `ReactNode` | Slot rendered above the main content (e.g. consumer breadcrumb bar). |
|
|
135
|
+
| `onDeleted` | `(task) => void` | Called after successful delete; consumer should navigate away. |
|
|
136
|
+
| `onNavigateToTask` | `(id, projectSlug) => void` | Provide to enable prev/next buttons. |
|
|
137
|
+
| `buildShareUrl` | `(task) => string` | Override the share URL. Defaults to `${origin}/task-board/${id}?project=${slug}`. |
|
|
117
138
|
|
|
118
139
|
## Hooks API
|
|
119
140
|
|
|
120
141
|
| Hook | Purpose |
|
|
121
142
|
|------|---------|
|
|
122
143
|
| `useTaskBoard()` | Board state: projects, tasks, loading, pagination |
|
|
123
|
-
| `useTaskActions(
|
|
144
|
+
| `useTaskActions(...)` | CRUD: create, update, delete, move tasks |
|
|
124
145
|
| `useTaskDetail(taskId)` | Single task: comments, activity, field updates |
|
|
146
|
+
| `useTaskQuestions(taskId, initial?)` | Outstanding Questions for a task: list + create / update / delete / reply |
|
|
147
|
+
| `useTaskAttachments(taskId, initial?)` | Attachments: list + uploadFile / addLink / remove |
|
|
148
|
+
| `useHighlightAnchor()` | Selection-driven anchor flow: bubble + pendingAnchor + focusAnchor |
|
|
125
149
|
| `useShareLink()` | Copy shareable task URLs |
|
|
126
150
|
|
|
127
151
|
## Feature Flags
|
|
@@ -129,19 +153,49 @@ function MyCustomUI() {
|
|
|
129
153
|
```tsx
|
|
130
154
|
<TaskBoardProvider
|
|
131
155
|
features={{
|
|
132
|
-
dragAndDrop: true,
|
|
133
|
-
comments: true,
|
|
134
|
-
mentions: true,
|
|
135
|
-
notifications: true,
|
|
136
|
-
internalComments: true,
|
|
137
|
-
tags: true,
|
|
138
|
-
sharing: true,
|
|
139
|
-
filters: true,
|
|
140
|
-
unreadIndicators: true,
|
|
156
|
+
dragAndDrop: true,
|
|
157
|
+
comments: true,
|
|
158
|
+
mentions: true,
|
|
159
|
+
notifications: true,
|
|
160
|
+
internalComments: true,
|
|
161
|
+
tags: true,
|
|
162
|
+
sharing: true,
|
|
163
|
+
filters: true,
|
|
164
|
+
unreadIndicators: true,
|
|
141
165
|
}}
|
|
142
166
|
/>
|
|
143
167
|
```
|
|
144
168
|
|
|
169
|
+
## Backwards-compatibility notes (v0.3 → v0.4)
|
|
170
|
+
|
|
171
|
+
- The `StructuredDescription.open_questions` field still exists and is preserved
|
|
172
|
+
on existing tasks, but is no longer rendered in the description editor — the
|
|
173
|
+
Outstanding Questions feature replaces it. Tasks created before v0.4 keep
|
|
174
|
+
their content; new tasks have an empty `open_questions` field.
|
|
175
|
+
- `Comment` gained optional `parent_id`, `title`, `thread_status`, `anchor`,
|
|
176
|
+
`attachment_ids`. Existing comments without these fields render the same as
|
|
177
|
+
before.
|
|
178
|
+
|
|
179
|
+
## Backend
|
|
180
|
+
|
|
181
|
+
The `backend-reference/` folder contains a Python FastAPI reference implementation:
|
|
182
|
+
|
|
183
|
+
- `models/taskboard.py` — Pydantic models (Tasks / Comments / Threads /
|
|
184
|
+
Questions / Attachments + the `ThreadAnchor` schema)
|
|
185
|
+
- `api/taskboard.py` — full FastAPI router covering all v0.4 endpoints,
|
|
186
|
+
including the threads, questions, and attachments routes
|
|
187
|
+
- `services/gcs_storage.py` — Google Cloud Storage helper for file uploads.
|
|
188
|
+
Supports inline service-account env vars, `GOOGLE_APPLICATION_CREDENTIALS`,
|
|
189
|
+
and Application Default Credentials
|
|
190
|
+
- `services/config_snippet.py` — settings fields and sample `.env` values
|
|
191
|
+
|
|
192
|
+
Add `google-cloud-storage>=2.18.0` to `requirements.txt`. Without
|
|
193
|
+
`GCP_STORAGE_BUCKET` set, link attachments still work but image/file uploads
|
|
194
|
+
return a clean 503.
|
|
195
|
+
|
|
196
|
+
See [`backend-reference/README.md`](backend-reference/README.md) for the
|
|
197
|
+
adaptation guide.
|
|
198
|
+
|
|
145
199
|
## Development
|
|
146
200
|
|
|
147
201
|
```bash
|
|
@@ -151,10 +205,6 @@ npm run build # Production build
|
|
|
151
205
|
npm test # Run tests
|
|
152
206
|
```
|
|
153
207
|
|
|
154
|
-
## Backend
|
|
155
|
-
|
|
156
|
-
The `backend-reference/` folder contains a Python FastAPI reference implementation for the task board API. Copy it into your app's backend and adapt the auth and database setup to match your app. See [`backend-reference/README.md`](backend-reference/README.md) for details.
|
|
157
|
-
|
|
158
208
|
## License
|
|
159
209
|
|
|
160
210
|
Private — internal use only.
|