2022-12-08 13:24:15 +01:00
|
|
|
import React, { VFC } from 'react';
|
|
|
|
import { Box } from '@mui/material';
|
|
|
|
import type { IChangeRequest } from '../changeRequest.types';
|
|
|
|
import { FeatureToggleChanges } from './Changes/FeatureToggleChanges';
|
|
|
|
import { Change } from './Changes/Change/Change';
|
|
|
|
import { DiscardContainer } from './Changes/Change/Discard';
|
2022-10-26 13:57:59 +02:00
|
|
|
|
2022-11-02 16:05:27 +01:00
|
|
|
interface IChangeRequestProps {
|
|
|
|
changeRequest: IChangeRequest;
|
2022-10-31 13:46:54 +01:00
|
|
|
onRefetch?: () => void;
|
|
|
|
onNavigate?: () => void;
|
|
|
|
}
|
|
|
|
|
2022-11-02 16:05:27 +01:00
|
|
|
export const ChangeRequest: VFC<IChangeRequestProps> = ({
|
2022-11-02 07:34:14 +01:00
|
|
|
changeRequest,
|
2022-10-31 13:46:54 +01:00
|
|
|
onRefetch,
|
|
|
|
onNavigate,
|
|
|
|
}) => {
|
2022-10-26 13:57:59 +02:00
|
|
|
return (
|
|
|
|
<Box>
|
2022-12-01 14:44:33 +01:00
|
|
|
{changeRequest.features?.map(feature => (
|
2022-12-08 13:24:15 +01:00
|
|
|
<FeatureToggleChanges
|
2022-12-01 14:44:33 +01:00
|
|
|
key={feature.name}
|
|
|
|
featureName={feature.name}
|
2022-11-02 07:34:14 +01:00
|
|
|
projectId={changeRequest.project}
|
2022-10-31 13:46:54 +01:00
|
|
|
onNavigate={onNavigate}
|
2022-12-01 14:44:33 +01:00
|
|
|
conflict={feature.conflict}
|
2022-10-26 13:57:59 +02:00
|
|
|
>
|
2022-12-01 14:44:33 +01:00
|
|
|
{feature.changes.map((change, index) => (
|
|
|
|
<Change
|
2022-12-06 15:28:33 +01:00
|
|
|
key={index}
|
2022-12-08 13:24:15 +01:00
|
|
|
discard={
|
|
|
|
<DiscardContainer
|
|
|
|
changeRequest={changeRequest}
|
|
|
|
changeId={change.id}
|
|
|
|
onPostDiscard={onRefetch}
|
|
|
|
/>
|
|
|
|
}
|
2022-12-01 14:44:33 +01:00
|
|
|
index={index}
|
|
|
|
changeRequest={changeRequest}
|
|
|
|
change={change}
|
|
|
|
feature={feature}
|
|
|
|
/>
|
2022-10-26 13:57:59 +02:00
|
|
|
))}
|
2022-12-08 13:24:15 +01:00
|
|
|
</FeatureToggleChanges>
|
2022-10-26 13:57:59 +02:00
|
|
|
))}
|
|
|
|
</Box>
|
|
|
|
);
|
|
|
|
};
|