INFRA-2867 | cleanup

This commit is contained in:
dhruvjoshi
2024-03-12 20:07:56 +05:30
parent e3c47724e1
commit 5aa003bfe6
7 changed files with 21 additions and 13 deletions

View File

@@ -10,7 +10,6 @@ import {
reducer,
} from '@src/Pages/Dashboard/constants';
import CreateIncidentForm from '@src/Pages/Dashboard/partials/CreateIncidentForm';
import styles from './CreateIncident.module.scss';
import { Team } from '../type';
import useCreateIncidentHelper from './CreateIncidentHelper';
@@ -21,6 +20,8 @@ import {
selectProductListData,
} from '@src/slices/createIncidentSlice';
import useIncidentFormApi from '../useDashboardApi';
import styles from './CreateIncident.module.scss';
interface CreateIncidentProps {
startIncidentSearch: () => void;
}

View File

@@ -19,12 +19,13 @@ import {
LIMITS as LIMITS,
actionTypes,
} from '@src/Pages/Dashboard/constants';
import styles from './CreateIncident.module.scss';
import useClickStream from '@src/services/clickStream';
import { CLICK_STREAM_EVENT_FACTORY } from '@src/services/clickStream/constants/values';
import ProductSelector from './ProductSelector';
import IncidentSingleSelector from './IncidentSingleSelector';
import { Team } from '../type';
import styles from './CreateIncident.module.scss';
interface CreateIncidentFormProps {
startIncidentSearch: () => void;
handleDrawerClose: () => void;
@@ -70,14 +71,14 @@ const CreateIncidentForm: React.FC<CreateIncidentFormProps> = ({
dispatch({ type: actionTypes.SET_TITLE, payload: inputValue });
validateTitle(inputValue);
};
const handleTeamChange = (val: SelectPickerOptionProps[]) => {
const handleTeamChange = (val: SelectPickerOptionProps[]): void => {
dispatch({ type: actionTypes.SET_SELECTED_TEAM, payload: val });
if (val?.length === 0) return;
};
const handleAssignerChange = (val: SelectPickerValue) => {
const handleAssignerChange = (val: SelectPickerValue): void => {
dispatch({ type: actionTypes.SET_SELECTED_ASSIGNER, payload: val });
};
const handleResponderChange = (val: SelectPickerValue) => {
const handleResponderChange = (val: SelectPickerValue): void => {
dispatch({ type: actionTypes.SET_SELECTED_RESPONDER, payload: val });
};
const handleDescriptionChange = (
@@ -94,7 +95,7 @@ const CreateIncidentForm: React.FC<CreateIncidentFormProps> = ({
dispatch({ type: actionTypes.CLEAR_DRAWER });
handleDrawerClose();
};
const isDisabled = () => {
const isDisabled = (): boolean => {
return (
!state.isTitleValid ||
!state.isDescriptionValid ||

View File

@@ -7,7 +7,9 @@ import {
} from '@src/slices/createIncidentSlice';
import { ActionType } from '@src/Pages/TeamRevamp/types';
const useCreateIncidentHelper = (dispatch: React.Dispatch<ActionType>) => {
const useCreateIncidentHelper = (
dispatch: React.Dispatch<ActionType>,
): void => {
const filterConfigData = useSelector(selectFilterConfigData);
const productListData = useSelector(selectProductListData);
const assignerResponderData = useSelector(selectAssignerResponderData);
@@ -18,7 +20,7 @@ const useCreateIncidentHelper = (dispatch: React.Dispatch<ActionType>) => {
});
};
const updateProductList = () => {
const updateProductList = (): void => {
dispatch({
type: actionTypes.SET_TEAMS,
payload: productListData?.products || [],
@@ -30,7 +32,7 @@ const useCreateIncidentHelper = (dispatch: React.Dispatch<ActionType>) => {
});
};
const updateAssignerAndResponder = () => {
const updateAssignerAndResponder = (): void => {
dispatch({
type: actionTypes.SET_ASSIGNERS,
payload: assignerResponderData?.assignerTeam?.teams,

View File

@@ -10,7 +10,9 @@ interface IncidentSingleSelectorProps {
handleSelectionChange: (options: SelectPickerValue) => void;
selected: SelectPickerValue;
}
const IncidentSingleSelector = (props: IncidentSingleSelectorProps) => {
const IncidentSingleSelector: React.FC<IncidentSingleSelectorProps> = (
props: IncidentSingleSelectorProps,
) => {
const { options, handleSelectionChange, selected } = props;
const handleClearCallback = (): void => {
handleSelectionChange('');

View File

@@ -8,7 +8,9 @@ interface ProductSelectorProps {
selected: SelectPickerOptionProps[];
}
const ProductSelector = (props: ProductSelectorProps) => {
const ProductSelector: React.FC<ProductSelectorProps> = (
props: ProductSelectorProps,
) => {
const { options, handleSelectionChange, selected } = props;
const handleChipRemoval = (options: SelectPickerOptionProps[]): void => {

View File

@@ -72,7 +72,7 @@ const SearchResultsTable: FC<SearchResultTableProps> = ({
};
});
const wrappedTextHandler = (param: string) => {
const wrappedTextHandler = (param: string): JSX.Element | string => {
if (param?.length > MAX_LENGTH) {
const wrappedText = param?.substring(0, MAX_LENGTH - 3) + '...';
return (

View File

@@ -439,7 +439,7 @@ const AllDailogBox: FC = () => {
);
};
const renderResponderChange = () => {
const renderResponderChange = (): JSX.Element => {
const handleResponderChange = (val: SelectPickerValue) => {
dispatch({ type: actionTypes.SET_TEAM, payload: val });
};