@kelpie/ui 0.27.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.
Files changed (198) hide show
  1. package/dist/api/resources/bulkActions.d.ts +50 -0
  2. package/dist/api/resources/bulkActions.d.ts.map +1 -0
  3. package/dist/api/resources/bulkActions.js +192 -0
  4. package/dist/api/resources/bulkActions.js.map +1 -0
  5. package/dist/api/resources/forms.d.ts +26 -1
  6. package/dist/api/resources/forms.d.ts.map +1 -1
  7. package/dist/api/resources/forms.js +98 -1
  8. package/dist/api/resources/forms.js.map +1 -1
  9. package/dist/app/KelpieApp.d.ts.map +1 -1
  10. package/dist/app/KelpieApp.js +3 -1
  11. package/dist/app/KelpieApp.js.map +1 -1
  12. package/dist/components/BulkActions.d.ts +61 -0
  13. package/dist/components/BulkActions.d.ts.map +1 -0
  14. package/dist/components/BulkActions.js +351 -0
  15. package/dist/components/BulkActions.js.map +1 -0
  16. package/dist/components/BulkParamFields.d.ts +13 -0
  17. package/dist/components/BulkParamFields.d.ts.map +1 -0
  18. package/dist/components/BulkParamFields.js +177 -0
  19. package/dist/components/BulkParamFields.js.map +1 -0
  20. package/dist/components/CellLinks.d.ts +38 -0
  21. package/dist/components/CellLinks.d.ts.map +1 -0
  22. package/dist/components/CellLinks.js +58 -0
  23. package/dist/components/CellLinks.js.map +1 -0
  24. package/dist/components/CustomFieldsPanel.d.ts +12 -1
  25. package/dist/components/CustomFieldsPanel.d.ts.map +1 -1
  26. package/dist/components/CustomFieldsPanel.js +5 -1
  27. package/dist/components/CustomFieldsPanel.js.map +1 -1
  28. package/dist/components/DataTable.d.ts +42 -1
  29. package/dist/components/DataTable.d.ts.map +1 -1
  30. package/dist/components/DataTable.js +51 -16
  31. package/dist/components/DataTable.js.map +1 -1
  32. package/dist/components/PhonesField.d.ts.map +1 -1
  33. package/dist/components/PhonesField.js +1 -3
  34. package/dist/components/PhonesField.js.map +1 -1
  35. package/dist/components/Shell.d.ts.map +1 -1
  36. package/dist/components/Shell.js +16 -6
  37. package/dist/components/Shell.js.map +1 -1
  38. package/dist/components/TagInput.d.ts.map +1 -1
  39. package/dist/components/TagInput.js +5 -0
  40. package/dist/components/TagInput.js.map +1 -1
  41. package/dist/components/bulkActionParams.d.ts +71 -0
  42. package/dist/components/bulkActionParams.d.ts.map +1 -0
  43. package/dist/components/bulkActionParams.js +241 -0
  44. package/dist/components/bulkActionParams.js.map +1 -0
  45. package/dist/components/bulkActionSummary.d.ts +22 -0
  46. package/dist/components/bulkActionSummary.d.ts.map +1 -0
  47. package/dist/components/bulkActionSummary.js +68 -0
  48. package/dist/components/bulkActionSummary.js.map +1 -0
  49. package/dist/components/bulkJobStatus.d.ts +4 -0
  50. package/dist/components/bulkJobStatus.d.ts.map +1 -0
  51. package/dist/components/bulkJobStatus.js +10 -0
  52. package/dist/components/bulkJobStatus.js.map +1 -0
  53. package/dist/index.d.ts +2 -2
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.js +1 -1
  56. package/dist/index.js.map +1 -1
  57. package/dist/lib/bulkSelection.d.ts +43 -0
  58. package/dist/lib/bulkSelection.d.ts.map +1 -0
  59. package/dist/lib/bulkSelection.js +70 -0
  60. package/dist/lib/bulkSelection.js.map +1 -0
  61. package/dist/lib/contactLinks.d.ts +15 -0
  62. package/dist/lib/contactLinks.d.ts.map +1 -0
  63. package/dist/lib/contactLinks.js +22 -0
  64. package/dist/lib/contactLinks.js.map +1 -0
  65. package/dist/pages/BulkJobsPage.d.ts +3 -0
  66. package/dist/pages/BulkJobsPage.d.ts.map +1 -0
  67. package/dist/pages/BulkJobsPage.js +92 -0
  68. package/dist/pages/BulkJobsPage.js.map +1 -0
  69. package/dist/pages/CompaniesPage.d.ts.map +1 -1
  70. package/dist/pages/CompaniesPage.js +8 -4
  71. package/dist/pages/CompaniesPage.js.map +1 -1
  72. package/dist/pages/DealsPage.d.ts.map +1 -1
  73. package/dist/pages/DealsPage.js +15 -4
  74. package/dist/pages/DealsPage.js.map +1 -1
  75. package/dist/pages/DecisionsPage.d.ts.map +1 -1
  76. package/dist/pages/DecisionsPage.js +11 -1
  77. package/dist/pages/DecisionsPage.js.map +1 -1
  78. package/dist/pages/EnquiriesPage.d.ts.map +1 -1
  79. package/dist/pages/EnquiriesPage.js +15 -6
  80. package/dist/pages/EnquiriesPage.js.map +1 -1
  81. package/dist/pages/EventDetail.d.ts.map +1 -1
  82. package/dist/pages/EventDetail.js +14 -6
  83. package/dist/pages/EventDetail.js.map +1 -1
  84. package/dist/pages/EventsPage.d.ts.map +1 -1
  85. package/dist/pages/EventsPage.js +13 -3
  86. package/dist/pages/EventsPage.js.map +1 -1
  87. package/dist/pages/FormsPage.d.ts.map +1 -1
  88. package/dist/pages/FormsPage.js +2 -2
  89. package/dist/pages/FormsPage.js.map +1 -1
  90. package/dist/pages/FundraisingPage.d.ts.map +1 -1
  91. package/dist/pages/FundraisingPage.js +15 -4
  92. package/dist/pages/FundraisingPage.js.map +1 -1
  93. package/dist/pages/HiringPage.d.ts.map +1 -1
  94. package/dist/pages/HiringPage.js +2 -1
  95. package/dist/pages/HiringPage.js.map +1 -1
  96. package/dist/pages/ListDetail.d.ts.map +1 -1
  97. package/dist/pages/ListDetail.js +39 -7
  98. package/dist/pages/ListDetail.js.map +1 -1
  99. package/dist/pages/ListsPage.d.ts.map +1 -1
  100. package/dist/pages/ListsPage.js +2 -1
  101. package/dist/pages/ListsPage.js.map +1 -1
  102. package/dist/pages/OpportunitiesPage.d.ts.map +1 -1
  103. package/dist/pages/OpportunitiesPage.js +15 -6
  104. package/dist/pages/OpportunitiesPage.js.map +1 -1
  105. package/dist/pages/PartnershipsPage.d.ts.map +1 -1
  106. package/dist/pages/PartnershipsPage.js +15 -4
  107. package/dist/pages/PartnershipsPage.js.map +1 -1
  108. package/dist/pages/PeoplePage.d.ts.map +1 -1
  109. package/dist/pages/PeoplePage.js +10 -9
  110. package/dist/pages/PeoplePage.js.map +1 -1
  111. package/dist/pages/PlanningPage.d.ts.map +1 -1
  112. package/dist/pages/PlanningPage.js +15 -4
  113. package/dist/pages/PlanningPage.js.map +1 -1
  114. package/dist/pages/RoleDetail.d.ts.map +1 -1
  115. package/dist/pages/RoleDetail.js +12 -4
  116. package/dist/pages/RoleDetail.js.map +1 -1
  117. package/dist/pages/forms/BlockedSendersPage.d.ts +10 -0
  118. package/dist/pages/forms/BlockedSendersPage.d.ts.map +1 -0
  119. package/dist/pages/forms/BlockedSendersPage.js +65 -0
  120. package/dist/pages/forms/BlockedSendersPage.js.map +1 -0
  121. package/dist/pages/forms/MarkSpamPanel.d.ts +19 -0
  122. package/dist/pages/forms/MarkSpamPanel.d.ts.map +1 -0
  123. package/dist/pages/forms/MarkSpamPanel.js +62 -0
  124. package/dist/pages/forms/MarkSpamPanel.js.map +1 -0
  125. package/dist/pages/forms/SubmissionDetail.d.ts.map +1 -1
  126. package/dist/pages/forms/SubmissionDetail.js +41 -11
  127. package/dist/pages/forms/SubmissionDetail.js.map +1 -1
  128. package/dist/pages/forms/SubmissionsTable.d.ts +1 -1
  129. package/dist/pages/forms/SubmissionsTable.d.ts.map +1 -1
  130. package/dist/pages/forms/SubmissionsTable.js +6 -4
  131. package/dist/pages/forms/SubmissionsTable.js.map +1 -1
  132. package/dist/pages/forms/markSpamChoices.d.ts +51 -0
  133. package/dist/pages/forms/markSpamChoices.d.ts.map +1 -0
  134. package/dist/pages/forms/markSpamChoices.js +96 -0
  135. package/dist/pages/forms/markSpamChoices.js.map +1 -0
  136. package/dist/pages/positionDirectory.d.ts +5 -0
  137. package/dist/pages/positionDirectory.d.ts.map +1 -1
  138. package/dist/pages/positionDirectory.js +11 -3
  139. package/dist/pages/positionDirectory.js.map +1 -1
  140. package/dist/registry/context.d.ts +3 -1
  141. package/dist/registry/context.d.ts.map +1 -1
  142. package/dist/registry/context.js +4 -0
  143. package/dist/registry/context.js.map +1 -1
  144. package/dist/registry/contributions.d.ts +23 -0
  145. package/dist/registry/contributions.d.ts.map +1 -1
  146. package/dist/registry/contributions.js.map +1 -1
  147. package/dist/registry/registry.d.ts +4 -1
  148. package/dist/registry/registry.d.ts.map +1 -1
  149. package/dist/registry/registry.js +6 -0
  150. package/dist/registry/registry.js.map +1 -1
  151. package/dist/registry/visibleNav.d.ts.map +1 -1
  152. package/dist/registry/visibleNav.js +1 -0
  153. package/dist/registry/visibleNav.js.map +1 -1
  154. package/package.json +3 -3
  155. package/src/api/resources/bulkActions.ts +267 -0
  156. package/src/api/resources/forms.ts +135 -0
  157. package/src/app/KelpieApp.tsx +5 -0
  158. package/src/components/BulkActions.tsx +961 -0
  159. package/src/components/BulkParamFields.tsx +524 -0
  160. package/src/components/CellLinks.tsx +138 -0
  161. package/src/components/CustomFieldsPanel.tsx +6 -2
  162. package/src/components/DataTable.tsx +142 -2
  163. package/src/components/PhonesField.tsx +2 -4
  164. package/src/components/Shell.tsx +23 -6
  165. package/src/components/TagInput.tsx +5 -0
  166. package/src/components/bulkActionParams.ts +405 -0
  167. package/src/components/bulkActionSummary.ts +104 -0
  168. package/src/components/bulkJobStatus.ts +11 -0
  169. package/src/index.ts +3 -0
  170. package/src/lib/bulkSelection.ts +128 -0
  171. package/src/lib/contactLinks.ts +25 -0
  172. package/src/pages/BulkJobsPage.tsx +206 -0
  173. package/src/pages/CompaniesPage.tsx +20 -5
  174. package/src/pages/DealsPage.tsx +30 -2
  175. package/src/pages/DecisionsPage.tsx +21 -1
  176. package/src/pages/EnquiriesPage.tsx +33 -5
  177. package/src/pages/EventDetail.tsx +43 -16
  178. package/src/pages/EventsPage.tsx +26 -2
  179. package/src/pages/FormsPage.tsx +7 -1
  180. package/src/pages/FundraisingPage.tsx +30 -2
  181. package/src/pages/HiringPage.tsx +6 -1
  182. package/src/pages/ListDetail.tsx +69 -5
  183. package/src/pages/ListsPage.tsx +6 -1
  184. package/src/pages/OpportunitiesPage.tsx +33 -5
  185. package/src/pages/PartnershipsPage.tsx +30 -2
  186. package/src/pages/PeoplePage.tsx +26 -21
  187. package/src/pages/PlanningPage.tsx +65 -24
  188. package/src/pages/RoleDetail.tsx +35 -7
  189. package/src/pages/forms/BlockedSendersPage.tsx +155 -0
  190. package/src/pages/forms/MarkSpamPanel.tsx +193 -0
  191. package/src/pages/forms/SubmissionDetail.tsx +73 -18
  192. package/src/pages/forms/SubmissionsTable.tsx +7 -5
  193. package/src/pages/forms/markSpamChoices.ts +141 -0
  194. package/src/pages/positionDirectory.ts +16 -4
  195. package/src/registry/context.ts +6 -0
  196. package/src/registry/contributions.ts +25 -0
  197. package/src/registry/registry.ts +12 -0
  198. package/src/registry/visibleNav.ts +1 -0
@@ -0,0 +1,206 @@
1
+ import { BULK_JOB_STATUSES, RECORD_TARGET_TYPE_LABELS } from '@kelpie/schemas'
2
+ import type { BulkActionTargetType, BulkJob, BulkJobStatus } from '@kelpie/schemas'
3
+ import { useState } from 'react'
4
+ import { Link, useNavigate, useParams } from 'react-router'
5
+
6
+ import { useTimezone } from '../api/resources/account.ts'
7
+ import {
8
+ isBulkJobFinal,
9
+ useBulkActionCatalog,
10
+ useBulkJob,
11
+ useBulkJobs,
12
+ useCancelBulkJob,
13
+ } from '../api/resources/bulkActions.ts'
14
+ import { BulkError, BulkJobDownload, JobCounts } from '../components/BulkActions.tsx'
15
+ import { STATUS_TEXT } from '../components/bulkJobStatus.ts'
16
+ import { DataTable } from '../components/DataTable.tsx'
17
+ import type { Column } from '../components/DataTable.tsx'
18
+ import { PageHeader } from '../components/PageHeader.tsx'
19
+ import { Paginator } from '../components/Paginator.tsx'
20
+ import { ErrorPanel, LoadingPanel, NotFoundPanel } from '../components/QueryState.tsx'
21
+ import { formatDateTime } from '../lib/dates.ts'
22
+
23
+ /**
24
+ * Bulk jobs: every bulk action the reader may see, newest first, and one job
25
+ * with its counts, its failed records, Cancel while it works, and its file
26
+ * when it made one.
27
+ *
28
+ * Read through `GET /v1/bulk-actions`, the same list an agent reads. The job
29
+ * list does not poll; one job does, until it ends.
30
+ */
31
+
32
+ const TYPE_LABELS: Readonly<Record<BulkActionTargetType, string>> = {
33
+ ...RECORD_TARGET_TYPE_LABELS,
34
+ decision: 'Decision',
35
+ plan_item: 'Plan item',
36
+ }
37
+
38
+ const STATUS_FILTER_LABELS: Readonly<Record<BulkJobStatus, string>> = {
39
+ queued: 'Queued',
40
+ running: 'Running',
41
+ completed: 'Done',
42
+ completed_with_errors: 'Done, with failures',
43
+ failed: 'Stopped',
44
+ cancelled: 'Cancelled',
45
+ }
46
+
47
+ function isStatus(value: string): value is BulkJobStatus {
48
+ return (BULK_JOB_STATUSES as readonly string[]).includes(value)
49
+ }
50
+
51
+ /** The action's label from its type's catalog. The key while that loads, or for an action no longer offered. */
52
+ function ActionLabel({ job }: { readonly job: BulkJob }): React.JSX.Element {
53
+ const catalog = useBulkActionCatalog(job.targetType)
54
+ const entry = catalog.actions.find((action) => action.key === job.action)
55
+
56
+ return <>{entry?.label ?? job.action}</>
57
+ }
58
+
59
+ export function BulkJobsPage(): React.JSX.Element {
60
+ const [status, setStatus] = useState<BulkJobStatus | undefined>(undefined)
61
+ const jobs = useBulkJobs(status)
62
+ const navigate = useNavigate()
63
+ const timezone = useTimezone()
64
+
65
+ const columns: readonly Column<BulkJob>[] = [
66
+ {
67
+ key: 'action',
68
+ header: 'Action',
69
+ render: (job) => (
70
+ <Link to={`/bulk-jobs/${job.id}`} className="font-medium text-ink hover:text-accent">
71
+ <ActionLabel job={job} />
72
+ </Link>
73
+ ),
74
+ },
75
+ { key: 'type', header: 'Records', render: (job) => TYPE_LABELS[job.targetType] },
76
+ { key: 'status', header: 'Status', render: (job) => STATUS_TEXT[job.status] },
77
+ {
78
+ key: 'counts',
79
+ header: 'Counts',
80
+ render: (job) =>
81
+ `${job.processedCount.toLocaleString()} of ${job.totalCount.toLocaleString()} · ${job.succeededCount.toLocaleString()} succeeded · ${job.skippedCount.toLocaleString()} skipped · ${job.failedCount.toLocaleString()} failed`,
82
+ },
83
+ { key: 'created', header: 'Created', render: (job) => formatDateTime(job.createdAt, timezone) },
84
+ ]
85
+
86
+ return (
87
+ <div className="animate-fade-in">
88
+ <PageHeader title="Bulk jobs" description="Actions run on many records at once, newest first." />
89
+
90
+ <label className="mb-3 inline-flex items-center gap-2 text-[12px] font-medium text-ink-muted">
91
+ Status
92
+ <select
93
+ value={status ?? ''}
94
+ onChange={(event) => {
95
+ setStatus(isStatus(event.target.value) ? event.target.value : undefined)
96
+ }}
97
+ className="rounded-md border border-border bg-surface px-2 py-1 text-[13px] text-ink outline-none focus:border-accent"
98
+ >
99
+ <option value="">Any status</option>
100
+ {BULK_JOB_STATUSES.map((value) => (
101
+ <option key={value} value={value}>
102
+ {STATUS_FILTER_LABELS[value]}
103
+ </option>
104
+ ))}
105
+ </select>
106
+ </label>
107
+
108
+ {jobs.error !== null ? (
109
+ <ErrorPanel error={jobs.error} />
110
+ ) : jobs.isLoading ? (
111
+ <LoadingPanel label="Loading bulk jobs…" />
112
+ ) : (
113
+ <>
114
+ <Paginator list={jobs} placement="top" />
115
+ <DataTable
116
+ columns={columns}
117
+ rows={jobs.records}
118
+ getRowId={(job) => job.id}
119
+ onRowClick={(job) => {
120
+ void navigate(`/bulk-jobs/${job.id}`)
121
+ }}
122
+ emptyMessage={status === undefined ? 'No bulk jobs yet' : 'No bulk jobs have this status'}
123
+ emptyDescription={
124
+ status === undefined
125
+ ? 'Select records on a list page and choose an action to start one.'
126
+ : 'Choose another status.'
127
+ }
128
+ />
129
+ <Paginator list={jobs} placement="bottom" />
130
+ </>
131
+ )}
132
+ </div>
133
+ )
134
+ }
135
+
136
+ export function BulkJobDetail(): React.JSX.Element {
137
+ const { id } = useParams()
138
+ const watched = useBulkJob(id)
139
+ const cancel = useCancelBulkJob()
140
+ const timezone = useTimezone()
141
+ const job = watched.record
142
+
143
+ if (watched.isNotFound) {
144
+ return <NotFoundPanel label="Bulk job" backTo="/bulk-jobs" />
145
+ }
146
+
147
+ if (watched.error !== null) {
148
+ return <ErrorPanel error={watched.error} />
149
+ }
150
+
151
+ if (watched.isLoading || job === undefined) {
152
+ return <LoadingPanel label="Loading bulk job…" />
153
+ }
154
+
155
+ const working = !isBulkJobFinal(job.status)
156
+
157
+ return (
158
+ <div className="animate-fade-in mx-auto max-w-3xl">
159
+ <Link
160
+ to="/bulk-jobs"
161
+ className="mb-4 inline-flex text-[12px] font-medium text-ink-muted transition hover:text-accent"
162
+ >
163
+ ← Bulk jobs
164
+ </Link>
165
+
166
+ <div className="mb-4 flex flex-wrap items-start gap-3">
167
+ <div className="min-w-[12rem] flex-1">
168
+ <h1 className="text-[22px] font-semibold tracking-tight text-ink">
169
+ <ActionLabel job={job} />
170
+ </h1>
171
+ <p className="mt-1 text-[12px] text-ink-muted">
172
+ {TYPE_LABELS[job.targetType]} records · created {formatDateTime(job.createdAt, timezone)}
173
+ {job.startedAt !== null && ` · started ${formatDateTime(job.startedAt, timezone)}`}
174
+ </p>
175
+ </div>
176
+ <div className="flex flex-wrap items-center gap-2">
177
+ {job.downloadUrl !== null && <BulkJobDownload job={job} />}
178
+ {working && (
179
+ <button
180
+ type="button"
181
+ disabled={cancel.isPending}
182
+ onClick={() => {
183
+ cancel.run(job.id)
184
+ }}
185
+ className="rounded-md border border-border px-2.5 py-1 text-[12px] font-medium text-ink-muted transition hover:border-danger hover:text-danger disabled:opacity-50"
186
+ >
187
+ {cancel.isPending ? 'Cancelling…' : 'Cancel'}
188
+ </button>
189
+ )}
190
+ </div>
191
+ </div>
192
+
193
+ <section aria-label="Progress" className="rounded-md border border-border bg-surface-raised px-4 py-3">
194
+ <p className="text-[13px] font-semibold text-ink" aria-live="polite">
195
+ {STATUS_TEXT[job.status]}
196
+ </p>
197
+ {cancel.error !== null && (
198
+ <div className="mt-2">
199
+ <BulkError error={cancel.error} />
200
+ </div>
201
+ )}
202
+ <JobCounts job={job} />
203
+ </section>
204
+ </div>
205
+ )
206
+ }
@@ -5,8 +5,10 @@ import { useNavigate } from 'react-router'
5
5
 
6
6
  import { useTimezone } from '../api/resources/account.ts'
7
7
  import { useCompanies, useCreateCompany } from '../api/resources/companies.ts'
8
+ import { RecordLink, WebsiteLink } from '../components/CellLinks.tsx'
8
9
  import { AddRecordPanel } from '../components/AddRecordPanel.tsx'
9
10
  import type { AddRecordValues } from '../components/AddRecordPanel.tsx'
11
+ import { BulkActions } from '../components/BulkActions.tsx'
10
12
  import { Chip } from '../components/Chip.tsx'
11
13
  import type { ChipTone } from '../components/Chip.tsx'
12
14
  import { ColumnPicker } from '../components/ColumnPicker.tsx'
@@ -15,6 +17,7 @@ import type { Column } from '../components/DataTable.tsx'
15
17
  import { FilterBar, PageHeader } from '../components/PageHeader.tsx'
16
18
  import { Paginator } from '../components/Paginator.tsx'
17
19
  import { ErrorPanel, LoadingPanel } from '../components/QueryState.tsx'
20
+ import { useBulkSelection } from '../lib/bulkSelection.ts'
18
21
  import { formatDate } from '../lib/dates.ts'
19
22
  import { useListView } from '../lib/listView.ts'
20
23
  import { serverSortOnly } from '../lib/sort.ts'
@@ -49,6 +52,7 @@ export function CompaniesPage(): React.JSX.Element {
49
52
  term: hasFilter ? term.trim() : undefined,
50
53
  sort: serverSortOnly(sort, SERVER_SORT_KEYS),
51
54
  })
55
+ const bulk = useBulkSelection({ filter: hasFilter ? { q: term.trim() } : {}, resetOn: [sort] })
52
56
  const headcounts = useCompanyHeadcounts(companies.records.map((company) => company.id))
53
57
  const createCompany = useCreateCompany()
54
58
 
@@ -67,15 +71,17 @@ export function CompaniesPage(): React.JSX.Element {
67
71
  key: 'name',
68
72
  header: 'Name',
69
73
  sortKey: 'name',
70
- render: (company) => <span className="font-medium">{company.name}</span>,
74
+ render: (company) => (
75
+ <RecordLink to={`/companies/${company.id}`} className="font-medium">
76
+ {company.name}
77
+ </RecordLink>
78
+ ),
71
79
  },
72
80
  {
73
81
  key: 'domain',
74
82
  header: 'Domain',
75
83
  getSortValue: (company) => company.domain,
76
- render: (company) => (
77
- <span className="font-mono text-[12px] text-ink-muted">{company.domain ?? '—'}</span>
78
- ),
84
+ render: (company) => <WebsiteLink domain={company.domain} />,
79
85
  },
80
86
  {
81
87
  key: 'industry',
@@ -212,7 +218,15 @@ export function CompaniesPage(): React.JSX.Element {
212
218
  />
213
219
  }
214
220
  />
215
- <FilterBar value={term} onChange={setTerm} placeholder="Filter by name, type, tags…" />
221
+ <BulkActions
222
+ targetType="company"
223
+ selection={bulk}
224
+ pageIds={companies.records.map((company) => company.id)}
225
+ hasNextPage={companies.hasNext}
226
+ noun={{ one: 'company', many: 'companies' }}
227
+ >
228
+ <FilterBar value={term} onChange={setTerm} placeholder="Filter by name, type, tags…" />
229
+ </BulkActions>
216
230
 
217
231
  {adding && (
218
232
  <AddRecordPanel
@@ -260,6 +274,7 @@ export function CompaniesPage(): React.JSX.Element {
260
274
  sort={sort}
261
275
  onSortChange={setSort}
262
276
  visibleColumnKeys={listView.visibleKeys}
277
+ selection={{ ...bulk, rowLabel: (company) => company.name }}
263
278
  />
264
279
  {!headcounts.isComplete && !headcounts.isLoading && (
265
280
  <p className="mt-2 text-[11px] text-ink-faint">
@@ -10,6 +10,8 @@ import { MAX_PAGE_SIZE, usePlanItems } from '../api/resources/planItems.ts'
10
10
  import { useTimezone } from '../api/resources/account.ts'
11
11
  import { AddCompanyRecordPanel } from '../components/AddRecordPanel.tsx'
12
12
  import type { AddRecordValues } from '../components/AddRecordPanel.tsx'
13
+ import { CompanyLink, RecordLink } from '../components/CellLinks.tsx'
14
+ import { BulkActions } from '../components/BulkActions.tsx'
13
15
  import { Chip } from '../components/Chip.tsx'
14
16
  import type { ChipTone } from '../components/Chip.tsx'
15
17
  import { ColumnPicker } from '../components/ColumnPicker.tsx'
@@ -20,6 +22,7 @@ import { PageHeader } from '../components/PageHeader.tsx'
20
22
  import { Paginator } from '../components/Paginator.tsx'
21
23
  import { ErrorPanel, LoadingPanel } from '../components/QueryState.tsx'
22
24
  import { SegmentedControl } from '../components/SegmentedControl.tsx'
25
+ import { useBulkSelection } from '../lib/bulkSelection.ts'
23
26
  import { formatDate, formatDay } from '../lib/dates.ts'
24
27
  import { useListView } from '../lib/listView.ts'
25
28
  import { formatMoney } from '../lib/money.ts'
@@ -115,6 +118,15 @@ export function DealsPage(): React.JSX.Element {
115
118
  const visibleStageIds = new Set(visibleStages.map((stage) => stage.id))
116
119
  const visibleDeals = deals.records.filter((deal) => visibleStageIds.has(deal.stageId))
117
120
 
121
+ // The board has no checkboxes, so a selection lives only in the list, and
122
+ // switching view clears it. The Open scope is a filter on stage, so a
123
+ // filter selection names the open stages the list is showing.
124
+ const openStageIds = visibleStages.map((stage) => stage.id)
125
+ const bulk = useBulkSelection({
126
+ filter: scope === 'open' && openStageIds.length > 0 ? { stage_id: openStageIds } : {},
127
+ resetOn: [sort, view],
128
+ })
129
+
118
130
  // The next-step column asks about the deals on screen by id. `?target_id=`
119
131
  // takes at most one page of them (`docs/agents/api-and-webhooks.md`), so past that ceiling the rest
120
132
  // read as having no plan; the note under the table says so.
@@ -150,13 +162,19 @@ export function DealsPage(): React.JSX.Element {
150
162
  key: 'name',
151
163
  header: 'Deal',
152
164
  sortKey: 'name',
153
- render: (deal) => <span className="font-medium text-ink">{deal.name}</span>,
165
+ render: (deal) => (
166
+ <RecordLink to={`/deals/${deal.id}`} className="font-medium text-ink">
167
+ {deal.name}
168
+ </RecordLink>
169
+ ),
154
170
  },
155
171
  {
156
172
  key: 'company',
157
173
  header: 'Company',
158
174
  getSortValue: (deal) => companyNameById.get(deal.companyId) ?? null,
159
- render: (deal) => companyNameById.get(deal.companyId) ?? '—',
175
+ render: (deal) => (
176
+ <CompanyLink id={deal.companyId} name={companyNameById.get(deal.companyId)} />
177
+ ),
160
178
  },
161
179
  {
162
180
  key: 'stage',
@@ -431,6 +449,15 @@ export function DealsPage(): React.JSX.Element {
431
449
  <LoadingPanel label="Loading deals…" />
432
450
  ) : (
433
451
  <>
452
+ {view === 'list' && (
453
+ <BulkActions
454
+ targetType="deal"
455
+ selection={bulk}
456
+ pageIds={visibleDeals.map((deal) => deal.id)}
457
+ hasNextPage={deals.hasNext}
458
+ noun={{ one: 'deal', many: 'deals' }}
459
+ />
460
+ )}
434
461
  {view === 'list' && <Paginator list={deals} placement="top" />}
435
462
  {view === 'columns' ? (
436
463
  <KanbanBoard
@@ -488,6 +515,7 @@ export function DealsPage(): React.JSX.Element {
488
515
  listView.setSort(next)
489
516
  }}
490
517
  visibleColumnKeys={listView.visibleKeys}
518
+ selection={{ ...bulk, rowLabel: (deal) => deal.name }}
491
519
  />
492
520
  )}
493
521
  {updateDeal.error !== null && (
@@ -12,6 +12,7 @@ import { useOpportunities } from '../api/resources/opportunities.ts'
12
12
  import { usePartnerships } from '../api/resources/partnerships.ts'
13
13
  import { usePeople } from '../api/resources/people.ts'
14
14
  import { useRaises } from '../api/resources/raises.ts'
15
+ import { BulkActions } from '../components/BulkActions.tsx'
15
16
  import { ColumnPicker } from '../components/ColumnPicker.tsx'
16
17
  import { DataTable } from '../components/DataTable.tsx'
17
18
  import type { Column } from '../components/DataTable.tsx'
@@ -23,6 +24,7 @@ import {
23
24
  import { FilterBar, PageHeader } from '../components/PageHeader.tsx'
24
25
  import { Paginator } from '../components/Paginator.tsx'
25
26
  import { ErrorPanel, LoadingPanel } from '../components/QueryState.tsx'
27
+ import { useBulkSelection } from '../lib/bulkSelection.ts'
26
28
  import { formatDate } from '../lib/dates.ts'
27
29
  import { serverSortOnly } from '../lib/sort.ts'
28
30
  import { useListView } from '../lib/listView.ts'
@@ -146,6 +148,10 @@ export function DecisionsPage(): React.JSX.Element {
146
148
  term: term.trim().length > 0 ? term.trim() : undefined,
147
149
  sort: serverSortOnly(sort, SERVER_SORT_KEYS),
148
150
  })
151
+ const bulk = useBulkSelection({
152
+ filter: term.trim().length > 0 ? { q: term.trim() } : {},
153
+ resetOn: [sort],
154
+ })
149
155
  const confirmDecision = useConfirmDecision()
150
156
  const directory = useTargetDirectory()
151
157
  const members = useMembers()
@@ -261,7 +267,15 @@ export function DecisionsPage(): React.JSX.Element {
261
267
  />
262
268
  }
263
269
  />
264
- <FilterBar value={term} onChange={setTerm} placeholder="Filter decisions…" />
270
+ <BulkActions
271
+ targetType="decision"
272
+ selection={bulk}
273
+ pageIds={decisions.records.map((decision) => decision.id)}
274
+ hasNextPage={decisions.hasNext}
275
+ noun={{ one: 'decision', many: 'decisions' }}
276
+ >
277
+ <FilterBar value={term} onChange={setTerm} placeholder="Filter decisions…" />
278
+ </BulkActions>
265
279
 
266
280
  <ConfirmedAnnouncement count={confirmDecision.confirmedCount} />
267
281
  {confirmDecision.error !== null && (
@@ -285,6 +299,7 @@ export function DecisionsPage(): React.JSX.Element {
285
299
  sort={sort}
286
300
  onSortChange={setSort}
287
301
  visibleColumnKeys={listView.visibleKeys}
302
+ selection={{ ...bulk, rowLabel: (decision) => shortLabel(decision.body) }}
288
303
  />
289
304
  <Paginator list={decisions} />
290
305
  </>
@@ -292,3 +307,8 @@ export function DecisionsPage(): React.JSX.Element {
292
307
  </div>
293
308
  )
294
309
  }
310
+
311
+ /** A decision's body is prose, so a checkbox label takes its opening words. */
312
+ function shortLabel(body: string): string {
313
+ return body.length > 60 ? `${body.slice(0, 60)}…` : body
314
+ }
@@ -14,6 +14,8 @@ import { MAX_PAGE_SIZE, usePlanItems } from '../api/resources/planItems.ts'
14
14
  import { useTimezone } from '../api/resources/account.ts'
15
15
  import { AddRecordPanel } from '../components/AddRecordPanel.tsx'
16
16
  import type { AddRecordValues } from '../components/AddRecordPanel.tsx'
17
+ import { CompanyLink, RecordLink } from '../components/CellLinks.tsx'
18
+ import { BulkActions } from '../components/BulkActions.tsx'
17
19
  import { Chip } from '../components/Chip.tsx'
18
20
  import type { ChipTone } from '../components/Chip.tsx'
19
21
  import { ColumnPicker } from '../components/ColumnPicker.tsx'
@@ -24,6 +26,7 @@ import { PageHeader } from '../components/PageHeader.tsx'
24
26
  import { Paginator } from '../components/Paginator.tsx'
25
27
  import { ErrorPanel, LoadingPanel } from '../components/QueryState.tsx'
26
28
  import { SegmentedControl } from '../components/SegmentedControl.tsx'
29
+ import { useBulkSelection } from '../lib/bulkSelection.ts'
27
30
  import { formatDate, formatDay } from '../lib/dates.ts'
28
31
  import { useListView } from '../lib/listView.ts'
29
32
  import { DUE_BUCKETS, byDateThenTitle, dueBucketFor, nextOpenByTarget } from '../lib/plan.ts'
@@ -108,6 +111,15 @@ export function EnquiriesPage(): React.JSX.Element {
108
111
  visibleStageIds.has(enquiry.stageId),
109
112
  )
110
113
 
114
+ // The board has no checkboxes, so a selection lives only in the list, and
115
+ // switching view clears it. The Open scope is a filter on stage, so a
116
+ // filter selection names the open stages the list is showing.
117
+ const openStageIds = visibleStages.map((stage) => stage.id)
118
+ const bulk = useBulkSelection({
119
+ filter: scope === 'open' && openStageIds.length > 0 ? { stage_id: openStageIds } : {},
120
+ resetOn: [sort, view],
121
+ })
122
+
111
123
  const askedIds = visibleEnquiries.slice(0, MAX_PAGE_SIZE).map((enquiry) => enquiry.id)
112
124
  const planItems = usePlanItems(
113
125
  {
@@ -140,7 +152,11 @@ export function EnquiriesPage(): React.JSX.Element {
140
152
  key: 'name',
141
153
  header: 'Enquiry',
142
154
  sortKey: 'name',
143
- render: (enquiry) => <span className="font-medium text-ink">{enquiry.name}</span>,
155
+ render: (enquiry) => (
156
+ <RecordLink to={`/enquiries/${enquiry.id}`} className="font-medium text-ink">
157
+ {enquiry.name}
158
+ </RecordLink>
159
+ ),
144
160
  },
145
161
  {
146
162
  key: 'source',
@@ -153,10 +169,12 @@ export function EnquiriesPage(): React.JSX.Element {
153
169
  header: 'Company',
154
170
  getSortValue: (enquiry) =>
155
171
  enquiry.companyId === null ? null : (companyNameById.get(enquiry.companyId) ?? null),
156
- render: (enquiry) =>
157
- enquiry.companyId === null
158
- ? '—'
159
- : (companyNameById.get(enquiry.companyId) ?? '—'),
172
+ render: (enquiry) => (
173
+ <CompanyLink
174
+ id={enquiry.companyId}
175
+ name={enquiry.companyId === null ? undefined : companyNameById.get(enquiry.companyId)}
176
+ />
177
+ ),
160
178
  },
161
179
  {
162
180
  key: 'stage',
@@ -369,6 +387,15 @@ export function EnquiriesPage(): React.JSX.Element {
369
387
  <LoadingPanel label="Loading enquiries…" />
370
388
  ) : (
371
389
  <>
390
+ {view === 'list' && (
391
+ <BulkActions
392
+ targetType="enquiry"
393
+ selection={bulk}
394
+ pageIds={visibleEnquiries.map((enquiry) => enquiry.id)}
395
+ hasNextPage={enquiries.hasNext}
396
+ noun={{ one: 'enquiry', many: 'enquiries' }}
397
+ />
398
+ )}
372
399
  {view === 'list' && <Paginator list={enquiries} placement="top" />}
373
400
  {view === 'columns' ? (
374
401
  <KanbanBoard
@@ -426,6 +453,7 @@ export function EnquiriesPage(): React.JSX.Element {
426
453
  listView.setSort(next)
427
454
  }}
428
455
  visibleColumnKeys={listView.visibleKeys}
456
+ selection={{ ...bulk, rowLabel: (enquiry) => enquiry.name }}
429
457
  />
430
458
  )}
431
459
  {updateEnquiry.error !== null && (
@@ -44,8 +44,10 @@ import { useRaises } from '../api/resources/raises.ts'
44
44
  import { useRoles } from '../api/resources/roles.ts'
45
45
  import { ActivitiesPanel, LatestActivity } from '../components/ActivitiesPanel.tsx'
46
46
  import { AgentTasks } from '../components/AgentTasks.tsx'
47
+ import { BulkActions } from '../components/BulkActions.tsx'
47
48
  import { Chip } from '../components/Chip.tsx'
48
49
  import type { ChipTone } from '../components/Chip.tsx'
50
+ import { CardSelectionHeader, RowCheckbox } from '../components/DataTable.tsx'
49
51
  import { DecisionsPanel } from '../components/DecisionsPanel.tsx'
50
52
  import { DeleteRecord } from '../components/DeleteRecord.tsx'
51
53
  import { EntitySearch } from '../components/EntitySearch.tsx'
@@ -58,6 +60,7 @@ import { PlanAttention } from '../components/PlanAttention.tsx'
58
60
  import { PlanPanel } from '../components/PlanPanel.tsx'
59
61
  import { ErrorPanel, LoadingPanel, NotFoundPanel } from '../components/QueryState.tsx'
60
62
  import { RecordTabs } from '../components/RecordTabs.tsx'
63
+ import { useBulkSelection } from '../lib/bulkSelection.ts'
61
64
  import type { RecordTabDescriptor } from '../components/RecordTabs.tsx'
62
65
  import { SectionHeader } from '../components/SectionHeader.tsx'
63
66
  import { SidebarField } from '../components/SidebarField.tsx'
@@ -420,6 +423,9 @@ function EventAttendees({ event }: { readonly event: CrmEvent }): React.JSX.Elem
420
423
  const directory = usePeople({ limit: 200 })
421
424
  const nameById = new Map(directory.records.map((person) => [person.id, person.name]))
422
425
  const registered = new Set(attendances.records.map((row) => row.personId))
426
+ // "All that match" is every attendance on this event, as the API filters them.
427
+ const bulk = useBulkSelection({ filter: { event_id: [event.id] } })
428
+ const pageIds = attendances.records.map((row) => row.id)
423
429
 
424
430
  function add(submitEvent: FormEvent): void {
425
431
  submitEvent.preventDefault()
@@ -436,6 +442,13 @@ function EventAttendees({ event }: { readonly event: CrmEvent }): React.JSX.Elem
436
442
  return (
437
443
  <section>
438
444
  <SectionHeader title="Attendees" />
445
+ <BulkActions
446
+ targetType="attendance"
447
+ selection={bulk}
448
+ pageIds={pageIds}
449
+ hasNextPage={attendances.hasNext}
450
+ noun={{ one: 'attendance', many: 'attendances' }}
451
+ />
439
452
  {createAttendance.error !== null && (
440
453
  <div className="mb-3">
441
454
  <ErrorPanel error={createAttendance.error} />
@@ -445,22 +458,31 @@ function EventAttendees({ event }: { readonly event: CrmEvent }): React.JSX.Elem
445
458
  {attendances.isLoading ? (
446
459
  <p className="text-[13px] text-ink-faint">Loading attendees…</p>
447
460
  ) : (
448
- <ul className="divide-y divide-border overflow-hidden rounded-md border border-border">
449
- {attendances.records.length === 0 && (
450
- <li className="px-3 py-3 text-[13px] text-ink-faint">No attendees yet.</li>
461
+ <>
462
+ {pageIds.length > 0 && (
463
+ <CardSelectionHeader ids={pageIds} isSelected={bulk.isSelected} onTogglePage={bulk.onTogglePage} />
451
464
  )}
452
- {attendances.records.map((row) => (
453
- <AttendanceRow
454
- key={row.id}
455
- attendance={row}
456
- personName={nameById.get(row.personId) ?? row.personId}
457
- notesOpen={openNotesId === row.id}
458
- onToggleNotes={() => {
459
- setOpenNotesId((current) => (current === row.id ? null : row.id))
460
- }}
461
- />
462
- ))}
463
- </ul>
465
+ <ul className="divide-y divide-border overflow-hidden rounded-md border border-border">
466
+ {attendances.records.length === 0 && (
467
+ <li className="px-3 py-3 text-[13px] text-ink-faint">No attendees yet.</li>
468
+ )}
469
+ {attendances.records.map((row) => (
470
+ <AttendanceRow
471
+ key={row.id}
472
+ attendance={row}
473
+ personName={nameById.get(row.personId) ?? row.personId}
474
+ selected={bulk.isSelected(row.id)}
475
+ onToggle={() => {
476
+ bulk.onToggle(row.id)
477
+ }}
478
+ notesOpen={openNotesId === row.id}
479
+ onToggleNotes={() => {
480
+ setOpenNotesId((current) => (current === row.id ? null : row.id))
481
+ }}
482
+ />
483
+ ))}
484
+ </ul>
485
+ </>
464
486
  )}
465
487
  <form onSubmit={add} className="mt-3 flex flex-wrap items-end gap-2">
466
488
  <div className="min-w-[220px] flex-1">
@@ -494,11 +516,15 @@ function EventAttendees({ event }: { readonly event: CrmEvent }): React.JSX.Elem
494
516
  function AttendanceRow({
495
517
  attendance,
496
518
  personName,
519
+ selected,
520
+ onToggle,
497
521
  notesOpen,
498
522
  onToggleNotes,
499
523
  }: {
500
524
  readonly attendance: Attendance
501
525
  readonly personName: string
526
+ readonly selected: boolean
527
+ readonly onToggle: () => void
502
528
  readonly notesOpen: boolean
503
529
  readonly onToggleNotes: () => void
504
530
  }): React.JSX.Element {
@@ -507,8 +533,9 @@ function AttendanceRow({
507
533
  const error = updateAttendance.error ?? deleteAttendance.error
508
534
 
509
535
  return (
510
- <li className="px-3 py-2">
536
+ <li className={`px-3 py-2 ${selected ? 'bg-accent-soft/40' : ''}`}>
511
537
  <div className="flex flex-wrap items-center gap-2">
538
+ <RowCheckbox label={personName} checked={selected} onToggle={onToggle} />
512
539
  <Link
513
540
  to={`/people/${attendance.personId}`}
514
541
  className="min-w-0 flex-1 text-[13px] font-medium text-accent hover:underline"