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

chore: Clean up App.tsx and MainContent.tsx #9106

Merged
merged 3 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 0 additions & 2 deletions packages/manager/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,6 @@ export class App extends React.Component<CombinedProps, State> {
<DocumentTitleSegment segment="Linode Manager" />
{this.props.featureFlagsLoading ? null : (
<MainContent
history={this.props.history}
location={this.props.location}
appIsLoading={this.props.appIsLoading}
isLoggedInAsCustomer={this.props.isLoggedInAsCustomer}
/>
Expand Down
36 changes: 10 additions & 26 deletions packages/manager/src/MainContent.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import classNames from 'classnames';
import { isEmpty } from 'ramda';
import * as React from 'react';
import { Redirect, Route, RouteComponentProps, Switch } from 'react-router-dom';
import { Redirect, Route, Switch } from 'react-router-dom';
import { compose } from 'recompose';
import Logo from 'src/assets/logo/akamai-logo.svg';
import Box from 'src/components/core/Box';
import { makeStyles, withTheme, WithTheme } from '@mui/styles';
import { makeStyles } from '@mui/styles';
import { Theme } from '@mui/material/styles';
import Grid from '@mui/material/Unstable_Grid2';
import MainContentBanner from 'src/components/MainContentBanner';
Expand Down Expand Up @@ -45,15 +45,6 @@ const useStyles = makeStyles((theme: Theme) => ({
backgroundColor: theme.bg.app,
zIndex: 1,
},
wrapper: {
padding: theme.spacing(3),
transition: theme.transitions.create('opacity'),
[theme.breakpoints.down('md')]: {
paddingTop: theme.spacing(2),
paddingLeft: theme.spacing(2),
paddingRight: theme.spacing(2),
},
},
cmrWrapper: {
maxWidth: `${theme.breakpoints.values.lg}px !important`,
padding: `${theme.spacing(3)} 0`,
Expand Down Expand Up @@ -135,13 +126,11 @@ const useStyles = makeStyles((theme: Theme) => ({
}));

interface Props {
location: RouteComponentProps['location'];
history: RouteComponentProps['history'];
appIsLoading: boolean;
isLoggedInAsCustomer: boolean;
}

type CombinedProps = Props & GlobalErrorProps & WithTheme;
type CombinedProps = Props & GlobalErrorProps;

const Account = React.lazy(() => import('src/features/Account'));
const LinodesRoutes = React.lazy(() => import('src/features/linodes'));
Expand Down Expand Up @@ -175,7 +164,7 @@ const AccountActivationLanding = React.lazy(
const Firewalls = React.lazy(() => import('src/features/Firewalls'));
const Databases = React.lazy(() => import('src/features/Databases'));

const MainContent: React.FC<CombinedProps> = (props) => {
const MainContent = (props: CombinedProps) => {
const classes = useStyles();
const flags = useFlags();
const { data: preferences } = usePreferences();
Expand Down Expand Up @@ -293,15 +282,11 @@ const MainContent: React.FC<CombinedProps> = (props) => {
closeMenu={() => toggleMenu(false)}
/>
<div
className={`
${classes.content}
${
className={classNames(classes.content, {
[classes.fullWidthContent]:
desktopMenuIsOpen ||
(desktopMenuIsOpen && desktopMenuIsOpen === true)
? classes.fullWidthContent
: ''
}
`}
(desktopMenuIsOpen && desktopMenuIsOpen === true),
})}
>
<TopMenu
isSideMenuOpen={!desktopMenuIsOpen}
Expand All @@ -316,7 +301,7 @@ const MainContent: React.FC<CombinedProps> = (props) => {
role="main"
>
<Grid container spacing={0} className={classes.grid}>
<Grid className={`${classes.switchWrapper} p0`}>
<Grid className={classNames(classes.switchWrapper, 'p0')}>
<GlobalNotifications />
<React.Suspense fallback={<SuspenseLoader />}>
<Switch>
Expand Down Expand Up @@ -380,8 +365,7 @@ const MainContent: React.FC<CombinedProps> = (props) => {

export default compose<CombinedProps, Props>(
React.memo,
withGlobalErrors(),
withTheme
withGlobalErrors()
)(MainContent);

// =============================================================================
Expand Down