This repository has been archived by the owner on Oct 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/task/Add_strategy_information_to…
…_playground_results' into task/Add_strategy_information_to_playground_results
- Loading branch information
Showing
19 changed files
with
171 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { makeStyles } from 'tss-react/mui'; | ||
|
||
export const useStyles = makeStyles()(theme => ({ | ||
container: { | ||
width: '100%', | ||
padding: theme.spacing(2, 3), | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'flex-start', | ||
fontSize: theme.fontSizes.smallBody, | ||
border: `1px solid ${theme.palette.dividerAlternative}`, | ||
position: 'relative', | ||
borderRadius: '5px', | ||
}, | ||
link: { | ||
textDecoration: 'none', | ||
marginLeft: theme.spacing(1), | ||
'&:hover': { | ||
textDecoration: 'underline', | ||
}, | ||
}, | ||
accordion: { | ||
border: `1px solid ${theme.palette.dividerAlternative}`, | ||
borderRadius: theme.shape.borderRadiusMedium, | ||
backgroundColor: '#fff', | ||
boxShadow: 'none', | ||
margin: 0, | ||
}, | ||
accordionRoot: { | ||
transition: 'all 0.1s ease', | ||
}, | ||
accordionExpanded: { | ||
backgroundColor: theme.palette.neutral.light, | ||
}, | ||
previewButton: { | ||
paddingTop: 0, | ||
paddingBottom: 0, | ||
marginLeft: 'auto', | ||
fontSize: theme.fontSizes.smallBody, | ||
}, | ||
summary: { | ||
fontSize: theme.fontSizes.smallBody, | ||
margin: theme.spacing(0.5, 0), | ||
}, | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { useState, VFC } from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
import { DonutLarge } from '@mui/icons-material'; | ||
import { ISegment } from 'interfaces/segment'; | ||
import { | ||
Accordion, | ||
AccordionDetails, | ||
AccordionSummary, | ||
Button, | ||
Typography, | ||
} from '@mui/material'; | ||
import { ConstraintAccordionList } from '../ConstraintAccordion/ConstraintAccordionList/ConstraintAccordionList'; | ||
import { ConditionallyRender } from '../ConditionallyRender/ConditionallyRender'; | ||
import { useStyles } from './SegmentItem.styles'; | ||
|
||
interface ISegmentItemProps { | ||
segment: ISegment; | ||
isExpanded?: boolean; | ||
} | ||
|
||
export const SegmentItem: VFC<ISegmentItemProps> = ({ | ||
segment, | ||
isExpanded, | ||
}) => { | ||
const { classes } = useStyles(); | ||
const [isOpen, setIsOpen] = useState(isExpanded || false); | ||
|
||
return ( | ||
<Accordion | ||
expanded={isOpen} | ||
className={classes.accordion} | ||
classes={{ | ||
root: classes.accordionRoot, | ||
expanded: classes.accordionExpanded, | ||
}} | ||
> | ||
<AccordionSummary | ||
id={`segment-accordion-${segment.id}`} | ||
className={classes.summary} | ||
> | ||
<DonutLarge color="secondary" sx={{ mr: 1 }} /> | ||
Segment: | ||
<Link | ||
to={`/segments/edit/${segment.id}`} | ||
className={classes.link} | ||
> | ||
{segment.name} | ||
</Link> | ||
<ConditionallyRender | ||
condition={!isExpanded} | ||
show={ | ||
<Button | ||
size="small" | ||
variant="outlined" | ||
onClick={() => setIsOpen(value => !value)} | ||
className={classes.previewButton} | ||
> | ||
{isOpen ? 'Close preview' : 'Preview'} | ||
</Button> | ||
} | ||
/> | ||
</AccordionSummary> | ||
<AccordionDetails sx={{ pt: 0 }}> | ||
<ConditionallyRender | ||
condition={segment!.constraints?.length > 0} | ||
show={ | ||
<ConstraintAccordionList | ||
constraints={segment!.constraints} | ||
showLabel={false} | ||
/> | ||
} | ||
elseShow={ | ||
<Typography> | ||
This segment has no constraints. | ||
</Typography> | ||
} | ||
/> | ||
</AccordionDetails> | ||
</Accordion> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 0 additions & 22 deletions
22
...ature/FeatureView/FeatureOverview/FeatureOverviewSegment/FeatureOverviewSegment.styles.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.