1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-06 00:07:44 +01:00
unleash.unleash/frontend/src/component/changeRequest/ChangeRequest/ChangeRequest.tsx

50 lines
1.7 KiB
TypeScript
Raw Normal View History

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';
interface IChangeRequestProps {
changeRequest: IChangeRequest;
onRefetch?: () => void;
onNavigate?: () => void;
}
export const ChangeRequest: VFC<IChangeRequestProps> = ({
changeRequest,
onRefetch,
onNavigate,
}) => {
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}
projectId={changeRequest.project}
onNavigate={onNavigate}
2022-12-01 14:44:33 +01:00
conflict={feature.conflict}
>
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-12-08 13:24:15 +01:00
</FeatureToggleChanges>
))}
</Box>
);
};