SpeedLimitSection/types/index.ts

src/ui/components/widgets/SpeedLimitSection/types/index.ts
mail@pastecode.io avatar
unknown
typescript
a month ago
2.6 kB
3
Indexable
Never
export enum ActionTypes {
  View = 'View',
  Edit = 'Edit',
  EditItem = 'EditItem',
  Add = 'Add'
}

export enum Direction {
  ASC = 'ASC',
  DESC = 'DESC'
}

export enum SpeedLimitType {
  Zone = 'Zone',
  TSO = 'TSO'
}

export interface speedLimitStates {
  type: string
  subdivision: string
  limit: number
  mp: number
  toMp: number
  heavy: boolean
  hazardous: boolean
  page: string
  actionType: ActionTypes
  indexItemSelected: number | null
  dataItemSelected: speedLimitItemType | null
  temporarySpeedLimitIdDelete: string | null
  routeId: string
  direction: string
  directionList: string[]
  isDeleteModal: boolean
  // edit: boolean
}

export interface speedLimitItemType {
  type?: string
  speed_limit_type?: string
  subdivision?: string
  speed_limit_mph?: number
  start_mile?: number
  end_mile?: number
  heavy?: boolean
  hazardous?: boolean
  temporary_speed_limit_id?: string
}

export enum speedLimitActions {
  INITIALIZE_STATES = 'INITIALIZE_STATES',
  ON_CHANGE_TYPE = 'ON_CHANGE_TYPE',
  ON_CHANGE_ACTION_TYPE = 'ON_CHANGE_ACTION_TYPE',
  ON_CHANGE_PAGE = 'ON_CHANGE_PAGE',
  ON_SELECTED_ITEM = 'ON_SELECTED_ITEM',
  ON_SELECTED_DELETE_ITEM = 'ON_SELECTED_DELETE_ITEM',
  ON_CHANGE_ROUTE_ID = 'ON_CHANGE_ROUTE_ID',
  ON_CHANGE_DIRECTION = 'ON_CHANGE_DIRECTION',
  ON_DELETE_SPEED_LIMIT = 'ON_DELETE_SPEED_LIMIT',
  ON_EDIT = 'ON_EDIT'
}

export interface reducerActionProps {
  type:
    | speedLimitActions.INITIALIZE_STATES
    | speedLimitActions.ON_CHANGE_TYPE
    | speedLimitActions.ON_CHANGE_ACTION_TYPE
    | speedLimitActions.ON_CHANGE_PAGE
    | speedLimitActions.ON_SELECTED_ITEM
    | speedLimitActions.ON_CHANGE_ROUTE_ID
    | speedLimitActions.ON_EDIT
    | speedLimitActions.ON_CHANGE_DIRECTION
    | speedLimitActions.ON_DELETE_SPEED_LIMIT
    | speedLimitActions.ON_SELECTED_DELETE_ITEM
  payload: any
}

export interface actionCreatorsProps {
  onInitStates: () => void
  onChangeType: (type: string) => void
  onChangeActionType: (actionType: ActionTypes) => void
  onChangePage: (selectedPage: string) => void
  onSelectedItem: ({
    selectedItemData,
    selectedIndex
  }: {
    selectedItemData: speedLimitItemType | null
    selectedIndex: number
  }) => void
  onSelectedDeleteItem: (temporarySpeedLimitId: string | null) => void
  onChangeRouteId: (routeId: string) => void
  onChangeDirection: (direction: string) => void
  onChangeIsOpenModalDelete: (isOpen: boolean) => void
  // onEdit: (isEdit: boolean) => void
}
Leave a Comment