import type { FC, ReactNode } from 'react'; import type { IFeatureChange, ChangeRequestType, IChangeRequestFeature, } from '../../../changeRequest.types'; import { objectId } from 'utils/objectId'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; import { Alert, Box, styled } from '@mui/material'; import { ToggleStatusChange } from './ToggleStatusChange.tsx'; import { StrategyChange } from './StrategyChange.tsx'; import { VariantPatch } from './VariantPatch/VariantPatch.tsx'; import { EnvironmentStrategyExecutionOrder } from './EnvironmentStrategyExecutionOrder/EnvironmentStrategyExecutionOrder.tsx'; import { ArchiveFeatureChange } from './ArchiveFeatureChange.tsx'; import { DependencyChange } from './DependencyChange.tsx'; import { Link } from 'react-router-dom'; import { ReleasePlanChange } from './ReleasePlanChange.tsx'; const StyledSingleChangeBox = styled(Box, { shouldForwardProp: (prop: string) => !prop.startsWith('$'), })<{ $hasConflict: boolean; $isAfterWarning: boolean; $isLast: boolean; $isInConflictFeature: boolean; }>( ({ theme, $hasConflict, $isInConflictFeature, $isAfterWarning, $isLast, }) => ({ overflow: 'hidden', borderLeft: '1px solid', borderRight: '1px solid', borderTop: '1px solid', borderBottom: $isLast ? '1px solid' : 'none', borderRadius: $isLast ? `0 0 ${theme.shape.borderRadiusLarge}px ${theme.shape.borderRadiusLarge}px` : 0, borderColor: $hasConflict || $isInConflictFeature ? theme.palette.warning.border : theme.palette.divider, borderTopColor: ($hasConflict || $isAfterWarning) && !$isInConflictFeature ? theme.palette.warning.border : theme.palette.divider, }), ); const StyledAlert = styled(Alert)(({ theme }) => ({ borderRadius: 0, padding: theme.spacing(1, 2), '&.MuiAlert-standardWarning': { borderStyle: 'none none solid none', }, })); const InlineList = styled('ul')(({ theme }) => ({ display: 'inline', padding: 0, li: { display: 'inline' }, 'li + li::before': { content: '", "', }, })); const ChangeInnerBox = styled(Box)(({ theme }) => ({ padding: theme.spacing(3), '&:has(.delete-strategy-information-wrapper)': { backgroundColor: theme.palette.error.light, }, })); export const FeatureChange: FC<{ actions: ReactNode; index: number; changeRequest: ChangeRequestType; change: IFeatureChange; feature: IChangeRequestFeature; onNavigate?: () => void; }> = ({ index, change, feature, changeRequest, actions, onNavigate }) => { const lastIndex = feature.defaultChange ? feature.changes.length + 1 : feature.changes.length; return ( Conflict! This change can’t be applied.{' '} {change.conflict}. } /> Potential conflict! This change would create conflicts with the following scheduled change request(s):{' '} {( change.scheduleConflicts ?? { changeRequests: [], } ).changeRequests.map(({ id, title }) => { const text = title ? `#${id} (${title})` : `#${id}`; return (
  • {text}
  • ); })} .
    } /> {(change.action === 'addDependency' || change.action === 'deleteDependency') && ( )} {change.action === 'updateEnabled' && ( )} {change.action === 'archiveFeature' && ( )} {change.action === 'addStrategy' || change.action === 'deleteStrategy' || change.action === 'updateStrategy' ? ( ) : null} {change.action === 'patchVariant' && ( )} {change.action === 'reorderStrategy' && ( )} {(change.action === 'addReleasePlan' || change.action === 'deleteReleasePlan' || change.action === 'startMilestone') && ( )}
    ); };