Add back pickers on all pages, fix command menu (#2662)

* Add back pickers on all pages, fix command menu

* Fix lint
This commit is contained in:
Charles Bochet
2023-11-22 22:32:25 +01:00
committed by GitHub
parent 41c0cebf48
commit ec3cfe6fdb
42 changed files with 425 additions and 300 deletions

View File

@ -1,4 +1,5 @@
import { CompanyProgressPicker } from '@/companies/components/CompanyProgressPicker';
import { OpportunityPicker } from '@/companies/components/OpportunityPicker';
import { useCreateOpportunity } from '@/companies/hooks/useCreateOpportunity';
import { PageHotkeyScope } from '@/types/PageHotkeyScope';
import { IconPlus } from '@/ui/display/icon/index';
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
@ -17,6 +18,8 @@ export const PipelineAddButton = () => {
dropdownScopeId: 'add-pipeline-progress',
});
const { createOpportunity } = useCreateOpportunity();
const handleCompanySelected = (
selectedCompany: EntityForSelect | null,
selectedPipelineStepId: string | null,
@ -24,9 +27,7 @@ export const PipelineAddButton = () => {
if (!selectedCompany?.id) {
enqueueSnackBar(
'There was a problem with the company selection, please retry.',
{
variant: 'error',
},
{ variant: 'error' },
);
logError('There was a problem with the company selection, please retry.');
@ -36,16 +37,14 @@ export const PipelineAddButton = () => {
if (!selectedPipelineStepId) {
enqueueSnackBar(
'There was a problem with the pipeline stage selection, please retry.',
{
variant: 'error',
},
{ variant: 'error' },
);
logError('There was a problem with the pipeline stage selection.');
logError('There was a problem with the pipeline step selection.');
return;
}
closeDropdown();
//createCompanyProgress(selectedCompany.id, selectedPipelineStepId);
createOpportunity(selectedCompany.id, selectedPipelineStepId);
};
return (
@ -62,7 +61,7 @@ export const PipelineAddButton = () => {
/>
}
dropdownComponents={
<CompanyProgressPicker
<OpportunityPicker
companyId={null}
onSubmit={handleCompanySelected}
onCancel={closeDropdown}