@kelpie/ui 0.21.0 → 0.23.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/resource.d.ts +12 -0
- package/dist/api/resource.d.ts.map +1 -1
- package/dist/api/resource.js +11 -0
- package/dist/api/resource.js.map +1 -1
- package/dist/api/resources/decisions.d.ts +31 -0
- package/dist/api/resources/decisions.d.ts.map +1 -1
- package/dist/api/resources/decisions.js +51 -1
- package/dist/api/resources/decisions.js.map +1 -1
- package/dist/api/resources/forms.d.ts +21 -7
- package/dist/api/resources/forms.d.ts.map +1 -1
- package/dist/api/resources/forms.js +39 -1
- package/dist/api/resources/forms.js.map +1 -1
- package/dist/api/resources/oauth.d.ts +2 -0
- package/dist/api/resources/oauth.d.ts.map +1 -1
- package/dist/api/resources/oauth.js +13 -1
- package/dist/api/resources/oauth.js.map +1 -1
- package/dist/api/resources/personIntake.d.ts +15 -3
- package/dist/api/resources/personIntake.d.ts.map +1 -1
- package/dist/api/resources/personIntake.js +38 -9
- package/dist/api/resources/personIntake.js.map +1 -1
- package/dist/api/resources/session.d.ts.map +1 -1
- package/dist/api/resources/session.js +4 -0
- package/dist/api/resources/session.js.map +1 -1
- package/dist/api/resources/tags.d.ts +20 -0
- package/dist/api/resources/tags.d.ts.map +1 -0
- package/dist/api/resources/tags.js +52 -0
- package/dist/api/resources/tags.js.map +1 -0
- package/dist/app/KelpieApp.d.ts.map +1 -1
- package/dist/app/KelpieApp.js +2 -1
- package/dist/app/KelpieApp.js.map +1 -1
- package/dist/components/AddRecordPanel.d.ts +35 -0
- package/dist/components/AddRecordPanel.d.ts.map +1 -0
- package/dist/components/AddRecordPanel.js +35 -0
- package/dist/components/AddRecordPanel.js.map +1 -0
- package/dist/components/AiDrawer.d.ts.map +1 -1
- package/dist/components/AiDrawer.js +29 -6
- package/dist/components/AiDrawer.js.map +1 -1
- package/dist/components/ApiKeysPanel.d.ts.map +1 -1
- package/dist/components/ApiKeysPanel.js +101 -44
- package/dist/components/ApiKeysPanel.js.map +1 -1
- package/dist/components/Chip.d.ts +5 -1
- package/dist/components/Chip.d.ts.map +1 -1
- package/dist/components/Chip.js +8 -2
- package/dist/components/Chip.js.map +1 -1
- package/dist/components/CustomFieldsPanel.d.ts.map +1 -1
- package/dist/components/CustomFieldsPanel.js +5 -2
- package/dist/components/CustomFieldsPanel.js.map +1 -1
- package/dist/components/DecisionProvenance.d.ts +27 -0
- package/dist/components/DecisionProvenance.d.ts.map +1 -0
- package/dist/components/DecisionProvenance.js +53 -0
- package/dist/components/DecisionProvenance.js.map +1 -0
- package/dist/components/DecisionsPanel.d.ts +3 -0
- package/dist/components/DecisionsPanel.d.ts.map +1 -1
- package/dist/components/DecisionsPanel.js +9 -5
- package/dist/components/DecisionsPanel.js.map +1 -1
- package/dist/components/MarkdownView.d.ts.map +1 -1
- package/dist/components/MarkdownView.js +18 -2
- package/dist/components/MarkdownView.js.map +1 -1
- package/dist/components/NotesPanel.d.ts.map +1 -1
- package/dist/components/NotesPanel.js +7 -3
- package/dist/components/NotesPanel.js.map +1 -1
- package/dist/components/OriginLabel.d.ts +5 -0
- package/dist/components/OriginLabel.d.ts.map +1 -0
- package/dist/components/OriginLabel.js +22 -0
- package/dist/components/OriginLabel.js.map +1 -0
- package/dist/components/Shell.d.ts.map +1 -1
- package/dist/components/Shell.js +17 -5
- package/dist/components/Shell.js.map +1 -1
- package/dist/components/TagInput.d.ts +29 -0
- package/dist/components/TagInput.d.ts.map +1 -0
- package/dist/components/TagInput.js +139 -0
- package/dist/components/TagInput.js.map +1 -0
- package/dist/components/aiDrawerState.d.ts +12 -0
- package/dist/components/aiDrawerState.d.ts.map +1 -1
- package/dist/components/aiDrawerState.js.map +1 -1
- package/dist/components/personIntakeTask.d.ts +15 -0
- package/dist/components/personIntakeTask.d.ts.map +1 -1
- package/dist/components/personIntakeTask.js +42 -0
- package/dist/components/personIntakeTask.js.map +1 -1
- package/dist/lib/personIntakeRunStorage.d.ts +15 -0
- package/dist/lib/personIntakeRunStorage.d.ts.map +1 -0
- package/dist/lib/personIntakeRunStorage.js +88 -0
- package/dist/lib/personIntakeRunStorage.js.map +1 -0
- package/dist/modules/PersonIntakeWizard.d.ts +1 -1
- package/dist/modules/PersonIntakeWizard.d.ts.map +1 -1
- package/dist/modules/PersonIntakeWizard.js +243 -29
- package/dist/modules/PersonIntakeWizard.js.map +1 -1
- package/dist/modules/ai.d.ts +1 -1
- package/dist/modules/ai.js +1 -1
- package/dist/pages/CompaniesPage.d.ts.map +1 -1
- package/dist/pages/CompaniesPage.js +13 -6
- 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/DealDetail.d.ts.map +1 -1
- package/dist/pages/DealDetail.js +4 -3
- package/dist/pages/DealDetail.js.map +1 -1
- package/dist/pages/DealsPage.d.ts.map +1 -1
- package/dist/pages/DealsPage.js +16 -8
- package/dist/pages/DealsPage.js.map +1 -1
- package/dist/pages/DecisionsPage.d.ts.map +1 -1
- package/dist/pages/DecisionsPage.js +7 -3
- package/dist/pages/DecisionsPage.js.map +1 -1
- package/dist/pages/EnquiriesPage.d.ts.map +1 -1
- package/dist/pages/EnquiriesPage.js +14 -6
- package/dist/pages/EnquiriesPage.js.map +1 -1
- package/dist/pages/EnquiryDetail.js +4 -4
- package/dist/pages/EnquiryDetail.js.map +1 -1
- package/dist/pages/EventDetail.js +4 -4
- package/dist/pages/EventDetail.js.map +1 -1
- package/dist/pages/FundraisingPage.d.ts.map +1 -1
- package/dist/pages/FundraisingPage.js +16 -11
- package/dist/pages/FundraisingPage.js.map +1 -1
- package/dist/pages/OpportunitiesPage.d.ts.map +1 -1
- package/dist/pages/OpportunitiesPage.js +14 -6
- package/dist/pages/OpportunitiesPage.js.map +1 -1
- package/dist/pages/OpportunityDetail.js +4 -4
- package/dist/pages/OpportunityDetail.js.map +1 -1
- package/dist/pages/PartnershipDetail.js +4 -4
- package/dist/pages/PartnershipDetail.js.map +1 -1
- package/dist/pages/PartnershipsPage.d.ts.map +1 -1
- package/dist/pages/PartnershipsPage.js +16 -11
- package/dist/pages/PartnershipsPage.js.map +1 -1
- package/dist/pages/PeoplePage.d.ts.map +1 -1
- package/dist/pages/PeoplePage.js +13 -8
- package/dist/pages/PeoplePage.js.map +1 -1
- package/dist/pages/PersonDetail.js +7 -7
- package/dist/pages/PersonDetail.js.map +1 -1
- package/dist/pages/RaiseDetail.js +4 -4
- package/dist/pages/RaiseDetail.js.map +1 -1
- package/dist/pages/SearchPage.d.ts.map +1 -1
- package/dist/pages/SearchPage.js +2 -1
- package/dist/pages/SearchPage.js.map +1 -1
- package/dist/pages/account/ConnectedAppsPage.d.ts +0 -5
- package/dist/pages/account/ConnectedAppsPage.d.ts.map +1 -1
- package/dist/pages/account/ConnectedAppsPage.js +38 -6
- package/dist/pages/account/ConnectedAppsPage.js.map +1 -1
- package/dist/pages/admin/AgentsPanel.d.ts +10 -0
- package/dist/pages/admin/AgentsPanel.d.ts.map +1 -0
- package/dist/pages/admin/AgentsPanel.js +81 -0
- package/dist/pages/admin/AgentsPanel.js.map +1 -0
- package/dist/pages/admin/AiAdminPage.d.ts.map +1 -1
- package/dist/pages/admin/AiAdminPage.js +9 -6
- package/dist/pages/admin/AiAdminPage.js.map +1 -1
- package/dist/pages/admin/AiPage.js +1 -1
- package/dist/pages/admin/TeamPage.d.ts.map +1 -1
- package/dist/pages/admin/TeamPage.js +16 -3
- package/dist/pages/admin/TeamPage.js.map +1 -1
- package/dist/pages/ai/AiAccessPage.d.ts +11 -0
- package/dist/pages/ai/AiAccessPage.d.ts.map +1 -0
- package/dist/pages/ai/AiAccessPage.js +16 -0
- package/dist/pages/ai/AiAccessPage.js.map +1 -0
- package/dist/pages/ai/McpPanel.d.ts +7 -0
- package/dist/pages/ai/McpPanel.d.ts.map +1 -0
- package/dist/pages/ai/McpPanel.js +86 -0
- package/dist/pages/ai/McpPanel.js.map +1 -0
- package/dist/pages/auth/nextPath.d.ts +6 -0
- package/dist/pages/auth/nextPath.d.ts.map +1 -1
- package/dist/pages/auth/nextPath.js +16 -1
- package/dist/pages/auth/nextPath.js.map +1 -1
- package/dist/pages/dashboard/sections.d.ts.map +1 -1
- package/dist/pages/dashboard/sections.js +4 -2
- package/dist/pages/dashboard/sections.js.map +1 -1
- package/dist/pages/forms/EmbedPanel.js +1 -1
- package/dist/pages/forms/EmbedPanel.js.map +1 -1
- package/dist/pages/forms/FieldsEditor.d.ts.map +1 -1
- package/dist/pages/forms/FieldsEditor.js +6 -7
- package/dist/pages/forms/FieldsEditor.js.map +1 -1
- package/dist/pages/forms/FormActions.d.ts.map +1 -1
- package/dist/pages/forms/FormActions.js +4 -11
- package/dist/pages/forms/FormActions.js.map +1 -1
- package/dist/pages/forms/FormEmails.d.ts.map +1 -1
- package/dist/pages/forms/FormEmails.js +6 -1
- package/dist/pages/forms/FormEmails.js.map +1 -1
- package/dist/pages/forms/FormSettings.d.ts.map +1 -1
- package/dist/pages/forms/FormSettings.js +6 -2
- package/dist/pages/forms/FormSettings.js.map +1 -1
- package/dist/pages/forms/SubmissionDetail.d.ts.map +1 -1
- package/dist/pages/forms/SubmissionDetail.js +26 -6
- package/dist/pages/forms/SubmissionDetail.js.map +1 -1
- package/dist/pages/forms/SubmissionsTable.d.ts.map +1 -1
- package/dist/pages/forms/SubmissionsTable.js +81 -6
- package/dist/pages/forms/SubmissionsTable.js.map +1 -1
- package/dist/pages/forms/fieldList.d.ts +13 -5
- package/dist/pages/forms/fieldList.d.ts.map +1 -1
- package/dist/pages/forms/fieldList.js +12 -4
- package/dist/pages/forms/fieldList.js.map +1 -1
- package/dist/pages/oauth/ConsentPage.d.ts.map +1 -1
- package/dist/pages/oauth/ConsentPage.js +132 -15
- package/dist/pages/oauth/ConsentPage.js.map +1 -1
- package/dist/registry/contributions.d.ts +1 -1
- package/package.json +3 -3
- package/src/api/resource.ts +16 -0
- package/src/api/resources/decisions.ts +81 -1
- package/src/api/resources/forms.ts +68 -7
- package/src/api/resources/oauth.ts +15 -1
- package/src/api/resources/personIntake.ts +54 -13
- package/src/api/resources/session.ts +4 -0
- package/src/api/resources/tags.ts +71 -0
- package/src/app/KelpieApp.tsx +4 -2
- package/src/components/AddRecordPanel.tsx +143 -0
- package/src/components/AiDrawer.tsx +34 -7
- package/src/components/ApiKeysPanel.tsx +193 -75
- package/src/components/Chip.tsx +32 -1
- package/src/components/CustomFieldsPanel.tsx +15 -5
- package/src/components/DecisionProvenance.tsx +95 -0
- package/src/components/DecisionsPanel.tsx +30 -2
- package/src/components/MarkdownView.tsx +45 -11
- package/src/components/NotesPanel.tsx +15 -6
- package/src/components/OriginLabel.tsx +26 -0
- package/src/components/Shell.tsx +30 -6
- package/src/components/TagInput.tsx +285 -0
- package/src/components/aiDrawerState.ts +12 -0
- package/src/components/personIntakeTask.tsx +48 -0
- package/src/lib/personIntakeRunStorage.ts +97 -0
- package/src/modules/PersonIntakeWizard.tsx +391 -30
- package/src/modules/ai.tsx +1 -1
- package/src/pages/CompaniesPage.tsx +22 -5
- package/src/pages/CompanyDetail.tsx +6 -17
- package/src/pages/DealDetail.tsx +6 -17
- package/src/pages/DealsPage.tsx +25 -8
- package/src/pages/DecisionsPage.tsx +28 -1
- package/src/pages/EnquiriesPage.tsx +23 -5
- package/src/pages/EnquiryDetail.tsx +6 -18
- package/src/pages/EventDetail.tsx +6 -18
- package/src/pages/FundraisingPage.tsx +25 -11
- package/src/pages/OpportunitiesPage.tsx +23 -5
- package/src/pages/OpportunityDetail.tsx +6 -18
- package/src/pages/PartnershipDetail.tsx +6 -18
- package/src/pages/PartnershipsPage.tsx +25 -11
- package/src/pages/PeoplePage.tsx +22 -7
- package/src/pages/PersonDetail.tsx +11 -21
- package/src/pages/RaiseDetail.tsx +6 -18
- package/src/pages/SearchPage.tsx +3 -0
- package/src/pages/account/ConnectedAppsPage.tsx +97 -14
- package/src/pages/admin/{McpPanel.tsx → AgentsPanel.tsx} +11 -168
- package/src/pages/admin/AiAdminPage.tsx +16 -11
- package/src/pages/admin/AiPage.tsx +1 -1
- package/src/pages/admin/TeamPage.tsx +33 -0
- package/src/pages/ai/AiAccessPage.tsx +23 -0
- package/src/pages/ai/McpPanel.tsx +261 -0
- package/src/pages/auth/nextPath.ts +18 -1
- package/src/pages/dashboard/sections.tsx +4 -0
- package/src/pages/forms/EmbedPanel.tsx +3 -2
- package/src/pages/forms/FieldsEditor.tsx +6 -7
- package/src/pages/forms/FormActions.tsx +18 -20
- package/src/pages/forms/FormEmails.tsx +11 -2
- package/src/pages/forms/FormSettings.tsx +5 -0
- package/src/pages/forms/SubmissionDetail.tsx +47 -9
- package/src/pages/forms/SubmissionsTable.tsx +180 -5
- package/src/pages/forms/fieldList.ts +21 -7
- package/src/pages/oauth/ConsentPage.tsx +271 -33
- package/src/registry/contributions.ts +1 -1
package/src/pages/DealDetail.tsx
CHANGED
|
@@ -39,6 +39,7 @@ import { RecordTabs } from '../components/RecordTabs.tsx'
|
|
|
39
39
|
import type { RecordTabDescriptor } from '../components/RecordTabs.tsx'
|
|
40
40
|
import { SectionHeader } from '../components/SectionHeader.tsx'
|
|
41
41
|
import { SidebarField } from '../components/SidebarField.tsx'
|
|
42
|
+
import { TagInput } from '../components/TagInput.tsx'
|
|
42
43
|
import { SummaryBlock } from '../components/SummaryBlock.tsx'
|
|
43
44
|
import { formatDay } from '../lib/dates.ts'
|
|
44
45
|
import { formatMoney } from '../lib/money.ts'
|
|
@@ -443,24 +444,12 @@ function DealSidebar({ deal }: { readonly deal: Deal }): React.JSX.Element {
|
|
|
443
444
|
/>
|
|
444
445
|
</SidebarField>
|
|
445
446
|
<SidebarField label="Tags">
|
|
446
|
-
<
|
|
447
|
-
value={deal.tags
|
|
448
|
-
|
|
449
|
-
|
|
447
|
+
<TagInput
|
|
448
|
+
value={deal.tags}
|
|
449
|
+
targetType="deal"
|
|
450
|
+
onChange={(tags) => {
|
|
451
|
+
patch({ tags })
|
|
450
452
|
}}
|
|
451
|
-
display={
|
|
452
|
-
deal.tags.length > 0 ? (
|
|
453
|
-
<span className="flex flex-wrap gap-1">
|
|
454
|
-
{deal.tags.map((tag) => (
|
|
455
|
-
<Chip key={tag}>
|
|
456
|
-
<span className="text-[10px]">{tag}</span>
|
|
457
|
-
</Chip>
|
|
458
|
-
))}
|
|
459
|
-
</span>
|
|
460
|
-
) : undefined
|
|
461
|
-
}
|
|
462
|
-
emptyLabel="Add tags…"
|
|
463
|
-
displayClassName="not-italic"
|
|
464
453
|
/>
|
|
465
454
|
</SidebarField>
|
|
466
455
|
</section>
|
package/src/pages/DealsPage.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Deal, PipelineStage } from '@kelpie/schemas'
|
|
2
|
+
import { useState } from 'react'
|
|
2
3
|
import { Link, useNavigate } from 'react-router'
|
|
3
4
|
|
|
4
5
|
import { useCompanies } from '../api/resources/companies.ts'
|
|
@@ -7,6 +8,8 @@ import { useMembers } from '../api/resources/members.ts'
|
|
|
7
8
|
import { usePipelineStages } from '../api/resources/pipelineStages.ts'
|
|
8
9
|
import { MAX_PAGE_SIZE, usePlanItems } from '../api/resources/planItems.ts'
|
|
9
10
|
import { useTimezone } from '../api/resources/account.ts'
|
|
11
|
+
import { AddCompanyRecordPanel } from '../components/AddRecordPanel.tsx'
|
|
12
|
+
import type { AddRecordValues } from '../components/AddRecordPanel.tsx'
|
|
10
13
|
import { Chip } from '../components/Chip.tsx'
|
|
11
14
|
import type { ChipTone } from '../components/Chip.tsx'
|
|
12
15
|
import { ColumnPicker } from '../components/ColumnPicker.tsx'
|
|
@@ -125,16 +128,19 @@ export function DealsPage(): React.JSX.Element {
|
|
|
125
128
|
|
|
126
129
|
const companyNameById = new Map(companies.records.map((company) => [company.id, company.name]))
|
|
127
130
|
|
|
128
|
-
|
|
129
|
-
const firstCompany = companies.records[0]
|
|
131
|
+
const [adding, setAdding] = useState(false)
|
|
130
132
|
|
|
131
|
-
|
|
133
|
+
function addDeal(values: AddRecordValues): void {
|
|
134
|
+
// The panel asks for a company, so one is always set here.
|
|
135
|
+
if (values.companyId === undefined) {
|
|
132
136
|
return
|
|
133
137
|
}
|
|
134
138
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
139
|
+
createDeal
|
|
140
|
+
.runAsync({ name: values.name, companyId: values.companyId })
|
|
141
|
+
.then((record) => navigate(`/deals/${record.id}`))
|
|
142
|
+
// The failure is shown from `createDeal.error` below.
|
|
143
|
+
.catch(() => undefined)
|
|
138
144
|
}
|
|
139
145
|
|
|
140
146
|
const stageLabelById = new Map(allStages.map((stage) => [stage.id, stage.label]))
|
|
@@ -340,7 +346,7 @@ export function DealsPage(): React.JSX.Element {
|
|
|
340
346
|
<PageHeader
|
|
341
347
|
title="Deals"
|
|
342
348
|
onAdd={() => {
|
|
343
|
-
|
|
349
|
+
setAdding(true)
|
|
344
350
|
}}
|
|
345
351
|
addLabel="Add deal"
|
|
346
352
|
actions={
|
|
@@ -397,6 +403,17 @@ export function DealsPage(): React.JSX.Element {
|
|
|
397
403
|
}
|
|
398
404
|
/>
|
|
399
405
|
|
|
406
|
+
{adding && (
|
|
407
|
+
<AddCompanyRecordPanel
|
|
408
|
+
title="Add deal"
|
|
409
|
+
isPending={createDeal.isPending}
|
|
410
|
+
onCancel={() => {
|
|
411
|
+
setAdding(false)
|
|
412
|
+
}}
|
|
413
|
+
onCreate={addDeal}
|
|
414
|
+
/>
|
|
415
|
+
)}
|
|
416
|
+
|
|
400
417
|
{createDeal.error !== null && (
|
|
401
418
|
<div className="mb-3">
|
|
402
419
|
<ErrorPanel error={createDeal.error} />
|
|
@@ -454,7 +471,7 @@ export function DealsPage(): React.JSX.Element {
|
|
|
454
471
|
? {
|
|
455
472
|
label: 'Add deal',
|
|
456
473
|
onClick: () => {
|
|
457
|
-
|
|
474
|
+
setAdding(true)
|
|
458
475
|
},
|
|
459
476
|
}
|
|
460
477
|
: scope === 'open'
|
|
@@ -5,7 +5,7 @@ import { Link } from 'react-router'
|
|
|
5
5
|
import { useTimezone } from '../api/resources/account.ts'
|
|
6
6
|
import { useCompanies } from '../api/resources/companies.ts'
|
|
7
7
|
import { useDeals } from '../api/resources/deals.ts'
|
|
8
|
-
import { useDecisions } from '../api/resources/decisions.ts'
|
|
8
|
+
import { useConfirmDecision, useDecisions } from '../api/resources/decisions.ts'
|
|
9
9
|
import { useEvents } from '../api/resources/events.ts'
|
|
10
10
|
import { useMembers } from '../api/resources/members.ts'
|
|
11
11
|
import { useOpportunities } from '../api/resources/opportunities.ts'
|
|
@@ -15,6 +15,11 @@ import { useRaises } from '../api/resources/raises.ts'
|
|
|
15
15
|
import { ColumnPicker } from '../components/ColumnPicker.tsx'
|
|
16
16
|
import { DataTable } from '../components/DataTable.tsx'
|
|
17
17
|
import type { Column } from '../components/DataTable.tsx'
|
|
18
|
+
import {
|
|
19
|
+
ConfirmDecisionButton,
|
|
20
|
+
ConfirmedAnnouncement,
|
|
21
|
+
DecisionProvenance,
|
|
22
|
+
} from '../components/DecisionProvenance.tsx'
|
|
18
23
|
import { FilterBar, PageHeader } from '../components/PageHeader.tsx'
|
|
19
24
|
import { Paginator } from '../components/Paginator.tsx'
|
|
20
25
|
import { ErrorPanel, LoadingPanel } from '../components/QueryState.tsx'
|
|
@@ -141,6 +146,7 @@ export function DecisionsPage(): React.JSX.Element {
|
|
|
141
146
|
term: term.trim().length > 0 ? term.trim() : undefined,
|
|
142
147
|
sort: serverSortOnly(sort, SERVER_SORT_KEYS),
|
|
143
148
|
})
|
|
149
|
+
const confirmDecision = useConfirmDecision()
|
|
144
150
|
const directory = useTargetDirectory()
|
|
145
151
|
const members = useMembers()
|
|
146
152
|
const timezone = useTimezone()
|
|
@@ -156,6 +162,20 @@ export function DecisionsPage(): React.JSX.Element {
|
|
|
156
162
|
{decision.rationale !== null && (
|
|
157
163
|
<div className="mt-0.5 text-[12px] text-ink-muted">{decision.rationale}</div>
|
|
158
164
|
)}
|
|
165
|
+
{(decision.origin === 'agent' || decision.origin === 'ai' || decision.confirmedAt === null) && (
|
|
166
|
+
<div className="mt-1 flex flex-wrap items-center gap-2">
|
|
167
|
+
<DecisionProvenance origin={decision.origin} confirmedAt={decision.confirmedAt} />
|
|
168
|
+
{decision.confirmedAt === null && (
|
|
169
|
+
<ConfirmDecisionButton
|
|
170
|
+
body={decision.body}
|
|
171
|
+
onConfirm={() => {
|
|
172
|
+
confirmDecision.run({ id: decision.id, updatedAt: decision.updatedAt })
|
|
173
|
+
}}
|
|
174
|
+
isPending={confirmDecision.pendingIds.has(decision.id)}
|
|
175
|
+
/>
|
|
176
|
+
)}
|
|
177
|
+
</div>
|
|
178
|
+
)}
|
|
159
179
|
</>
|
|
160
180
|
),
|
|
161
181
|
},
|
|
@@ -243,6 +263,13 @@ export function DecisionsPage(): React.JSX.Element {
|
|
|
243
263
|
/>
|
|
244
264
|
<FilterBar value={term} onChange={setTerm} placeholder="Filter decisions…" />
|
|
245
265
|
|
|
266
|
+
<ConfirmedAnnouncement count={confirmDecision.confirmedCount} />
|
|
267
|
+
{confirmDecision.error !== null && (
|
|
268
|
+
<div className="mb-3">
|
|
269
|
+
<ErrorPanel error={confirmDecision.error} />
|
|
270
|
+
</div>
|
|
271
|
+
)}
|
|
272
|
+
|
|
246
273
|
{decisions.error !== null ? (
|
|
247
274
|
<ErrorPanel error={decisions.error} />
|
|
248
275
|
) : decisions.isLoading ? (
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Enquiry, PipelineStage } from '@kelpie/schemas'
|
|
2
|
+
import { useState } from 'react'
|
|
2
3
|
import { Link, useNavigate } from 'react-router'
|
|
3
4
|
|
|
4
5
|
import { useCompanies } from '../api/resources/companies.ts'
|
|
@@ -11,6 +12,8 @@ import { useMembers } from '../api/resources/members.ts'
|
|
|
11
12
|
import { usePipelineStages } from '../api/resources/pipelineStages.ts'
|
|
12
13
|
import { MAX_PAGE_SIZE, usePlanItems } from '../api/resources/planItems.ts'
|
|
13
14
|
import { useTimezone } from '../api/resources/account.ts'
|
|
15
|
+
import { AddRecordPanel } from '../components/AddRecordPanel.tsx'
|
|
16
|
+
import type { AddRecordValues } from '../components/AddRecordPanel.tsx'
|
|
14
17
|
import { Chip } from '../components/Chip.tsx'
|
|
15
18
|
import type { ChipTone } from '../components/Chip.tsx'
|
|
16
19
|
import { ColumnPicker } from '../components/ColumnPicker.tsx'
|
|
@@ -120,10 +123,14 @@ export function EnquiriesPage(): React.JSX.Element {
|
|
|
120
123
|
|
|
121
124
|
const companyNameById = new Map(companies.records.map((company) => [company.id, company.name]))
|
|
122
125
|
|
|
123
|
-
|
|
124
|
-
const enquiry = await createEnquiry.runAsync({ name: 'New enquiry' })
|
|
126
|
+
const [adding, setAdding] = useState(false)
|
|
125
127
|
|
|
126
|
-
|
|
128
|
+
function addEnquiry(values: AddRecordValues): void {
|
|
129
|
+
createEnquiry
|
|
130
|
+
.runAsync({ name: values.name })
|
|
131
|
+
.then((record) => navigate(`/enquiries/${record.id}`))
|
|
132
|
+
// The failure is shown from `createEnquiry.error` below.
|
|
133
|
+
.catch(() => undefined)
|
|
127
134
|
}
|
|
128
135
|
|
|
129
136
|
const stageLabelById = new Map(allStages.map((stage) => [stage.id, stage.label]))
|
|
@@ -282,7 +289,7 @@ export function EnquiriesPage(): React.JSX.Element {
|
|
|
282
289
|
<PageHeader
|
|
283
290
|
title="Enquiries"
|
|
284
291
|
onAdd={() => {
|
|
285
|
-
|
|
292
|
+
setAdding(true)
|
|
286
293
|
}}
|
|
287
294
|
addLabel="Add enquiry"
|
|
288
295
|
actions={
|
|
@@ -339,6 +346,17 @@ export function EnquiriesPage(): React.JSX.Element {
|
|
|
339
346
|
}
|
|
340
347
|
/>
|
|
341
348
|
|
|
349
|
+
{adding && (
|
|
350
|
+
<AddRecordPanel
|
|
351
|
+
title="Add enquiry"
|
|
352
|
+
isPending={createEnquiry.isPending}
|
|
353
|
+
onCancel={() => {
|
|
354
|
+
setAdding(false)
|
|
355
|
+
}}
|
|
356
|
+
onCreate={addEnquiry}
|
|
357
|
+
/>
|
|
358
|
+
)}
|
|
359
|
+
|
|
342
360
|
{createEnquiry.error !== null && (
|
|
343
361
|
<div className="mb-3">
|
|
344
362
|
<ErrorPanel error={createEnquiry.error} />
|
|
@@ -391,7 +409,7 @@ export function EnquiriesPage(): React.JSX.Element {
|
|
|
391
409
|
? {
|
|
392
410
|
label: 'Add enquiry',
|
|
393
411
|
onClick: () => {
|
|
394
|
-
|
|
412
|
+
setAdding(true)
|
|
395
413
|
},
|
|
396
414
|
}
|
|
397
415
|
: scope === 'open'
|
|
@@ -43,11 +43,11 @@ import { RecordTabs } from '../components/RecordTabs.tsx'
|
|
|
43
43
|
import type { RecordTabDescriptor } from '../components/RecordTabs.tsx'
|
|
44
44
|
import { SectionHeader } from '../components/SectionHeader.tsx'
|
|
45
45
|
import { SidebarField } from '../components/SidebarField.tsx'
|
|
46
|
+
import { TagInput } from '../components/TagInput.tsx'
|
|
46
47
|
import { SummaryBlock } from '../components/SummaryBlock.tsx'
|
|
47
48
|
import { useRecordTabs } from '../registry/context.ts'
|
|
48
49
|
import { inSlotOrder } from '../registry/registry.ts'
|
|
49
50
|
import { useRecordTab } from '../lib/fragmentTarget.ts'
|
|
50
|
-
import { toTags } from './fields.ts'
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* One enquiry.
|
|
@@ -350,24 +350,12 @@ function EnquirySidebar({ enquiry }: { readonly enquiry: Enquiry }): React.JSX.E
|
|
|
350
350
|
/>
|
|
351
351
|
</SidebarField>
|
|
352
352
|
<SidebarField label="Tags">
|
|
353
|
-
<
|
|
354
|
-
value={enquiry.tags
|
|
355
|
-
|
|
356
|
-
|
|
353
|
+
<TagInput
|
|
354
|
+
value={enquiry.tags}
|
|
355
|
+
targetType="enquiry"
|
|
356
|
+
onChange={(tags) => {
|
|
357
|
+
patch({ tags })
|
|
357
358
|
}}
|
|
358
|
-
display={
|
|
359
|
-
enquiry.tags.length > 0 ? (
|
|
360
|
-
<span className="flex flex-wrap gap-1">
|
|
361
|
-
{enquiry.tags.map((tag) => (
|
|
362
|
-
<Chip key={tag}>
|
|
363
|
-
<span className="text-[10px]">{tag}</span>
|
|
364
|
-
</Chip>
|
|
365
|
-
))}
|
|
366
|
-
</span>
|
|
367
|
-
) : undefined
|
|
368
|
-
}
|
|
369
|
-
emptyLabel="Add tags…"
|
|
370
|
-
displayClassName="not-italic"
|
|
371
359
|
/>
|
|
372
360
|
</SidebarField>
|
|
373
361
|
</section>
|
|
@@ -61,13 +61,13 @@ import { RecordTabs } from '../components/RecordTabs.tsx'
|
|
|
61
61
|
import type { RecordTabDescriptor } from '../components/RecordTabs.tsx'
|
|
62
62
|
import { SectionHeader } from '../components/SectionHeader.tsx'
|
|
63
63
|
import { SidebarField } from '../components/SidebarField.tsx'
|
|
64
|
+
import { TagInput } from '../components/TagInput.tsx'
|
|
64
65
|
import { SummaryBlock } from '../components/SummaryBlock.tsx'
|
|
65
66
|
import { TimezoneSearch } from '../components/TimezoneSearch.tsx'
|
|
66
67
|
import { formatDateTime } from '../lib/dates.ts'
|
|
67
68
|
import { useRecordTab } from '../lib/fragmentTarget.ts'
|
|
68
69
|
import { useRecordTabs } from '../registry/context.ts'
|
|
69
70
|
import { inSlotOrder } from '../registry/registry.ts'
|
|
70
|
-
import { toTags } from './fields.ts'
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* One dated gathering. Not a pipeline: no stages, no convert, no kanban.
|
|
@@ -396,24 +396,12 @@ function EventSidebar({ event }: { readonly event: CrmEvent }): React.JSX.Elemen
|
|
|
396
396
|
/>
|
|
397
397
|
</SidebarField>
|
|
398
398
|
<SidebarField label="Tags">
|
|
399
|
-
<
|
|
400
|
-
value={event.tags
|
|
401
|
-
|
|
402
|
-
|
|
399
|
+
<TagInput
|
|
400
|
+
value={event.tags}
|
|
401
|
+
targetType="event"
|
|
402
|
+
onChange={(tags) => {
|
|
403
|
+
patch({ tags })
|
|
403
404
|
}}
|
|
404
|
-
display={
|
|
405
|
-
event.tags.length > 0 ? (
|
|
406
|
-
<span className="flex flex-wrap gap-1">
|
|
407
|
-
{event.tags.map((tag) => (
|
|
408
|
-
<Chip key={tag}>
|
|
409
|
-
<span className="text-[10px]">{tag}</span>
|
|
410
|
-
</Chip>
|
|
411
|
-
))}
|
|
412
|
-
</span>
|
|
413
|
-
) : undefined
|
|
414
|
-
}
|
|
415
|
-
emptyLabel="Add tags…"
|
|
416
|
-
displayClassName="not-italic"
|
|
417
405
|
/>
|
|
418
406
|
</SidebarField>
|
|
419
407
|
</section>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PipelineStage, Raise } from '@kelpie/schemas'
|
|
2
|
+
import { useState } from 'react'
|
|
2
3
|
import { Link, useNavigate } from 'react-router'
|
|
3
4
|
|
|
4
5
|
import { useCompanies } from '../api/resources/companies.ts'
|
|
@@ -7,6 +8,8 @@ import { usePipelineStages } from '../api/resources/pipelineStages.ts'
|
|
|
7
8
|
import { MAX_PAGE_SIZE, usePlanItems } from '../api/resources/planItems.ts'
|
|
8
9
|
import { useCreateRaise, useRaises, useUpdateRaise } from '../api/resources/raises.ts'
|
|
9
10
|
import { useTimezone } from '../api/resources/account.ts'
|
|
11
|
+
import { AddCompanyRecordPanel } from '../components/AddRecordPanel.tsx'
|
|
12
|
+
import type { AddRecordValues } from '../components/AddRecordPanel.tsx'
|
|
10
13
|
import { Chip } from '../components/Chip.tsx'
|
|
11
14
|
import type { ChipTone } from '../components/Chip.tsx'
|
|
12
15
|
import { ColumnPicker } from '../components/ColumnPicker.tsx'
|
|
@@ -126,19 +129,19 @@ export function FundraisingPage(): React.JSX.Element {
|
|
|
126
129
|
|
|
127
130
|
const companyNameById = new Map(companies.records.map((company) => [company.id, company.name]))
|
|
128
131
|
|
|
129
|
-
|
|
130
|
-
const firstCompany = companies.records[0]
|
|
132
|
+
const [adding, setAdding] = useState(false)
|
|
131
133
|
|
|
132
|
-
|
|
134
|
+
function addRaise(values: AddRecordValues): void {
|
|
135
|
+
// The panel asks for a company, so one is always set here.
|
|
136
|
+
if (values.companyId === undefined) {
|
|
133
137
|
return
|
|
134
138
|
}
|
|
135
139
|
|
|
136
|
-
|
|
137
|
-
name:
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
await navigate(`/fundraising/${raise.id}`)
|
|
140
|
+
createRaise
|
|
141
|
+
.runAsync({ name: values.name, companyId: values.companyId })
|
|
142
|
+
.then((record) => navigate(`/fundraising/${record.id}`))
|
|
143
|
+
// The failure is shown from `createRaise.error` below.
|
|
144
|
+
.catch(() => undefined)
|
|
142
145
|
}
|
|
143
146
|
|
|
144
147
|
const stageLabelById = new Map(allStages.map((stage) => [stage.id, stage.label]))
|
|
@@ -327,7 +330,7 @@ export function FundraisingPage(): React.JSX.Element {
|
|
|
327
330
|
<PageHeader
|
|
328
331
|
title="Fundraising"
|
|
329
332
|
onAdd={() => {
|
|
330
|
-
|
|
333
|
+
setAdding(true)
|
|
331
334
|
}}
|
|
332
335
|
addLabel="Add raise"
|
|
333
336
|
actions={
|
|
@@ -390,6 +393,17 @@ export function FundraisingPage(): React.JSX.Element {
|
|
|
390
393
|
</p>
|
|
391
394
|
)}
|
|
392
395
|
|
|
396
|
+
{adding && (
|
|
397
|
+
<AddCompanyRecordPanel
|
|
398
|
+
title="Add raise"
|
|
399
|
+
isPending={createRaise.isPending}
|
|
400
|
+
onCancel={() => {
|
|
401
|
+
setAdding(false)
|
|
402
|
+
}}
|
|
403
|
+
onCreate={addRaise}
|
|
404
|
+
/>
|
|
405
|
+
)}
|
|
406
|
+
|
|
393
407
|
{createRaise.error !== null && (
|
|
394
408
|
<div className="mb-3">
|
|
395
409
|
<ErrorPanel error={createRaise.error} />
|
|
@@ -440,7 +454,7 @@ export function FundraisingPage(): React.JSX.Element {
|
|
|
440
454
|
? {
|
|
441
455
|
label: 'Add raise',
|
|
442
456
|
onClick: () => {
|
|
443
|
-
|
|
457
|
+
setAdding(true)
|
|
444
458
|
},
|
|
445
459
|
}
|
|
446
460
|
: scope === 'open'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Opportunity, PipelineStage } from '@kelpie/schemas'
|
|
2
|
+
import { useState } from 'react'
|
|
2
3
|
import { Link, useNavigate } from 'react-router'
|
|
3
4
|
|
|
4
5
|
import { useCompanies } from '../api/resources/companies.ts'
|
|
@@ -11,6 +12,8 @@ import {
|
|
|
11
12
|
import { usePipelineStages } from '../api/resources/pipelineStages.ts'
|
|
12
13
|
import { MAX_PAGE_SIZE, usePlanItems } from '../api/resources/planItems.ts'
|
|
13
14
|
import { useTimezone } from '../api/resources/account.ts'
|
|
15
|
+
import { AddRecordPanel } from '../components/AddRecordPanel.tsx'
|
|
16
|
+
import type { AddRecordValues } from '../components/AddRecordPanel.tsx'
|
|
14
17
|
import { Chip } from '../components/Chip.tsx'
|
|
15
18
|
import type { ChipTone } from '../components/Chip.tsx'
|
|
16
19
|
import { ColumnPicker } from '../components/ColumnPicker.tsx'
|
|
@@ -126,10 +129,14 @@ export function OpportunitiesPage(): React.JSX.Element {
|
|
|
126
129
|
|
|
127
130
|
const companyNameById = new Map(companies.records.map((company) => [company.id, company.name]))
|
|
128
131
|
|
|
129
|
-
|
|
130
|
-
const opportunity = await createOpportunity.runAsync({ name: 'New opportunity' })
|
|
132
|
+
const [adding, setAdding] = useState(false)
|
|
131
133
|
|
|
132
|
-
|
|
134
|
+
function addOpportunity(values: AddRecordValues): void {
|
|
135
|
+
createOpportunity
|
|
136
|
+
.runAsync({ name: values.name })
|
|
137
|
+
.then((record) => navigate(`/opportunities/${record.id}`))
|
|
138
|
+
// The failure is shown from `createOpportunity.error` below.
|
|
139
|
+
.catch(() => undefined)
|
|
133
140
|
}
|
|
134
141
|
|
|
135
142
|
const stageLabelById = new Map(allStages.map((stage) => [stage.id, stage.label]))
|
|
@@ -303,7 +310,7 @@ export function OpportunitiesPage(): React.JSX.Element {
|
|
|
303
310
|
<PageHeader
|
|
304
311
|
title="Opportunities"
|
|
305
312
|
onAdd={() => {
|
|
306
|
-
|
|
313
|
+
setAdding(true)
|
|
307
314
|
}}
|
|
308
315
|
addLabel="Add opportunity"
|
|
309
316
|
actions={
|
|
@@ -360,6 +367,17 @@ export function OpportunitiesPage(): React.JSX.Element {
|
|
|
360
367
|
}
|
|
361
368
|
/>
|
|
362
369
|
|
|
370
|
+
{adding && (
|
|
371
|
+
<AddRecordPanel
|
|
372
|
+
title="Add opportunity"
|
|
373
|
+
isPending={createOpportunity.isPending}
|
|
374
|
+
onCancel={() => {
|
|
375
|
+
setAdding(false)
|
|
376
|
+
}}
|
|
377
|
+
onCreate={addOpportunity}
|
|
378
|
+
/>
|
|
379
|
+
)}
|
|
380
|
+
|
|
363
381
|
{createOpportunity.error !== null && (
|
|
364
382
|
<div className="mb-3">
|
|
365
383
|
<ErrorPanel error={createOpportunity.error} />
|
|
@@ -412,7 +430,7 @@ export function OpportunitiesPage(): React.JSX.Element {
|
|
|
412
430
|
? {
|
|
413
431
|
label: 'Add opportunity',
|
|
414
432
|
onClick: () => {
|
|
415
|
-
|
|
433
|
+
setAdding(true)
|
|
416
434
|
},
|
|
417
435
|
}
|
|
418
436
|
: scope === 'open'
|
|
@@ -43,12 +43,12 @@ import { RecordTabs } from '../components/RecordTabs.tsx'
|
|
|
43
43
|
import type { RecordTabDescriptor } from '../components/RecordTabs.tsx'
|
|
44
44
|
import { SectionHeader } from '../components/SectionHeader.tsx'
|
|
45
45
|
import { SidebarField } from '../components/SidebarField.tsx'
|
|
46
|
+
import { TagInput } from '../components/TagInput.tsx'
|
|
46
47
|
import { SummaryBlock } from '../components/SummaryBlock.tsx'
|
|
47
48
|
import { formatDay } from '../lib/dates.ts'
|
|
48
49
|
import { useRecordTab } from '../lib/fragmentTarget.ts'
|
|
49
50
|
import { useRecordTabs } from '../registry/context.ts'
|
|
50
51
|
import { inSlotOrder } from '../registry/registry.ts'
|
|
51
|
-
import { toTags } from './fields.ts'
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* One opportunity.
|
|
@@ -376,24 +376,12 @@ function OpportunitySidebar({
|
|
|
376
376
|
/>
|
|
377
377
|
</SidebarField>
|
|
378
378
|
<SidebarField label="Tags">
|
|
379
|
-
<
|
|
380
|
-
value={opportunity.tags
|
|
381
|
-
|
|
382
|
-
|
|
379
|
+
<TagInput
|
|
380
|
+
value={opportunity.tags}
|
|
381
|
+
targetType="opportunity"
|
|
382
|
+
onChange={(tags) => {
|
|
383
|
+
patch({ tags })
|
|
383
384
|
}}
|
|
384
|
-
display={
|
|
385
|
-
opportunity.tags.length > 0 ? (
|
|
386
|
-
<span className="flex flex-wrap gap-1">
|
|
387
|
-
{opportunity.tags.map((tag) => (
|
|
388
|
-
<Chip key={tag}>
|
|
389
|
-
<span className="text-[10px]">{tag}</span>
|
|
390
|
-
</Chip>
|
|
391
|
-
))}
|
|
392
|
-
</span>
|
|
393
|
-
) : undefined
|
|
394
|
-
}
|
|
395
|
-
emptyLabel="Add tags…"
|
|
396
|
-
displayClassName="not-italic"
|
|
397
385
|
/>
|
|
398
386
|
</SidebarField>
|
|
399
387
|
</section>
|
|
@@ -43,12 +43,12 @@ import { RecordTabs } from '../components/RecordTabs.tsx'
|
|
|
43
43
|
import type { RecordTabDescriptor } from '../components/RecordTabs.tsx'
|
|
44
44
|
import { SectionHeader } from '../components/SectionHeader.tsx'
|
|
45
45
|
import { SidebarField } from '../components/SidebarField.tsx'
|
|
46
|
+
import { TagInput } from '../components/TagInput.tsx'
|
|
46
47
|
import { SummaryBlock } from '../components/SummaryBlock.tsx'
|
|
47
48
|
import { formatDay } from '../lib/dates.ts'
|
|
48
49
|
import { useRecordTab } from '../lib/fragmentTarget.ts'
|
|
49
50
|
import { useRecordTabs } from '../registry/context.ts'
|
|
50
51
|
import { inSlotOrder } from '../registry/registry.ts'
|
|
51
|
-
import { toTags } from './fields.ts'
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* One partnership.
|
|
@@ -398,24 +398,12 @@ function PartnershipSidebar({
|
|
|
398
398
|
/>
|
|
399
399
|
</SidebarField>
|
|
400
400
|
<SidebarField label="Tags">
|
|
401
|
-
<
|
|
402
|
-
value={partnership.tags
|
|
403
|
-
|
|
404
|
-
|
|
401
|
+
<TagInput
|
|
402
|
+
value={partnership.tags}
|
|
403
|
+
targetType="partnership"
|
|
404
|
+
onChange={(tags) => {
|
|
405
|
+
patch({ tags })
|
|
405
406
|
}}
|
|
406
|
-
display={
|
|
407
|
-
partnership.tags.length > 0 ? (
|
|
408
|
-
<span className="flex flex-wrap gap-1">
|
|
409
|
-
{partnership.tags.map((tag) => (
|
|
410
|
-
<Chip key={tag}>
|
|
411
|
-
<span className="text-[10px]">{tag}</span>
|
|
412
|
-
</Chip>
|
|
413
|
-
))}
|
|
414
|
-
</span>
|
|
415
|
-
) : undefined
|
|
416
|
-
}
|
|
417
|
-
emptyLabel="Add tags…"
|
|
418
|
-
displayClassName="not-italic"
|
|
419
407
|
/>
|
|
420
408
|
</SidebarField>
|
|
421
409
|
</section>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Partnership, PipelineStage } from '@kelpie/schemas'
|
|
2
|
+
import { useState } from 'react'
|
|
2
3
|
import { Link, useNavigate } from 'react-router'
|
|
3
4
|
|
|
4
5
|
import { useCompanies } from '../api/resources/companies.ts'
|
|
@@ -11,6 +12,8 @@ import {
|
|
|
11
12
|
import { usePipelineStages } from '../api/resources/pipelineStages.ts'
|
|
12
13
|
import { MAX_PAGE_SIZE, usePlanItems } from '../api/resources/planItems.ts'
|
|
13
14
|
import { useTimezone } from '../api/resources/account.ts'
|
|
15
|
+
import { AddCompanyRecordPanel } from '../components/AddRecordPanel.tsx'
|
|
16
|
+
import type { AddRecordValues } from '../components/AddRecordPanel.tsx'
|
|
14
17
|
import { Chip } from '../components/Chip.tsx'
|
|
15
18
|
import type { ChipTone } from '../components/Chip.tsx'
|
|
16
19
|
import { ColumnPicker } from '../components/ColumnPicker.tsx'
|
|
@@ -127,19 +130,19 @@ export function PartnershipsPage(): React.JSX.Element {
|
|
|
127
130
|
|
|
128
131
|
const companyNameById = new Map(companies.records.map((company) => [company.id, company.name]))
|
|
129
132
|
|
|
130
|
-
|
|
131
|
-
const firstCompany = companies.records[0]
|
|
133
|
+
const [adding, setAdding] = useState(false)
|
|
132
134
|
|
|
133
|
-
|
|
135
|
+
function addPartnership(values: AddRecordValues): void {
|
|
136
|
+
// The panel asks for a company, so one is always set here.
|
|
137
|
+
if (values.companyId === undefined) {
|
|
134
138
|
return
|
|
135
139
|
}
|
|
136
140
|
|
|
137
|
-
|
|
138
|
-
name:
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
await navigate(`/partnerships/${partnership.id}`)
|
|
141
|
+
createPartnership
|
|
142
|
+
.runAsync({ name: values.name, companyId: values.companyId })
|
|
143
|
+
.then((record) => navigate(`/partnerships/${record.id}`))
|
|
144
|
+
// The failure is shown from `createPartnership.error` below.
|
|
145
|
+
.catch(() => undefined)
|
|
143
146
|
}
|
|
144
147
|
|
|
145
148
|
const stageLabelById = new Map(allStages.map((stage) => [stage.id, stage.label]))
|
|
@@ -320,7 +323,7 @@ export function PartnershipsPage(): React.JSX.Element {
|
|
|
320
323
|
<PageHeader
|
|
321
324
|
title="Partnerships"
|
|
322
325
|
onAdd={() => {
|
|
323
|
-
|
|
326
|
+
setAdding(true)
|
|
324
327
|
}}
|
|
325
328
|
addLabel="Add partnership"
|
|
326
329
|
actions={
|
|
@@ -383,6 +386,17 @@ export function PartnershipsPage(): React.JSX.Element {
|
|
|
383
386
|
</p>
|
|
384
387
|
)}
|
|
385
388
|
|
|
389
|
+
{adding && (
|
|
390
|
+
<AddCompanyRecordPanel
|
|
391
|
+
title="Add partnership"
|
|
392
|
+
isPending={createPartnership.isPending}
|
|
393
|
+
onCancel={() => {
|
|
394
|
+
setAdding(false)
|
|
395
|
+
}}
|
|
396
|
+
onCreate={addPartnership}
|
|
397
|
+
/>
|
|
398
|
+
)}
|
|
399
|
+
|
|
386
400
|
{createPartnership.error !== null && (
|
|
387
401
|
<div className="mb-3">
|
|
388
402
|
<ErrorPanel error={createPartnership.error} />
|
|
@@ -435,7 +449,7 @@ export function PartnershipsPage(): React.JSX.Element {
|
|
|
435
449
|
? {
|
|
436
450
|
label: 'Add partnership',
|
|
437
451
|
onClick: () => {
|
|
438
|
-
|
|
452
|
+
setAdding(true)
|
|
439
453
|
},
|
|
440
454
|
}
|
|
441
455
|
: scope === 'open'
|