diff --git a/src/modules/common/components/step/Step.tsx b/src/modules/common/components/step/Step.tsx index d61119e5b..327bc68bd 100644 --- a/src/modules/common/components/step/Step.tsx +++ b/src/modules/common/components/step/Step.tsx @@ -18,7 +18,7 @@ type Props = { img?: string; title?: string; children?: React.ReactNode; - next?: (number: number) => void; + next?: (stepNumber: number) => void; nextButton?: React.ReactNode; save?: (name: string, e: React.MouseEvent) => void; message?: any; diff --git a/src/modules/deals/components/editForm/EditForm.tsx b/src/modules/deals/components/editForm/EditForm.tsx index fc8718345..bdcefc786 100644 --- a/src/modules/deals/components/editForm/EditForm.tsx +++ b/src/modules/deals/components/editForm/EditForm.tsx @@ -16,7 +16,7 @@ type Props = { users: IUser[]; addDeal: (doc: IDealParams, callback: () => void) => void; saveDeal: (doc: IDealParams, callback: () => void) => void; - removeDeal: (_id: string, callback: () => void) => void; + removeDeal: (dealId: string, callback: () => void) => void; closeModal: () => void; }; diff --git a/src/modules/deals/components/editForm/Sidebar.tsx b/src/modules/deals/components/editForm/Sidebar.tsx index d8c6613fc..a18742036 100644 --- a/src/modules/deals/components/editForm/Sidebar.tsx +++ b/src/modules/deals/components/editForm/Sidebar.tsx @@ -20,7 +20,7 @@ type Props = { value: any ) => void; copyDeal: () => void; - removeDeal: (_id: string) => void; + removeDeal: (dealId: string) => void; saveProductsData: () => void; }; diff --git a/src/modules/deals/components/portable/Deal.tsx b/src/modules/deals/components/portable/Deal.tsx index 903dc76a8..6201ec954 100644 --- a/src/modules/deals/components/portable/Deal.tsx +++ b/src/modules/deals/components/portable/Deal.tsx @@ -19,7 +19,7 @@ import { IDeal } from '../../types'; type Props = { deal: IDeal; onAdd: (stageId: string, deal: IDeal) => void; - onRemove: (_id: string, stageId: string) => void; + onRemove: (dealId: string, stageId: string) => void; onUpdate: (deal: IDeal) => void; }; diff --git a/src/modules/deals/components/product/ProductForm.tsx b/src/modules/deals/components/product/ProductForm.tsx index d11abf7cf..a25962b91 100644 --- a/src/modules/deals/components/product/ProductForm.tsx +++ b/src/modules/deals/components/product/ProductForm.tsx @@ -62,10 +62,10 @@ class ProductForm extends React.Component { onChangeProductsData(productsData); } - removeProductItem(_id) { + removeProductItem(productId) { const { productsData, onChangeProductsData } = this.props; - const removedProductsData = productsData.filter(p => p._id !== _id); + const removedProductsData = productsData.filter(p => p._id !== productId); onChangeProductsData(removedProductsData); diff --git a/src/modules/deals/components/product/ProductItemForm.tsx b/src/modules/deals/components/product/ProductItemForm.tsx index 0850d60a6..b27ea94c6 100644 --- a/src/modules/deals/components/product/ProductItemForm.tsx +++ b/src/modules/deals/components/product/ProductItemForm.tsx @@ -19,7 +19,7 @@ type Props = { currencies: string[]; productsData?: IProductData[]; productData: IProductData; - removeProductItem?: (_id: string) => void; + removeProductItem?: (productId: string) => void; onChangeProductsData?: (productsData: IProductData[]) => void; updateTotal?: () => void; }; @@ -70,11 +70,11 @@ class ProductItemForm extends React.Component { } } - onChangeField(type, value, _id) { + onChangeField(type, value, productId) { const { productsData, onChangeProductsData } = this.props; if (productsData) { - const productData = productsData.find(p => p._id === _id); + const productData = productsData.find(p => p._id === productId); if (productData) { productData[type] = value; } diff --git a/src/modules/deals/components/stage/DealItem.tsx b/src/modules/deals/components/stage/DealItem.tsx index dcf94fda8..342d63182 100644 --- a/src/modules/deals/components/stage/DealItem.tsx +++ b/src/modules/deals/components/stage/DealItem.tsx @@ -21,7 +21,7 @@ type Props = { isDragging: boolean; provided; onAdd: (stageId: string, deal: IDeal) => void; - onRemove: (_id: string, stageId: string) => void; + onRemove: (dealId: string, stageId: string) => void; onUpdate: (deal: IDeal) => void; }; diff --git a/src/modules/deals/containers/PipelineContext.tsx b/src/modules/deals/containers/PipelineContext.tsx index b97f5be9f..7c1c43a1f 100644 --- a/src/modules/deals/containers/PipelineContext.tsx +++ b/src/modules/deals/containers/PipelineContext.tsx @@ -20,7 +20,7 @@ interface IStore { stageIds: string[]; onDragEnd: (result: IDragResult) => void; onAddDeal: (stageId: string, deal: IDeal) => void; - onRemoveDeal: (_id: string, stageId: string) => void; + onRemoveDeal: (dealId: string, stageId: string) => void; onUpdateDeal: (deal: IDeal, prevStageId?: string) => void; } @@ -129,10 +129,10 @@ export class PipelineProvider extends React.Component { }); }; - onRemoveDeal = (_id: string, stageId: string) => { + onRemoveDeal = (dealId: string, stageId: string) => { const { dealMap } = this.state; - const deals = dealMap[stageId].filter(deal => deal._id !== _id); + const deals = dealMap[stageId].filter(deal => deal._id !== dealId); this.setState({ dealMap: { ...dealMap, [stageId]: deals } diff --git a/src/modules/deals/containers/editForm/EditForm.tsx b/src/modules/deals/containers/editForm/EditForm.tsx index 9c91aa289..a4a216ee3 100644 --- a/src/modules/deals/containers/editForm/EditForm.tsx +++ b/src/modules/deals/containers/editForm/EditForm.tsx @@ -22,7 +22,7 @@ type Props = { editMutation: SaveDealMutation; removeMutation: RemoveDealMutation; onAdd?: (stageId: string, deal: IDeal) => void; - onRemove?: (_id: string, stageId: string) => void; + onRemove?: (dealId: string, stageId: string) => void; onUpdate?: (deal: IDeal, prevStageId: string) => void; closeModal: () => void; }; @@ -72,16 +72,16 @@ class EditFormContainer extends React.Component { }); } - removeDeal(_id: string, callback) { + removeDeal(dealId: string, callback) { const { removeMutation, onRemove, stageId } = this.props; confirm().then(() => - removeMutation({ variables: { _id } }) + removeMutation({ variables: { _id: dealId } }) .then(() => { callback(); if (onRemove) { - onRemove(_id, stageId); + onRemove(dealId, stageId); } }) diff --git a/src/modules/deals/data.ts b/src/modules/deals/data.ts index f5308954c..4da4a515e 100644 --- a/src/modules/deals/data.ts +++ b/src/modules/deals/data.ts @@ -4,10 +4,10 @@ import { IDeal } from './types'; type StagesWithDeals = IStage & { deals: IDeal[] }; const dealFactory = (pipeline: IPipeline, stage: IStage): IDeal => { - const _id = Math.random().toString(); + const id = Math.random().toString(); return { - _id, + _id: id, order: 1, stageId: stage._id, assignedUsers: [], @@ -18,7 +18,7 @@ const dealFactory = (pipeline: IPipeline, stage: IStage): IDeal => { pipeline, products: [], amount: 10000, - name: `Deal_${_id}` + name: `Deal_${id}` }; }; @@ -26,11 +26,11 @@ const stageFactory = ( pipeline: IPipeline, dealCount: number ): StagesWithDeals => { - const _id = Math.random().toString(); + const id = Math.random().toString(); const stage: IStage = { - _id, - name: `Stage_${_id}`, + _id: id, + name: `Stage_${id}`, pipelineId: pipeline._id }; diff --git a/src/modules/deals/types.ts b/src/modules/deals/types.ts index 0d966e038..1da35142f 100644 --- a/src/modules/deals/types.ts +++ b/src/modules/deals/types.ts @@ -100,8 +100,11 @@ export interface IStageMap { } export type SaveDealMutation = ({ variables: IDealParams }) => Promise; + +interface IRemoveDealVariables { + _id: string; +} + export type RemoveDealMutation = ( - { - variables: { _id: string } - } + { variables: IRemoveDealVariables } ) => Promise; diff --git a/src/modules/engage/components/Scheduler.tsx b/src/modules/engage/components/Scheduler.tsx index 2fdd47948..cd5a60fa8 100644 --- a/src/modules/engage/components/Scheduler.tsx +++ b/src/modules/engage/components/Scheduler.tsx @@ -37,10 +37,10 @@ class Scheduler extends React.Component { this.props.onChange('scheduleDate', scheduleDate); } - generateOptions(number) { + generateOptions(length) { const options: React.ReactNode[] = []; - for (let i = 1; i <= number; i++) { + for (let i = 1; i <= length; i++) { options.push(