Skip to content

Commit

Permalink
chore: use utils for creating new strategies
Browse files Browse the repository at this point in the history
  • Loading branch information
daveleek committed Nov 22, 2024
1 parent 54f67fd commit 25fd2bf
Showing 1 changed file with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type { IStrategy } from 'interfaces/strategy';
import StringTruncator from 'component/common/StringTruncator/StringTruncator';
import type { IReleasePlanMilestoneStrategy } from 'interfaces/releasePlans';
import { v4 as uuidv4 } from 'uuid';
import { createFeatureStrategy } from 'utils/createFeatureStrategy';

const StyledIcon = styled('div')(({ theme }) => ({
width: theme.spacing(4),
Expand Down Expand Up @@ -49,10 +50,7 @@ const StyledCard = styled('div')(({ theme }) => ({
}));

interface IMilestoneStrategyMenuCardProps {
strategy: Pick<
IStrategy,
'name' | 'displayName' | 'description' | 'parameters'
>;
strategy: IStrategy;
strategyClicked: (strategy: IReleasePlanMilestoneStrategy) => void;
}

Expand All @@ -64,15 +62,16 @@ export const MilestoneStrategyMenuCard = ({
const strategyName = formatStrategyName(strategy.name);
return (
<StyledCard
onClick={() =>
onClick={() => {
const strat = createFeatureStrategy('', strategy);
strategyClicked({
id: uuidv4(),
name: strategy.name,
name: strat.name,
title: '',
constraints: [],
parameters: {},
})
}
constraints: strat.constraints,
parameters: strat.parameters,
});
}}
>
<StyledIcon>
<StrategyIcon />
Expand Down

0 comments on commit 25fd2bf

Please sign in to comment.