2022-10-26 13:57:59 +02:00
|
|
|
import { FC } from 'react';
|
|
|
|
import { Box } from '@mui/material';
|
|
|
|
import { SuggestedFeatureToggleChange } from '../SuggestedChangeOverview/SuggestedFeatureToggleChange/SuggestedFeatureToggleChange';
|
|
|
|
import { objectId } from 'utils/objectId';
|
|
|
|
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
|
|
|
import { ToggleStatusChange } from '../SuggestedChangeOverview/SuggestedFeatureToggleChange/ToggleStatusChange';
|
2022-10-28 09:43:49 +02:00
|
|
|
// import {
|
|
|
|
// StrategyAddedChange,
|
|
|
|
// StrategyDeletedChange,
|
|
|
|
// StrategyEditedChange,
|
|
|
|
// } from '../SuggestedChangeOverview/SuggestedFeatureToggleChange/StrategyChange';
|
|
|
|
// import {
|
|
|
|
// formatStrategyName,
|
|
|
|
// GetFeatureStrategyIcon,
|
|
|
|
// } from 'utils/strategyNames';
|
|
|
|
import type { ISuggestChangesResponse } from 'hooks/api/getters/useSuggestedChangesDraft/useSuggestedChangesDraft';
|
2022-10-26 13:57:59 +02:00
|
|
|
|
2022-10-28 09:43:49 +02:00
|
|
|
export const SuggestedChangeset: FC<{
|
|
|
|
suggestedChange: ISuggestChangesResponse;
|
|
|
|
}> = ({ suggestedChange }) => {
|
2022-10-26 13:57:59 +02:00
|
|
|
return (
|
|
|
|
<Box>
|
|
|
|
Changes
|
2022-10-28 09:43:49 +02:00
|
|
|
{suggestedChange.features?.map(featureToggleChange => (
|
2022-10-26 13:57:59 +02:00
|
|
|
<SuggestedFeatureToggleChange
|
2022-10-28 09:43:49 +02:00
|
|
|
key={featureToggleChange.name}
|
|
|
|
featureToggleName={featureToggleChange.name}
|
2022-10-26 13:57:59 +02:00
|
|
|
>
|
2022-10-28 09:43:49 +02:00
|
|
|
{featureToggleChange.changes.map(change => (
|
2022-10-26 13:57:59 +02:00
|
|
|
<Box key={objectId(change)}>
|
|
|
|
<ConditionallyRender
|
|
|
|
condition={change.action === 'updateEnabled'}
|
|
|
|
show={
|
|
|
|
<ToggleStatusChange
|
2022-10-28 09:43:49 +02:00
|
|
|
enabled={change?.payload?.enabled}
|
2022-10-26 13:57:59 +02:00
|
|
|
/>
|
|
|
|
}
|
|
|
|
/>
|
2022-10-28 09:43:49 +02:00
|
|
|
{/* <ConditionallyRender
|
2022-10-26 13:57:59 +02:00
|
|
|
condition={change.action === 'addStrategy'}
|
|
|
|
show={
|
|
|
|
<StrategyAddedChange>
|
|
|
|
<GetFeatureStrategyIcon
|
|
|
|
strategyName={change.payload.name}
|
|
|
|
/>
|
|
|
|
{formatStrategyName(
|
|
|
|
change.payload.name
|
|
|
|
)}
|
|
|
|
</StrategyAddedChange>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
<ConditionallyRender
|
|
|
|
condition={change.action === 'deleteStrategy'}
|
|
|
|
show={<StrategyDeletedChange />}
|
|
|
|
/>
|
|
|
|
<ConditionallyRender
|
|
|
|
condition={change.action === 'updateStrategy'}
|
|
|
|
show={<StrategyEditedChange />}
|
2022-10-28 09:43:49 +02:00
|
|
|
/> */}
|
2022-10-26 13:57:59 +02:00
|
|
|
</Box>
|
|
|
|
))}
|
|
|
|
</SuggestedFeatureToggleChange>
|
|
|
|
))}
|
|
|
|
</Box>
|
|
|
|
);
|
|
|
|
};
|