import { VFC } from 'react'; import { Box } from '@mui/material'; import { ChangeRequestFeatureToggleChange } from '../ChangeRequestOverview/ChangeRequestFeatureToggleChange/ChangeRequestFeatureToggleChange'; import { objectId } from 'utils/objectId'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; import { ToggleStatusChange } from '../ChangeRequestOverview/ChangeRequestFeatureToggleChange/ToggleStatusChange'; import type { IChangeRequestResponse } from 'hooks/api/getters/useChangeRequestDraft/useChangeRequestDraft'; import { useChangeRequestApi } from 'hooks/api/actions/useChangeRequestApi/useChangeRequestApi'; import { formatUnknownError } from 'utils/formatUnknownError'; import useToast from 'hooks/useToast'; interface IChangeRequest { changeRequest: IChangeRequestResponse; onRefetch?: () => void; onNavigate?: () => void; } export const ChangeRequest: VFC = ({ changeRequest, onRefetch, onNavigate, }) => { const { discardChangeRequestEvent } = useChangeRequestApi(); const { setToastData, setToastApiError } = useToast(); const onDiscard = (id: number) => async () => { try { await discardChangeRequestEvent( changeRequest.project, changeRequest.id, id ); setToastData({ title: 'Change discarded from change request draft.', type: 'success', }); onRefetch?.(); } catch (error: unknown) { setToastApiError(formatUnknownError(error)); } }; return ( Changes {changeRequest.features?.map(featureToggleChange => ( {featureToggleChange.changes.map(change => ( } /> {/* {formatStrategyName( change.payload.name )} } /> } /> } /> */} ))} ))} ); };