Feat/company card fields (#686)

* wip

* Ok

* asd

* Fixed cancel submit

* Renamed

* Fixed
This commit is contained in:
Lucas Bordeau
2023-07-16 04:17:31 +02:00
committed by GitHub
parent 7959308e0b
commit be21392737
35 changed files with 1041 additions and 95 deletions

View File

@ -1,6 +1,7 @@
import { PersonChip } from '@/people/components/PersonChip';
import { RelationPickerHotkeyScope } from '@/relation-picker/types/RelationPickerHotkeyScope';
import { EditableCell } from '@/ui/components/editable-cell/EditableCell';
import { useEditableCell } from '@/ui/components/editable-cell/hooks/useEditableCell';
import { Company, User } from '~/generated/graphql';
import { CompanyAccountOwnerPicker } from './CompanyAccountOwnerPicker';
@ -14,10 +15,26 @@ export type OwnProps = {
};
export function CompanyAccountOwnerCell({ company }: OwnProps) {
const { closeEditableCell } = useEditableCell();
function handleCancel() {
closeEditableCell();
}
function handleSubmit() {
closeEditableCell();
}
return (
<EditableCell
editHotkeyScope={{ scope: RelationPickerHotkeyScope.RelationPicker }}
editModeContent={<CompanyAccountOwnerPicker company={company} />}
editModeContent={
<CompanyAccountOwnerPicker
onCancel={handleCancel}
onSubmit={handleSubmit}
company={company}
/>
}
nonEditModeContent={
company.accountOwner?.displayName ? (
<PersonChip