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 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix playground custom strategy parameters debugging (#1213)
* fix playground custom strategy parameters debugging * fix playground strategy parameters and chips consistency
- Loading branch information
Showing
16 changed files
with
245 additions
and
195 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
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
2 changes: 1 addition & 1 deletion
2
...cordionViewHeader/ConstraintAccordionViewHeaderInfo/ConstraintAccordionViewHeaderInfo.tsx
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
97 changes: 97 additions & 0 deletions
97
...gyItem/StrategyExecution/CustomStrategyParams/CustomParameterItem/CustomParameterItem.tsx
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,97 @@ | ||
import { Box, styled, Typography, useTheme } from '@mui/material'; | ||
import { CancelOutlined } from '@mui/icons-material'; | ||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; | ||
import StringTruncator from 'component/common/StringTruncator/StringTruncator'; | ||
|
||
interface ICustomParameterItem { | ||
text: string; | ||
input?: string | null; | ||
isRequired?: boolean; | ||
} | ||
|
||
const StyledWrapper = styled(Box)(({ theme }) => ({ | ||
width: '100%', | ||
padding: theme.spacing(2, 3), | ||
borderRadius: theme.shape.borderRadiusMedium, | ||
border: `1px solid ${theme.palette.dividerAlternative}`, | ||
display: 'flex', | ||
flexDirection: 'row', | ||
alignItems: 'center', | ||
gap: 2, | ||
})); | ||
|
||
export const CustomParameterItem = ({ | ||
text, | ||
input = null, | ||
isRequired = false, | ||
}: ICustomParameterItem) => { | ||
const theme = useTheme(); | ||
|
||
const color = input === null ? 'error' : 'neutral'; | ||
const requiredError = isRequired && input === null; | ||
|
||
return ( | ||
<StyledWrapper> | ||
<Typography | ||
variant="subtitle1" | ||
color={theme.palette[color].main} | ||
sx={{ minWidth: 118 }} | ||
> | ||
{`${input === null ? 'no value' : input}`} | ||
</Typography> | ||
<Box | ||
sx={{ | ||
flexGrow: 1, | ||
flexDirection: 'column', | ||
}} | ||
> | ||
<Box sx={{ flexGrow: 1 }}> | ||
<ConditionallyRender | ||
condition={Boolean(requiredError)} | ||
show={ | ||
<> | ||
<Typography | ||
component="span" | ||
color={theme.palette.error.main} | ||
> | ||
{' required parameter '} | ||
</Typography> | ||
<StringTruncator | ||
maxWidth="300" | ||
text={text} | ||
maxLength={50} | ||
/> | ||
<Typography | ||
component="span" | ||
color={theme.palette.error.main} | ||
> | ||
{' is not set '} | ||
</Typography> | ||
</> | ||
} | ||
elseShow={ | ||
<> | ||
<Typography | ||
component="span" | ||
color="text.disabled" | ||
> | ||
{' set on parameter '} | ||
</Typography> | ||
<StringTruncator | ||
maxWidth="300" | ||
text={text} | ||
maxLength={50} | ||
/> | ||
</> | ||
} | ||
/> | ||
</Box> | ||
</Box> | ||
<ConditionallyRender | ||
condition={Boolean(requiredError)} | ||
show={<CancelOutlined color={'error'} />} | ||
elseShow={<div />} | ||
/> | ||
</StyledWrapper> | ||
); | ||
}; |
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.