@kelpie/ui 0.26.0 → 0.28.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/dist/api/resources/account.d.ts +7 -1
- package/dist/api/resources/account.d.ts.map +1 -1
- package/dist/api/resources/account.js +17 -1
- package/dist/api/resources/account.js.map +1 -1
- package/dist/api/resources/bulkActions.d.ts +50 -0
- package/dist/api/resources/bulkActions.d.ts.map +1 -0
- package/dist/api/resources/bulkActions.js +192 -0
- package/dist/api/resources/bulkActions.js.map +1 -0
- package/dist/api/resources/forms.d.ts +26 -1
- package/dist/api/resources/forms.d.ts.map +1 -1
- package/dist/api/resources/forms.js +98 -1
- package/dist/api/resources/forms.js.map +1 -1
- package/dist/app/KelpieApp.d.ts.map +1 -1
- package/dist/app/KelpieApp.js +3 -1
- package/dist/app/KelpieApp.js.map +1 -1
- package/dist/components/ActivitiesPanel.d.ts.map +1 -1
- package/dist/components/ActivitiesPanel.js +3 -12
- package/dist/components/ActivitiesPanel.js.map +1 -1
- package/dist/components/BulkActions.d.ts +61 -0
- package/dist/components/BulkActions.d.ts.map +1 -0
- package/dist/components/BulkActions.js +351 -0
- package/dist/components/BulkActions.js.map +1 -0
- package/dist/components/BulkParamFields.d.ts +13 -0
- package/dist/components/BulkParamFields.d.ts.map +1 -0
- package/dist/components/BulkParamFields.js +177 -0
- package/dist/components/BulkParamFields.js.map +1 -0
- package/dist/components/CellLinks.d.ts +38 -0
- package/dist/components/CellLinks.d.ts.map +1 -0
- package/dist/components/CellLinks.js +58 -0
- package/dist/components/CellLinks.js.map +1 -0
- package/dist/components/CustomFieldsPanel.d.ts +12 -1
- package/dist/components/CustomFieldsPanel.d.ts.map +1 -1
- package/dist/components/CustomFieldsPanel.js +5 -1
- package/dist/components/CustomFieldsPanel.js.map +1 -1
- package/dist/components/DataTable.d.ts +42 -1
- package/dist/components/DataTable.d.ts.map +1 -1
- package/dist/components/DataTable.js +51 -16
- package/dist/components/DataTable.js.map +1 -1
- package/dist/components/NotesPanel.d.ts.map +1 -1
- package/dist/components/NotesPanel.js +2 -15
- package/dist/components/NotesPanel.js.map +1 -1
- package/dist/components/PhonesField.d.ts.map +1 -1
- package/dist/components/PhonesField.js +1 -3
- package/dist/components/PhonesField.js.map +1 -1
- package/dist/components/Shell.d.ts.map +1 -1
- package/dist/components/Shell.js +16 -6
- package/dist/components/Shell.js.map +1 -1
- package/dist/components/TagInput.d.ts.map +1 -1
- package/dist/components/TagInput.js +5 -0
- package/dist/components/TagInput.js.map +1 -1
- package/dist/components/bulkActionParams.d.ts +71 -0
- package/dist/components/bulkActionParams.d.ts.map +1 -0
- package/dist/components/bulkActionParams.js +241 -0
- package/dist/components/bulkActionParams.js.map +1 -0
- package/dist/components/bulkActionSummary.d.ts +22 -0
- package/dist/components/bulkActionSummary.d.ts.map +1 -0
- package/dist/components/bulkActionSummary.js +68 -0
- package/dist/components/bulkActionSummary.js.map +1 -0
- package/dist/components/bulkJobStatus.d.ts +4 -0
- package/dist/components/bulkJobStatus.d.ts.map +1 -0
- package/dist/components/bulkJobStatus.js +10 -0
- package/dist/components/bulkJobStatus.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/attribution.d.ts +31 -0
- package/dist/lib/attribution.d.ts.map +1 -0
- package/dist/lib/attribution.js +48 -0
- package/dist/lib/attribution.js.map +1 -0
- package/dist/lib/bulkSelection.d.ts +43 -0
- package/dist/lib/bulkSelection.d.ts.map +1 -0
- package/dist/lib/bulkSelection.js +70 -0
- package/dist/lib/bulkSelection.js.map +1 -0
- package/dist/lib/contactLinks.d.ts +15 -0
- package/dist/lib/contactLinks.d.ts.map +1 -0
- package/dist/lib/contactLinks.js +22 -0
- package/dist/lib/contactLinks.js.map +1 -0
- package/dist/pages/BulkJobsPage.d.ts +3 -0
- package/dist/pages/BulkJobsPage.d.ts.map +1 -0
- package/dist/pages/BulkJobsPage.js +92 -0
- package/dist/pages/BulkJobsPage.js.map +1 -0
- package/dist/pages/CompaniesPage.d.ts.map +1 -1
- package/dist/pages/CompaniesPage.js +9 -5
- package/dist/pages/CompaniesPage.js.map +1 -1
- package/dist/pages/CompanyDetail.d.ts.map +1 -1
- package/dist/pages/CompanyDetail.js +4 -3
- package/dist/pages/CompanyDetail.js.map +1 -1
- package/dist/pages/DealsPage.d.ts.map +1 -1
- package/dist/pages/DealsPage.js +15 -4
- package/dist/pages/DealsPage.js.map +1 -1
- package/dist/pages/DecisionsPage.d.ts.map +1 -1
- package/dist/pages/DecisionsPage.js +11 -1
- package/dist/pages/DecisionsPage.js.map +1 -1
- package/dist/pages/EnquiriesPage.d.ts.map +1 -1
- package/dist/pages/EnquiriesPage.js +15 -6
- package/dist/pages/EnquiriesPage.js.map +1 -1
- package/dist/pages/EventDetail.d.ts.map +1 -1
- package/dist/pages/EventDetail.js +14 -6
- package/dist/pages/EventDetail.js.map +1 -1
- package/dist/pages/EventsPage.d.ts.map +1 -1
- package/dist/pages/EventsPage.js +22 -5
- package/dist/pages/EventsPage.js.map +1 -1
- package/dist/pages/FormsPage.d.ts.map +1 -1
- package/dist/pages/FormsPage.js +2 -2
- package/dist/pages/FormsPage.js.map +1 -1
- package/dist/pages/FundraisingPage.d.ts.map +1 -1
- package/dist/pages/FundraisingPage.js +15 -4
- package/dist/pages/FundraisingPage.js.map +1 -1
- package/dist/pages/HiringPage.d.ts.map +1 -1
- package/dist/pages/HiringPage.js +2 -1
- package/dist/pages/HiringPage.js.map +1 -1
- package/dist/pages/ListDetail.d.ts.map +1 -1
- package/dist/pages/ListDetail.js +39 -7
- package/dist/pages/ListDetail.js.map +1 -1
- package/dist/pages/ListsPage.d.ts.map +1 -1
- package/dist/pages/ListsPage.js +2 -1
- package/dist/pages/ListsPage.js.map +1 -1
- package/dist/pages/OpportunitiesPage.d.ts.map +1 -1
- package/dist/pages/OpportunitiesPage.js +15 -6
- package/dist/pages/OpportunitiesPage.js.map +1 -1
- package/dist/pages/PartnershipsPage.d.ts.map +1 -1
- package/dist/pages/PartnershipsPage.js +15 -4
- package/dist/pages/PartnershipsPage.js.map +1 -1
- package/dist/pages/PeoplePage.d.ts.map +1 -1
- package/dist/pages/PeoplePage.js +10 -9
- package/dist/pages/PeoplePage.js.map +1 -1
- package/dist/pages/PlanningPage.d.ts.map +1 -1
- package/dist/pages/PlanningPage.js +15 -4
- package/dist/pages/PlanningPage.js.map +1 -1
- package/dist/pages/RoleDetail.d.ts.map +1 -1
- package/dist/pages/RoleDetail.js +12 -4
- package/dist/pages/RoleDetail.js.map +1 -1
- package/dist/pages/dashboard/sections.d.ts.map +1 -1
- package/dist/pages/dashboard/sections.js +8 -10
- package/dist/pages/dashboard/sections.js.map +1 -1
- package/dist/pages/forms/BlockedSendersPage.d.ts +10 -0
- package/dist/pages/forms/BlockedSendersPage.d.ts.map +1 -0
- package/dist/pages/forms/BlockedSendersPage.js +65 -0
- package/dist/pages/forms/BlockedSendersPage.js.map +1 -0
- package/dist/pages/forms/MarkSpamPanel.d.ts +19 -0
- package/dist/pages/forms/MarkSpamPanel.d.ts.map +1 -0
- package/dist/pages/forms/MarkSpamPanel.js +62 -0
- package/dist/pages/forms/MarkSpamPanel.js.map +1 -0
- package/dist/pages/forms/SubmissionDetail.d.ts.map +1 -1
- package/dist/pages/forms/SubmissionDetail.js +41 -11
- package/dist/pages/forms/SubmissionDetail.js.map +1 -1
- package/dist/pages/forms/SubmissionsTable.d.ts +1 -1
- package/dist/pages/forms/SubmissionsTable.d.ts.map +1 -1
- package/dist/pages/forms/SubmissionsTable.js +6 -4
- package/dist/pages/forms/SubmissionsTable.js.map +1 -1
- package/dist/pages/forms/markSpamChoices.d.ts +51 -0
- package/dist/pages/forms/markSpamChoices.d.ts.map +1 -0
- package/dist/pages/forms/markSpamChoices.js +96 -0
- package/dist/pages/forms/markSpamChoices.js.map +1 -0
- package/dist/pages/positionDirectory.d.ts +5 -0
- package/dist/pages/positionDirectory.d.ts.map +1 -1
- package/dist/pages/positionDirectory.js +11 -3
- package/dist/pages/positionDirectory.js.map +1 -1
- package/dist/registry/context.d.ts +3 -1
- package/dist/registry/context.d.ts.map +1 -1
- package/dist/registry/context.js +4 -0
- package/dist/registry/context.js.map +1 -1
- package/dist/registry/contributions.d.ts +23 -0
- package/dist/registry/contributions.d.ts.map +1 -1
- package/dist/registry/contributions.js.map +1 -1
- package/dist/registry/registry.d.ts +4 -1
- package/dist/registry/registry.d.ts.map +1 -1
- package/dist/registry/registry.js +6 -0
- package/dist/registry/registry.js.map +1 -1
- package/dist/registry/visibleNav.d.ts.map +1 -1
- package/dist/registry/visibleNav.js +1 -0
- package/dist/registry/visibleNav.js.map +1 -1
- package/package.json +3 -3
- package/src/api/resources/account.ts +20 -0
- package/src/api/resources/bulkActions.ts +267 -0
- package/src/api/resources/forms.ts +135 -0
- package/src/app/KelpieApp.tsx +5 -0
- package/src/components/ActivitiesPanel.tsx +3 -14
- package/src/components/BulkActions.tsx +961 -0
- package/src/components/BulkParamFields.tsx +524 -0
- package/src/components/CellLinks.tsx +138 -0
- package/src/components/CustomFieldsPanel.tsx +6 -2
- package/src/components/DataTable.tsx +142 -2
- package/src/components/NotesPanel.tsx +2 -17
- package/src/components/PhonesField.tsx +2 -4
- package/src/components/Shell.tsx +23 -6
- package/src/components/TagInput.tsx +5 -0
- package/src/components/bulkActionParams.ts +405 -0
- package/src/components/bulkActionSummary.ts +104 -0
- package/src/components/bulkJobStatus.ts +11 -0
- package/src/index.ts +3 -0
- package/src/lib/attribution.ts +59 -0
- package/src/lib/bulkSelection.ts +128 -0
- package/src/lib/contactLinks.ts +25 -0
- package/src/pages/BulkJobsPage.tsx +206 -0
- package/src/pages/CompaniesPage.tsx +21 -6
- package/src/pages/CompanyDetail.tsx +4 -3
- package/src/pages/DealsPage.tsx +30 -2
- package/src/pages/DecisionsPage.tsx +21 -1
- package/src/pages/EnquiriesPage.tsx +33 -5
- package/src/pages/EventDetail.tsx +43 -16
- package/src/pages/EventsPage.tsx +35 -4
- package/src/pages/FormsPage.tsx +7 -1
- package/src/pages/FundraisingPage.tsx +30 -2
- package/src/pages/HiringPage.tsx +6 -1
- package/src/pages/ListDetail.tsx +69 -5
- package/src/pages/ListsPage.tsx +6 -1
- package/src/pages/OpportunitiesPage.tsx +33 -5
- package/src/pages/PartnershipsPage.tsx +30 -2
- package/src/pages/PeoplePage.tsx +26 -21
- package/src/pages/PlanningPage.tsx +65 -24
- package/src/pages/RoleDetail.tsx +35 -7
- package/src/pages/dashboard/sections.tsx +13 -14
- package/src/pages/forms/BlockedSendersPage.tsx +155 -0
- package/src/pages/forms/MarkSpamPanel.tsx +193 -0
- package/src/pages/forms/SubmissionDetail.tsx +73 -18
- package/src/pages/forms/SubmissionsTable.tsx +7 -5
- package/src/pages/forms/markSpamChoices.ts +141 -0
- package/src/pages/positionDirectory.ts +16 -4
- package/src/registry/context.ts +6 -0
- package/src/registry/contributions.ts +25 -0
- package/src/registry/registry.ts +12 -0
- package/src/registry/visibleNav.ts +1 -0
|
@@ -31,6 +31,20 @@ export interface EmptyStateAction {
|
|
|
31
31
|
readonly onClick: () => void
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Row checkboxes for bulk actions. A table that passes none has no checkbox
|
|
36
|
+
* column. The state lives with the caller (`useBulkSelection`), so paging and
|
|
37
|
+
* a filter change are the caller's to decide.
|
|
38
|
+
*/
|
|
39
|
+
export interface DataTableSelection<TRow> {
|
|
40
|
+
readonly isSelected: (id: string) => boolean
|
|
41
|
+
readonly onToggle: (id: string) => void
|
|
42
|
+
/** Ticks or unticks every row the table is showing. */
|
|
43
|
+
readonly onTogglePage: (ids: readonly string[], selected: boolean) => void
|
|
44
|
+
/** Names a row for its checkbox's label, such as the record's name. */
|
|
45
|
+
readonly rowLabel: (row: TRow) => string
|
|
46
|
+
}
|
|
47
|
+
|
|
34
48
|
export interface DataTableProps<TRow> {
|
|
35
49
|
readonly columns: readonly Column<TRow>[]
|
|
36
50
|
readonly rows?: readonly TRow[] | undefined
|
|
@@ -52,6 +66,7 @@ export interface DataTableProps<TRow> {
|
|
|
52
66
|
* a stored preference outliving a rename should hide only what it recognises.
|
|
53
67
|
*/
|
|
54
68
|
readonly visibleColumnKeys?: readonly string[] | undefined
|
|
69
|
+
readonly selection?: DataTableSelection<TRow> | undefined
|
|
55
70
|
}
|
|
56
71
|
|
|
57
72
|
type SortDirection = 'asc' | 'desc'
|
|
@@ -120,6 +135,7 @@ export function DataTable<TRow>({
|
|
|
120
135
|
sort,
|
|
121
136
|
onSortChange,
|
|
122
137
|
visibleColumnKeys,
|
|
138
|
+
selection,
|
|
123
139
|
}: DataTableProps<TRow>): React.JSX.Element {
|
|
124
140
|
const flatRows = groups === undefined ? (rows ?? []) : groups.flatMap((group) => group.rows)
|
|
125
141
|
const displayedColumns =
|
|
@@ -171,6 +187,15 @@ export function DataTable<TRow>({
|
|
|
171
187
|
<table className="w-full border-collapse text-left text-[13px]">
|
|
172
188
|
<thead>
|
|
173
189
|
<tr className="border-b border-border">
|
|
190
|
+
{selection !== undefined && (
|
|
191
|
+
<th className="w-8 px-3 py-2">
|
|
192
|
+
<PageCheckbox
|
|
193
|
+
ids={flatRows.map(getRowId)}
|
|
194
|
+
isSelected={selection.isSelected}
|
|
195
|
+
onTogglePage={selection.onTogglePage}
|
|
196
|
+
/>
|
|
197
|
+
</th>
|
|
198
|
+
)}
|
|
174
199
|
{displayedColumns.map((column) => {
|
|
175
200
|
const field = sortFieldOf(column)
|
|
176
201
|
const direction = directionOf(sort, field)
|
|
@@ -208,8 +233,10 @@ export function DataTable<TRow>({
|
|
|
208
233
|
<DataRow
|
|
209
234
|
key={getRowId(row)}
|
|
210
235
|
row={row}
|
|
236
|
+
rowId={getRowId(row)}
|
|
211
237
|
columns={displayedColumns}
|
|
212
238
|
onRowClick={onRowClick}
|
|
239
|
+
selection={selection}
|
|
213
240
|
/>
|
|
214
241
|
))
|
|
215
242
|
: displayedGroups.map((group) => (
|
|
@@ -219,6 +246,7 @@ export function DataTable<TRow>({
|
|
|
219
246
|
columns={displayedColumns}
|
|
220
247
|
onRowClick={onRowClick}
|
|
221
248
|
getRowId={getRowId}
|
|
249
|
+
selection={selection}
|
|
222
250
|
/>
|
|
223
251
|
))}
|
|
224
252
|
</tbody>
|
|
@@ -233,21 +261,60 @@ export function DataTable<TRow>({
|
|
|
233
261
|
)
|
|
234
262
|
}
|
|
235
263
|
|
|
264
|
+
/**
|
|
265
|
+
* Ticks every row on screen. Indeterminate when only some are ticked, so a
|
|
266
|
+
* click from that state ticks the rest rather than clearing what was chosen.
|
|
267
|
+
*
|
|
268
|
+
* Exported with `RowCheckbox` for pages whose rows are cards, not a table,
|
|
269
|
+
* so their selection looks and reads the same.
|
|
270
|
+
*/
|
|
271
|
+
export function PageCheckbox({
|
|
272
|
+
ids,
|
|
273
|
+
isSelected,
|
|
274
|
+
onTogglePage,
|
|
275
|
+
}: {
|
|
276
|
+
readonly ids: readonly string[]
|
|
277
|
+
readonly isSelected: (id: string) => boolean
|
|
278
|
+
readonly onTogglePage: (ids: readonly string[], selected: boolean) => void
|
|
279
|
+
}): React.JSX.Element {
|
|
280
|
+
const ticked = ids.filter(isSelected).length
|
|
281
|
+
const all = ids.length > 0 && ticked === ids.length
|
|
282
|
+
|
|
283
|
+
return (
|
|
284
|
+
<input
|
|
285
|
+
type="checkbox"
|
|
286
|
+
aria-label="Select all rows on this page"
|
|
287
|
+
checked={all}
|
|
288
|
+
ref={(input) => {
|
|
289
|
+
if (input !== null) {
|
|
290
|
+
input.indeterminate = ticked > 0 && !all
|
|
291
|
+
}
|
|
292
|
+
}}
|
|
293
|
+
onChange={() => {
|
|
294
|
+
onTogglePage(ids, !all)
|
|
295
|
+
}}
|
|
296
|
+
className="h-3.5 w-3.5 rounded border-border text-accent focus:ring-accent"
|
|
297
|
+
/>
|
|
298
|
+
)
|
|
299
|
+
}
|
|
300
|
+
|
|
236
301
|
function GroupRows<TRow>({
|
|
237
302
|
group,
|
|
238
303
|
columns,
|
|
239
304
|
onRowClick,
|
|
240
305
|
getRowId,
|
|
306
|
+
selection,
|
|
241
307
|
}: {
|
|
242
308
|
readonly group: DataTableGroup<TRow>
|
|
243
309
|
readonly columns: readonly Column<TRow>[]
|
|
244
310
|
readonly onRowClick?: ((row: TRow) => void) | undefined
|
|
245
311
|
readonly getRowId: (row: TRow) => string
|
|
312
|
+
readonly selection?: DataTableSelection<TRow> | undefined
|
|
246
313
|
}): React.JSX.Element {
|
|
247
314
|
return (
|
|
248
315
|
<>
|
|
249
316
|
<tr className="border-b border-border bg-surface-sunken/60">
|
|
250
|
-
<td colSpan={columns.length} className="px-3 py-1.5">
|
|
317
|
+
<td colSpan={columns.length + (selection === undefined ? 0 : 1)} className="px-3 py-1.5">
|
|
251
318
|
<span className="inline-flex items-center gap-2">
|
|
252
319
|
{group.label}
|
|
253
320
|
<span className="font-mono text-[11px] text-ink-faint">{group.rows.length}</span>
|
|
@@ -255,7 +322,14 @@ function GroupRows<TRow>({
|
|
|
255
322
|
</td>
|
|
256
323
|
</tr>
|
|
257
324
|
{group.rows.map((row) => (
|
|
258
|
-
<DataRow
|
|
325
|
+
<DataRow
|
|
326
|
+
key={getRowId(row)}
|
|
327
|
+
row={row}
|
|
328
|
+
rowId={getRowId(row)}
|
|
329
|
+
columns={columns}
|
|
330
|
+
onRowClick={onRowClick}
|
|
331
|
+
selection={selection}
|
|
332
|
+
/>
|
|
259
333
|
))}
|
|
260
334
|
</>
|
|
261
335
|
)
|
|
@@ -263,21 +337,45 @@ function GroupRows<TRow>({
|
|
|
263
337
|
|
|
264
338
|
function DataRow<TRow>({
|
|
265
339
|
row,
|
|
340
|
+
rowId,
|
|
266
341
|
columns,
|
|
267
342
|
onRowClick,
|
|
343
|
+
selection,
|
|
268
344
|
}: {
|
|
269
345
|
readonly row: TRow
|
|
346
|
+
readonly rowId: string
|
|
270
347
|
readonly columns: readonly Column<TRow>[]
|
|
271
348
|
readonly onRowClick?: ((row: TRow) => void) | undefined
|
|
349
|
+
readonly selection?: DataTableSelection<TRow> | undefined
|
|
272
350
|
}): React.JSX.Element {
|
|
351
|
+
const selected = selection?.isSelected(rowId) ?? false
|
|
352
|
+
|
|
273
353
|
return (
|
|
274
354
|
<tr
|
|
275
355
|
onClick={() => onRowClick?.(row)}
|
|
276
356
|
className={[
|
|
277
357
|
'border-b border-border last:border-0 transition-colors',
|
|
358
|
+
selected ? 'bg-accent-soft/40' : '',
|
|
278
359
|
onRowClick === undefined ? '' : 'cursor-pointer hover:bg-surface-sunken/70',
|
|
279
360
|
].join(' ')}
|
|
280
361
|
>
|
|
362
|
+
{selection !== undefined && (
|
|
363
|
+
// The cell swallows the click, so a near miss on the box does not open the record.
|
|
364
|
+
<td
|
|
365
|
+
className="w-8 px-3 py-2"
|
|
366
|
+
onClick={(event) => {
|
|
367
|
+
event.stopPropagation()
|
|
368
|
+
}}
|
|
369
|
+
>
|
|
370
|
+
<RowCheckbox
|
|
371
|
+
label={selection.rowLabel(row)}
|
|
372
|
+
checked={selected}
|
|
373
|
+
onToggle={() => {
|
|
374
|
+
selection.onToggle(rowId)
|
|
375
|
+
}}
|
|
376
|
+
/>
|
|
377
|
+
</td>
|
|
378
|
+
)}
|
|
281
379
|
{columns.map((column) => (
|
|
282
380
|
<td key={column.key} className={`px-3 py-2 text-ink ${column.className ?? ''}`}>
|
|
283
381
|
{column.render(row)}
|
|
@@ -286,3 +384,45 @@ function DataRow<TRow>({
|
|
|
286
384
|
</tr>
|
|
287
385
|
)
|
|
288
386
|
}
|
|
387
|
+
|
|
388
|
+
/** One row's box, labelled "Select <name>". */
|
|
389
|
+
export function RowCheckbox({
|
|
390
|
+
label,
|
|
391
|
+
checked,
|
|
392
|
+
onToggle,
|
|
393
|
+
}: {
|
|
394
|
+
readonly label: string
|
|
395
|
+
readonly checked: boolean
|
|
396
|
+
readonly onToggle: () => void
|
|
397
|
+
}): React.JSX.Element {
|
|
398
|
+
return (
|
|
399
|
+
<input
|
|
400
|
+
type="checkbox"
|
|
401
|
+
aria-label={`Select ${label}`}
|
|
402
|
+
checked={checked}
|
|
403
|
+
onChange={onToggle}
|
|
404
|
+
className="h-3.5 w-3.5 rounded border-border text-accent focus:ring-accent"
|
|
405
|
+
/>
|
|
406
|
+
)
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* The page box for a list drawn as cards: the same box as a table's header
|
|
411
|
+
* cell, with its words beside it.
|
|
412
|
+
*/
|
|
413
|
+
export function CardSelectionHeader({
|
|
414
|
+
ids,
|
|
415
|
+
isSelected,
|
|
416
|
+
onTogglePage,
|
|
417
|
+
}: {
|
|
418
|
+
readonly ids: readonly string[]
|
|
419
|
+
readonly isSelected: (id: string) => boolean
|
|
420
|
+
readonly onTogglePage: (ids: readonly string[], selected: boolean) => void
|
|
421
|
+
}): React.JSX.Element {
|
|
422
|
+
return (
|
|
423
|
+
<div className="mb-1.5 flex items-center gap-2 px-4 text-[11px] text-ink-muted">
|
|
424
|
+
<PageCheckbox ids={ids} isSelected={isSelected} onTogglePage={onTogglePage} />
|
|
425
|
+
<span aria-hidden>Select page</span>
|
|
426
|
+
</div>
|
|
427
|
+
)
|
|
428
|
+
}
|
|
@@ -5,6 +5,7 @@ import type { FormEvent } from 'react'
|
|
|
5
5
|
import { useTimezone } from '../api/resources/account.ts'
|
|
6
6
|
import { useMembers } from '../api/resources/members.ts'
|
|
7
7
|
import { useCreateNote, useDeleteNote, useNotes, useUpdateNote } from '../api/resources/notes.ts'
|
|
8
|
+
import { noteAuthorName } from '../lib/attribution.ts'
|
|
8
9
|
import { formatDateTime } from '../lib/dates.ts'
|
|
9
10
|
import { FRAGMENT_HIGHLIGHT, useFragmentTarget } from '../lib/fragmentTarget.ts'
|
|
10
11
|
import { MarkdownView } from './MarkdownView.tsx'
|
|
@@ -113,7 +114,7 @@ export function NotesPanel({ targetType, targetId }: NotesPanelProps): React.JSX
|
|
|
113
114
|
) : (
|
|
114
115
|
<ul className="flex flex-col gap-3">
|
|
115
116
|
{ordered.map((note) => (
|
|
116
|
-
<NoteItem key={note.id} note={note} authorName={
|
|
117
|
+
<NoteItem key={note.id} note={note} authorName={noteAuthorName(note, members.nameById)} />
|
|
117
118
|
))}
|
|
118
119
|
</ul>
|
|
119
120
|
)}
|
|
@@ -123,22 +124,6 @@ export function NotesPanel({ targetType, targetId }: NotesPanelProps): React.JSX
|
|
|
123
124
|
)
|
|
124
125
|
}
|
|
125
126
|
|
|
126
|
-
/**
|
|
127
|
-
* A null author is a note written by a workspace API key, which belongs to the
|
|
128
|
-
* workspace rather than to a person. An id with no matching member is one whose
|
|
129
|
-
* membership was removed.
|
|
130
|
-
*
|
|
131
|
-
* A hosted AI run has no author and no key either, so it gets no name: the
|
|
132
|
-
* origin label beside the date says what wrote the note.
|
|
133
|
-
*/
|
|
134
|
-
function authorNameFor(note: Note, nameById: ReadonlyMap<string, string>): string | undefined {
|
|
135
|
-
if (note.authorId === null) {
|
|
136
|
-
return note.origin === 'ai' ? undefined : 'API key'
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
return nameById.get(note.authorId) ?? 'Unknown'
|
|
140
|
-
}
|
|
141
|
-
|
|
142
127
|
function NoteItem({
|
|
143
128
|
note,
|
|
144
129
|
authorName,
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { useEffect, useRef, useState } from 'react'
|
|
2
2
|
|
|
3
|
+
import { telHref } from '../lib/contactLinks.ts'
|
|
4
|
+
|
|
3
5
|
export interface PhonesFieldProps {
|
|
4
6
|
readonly value: readonly string[]
|
|
5
7
|
readonly onChange: (phones: readonly string[]) => void
|
|
6
8
|
}
|
|
7
9
|
|
|
8
|
-
function telHref(phone: string): string {
|
|
9
|
-
return `tel:${phone.replace(/[^\d+]/gu, '')}`
|
|
10
|
-
}
|
|
11
|
-
|
|
12
10
|
/** Add, edit, and remove phone numbers. Clearing one to empty removes it. */
|
|
13
11
|
export function PhonesField({ value, onChange }: PhonesFieldProps): React.JSX.Element {
|
|
14
12
|
const addInputRef = useRef<HTMLInputElement>(null)
|
package/src/components/Shell.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useRef, useState } from 'react'
|
|
1
|
+
import { Fragment, useCallback, useEffect, useRef, useState } from 'react'
|
|
2
2
|
import { Link, NavLink, Navigate, Outlet, useLocation, useNavigate } from 'react-router'
|
|
3
3
|
|
|
4
4
|
import { useAccount, useTheme } from '../api/resources/account.ts'
|
|
@@ -6,7 +6,7 @@ import { useLogOut, useSession } from '../api/resources/session.ts'
|
|
|
6
6
|
import { initialsOf } from '../lib/names.ts'
|
|
7
7
|
import type { ThemePreference } from '../lib/theme.ts'
|
|
8
8
|
import { ONBOARDING_RERUN_ENTRY } from '../pages/onboarding/onboardingRerun.ts'
|
|
9
|
-
import { useNavItems } from '../registry/context.ts'
|
|
9
|
+
import { useNavItems, useUserMenuItems } from '../registry/context.ts'
|
|
10
10
|
import type { NavItem } from '../registry/contributions.ts'
|
|
11
11
|
import { useVisibleNavItems } from '../registry/visibleNav.ts'
|
|
12
12
|
import { AiDrawerLauncher, AiDrawerPanel, AiDrawerProvider } from './AiDrawer.tsx'
|
|
@@ -48,6 +48,7 @@ const CORE_NAV: readonly NavItem[] = [
|
|
|
48
48
|
{ id: 'partnerships', label: 'Partnerships', to: '/partnerships', order: 375 },
|
|
49
49
|
{ id: 'lists', label: 'Lists', to: '/lists', order: 378 },
|
|
50
50
|
{ id: 'forms', label: 'Forms', to: '/forms', order: 380 },
|
|
51
|
+
{ id: 'bulk-jobs', label: 'Bulk jobs', to: '/bulk-jobs', order: 385 },
|
|
51
52
|
{ id: 'handbook', label: 'Handbook', to: '/handbook', order: 390 },
|
|
52
53
|
{ id: 'planning', label: 'Planning', to: '/planning', order: 400 },
|
|
53
54
|
{ id: 'decisions', label: 'Decisions', to: '/decisions', order: 500 },
|
|
@@ -57,12 +58,12 @@ const CORE_NAV: readonly NavItem[] = [
|
|
|
57
58
|
* `nav.primary` is one flat slot; the shell renders it as visual
|
|
58
59
|
* groups: an unheaded top section, an unheaded directory pair (People,
|
|
59
60
|
* Companies), a headed "CRM" section for pipeline objects, then a headed
|
|
60
|
-
* "Tools" section for Lists and
|
|
61
|
+
* "Tools" section for Lists, Forms and Bulk jobs. Presentation only — it stays here rather
|
|
61
62
|
* than becoming extra slots.
|
|
62
63
|
*/
|
|
63
64
|
const TOP_LEVEL_NAV_IDS: ReadonlySet<string> = new Set(['dashboard', 'handbook', 'planning', 'decisions'])
|
|
64
65
|
const DIRECTORY_NAV_IDS: ReadonlySet<string> = new Set(['people', 'companies'])
|
|
65
|
-
const TOOLS_NAV_IDS: ReadonlySet<string> = new Set(['lists', 'forms'])
|
|
66
|
+
const TOOLS_NAV_IDS: ReadonlySet<string> = new Set(['lists', 'forms', 'bulk-jobs'])
|
|
66
67
|
|
|
67
68
|
const ADMIN_ENTRY_PATH = '/admin/workspace'
|
|
68
69
|
const AI_ENTRY_PATH = '/ai'
|
|
@@ -102,6 +103,13 @@ export function Shell(): React.JSX.Element {
|
|
|
102
103
|
)
|
|
103
104
|
}
|
|
104
105
|
|
|
106
|
+
/**
|
|
107
|
+
* The class every user-menu row shares. Contributed rows receive it too, so a
|
|
108
|
+
* module's item cannot drift from core's look.
|
|
109
|
+
*/
|
|
110
|
+
const USER_MENU_ITEM_CLASS =
|
|
111
|
+
'block w-full px-3 py-1.5 text-left text-[13px] text-ink hover:bg-surface-sunken'
|
|
112
|
+
|
|
105
113
|
function ShellLayout(): React.JSX.Element {
|
|
106
114
|
// A reload finds a person-intake run this tab started, and shows it in the
|
|
107
115
|
// header with the drawer closed.
|
|
@@ -112,7 +120,11 @@ function ShellLayout(): React.JSX.Element {
|
|
|
112
120
|
const logOut = useLogOut()
|
|
113
121
|
const moduleNav = useNavItems('primary')
|
|
114
122
|
const moduleAdminNav = useNavItems('admin')
|
|
123
|
+
const moduleUserMenu = useUserMenuItems()
|
|
115
124
|
const [menuOpen, setMenuOpen] = useState(false)
|
|
125
|
+
const closeMenu = useCallback((): void => {
|
|
126
|
+
setMenuOpen(false)
|
|
127
|
+
}, [])
|
|
116
128
|
// Below `md` the sidebar is an off-canvas drawer; from `md` up it is always
|
|
117
129
|
// shown and this flag has no effect.
|
|
118
130
|
const [navOpen, setNavOpen] = useState(false)
|
|
@@ -417,10 +429,15 @@ function ShellLayout(): React.JSX.Element {
|
|
|
417
429
|
setMenuOpen(false)
|
|
418
430
|
void navigate(ONBOARDING_RERUN_ENTRY)
|
|
419
431
|
}}
|
|
420
|
-
className=
|
|
432
|
+
className={USER_MENU_ITEM_CLASS}
|
|
421
433
|
>
|
|
422
434
|
Rerun onboarding wizard
|
|
423
435
|
</button>
|
|
436
|
+
{moduleUserMenu.map((item) => (
|
|
437
|
+
<Fragment key={item.id}>
|
|
438
|
+
{item.render({ close: closeMenu, itemClassName: USER_MENU_ITEM_CLASS })}
|
|
439
|
+
</Fragment>
|
|
440
|
+
))}
|
|
424
441
|
<button
|
|
425
442
|
type="button"
|
|
426
443
|
role="menuitem"
|
|
@@ -434,7 +451,7 @@ function ShellLayout(): React.JSX.Element {
|
|
|
434
451
|
void navigate('/login', { replace: true })
|
|
435
452
|
})
|
|
436
453
|
}}
|
|
437
|
-
className=
|
|
454
|
+
className={`${USER_MENU_ITEM_CLASS} border-t border-border`}
|
|
438
455
|
>
|
|
439
456
|
Sign out
|
|
440
457
|
</button>
|
|
@@ -184,6 +184,11 @@ export function TagInput({
|
|
|
184
184
|
add(row?.tag ?? trimmed)
|
|
185
185
|
}
|
|
186
186
|
} else if (event.key === 'Escape') {
|
|
187
|
+
// An open list takes the first Escape, so a dialog or panel
|
|
188
|
+
// around the input closes only on a second one.
|
|
189
|
+
if (open) {
|
|
190
|
+
event.stopPropagation()
|
|
191
|
+
}
|
|
187
192
|
setOpen(false)
|
|
188
193
|
setQuery('')
|
|
189
194
|
}
|