From 0fa1e20458b3ec5f72b54935239e2bbc6013bd44 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Tue, 16 Feb 2021 10:05:41 -0800 Subject: [PATCH] Improve bundle size. --- packages/webapp/src/app.tsx | 5 +++-- .../classes/client/client-health-sentinel/index.tsx | 9 +++++++-- .../components/forgot-password-success-page/index.tsx | 3 ++- .../action-dispatcher/publish-dialog/index.tsx | 1 + packages/webapp/src/components/maps-page/index.tsx | 10 +++++++--- .../src/components/maps-page/language-menu/index.tsx | 11 ++++++++++- packages/webapp/src/theme/index.ts | 2 +- 7 files changed, 31 insertions(+), 10 deletions(-) diff --git a/packages/webapp/src/app.tsx b/packages/webapp/src/app.tsx index c7ba00be..9d45d198 100644 --- a/packages/webapp/src/app.tsx +++ b/packages/webapp/src/app.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React from 'react'; import { IntlProvider } from 'react-intl'; import { Route, Switch, Redirect, BrowserRouter as Router } from 'react-router-dom'; @@ -10,10 +10,11 @@ import store from "./redux/store"; import { ForgotPasswordPage } from './components/forgot-password-page'; import { Provider } from 'react-redux'; import { QueryClient, QueryClientProvider } from 'react-query'; -import { CssBaseline, ThemeProvider } from '@material-ui/core'; import { theme } from './theme' import AppI18n, { Locales } from './classes/app-i18n'; import MapsPage from './components/maps-page'; +import CssBaseline from '@material-ui/core/CssBaseline'; +import { ThemeProvider } from '@material-ui/core/styles'; const queryClient = new QueryClient({ defaultOptions: { diff --git a/packages/webapp/src/classes/client/client-health-sentinel/index.tsx b/packages/webapp/src/classes/client/client-health-sentinel/index.tsx index 0a9804fd..5844efe4 100644 --- a/packages/webapp/src/classes/client/client-health-sentinel/index.tsx +++ b/packages/webapp/src/classes/client/client-health-sentinel/index.tsx @@ -1,9 +1,14 @@ import { useSelector } from 'react-redux'; import React from "react"; import { activeInstanceStatus, ClientStatus } from '../../../redux/clientSlice'; -import { Button, Dialog, DialogActions, DialogContent, DialogTitle } from '@material-ui/core'; import { FormattedMessage } from 'react-intl'; -import { Alert, AlertTitle } from '@material-ui/lab'; +import Dialog from '@material-ui/core/Dialog'; +import DialogTitle from '@material-ui/core/DialogTitle'; +import DialogContent from '@material-ui/core/DialogContent'; +import Alert from '@material-ui/lab/Alert'; +import DialogActions from '@material-ui/core/DialogActions'; +import Button from '@material-ui/core/Button'; +import AlertTitle from '@material-ui/lab/AlertTitle'; const ClientHealthSentinel = () => { const status: ClientStatus = useSelector(activeInstanceStatus); diff --git a/packages/webapp/src/components/forgot-password-success-page/index.tsx b/packages/webapp/src/components/forgot-password-success-page/index.tsx index 1641a682..5e7fbc7d 100644 --- a/packages/webapp/src/components/forgot-password-success-page/index.tsx +++ b/packages/webapp/src/components/forgot-password-success-page/index.tsx @@ -3,8 +3,9 @@ import { FormattedMessage } from 'react-intl' import FormContainer from '../layout/form-container'; import Header from '../layout/header' import Footer from '../layout/footer' -import { Button, Typography } from '@material-ui/core'; import { Link as RouterLink} from 'react-router-dom' +import Typography from '@material-ui/core/Typography'; +import Button from '@material-ui/core/Button'; const ForgotPasswordSuccessPage = () => { diff --git a/packages/webapp/src/components/maps-page/action-dispatcher/publish-dialog/index.tsx b/packages/webapp/src/components/maps-page/action-dispatcher/publish-dialog/index.tsx index a1191832..43d8b911 100644 --- a/packages/webapp/src/components/maps-page/action-dispatcher/publish-dialog/index.tsx +++ b/packages/webapp/src/components/maps-page/action-dispatcher/publish-dialog/index.tsx @@ -7,6 +7,7 @@ import { activeInstance, fetchMapById } from '../../../../redux/clientSlice'; import BaseDialog from '../base-dialog'; import { handleOnMutationSuccess, SimpleDialogProps } from '..'; import { useStyles } from './style'; + import FormControl from '@material-ui/core/FormControl'; import FormControlLabel from '@material-ui/core/FormControlLabel'; import Checkbox from '@material-ui/core/Checkbox'; diff --git a/packages/webapp/src/components/maps-page/index.tsx b/packages/webapp/src/components/maps-page/index.tsx index 65811b0d..17541f79 100644 --- a/packages/webapp/src/components/maps-page/index.tsx +++ b/packages/webapp/src/components/maps-page/index.tsx @@ -5,10 +5,7 @@ import AppBar from '@material-ui/core/AppBar'; import Toolbar from '@material-ui/core/Toolbar'; import List from '@material-ui/core/List'; import IconButton from '@material-ui/core/IconButton'; -import ListItem from '@material-ui/core/ListItem'; -import ListItemIcon from '@material-ui/core/ListItemIcon'; import { useStyles } from './style'; -import { Button, Link, ListItemSecondaryAction, ListItemText, Tooltip } from '@material-ui/core'; import { MapsList } from './maps-list'; import { FormattedMessage, IntlProvider, useIntl } from 'react-intl'; import { useQuery, useMutation, useQueryClient } from 'react-query'; @@ -24,6 +21,8 @@ import LanguageMenu from './language-menu'; import AppI18n, { Locales } from '../../classes/app-i18n'; +import ListItemIcon from '@material-ui/core/ListItemIcon'; +import ListItem from '@material-ui/core/ListItem'; import AddCircleTwoTone from '@material-ui/icons/AddCircleTwoTone'; import CloudUploadTwoTone from '@material-ui/icons/CloudUploadTwoTone'; @@ -34,6 +33,11 @@ import PublicTwoTone from '@material-ui/icons/PublicTwoTone'; import ScatterPlotTwoTone from '@material-ui/icons/ScatterPlotTwoTone'; import ShareTwoTone from '@material-ui/icons/ShareTwoTone'; import StarTwoTone from '@material-ui/icons/StarTwoTone'; +import Tooltip from '@material-ui/core/Tooltip'; +import Button from '@material-ui/core/Button'; +import Link from '@material-ui/core/Link'; +import ListItemText from '@material-ui/core/ListItemText'; +import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction'; const logoIcon = require('../../images/logo-small.svg'); diff --git a/packages/webapp/src/components/maps-page/language-menu/index.tsx b/packages/webapp/src/components/maps-page/language-menu/index.tsx index 79afe441..da6f3097 100644 --- a/packages/webapp/src/components/maps-page/language-menu/index.tsx +++ b/packages/webapp/src/components/maps-page/language-menu/index.tsx @@ -1,4 +1,3 @@ -import { Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, Divider, Menu, MenuItem, Tooltip } from '@material-ui/core'; import TranslateTwoTone from '@material-ui/icons/TranslateTwoTone'; import React from "react"; import { useMutation, useQueryClient } from "react-query"; @@ -7,6 +6,16 @@ import { useSelector } from 'react-redux'; import { activeInstance, fetchAccount } from '../../../redux/clientSlice'; import { FormattedMessage, useIntl } from 'react-intl'; import { LocaleCode, Locales } from '../../../classes/app-i18n'; +import Tooltip from '@material-ui/core/Tooltip'; +import Button from '@material-ui/core/Button'; +import Menu from '@material-ui/core/Menu'; +import MenuItem from '@material-ui/core/MenuItem'; +import Dialog from '@material-ui/core/Dialog'; +import DialogTitle from '@material-ui/core/DialogTitle'; +import DialogContent from '@material-ui/core/DialogContent'; +import DialogContentText from '@material-ui/core/DialogContentText'; +import DialogActions from '@material-ui/core/DialogActions'; +import Divider from '@material-ui/core/Divider'; const LanguageMenu = () => { diff --git a/packages/webapp/src/theme/index.ts b/packages/webapp/src/theme/index.ts index 2a4ede6d..a8443efa 100644 --- a/packages/webapp/src/theme/index.ts +++ b/packages/webapp/src/theme/index.ts @@ -1,4 +1,4 @@ -import { createMuiTheme } from '@material-ui/core'; +import createMuiTheme from "@material-ui/core/styles/createMuiTheme"; const theme = createMuiTheme({ overrides: {