refactor: improve SingleEntitySelect empty option (#1543)
Closes #1331 Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -34,13 +34,11 @@ export function CompanyPicker({ companyId, onSubmit, onCancel }: OwnProps) {
|
||||
|
||||
return (
|
||||
<SingleEntitySelect
|
||||
onEntitySelected={handleEntitySelected}
|
||||
entitiesToSelect={companies.entitiesToSelect}
|
||||
loading={companies.loading}
|
||||
onCancel={onCancel}
|
||||
entities={{
|
||||
loading: companies.loading,
|
||||
entitiesToSelect: companies.entitiesToSelect,
|
||||
selectedEntity: companies.selectedEntities[0],
|
||||
}}
|
||||
onEntitySelected={handleEntitySelected}
|
||||
selectedEntity={companies.selectedEntities[0]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { useFilteredSearchCompanyQuery } from '@/companies/hooks/useFilteredSearchCompanyQuery';
|
||||
import { IconBuildingSkyscraper } from '@/ui/icon';
|
||||
import { SingleEntitySelect } from '@/ui/input/relation-picker/components/SingleEntitySelect';
|
||||
import { relationPickerSearchFilterScopedState } from '@/ui/input/relation-picker/states/relationPickerSearchFilterScopedState';
|
||||
import { EntityForSelect } from '@/ui/input/relation-picker/types/EntityForSelect';
|
||||
@ -77,34 +78,25 @@ export function CompanyPickerCell({
|
||||
});
|
||||
setIsCreateMode(false);
|
||||
}
|
||||
const noCompany: CompanyPickerSelectedCompany = {
|
||||
entityType: Entity.Company,
|
||||
id: '',
|
||||
name: 'No Company',
|
||||
avatarType: 'rounded',
|
||||
domainName: '',
|
||||
avatarUrl: '',
|
||||
};
|
||||
return isCreateMode ? (
|
||||
<DoubleTextCellEdit
|
||||
firstValue={relationPickerSearchFilter}
|
||||
secondValue={''}
|
||||
firstValuePlaceholder={'Name'}
|
||||
secondValuePlaceholder={'Url'}
|
||||
secondValue=""
|
||||
firstValuePlaceholder="Name"
|
||||
secondValuePlaceholder="Url"
|
||||
onSubmit={handleCreate}
|
||||
/>
|
||||
) : (
|
||||
<SingleEntitySelect
|
||||
width={width}
|
||||
onCreate={createModeEnabled ? handleStartCreation : undefined}
|
||||
EmptyIcon={IconBuildingSkyscraper}
|
||||
emptyLabel="No Company"
|
||||
entitiesToSelect={companies.entitiesToSelect}
|
||||
loading={companies.loading}
|
||||
onCancel={onCancel}
|
||||
onCreate={createModeEnabled ? handleStartCreation : undefined}
|
||||
onEntitySelected={handleCompanySelected}
|
||||
entities={{
|
||||
entitiesToSelect: companies.entitiesToSelect,
|
||||
selectedEntity: companies.selectedEntities[0],
|
||||
loading: companies.loading,
|
||||
}}
|
||||
noUser={noCompany}
|
||||
selectedEntity={companies.selectedEntities[0]}
|
||||
width={width}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@ -114,13 +114,11 @@ export function CompanyProgressPicker({
|
||||
<StyledDropdownMenuSeparator />
|
||||
<RecoilScope>
|
||||
<SingleEntitySelectBase
|
||||
onEntitySelected={handleEntitySelected}
|
||||
entitiesToSelect={companies.entitiesToSelect}
|
||||
loading={companies.loading}
|
||||
onCancel={onCancel}
|
||||
entities={{
|
||||
loading: companies.loading,
|
||||
entitiesToSelect: companies.entitiesToSelect,
|
||||
selectedEntity: companies.selectedEntities[0],
|
||||
}}
|
||||
onEntitySelected={handleEntitySelected}
|
||||
selectedEntity={companies.selectedEntities[0]}
|
||||
/>
|
||||
</RecoilScope>
|
||||
</>
|
||||
|
||||
@ -64,14 +64,12 @@ export function NewCompanyProgressButton() {
|
||||
<RecoilScope>
|
||||
{isCreatingCard ? (
|
||||
<SingleEntitySelect
|
||||
onEntitySelected={(value) => handleEntitySelect(value)}
|
||||
disableBackgroundBlur
|
||||
entitiesToSelect={companies.entitiesToSelect}
|
||||
loading={companies.loading}
|
||||
onCancel={handleCancel}
|
||||
entities={{
|
||||
entitiesToSelect: companies.entitiesToSelect,
|
||||
selectedEntity: companies.selectedEntities[0],
|
||||
loading: companies.loading,
|
||||
}}
|
||||
disableBackgroundBlur={true}
|
||||
onEntitySelected={handleEntitySelect}
|
||||
selectedEntity={companies.selectedEntities[0]}
|
||||
/>
|
||||
) : (
|
||||
<NewButton onClick={handleNewClick} />
|
||||
|
||||
Reference in New Issue
Block a user