Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(revamp): fix broken modern theme layout from adding new revamp layout #3303

Merged
merged 4 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 24 additions & 17 deletions packages/yoroi-extension/app/components/layout/TopBarLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function TopBarLayout({
bgcolor,
}: AllProps) {
const isModern = currentTheme === THEMES.YOROI_MODERN;
const isRevamp = isRevampLayout && asModern !== true && !isModern;

const getContentUnderBanner: void => Node = () => {
const topbarComponent = <Box sx={{ zIndex: 2 }}>{topbar}</Box>;
Expand All @@ -52,15 +53,16 @@ function TopBarLayout({
{navbar != null ? navbarComponent : null}
{notification}
<Box
id="inner-content-wrapper"
sx={{
position: 'relative',
height: '100%',
'&::-webkit-scrollbar-button': {
height: '7px',
display: 'block',
},
boxShadow: !isRevampLayout && showAsCard === true && '0 2px 12px 0 rgba(0, 0, 0, 0.06)',
borderRadius: !isRevampLayout && showAsCard === true && '8px',
boxShadow: !isRevamp && showAsCard === true && '0 2px 12px 0 rgba(0, 0, 0, 0.06)',
borderRadius: !isRevamp && showAsCard === true && '8px',
...(showInContainer === true && {
bgcolor: 'common.white',
width: '100%',
Expand All @@ -70,10 +72,10 @@ function TopBarLayout({
flex: '0 1 auto',
height: '100%',
}),
overflow: isRevampLayout && asModern !== true && !isModern ? 'auto' : '',
overflow: isRevamp ? 'auto' : 'unset',
}}
>
{isRevampLayout && asModern !== true && !isModern ? (
{isRevamp ? (
<Box
sx={{
bgcolor: bgcolor || 'common.white',
Expand All @@ -94,7 +96,8 @@ function TopBarLayout({
sx={{
height: '100%',
minHeight: '200px',
padding: typeof withPadding === 'undefined' || withPadding === true ? '24px' : '0px',
padding:
typeof withPadding === 'undefined' || withPadding === true ? '24px' : '0px',
pb: 0,
bgcolor: bgcolor || 'common.white',
}}
Expand All @@ -104,16 +107,24 @@ function TopBarLayout({
</Box>
</Box>
) : (
<Box sx={{ height: '100%', minHeight: '200px' }}>{children}</Box>
<Box
sx={{
height: '100%',
minHeight: '200px',
}}
>
{children}
</Box>
)}
</Box>
</>
);

if (showInContainer === true) {
const boxProperties = {
height: '100%',
minHeight: '200px',
backgroundColor: 'grey.50',
backgroundColor: isRevamp ? 'common.white' : 'var(--yoroi-palette-gray-50)',
maxWidth: '1295px',
paddingLeft: '40px',
paddingRight: '40px',
Expand All @@ -123,11 +134,11 @@ function TopBarLayout({
display: 'flex',
flexDirection: 'column',
maxHeight: 'calc(100vh - 110px)',
overflow: isRevamp ? 'unset' : 'hidden',
pb: isRevamp ? '0px' : '100px',
};
if (isRevampLayout && asModern !== true && !isModern) {
boxProperties.backgroundColor = 'common.white';
}
return isRevampLayout && asModern !== true && !isModern ? (

return isRevamp ? (
<Box
sx={{
maxWidth: '100%',
Expand All @@ -142,11 +153,7 @@ function TopBarLayout({
{content}
</Box>
) : (
<Box
sx={boxProperties}
>
{content}
</Box>
<Box sx={boxProperties}>{content}</Box>
);
}
return content;
Expand Down Expand Up @@ -185,7 +192,7 @@ function TopBarLayout({
display: 'flex',
flexDirection: 'column',
position: 'relative',
backgroundColor: isRevampLayout && asModern !== true && !isModern ? 'common.white' : '',
backgroundColor: isRevamp ? 'common.white' : 'var(--yoroi-palette-gray-50)',
}}
>
{banner}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const messages = defineMessages({
},
currentVersion: {
id: 'settings.theme.currentVersion',
defaultMessage: '!!!Yoroi current version',
defaultMessage: '!!!Yoroi old version',
},
newVersion: {
id: 'settings.theme.newVersion',
Expand Down Expand Up @@ -138,15 +138,6 @@ export default class ThemeSettingsBlock extends Component<Props> {
flexDirection: 'row',
}}
>
<FormControlLabel
value={OLD_THEME}
control={<Radio sx={{ color: 'primary.500' }} size="small" />}
label={intl.formatMessage(messages.currentVersion)}
id="switchToOldVersionButton"
sx={{
marginRight: '20px',
}}
/>
<FormControlLabel
value={NEW_THEME}
control={
Expand All @@ -160,6 +151,15 @@ export default class ThemeSettingsBlock extends Component<Props> {
label={intl.formatMessage(messages.newVersion)}
id="switchToNewVersionButton"
/>
<FormControlLabel
value={OLD_THEME}
control={<Radio sx={{ color: 'primary.500' }} size="small" />}
label={intl.formatMessage(messages.currentVersion)}
id="switchToOldVersionButton"
sx={{
marginRight: '20px',
}}
/>
</RadioGroup>
</Box>
{false && currentTheme === THEMES.YOROI_REVAMP && environment.isDev() && (
Expand Down
2 changes: 1 addition & 1 deletion packages/yoroi-extension/app/i18n/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@
"settings.support.reportProblem.content": "If the FAQ does not solve the issue you are experiencing, please use our {supportRequestLink} feature.",
"settings.support.reportProblem.link": "Support request",
"settings.support.reportProblem.title": "Reporting a problem",
"settings.theme.currentVersion": "Yoroi current version",
"settings.theme.currentVersion": "Yoroi old version",
"settings.theme.newVersion": "Yoroi new version",
"settings.theme.selectColorTheme": "Select color theme for old version",
"settings.theme.version": "Version",
Expand Down
Loading