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:
@ -3,7 +3,7 @@ import { useSetRecoilState } from 'recoil';
|
||||
import { genericEntitiesFamilyState } from '@/ui/editable-field/states/genericEntitiesFamilyState';
|
||||
import { useGetCompanyQuery } from '~/generated/graphql';
|
||||
|
||||
export function useCompanyQuery(id: string) {
|
||||
export const useCompanyQuery = (id: string) => {
|
||||
const updateCompanyShowPage = useSetRecoilState(
|
||||
genericEntitiesFamilyState(id),
|
||||
);
|
||||
@ -13,4 +13,4 @@ export function useCompanyQuery(id: string) {
|
||||
updateCompanyShowPage(data?.findUniqueCompany);
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@ -8,15 +8,15 @@ import { ActivityType } from '~/generated/graphql';
|
||||
|
||||
import { useDeleteSelectedComapnies } from './useDeleteCompanies';
|
||||
|
||||
export function useCompanyTableActionBarEntries() {
|
||||
export const useCompanyTableActionBarEntries = () => {
|
||||
const setActionBarEntries = useSetRecoilState(actionBarEntriesState);
|
||||
|
||||
const openCreateActivityRightDrawer =
|
||||
useOpenCreateActivityDrawerForSelectedRowIds();
|
||||
|
||||
async function handleActivityClick(type: ActivityType) {
|
||||
const handleActivityClick = async (type: ActivityType) => {
|
||||
openCreateActivityRightDrawer(type, ActivityTargetableEntityType.Company);
|
||||
}
|
||||
};
|
||||
|
||||
const deleteSelectedCompanies = useDeleteSelectedComapnies();
|
||||
return {
|
||||
@ -40,4 +40,4 @@ export function useCompanyTableActionBarEntries() {
|
||||
},
|
||||
]),
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
@ -8,15 +8,15 @@ import { ActivityType } from '~/generated/graphql';
|
||||
|
||||
import { useDeleteSelectedComapnies } from './useDeleteCompanies';
|
||||
|
||||
export function useCompanyTableContextMenuEntries() {
|
||||
export const useCompanyTableContextMenuEntries = () => {
|
||||
const setContextMenuEntries = useSetRecoilState(contextMenuEntriesState);
|
||||
|
||||
const openCreateActivityRightDrawer =
|
||||
useOpenCreateActivityDrawerForSelectedRowIds();
|
||||
|
||||
async function handleButtonClick(type: ActivityType) {
|
||||
const handleButtonClick = async (type: ActivityType) => {
|
||||
openCreateActivityRightDrawer(type, ActivityTargetableEntityType.Company);
|
||||
}
|
||||
};
|
||||
|
||||
const deleteSelectedCompanies = useDeleteSelectedComapnies();
|
||||
|
||||
@ -41,4 +41,4 @@ export function useCompanyTableContextMenuEntries() {
|
||||
},
|
||||
]),
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
@ -8,7 +8,7 @@ import { currentPipelineState } from '@/pipeline/states/currentPipelineState';
|
||||
import { boardCardIdsByColumnIdFamilyState } from '@/ui/board/states/boardCardIdsByColumnIdFamilyState';
|
||||
import { useCreateOneCompanyPipelineProgressMutation } from '~/generated/graphql';
|
||||
|
||||
export function useCreateCompanyProgress() {
|
||||
export const useCreateCompanyProgress = () => {
|
||||
const [createOneCompanyPipelineProgress] =
|
||||
useCreateOneCompanyPipelineProgressMutation({
|
||||
refetchQueries: [
|
||||
@ -44,4 +44,4 @@ export function useCreateCompanyProgress() {
|
||||
},
|
||||
[createOneCompanyPipelineProgress, currentPipeline],
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -7,7 +7,7 @@ import { selectedRowIdsSelector } from '@/ui/table/states/selectors/selectedRowI
|
||||
import { tableRowIdsState } from '@/ui/table/states/tableRowIdsState';
|
||||
import { useDeleteManyCompaniesMutation } from '~/generated/graphql';
|
||||
|
||||
export function useDeleteSelectedComapnies() {
|
||||
export const useDeleteSelectedComapnies = () => {
|
||||
const selectedRowIds = useRecoilValue(selectedRowIdsSelector);
|
||||
|
||||
const resetRowSelection = useResetTableRowSelection();
|
||||
@ -18,7 +18,7 @@ export function useDeleteSelectedComapnies() {
|
||||
|
||||
const [tableRowIds, setTableRowIds] = useRecoilState(tableRowIdsState);
|
||||
|
||||
async function deleteSelectedCompanies() {
|
||||
const deleteSelectedCompanies = async () => {
|
||||
const rowIdsToDelete = selectedRowIds;
|
||||
|
||||
resetRowSelection();
|
||||
@ -46,7 +46,7 @@ export function useDeleteSelectedComapnies() {
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return deleteSelectedCompanies;
|
||||
}
|
||||
};
|
||||
|
||||
@ -3,7 +3,7 @@ import { useFilteredSearchEntityQuery } from '@/search/hooks/useFilteredSearchEn
|
||||
import { useSearchCompanyQuery } from '~/generated/graphql';
|
||||
import { getLogoUrlFromDomainName } from '~/utils';
|
||||
|
||||
export function useFilteredSearchCompanyQuery({
|
||||
export const useFilteredSearchCompanyQuery = ({
|
||||
searchFilter,
|
||||
selectedIds = [],
|
||||
limit,
|
||||
@ -11,7 +11,7 @@ export function useFilteredSearchCompanyQuery({
|
||||
searchFilter: string;
|
||||
selectedIds?: string[];
|
||||
limit?: number;
|
||||
}) {
|
||||
}) => {
|
||||
return useFilteredSearchEntityQuery({
|
||||
queryHook: useSearchCompanyQuery,
|
||||
filters: [
|
||||
@ -32,4 +32,4 @@ export function useFilteredSearchCompanyQuery({
|
||||
selectedIds: selectedIds,
|
||||
limit,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@ -9,7 +9,7 @@ import { fieldsForCompany } from '../utils/fieldsForCompany';
|
||||
|
||||
export type FieldCompanyMapping = (typeof fieldsForCompany)[number]['key'];
|
||||
|
||||
export function useSpreadsheetCompanyImport() {
|
||||
export const useSpreadsheetCompanyImport = () => {
|
||||
const { openSpreadsheetImport } = useSpreadsheetImport<FieldCompanyMapping>();
|
||||
const { enqueueSnackBar } = useSnackBar();
|
||||
|
||||
@ -23,7 +23,7 @@ export function useSpreadsheetCompanyImport() {
|
||||
) => {
|
||||
openSpreadsheetImport({
|
||||
...options,
|
||||
async onSubmit(data) {
|
||||
onSubmit: async (data) => {
|
||||
// TODO: Add better type checking in spreadsheet import later
|
||||
const createInputs = data.validData.map((company) => ({
|
||||
id: uuidv4(),
|
||||
@ -56,4 +56,4 @@ export function useSpreadsheetCompanyImport() {
|
||||
};
|
||||
|
||||
return { openCompanySpreadsheetImport };
|
||||
}
|
||||
};
|
||||
|
||||
@ -4,8 +4,8 @@ import { boardCardIdsByColumnIdFamilyState } from '@/ui/board/states/boardCardId
|
||||
import { boardColumnsState } from '@/ui/board/states/boardColumnsState';
|
||||
import { GetPipelineProgressQuery } from '~/generated/graphql';
|
||||
|
||||
export function useUpdateCompanyBoardCardIds() {
|
||||
return useRecoilCallback(
|
||||
export const useUpdateCompanyBoardCardIds = () =>
|
||||
useRecoilCallback(
|
||||
({ snapshot, set }) =>
|
||||
(
|
||||
pipelineProgresses: GetPipelineProgressQuery['findManyPipelineProgress'],
|
||||
@ -27,4 +27,3 @@ export function useUpdateCompanyBoardCardIds() {
|
||||
},
|
||||
[],
|
||||
);
|
||||
}
|
||||
|
||||
@ -16,8 +16,8 @@ import {
|
||||
PipelineProgressForBoard,
|
||||
} from '../types/CompanyProgress';
|
||||
|
||||
export function useUpdateCompanyBoard() {
|
||||
return useRecoilCallback(
|
||||
export const useUpdateCompanyBoard = () =>
|
||||
useRecoilCallback(
|
||||
({ set, snapshot }) =>
|
||||
(
|
||||
pipeline: Pipeline,
|
||||
@ -141,4 +141,3 @@ export function useUpdateCompanyBoard() {
|
||||
},
|
||||
[],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user