Skip to content

Commit

Permalink
feat: make segments editing work with template milestone strategies (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
daveleek authored Dec 12, 2024
1 parent 828ecf8 commit 8ad63bc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ const StyledAccordion = styled(Accordion)(({ theme }) => ({
},
transition: 'background-color 0.2s ease-in-out',
backgroundColor: theme.palette.background.default,
'&:hover': {
backgroundColor: theme.palette.neutral.light,
},
'&.Mui-expanded': {
marginTop: theme.spacing(3),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,31 @@ export const ReleasePlanTemplateAddStrategyForm = ({
? String(currentStrategy.parameters.stickiness)
: 'default';

const segmentsMap = allSegments?.reduce(
(acc, segment) => {
acc[segment.id] = segment;
return acc;
},
{} as Record<string, ISegment>,
);

useEffect(() => {
setSegments([]);
if (segmentsMap) {
setSegments(
(currentStrategy?.segments || []).map((segment) => {
return segmentsMap[segment];
}),
);
}
}, []);

useEffect(() => {
setCurrentStrategy((prev) => ({
...prev,
segments: segments.map((segment) => segment.id),
}));
}, [segments]);

useEffect(() => {
setCurrentStrategy((prev) => ({
...prev,
Expand Down

0 comments on commit 8ad63bc

Please sign in to comment.