Add linkedinUrl and job titles to table views (#809)

* Add linedinUrl and job titles to table views

* Keep address in the end

* Add mock data
This commit is contained in:
Emilien Chauvet
2023-07-21 15:18:19 -07:00
committed by GitHub
parent 56cff63c4b
commit 73e9104b16
22 changed files with 301 additions and 19 deletions

View File

@ -0,0 +1,43 @@
import { useEffect, useState } from 'react';
import { useRecoilValue } from 'recoil';
import { peopleJobTitleFamilyState } from '@/people/states/peopleJobTitleFamilyState';
import { EditableCellText } from '@/ui/table/editable-cell/types/EditableCellText';
import { useCurrentRowEntityId } from '@/ui/table/hooks/useCurrentEntityId';
import { useUpdateOnePersonMutation } from '~/generated/graphql';
export function EditablePeopleJobTitleCell() {
const currentRowEntityId = useCurrentRowEntityId();
const [updatePerson] = useUpdateOnePersonMutation();
const jobTitle = useRecoilValue(
peopleJobTitleFamilyState(currentRowEntityId ?? ''),
);
const [internalValue, setInternalValue] = useState(jobTitle ?? '');
useEffect(() => {
setInternalValue(jobTitle ?? '');
}, [jobTitle]);
return (
<EditableCellText
value={internalValue}
onChange={setInternalValue}
onSubmit={() =>
updatePerson({
variables: {
where: {
id: currentRowEntityId,
},
data: {
jobTitle: internalValue,
},
},
})
}
onCancel={() => setInternalValue(jobTitle ?? '')}
/>
);
}