a2ccb643ff
* wip * wip * Ok * Deleted unused code * Fixed lint * Minor fixes * Minor fixes * Minor Fixes * Minor merge fixes * Ok * Fix storybook tests * Removed console.log * Fix login * asd * Fixed storybook * Added await * Fixed await * Added sleep for failing test * Fix sleep * Fix test * Fix tests --------- Co-authored-by: Charles Bochet <charles@twenty.com>
35 lines
934 B
TypeScript
35 lines
934 B
TypeScript
import { useRecoilValue } from 'recoil';
|
|
|
|
import { peoplePhoneFamilyState } from '@/people/states/peoplePhoneFamilyState';
|
|
import { EditableCellPhone } from '@/ui/table/editable-cell/types/EditableCellPhone';
|
|
import { useCurrentRowEntityId } from '@/ui/table/hooks/useCurrentEntityId';
|
|
import { useUpdateOnePersonMutation } from '~/generated/graphql';
|
|
|
|
export function EditablePeoplePhoneCell() {
|
|
const currentRowEntityId = useCurrentRowEntityId();
|
|
|
|
const [updatePerson] = useUpdateOnePersonMutation();
|
|
|
|
const phone = useRecoilValue(
|
|
peoplePhoneFamilyState(currentRowEntityId ?? ''),
|
|
);
|
|
|
|
return (
|
|
<EditableCellPhone
|
|
value={phone?.toString() ?? ''}
|
|
onSubmit={(newPhone) =>
|
|
updatePerson({
|
|
variables: {
|
|
where: {
|
|
id: currentRowEntityId,
|
|
},
|
|
data: {
|
|
phone: newPhone,
|
|
},
|
|
},
|
|
})
|
|
}
|
|
/>
|
|
);
|
|
}
|