Change to using arrow functions (#1603)
* Change to using arrow functions Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> * Add lint rule --------- Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -6,7 +6,7 @@ import { useViewBarContext } from '@/ui/view-bar/hooks/useViewBarContext';
|
||||
import { filterDropdownSearchInputScopedState } from '@/ui/view-bar/states/filterDropdownSearchInputScopedState';
|
||||
import { filterDropdownSelectedEntityIdScopedState } from '@/ui/view-bar/states/filterDropdownSelectedEntityIdScopedState';
|
||||
|
||||
export function FilterDropdownPeopleSearchSelect() {
|
||||
export const FilterDropdownPeopleSearchSelect = () => {
|
||||
const { ViewBarRecoilScopeContext } = useViewBarContext();
|
||||
|
||||
const filterDropdownSearchInput = useRecoilScopedValue(
|
||||
@ -29,4 +29,4 @@ export function FilterDropdownPeopleSearchSelect() {
|
||||
return (
|
||||
<FilterDropdownEntitySearchSelect entitiesForSelect={peopleForSelect} />
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -71,10 +71,10 @@ const StyledJobTitle = styled.div`
|
||||
}
|
||||
`;
|
||||
|
||||
export function PeopleCard({
|
||||
export const PeopleCard = ({
|
||||
person,
|
||||
hasBottomBorder = true,
|
||||
}: PeopleCardProps) {
|
||||
}: PeopleCardProps) => {
|
||||
const navigate = useNavigate();
|
||||
const [isHovered, setIsHovered] = useState(false);
|
||||
const [isOptionsOpen, setIsOptionsOpen] = useState(false);
|
||||
@ -98,22 +98,22 @@ export function PeopleCard({
|
||||
},
|
||||
});
|
||||
|
||||
function handleMouseEnter() {
|
||||
const handleMouseEnter = () => {
|
||||
setIsHovered(true);
|
||||
}
|
||||
};
|
||||
|
||||
function handleMouseLeave() {
|
||||
const handleMouseLeave = () => {
|
||||
if (!isOptionsOpen) {
|
||||
setIsHovered(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function handleToggleOptions(e: React.MouseEvent<HTMLButtonElement>) {
|
||||
const handleToggleOptions = (e: React.MouseEvent<HTMLButtonElement>) => {
|
||||
e.stopPropagation();
|
||||
setIsOptionsOpen(!isOptionsOpen);
|
||||
}
|
||||
};
|
||||
|
||||
function handleDetachPerson() {
|
||||
const handleDetachPerson = () => {
|
||||
updatePerson({
|
||||
variables: {
|
||||
where: {
|
||||
@ -127,16 +127,16 @@ export function PeopleCard({
|
||||
},
|
||||
refetchQueries: [getOperationName(GET_PEOPLE) ?? ''],
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function handleDeletePerson() {
|
||||
const handleDeletePerson = () => {
|
||||
deletePerson({
|
||||
variables: {
|
||||
ids: person.id,
|
||||
},
|
||||
refetchQueries: [getOperationName(GET_PEOPLE) ?? ''],
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<StyledCard
|
||||
@ -186,4 +186,4 @@ export function PeopleCard({
|
||||
)}
|
||||
</StyledCard>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -6,7 +6,7 @@ import {
|
||||
|
||||
import { useSetPeopleEntityTable } from '../hooks/useSetPeopleEntityTable';
|
||||
|
||||
export function PeopleEntityTableDataEffect({
|
||||
export const PeopleEntityTableData = ({
|
||||
orderBy = [
|
||||
{
|
||||
createdAt: SortOrder.Desc,
|
||||
@ -16,7 +16,7 @@ export function PeopleEntityTableDataEffect({
|
||||
}: {
|
||||
orderBy?: PersonOrderByWithRelationInput[];
|
||||
whereFilters?: any;
|
||||
}) {
|
||||
}) => {
|
||||
const setPeopleEntityTable = useSetPeopleEntityTable();
|
||||
|
||||
useGetPeopleQuery({
|
||||
@ -29,4 +29,4 @@ export function PeopleEntityTableDataEffect({
|
||||
});
|
||||
|
||||
return <></>;
|
||||
}
|
||||
};
|
||||
|
||||
@ -19,14 +19,14 @@ export type PersonForSelect = EntityForSelect & {
|
||||
entityType: Entity.Person;
|
||||
};
|
||||
|
||||
export function PeoplePicker({
|
||||
export const PeoplePicker = ({
|
||||
personId,
|
||||
companyId,
|
||||
onSubmit,
|
||||
onCancel,
|
||||
onCreate,
|
||||
excludePersonIds,
|
||||
}: OwnProps) {
|
||||
}: OwnProps) => {
|
||||
const [relationPickerSearchFilter] = useRecoilScopedState(
|
||||
relationPickerSearchFilterScopedState,
|
||||
);
|
||||
@ -60,11 +60,11 @@ export function PeoplePicker({
|
||||
excludeEntityIds: excludePersonIds,
|
||||
});
|
||||
|
||||
async function handleEntitySelected(
|
||||
const handleEntitySelected = async (
|
||||
selectedPerson: PersonForSelect | null | undefined,
|
||||
) {
|
||||
) => {
|
||||
onSubmit(selectedPerson ?? null);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<SingleEntitySelect
|
||||
@ -76,4 +76,4 @@ export function PeoplePicker({
|
||||
selectedEntity={people.selectedEntities[0]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -7,20 +7,18 @@ export type PersonChipPropsType = {
|
||||
variant?: EntityChipVariant;
|
||||
};
|
||||
|
||||
export function PersonChip({
|
||||
export const PersonChip = ({
|
||||
id,
|
||||
name,
|
||||
pictureUrl,
|
||||
variant,
|
||||
}: PersonChipPropsType) {
|
||||
return (
|
||||
<EntityChip
|
||||
entityId={id}
|
||||
linkToEntity={`/person/${id}`}
|
||||
name={name}
|
||||
avatarType="rounded"
|
||||
pictureUrl={pictureUrl}
|
||||
variant={variant}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}: PersonChipPropsType) => (
|
||||
<EntityChip
|
||||
entityId={id}
|
||||
linkToEntity={`/person/${id}`}
|
||||
name={name}
|
||||
avatarType="rounded"
|
||||
pictureUrl={pictureUrl}
|
||||
variant={variant}
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user