Skip to content

chore(site): Upgrade to MUI v5 #7437

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

Merged
merged 36 commits into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
73c3c17
Initial changes
BrunoQuaresma May 5, 2023
047c10b
Apply codemod
BrunoQuaresma May 5, 2023
0b26a9b
Apply variant mod
BrunoQuaresma May 5, 2023
d0b064a
Migrate theme options
BrunoQuaresma May 5, 2023
9a5203d
Merge branch 'main' into bq/migrate-to-muiv5
BrunoQuaresma May 8, 2023
1f078ce
Fix all TS problems
BrunoQuaresma May 8, 2023
fc683c8
Merge branch 'main' into bq/migrate-to-muiv5
BrunoQuaresma May 8, 2023
77777fb
Remove unusable test
BrunoQuaresma May 8, 2023
479ce07
Button and input text
BrunoQuaresma May 8, 2023
9dfec8f
Set typography
BrunoQuaresma May 8, 2023
50e9f22
Remove default outlined
BrunoQuaresma May 8, 2023
34d9d8d
Improve theme
BrunoQuaresma May 8, 2023
9a62dcc
Setup links
BrunoQuaresma May 8, 2023
756277e
Fix link
BrunoQuaresma May 8, 2023
5c45cf6
Fix button outlined neutral
BrunoQuaresma May 8, 2023
5ae26fa
Fix
BrunoQuaresma May 8, 2023
a1cbc12
Update workspace header
BrunoQuaresma May 8, 2023
55c0751
Merge branch 'main' into bq/migrate-to-muiv5
BrunoQuaresma May 9, 2023
168814c
Fix format
BrunoQuaresma May 9, 2023
a591559
Adjust buttons
BrunoQuaresma May 9, 2023
a4bba50
Fix table loaders
BrunoQuaresma May 9, 2023
a24edee
Few tweaks on deployment settings
BrunoQuaresma May 9, 2023
4abb23d
Fix typo
BrunoQuaresma May 9, 2023
a0bbf8f
Fix filter size
BrunoQuaresma May 9, 2023
029e658
Fix skeleton path
BrunoQuaresma May 9, 2023
367c445
Fix storybook
BrunoQuaresma May 9, 2023
9682b7b
Many storybook fixes
BrunoQuaresma May 9, 2023
82d2e53
Fix table min
BrunoQuaresma May 9, 2023
a38eb9a
Fix colors and input sizes
BrunoQuaresma May 9, 2023
9a0e553
Previous design issue
BrunoQuaresma May 9, 2023
1145725
Better workspace build state error
BrunoQuaresma May 9, 2023
7251da2
Fix type
BrunoQuaresma May 9, 2023
a3a807a
Merge branch 'main' into bq/migrate-to-muiv5
BrunoQuaresma May 10, 2023
e18c0c1
Apply Kira PR comments
BrunoQuaresma May 10, 2023
47ab467
Fix fmt
BrunoQuaresma May 10, 2023
6bb6f5b
Fix
BrunoQuaresma May 10, 2023
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
Prev Previous commit
Next Next commit
Migrate theme options
  • Loading branch information
BrunoQuaresma committed May 5, 2023
commit d0b064a8b89c36989f03a855765fbf08285f5a42
7 changes: 3 additions & 4 deletions site/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ rules:
- argsIgnorePattern: "^_"
varsIgnorePattern: "^_"
ignoreRestSiblings: true
"@typescript-eslint/no-empty-interface":
- error
- allowSingleExtends: true
"brace-style": "off"
"curly": ["error", "all"]
"eslint-comments/require-description": "error"
Expand Down Expand Up @@ -121,10 +124,6 @@ rules:
message:
"Use path imports to avoid pulling in unused modules. See:
https://material-ui.com/guides/minimizing-bundle-size/"
- name: "@mui/styles"
message:
"Use path imports to avoid pulling in unused modules. See:
https://material-ui.com/guides/minimizing-bundle-size/"
- name: "@mui/material/Avatar"
message:
"You should use the Avatar component provided on
Expand Down
11 changes: 11 additions & 0 deletions site/mui.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Theme } from "@mui/material/styles"

declare module "@mui/material/styles" {
interface TypeBackground {
paperLight: string
}
}

declare module "@mui/styles/defaultTheme" {
interface DefaultTheme extends Theme {}
}
4 changes: 2 additions & 2 deletions site/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import CssBaseline from "@mui/material/CssBaseline"
import ThemeProvider from "@mui/styles/ThemeProvider"
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"
import { AuthProvider } from "components/AuthProvider/AuthProvider"
import { FC, PropsWithChildren } from "react"
Expand All @@ -9,6 +8,7 @@ import { ErrorBoundary } from "./components/ErrorBoundary/ErrorBoundary"
import { GlobalSnackbar } from "./components/GlobalSnackbar/GlobalSnackbar"
import { dark } from "./theme"
import "./theme/globalFonts"
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles"

const queryClient = new QueryClient({
defaultOptions: {
Expand Down Expand Up @@ -38,7 +38,7 @@ export const AppProviders: FC<PropsWithChildren> = ({ children }) => {
</ThemeProvider>
</StyledEngineProvider>
</HelmetProvider>
);
)
}

export const App: FC = () => {
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/AppLink/AppLink.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import CircularProgress from "@mui/material/CircularProgress"
import Link from "@mui/material/Link"
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import Tooltip from "@mui/material/Tooltip"
import ErrorOutlineIcon from "@mui/icons-material/ErrorOutline"
import { PrimaryAgentButton } from "components/Resources/AgentButton"
Expand Down
6 changes: 3 additions & 3 deletions site/src/components/AppLink/AppLinkSkeleton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { makeStyles } from "@mui/material/styles"
import { Skeleton } from '@mui/material';
import { makeStyles } from "@mui/styles"
import { Skeleton } from "@mui/material"
import { FC } from "react"
import { borderRadiusSm } from "theme/constants"

Expand All @@ -12,7 +12,7 @@ export const AppLinkSkeleton: FC<{ width: number }> = ({ width }) => {
variant="rectangular"
className={styles.skeleton}
/>
);
)
}

const useStyles = makeStyles(() => ({
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/AppLink/AppPreviewLink.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import { Stack } from "components/Stack/Stack"
import { FC } from "react"
import * as TypesGen from "api/typesGenerated"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import { AuditLog } from "api/typesGenerated"
import { colors } from "theme/colors"
import { MONOSPACE_FONT_FAMILY } from "theme/constants"
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/AuditLogRow/AuditLogRow.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Collapse from "@mui/material/Collapse"
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import TableCell from "@mui/material/TableCell"
import { AuditLog } from "api/typesGenerated"
import {
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/Avatar/Avatar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This is the only place MuiAvatar can be used
// eslint-disable-next-line no-restricted-imports -- Read above
import MuiAvatar, { AvatarProps as MuiAvatarProps } from "@mui/material/Avatar"
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import { FC } from "react"
import { combineClasses } from "utils/combineClasses"
import { firstLetter } from "./firstLetter"
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/AvatarData/AvatarData.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Avatar } from "components/Avatar/Avatar"
import { FC, PropsWithChildren } from "react"
import { Stack } from "components/Stack/Stack"
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"

export interface AvatarDataProps {
title: string | JSX.Element
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/BorderedMenu/BorderedMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Popover, { PopoverProps } from "@mui/material/Popover"
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import { FC, PropsWithChildren } from "react"

type BorderedMenuVariant = "user-dropdown"
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/BorderedMenuRow/BorderedMenuRow.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ListItem from "@mui/material/ListItem"
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import SvgIcon from "@mui/material/SvgIcon"
import CheckIcon from "@mui/icons-material/Check"
import { FC } from "react"
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/BuildsTable/BuildRow.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import TableCell from "@mui/material/TableCell"
import { WorkspaceBuild } from "api/typesGenerated"
import { Stack } from "components/Stack/Stack"
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/CodeBlock/CodeBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import { FC, Fragment, ReactElement } from "react"
import { MONOSPACE_FONT_FAMILY } from "../../theme/constants"
import { combineClasses } from "../../utils/combineClasses"
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/CopyButton/CopyButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import IconButton from "@mui/material/Button"
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import Tooltip from "@mui/material/Tooltip"
import Check from "@mui/icons-material/Check"
import { useClipboard } from "hooks/useClipboard"
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/CopyableValue/CopyableValue.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import Tooltip from "@mui/material/Tooltip"
import { useClickable } from "hooks/useClickable"
import { useClipboard } from "hooks/useClipboard"
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/Dashboard/DashboardLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import { useMachine } from "@xstate/react"
import { UpdateCheckResponse } from "api/typesGenerated"
import { DeploymentBanner } from "components/DeploymentBanner/DeploymentBanner"
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/DeploySettingsLayout/Badges.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import { Stack } from "components/Stack/Stack"
import { PropsWithChildren, FC } from "react"
import { MONOSPACE_FONT_FAMILY } from "theme/constants"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import { Margins } from "components/Margins/Margins"
import { Stack } from "components/Stack/Stack"
import { Sidebar } from "./Sidebar"
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/DeploySettingsLayout/Fieldset.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import { FC, ReactNode, FormEventHandler } from "react"
import Button from "@mui/material/Button"

Expand Down
2 changes: 1 addition & 1 deletion site/src/components/DeploySettingsLayout/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Button from "@mui/material/Button"
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import LaunchOutlined from "@mui/icons-material/LaunchOutlined"
import { Stack } from "components/Stack/Stack"
import { FC } from "react"
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/DeploySettingsLayout/Option.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import { PropsWithChildren, FC, ReactNode } from "react"
import { MONOSPACE_FONT_FAMILY } from "theme/constants"
import { DisabledBadge, EnabledBadge } from "./Badges"
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/DeploySettingsLayout/OptionsTable.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import Table from "@mui/material/Table"
import TableBody from "@mui/material/TableBody"
import TableCell from "@mui/material/TableCell"
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/DeploySettingsLayout/Sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import Brush from "@mui/icons-material/Brush"
import LaunchOutlined from "@mui/icons-material/LaunchOutlined"
import ApprovalIcon from "@mui/icons-material/VerifiedUserOutlined"
Expand Down
6 changes: 3 additions & 3 deletions site/src/components/DeploymentBanner/DeploymentBannerView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FC, useMemo, useEffect, useState } from "react"
import prettyBytes from "pretty-bytes"
import { getStatus } from "components/WorkspaceStatusBadge/WorkspaceStatusBadge"
import BuildingIcon from "@mui/icons-material/Build"
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import { RocketIcon } from "components/Icons/RocketIcon"
import { MONOSPACE_FONT_FAMILY } from "theme/constants"
import Tooltip from "@mui/material/Tooltip"
Expand Down Expand Up @@ -251,7 +251,7 @@ const useStyles = makeStyles((theme) => ({
height: 16,
},

[theme.breakpoints.down('lg')]: {
[theme.breakpoints.down("lg")]: {
display: "none",
},
},
Expand All @@ -269,7 +269,7 @@ const useStyles = makeStyles((theme) => ({
gap: theme.spacing(4),
borderTop: `1px solid ${theme.palette.divider}`,

[theme.breakpoints.down('lg')]: {
[theme.breakpoints.down("lg")]: {
flexDirection: "column",
gap: theme.spacing(1),
alignItems: "left",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import DialogActions from "@mui/material/DialogActions"
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import { ReactNode, FC, PropsWithChildren } from "react"
import {
Dialog,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import { FC } from "react"
import * as TypesGen from "../../../api/typesGenerated"
import { CodeExample } from "../../CodeExample/CodeExample"
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/EditRolesButton/EditRolesButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import IconButton from "@mui/material/IconButton"
import { EditSquare } from "components/Icons/EditSquare"
import { useRef, useState, FC } from "react"
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import { useTranslation } from "react-i18next"
import Popover from "@mui/material/Popover"
import { Stack } from "components/Stack/Stack"
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/EmptyState/EmptyState.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Box from "@mui/material/Box"
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import Typography from "@mui/material/Typography"
import { FC, ReactNode } from "react"
import { combineClasses } from "../../utils/combineClasses"
Expand Down
10 changes: 7 additions & 3 deletions site/src/components/EnterpriseSnackbar/EnterpriseSnackbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import IconButton from "@mui/material/IconButton"
import Snackbar, {
SnackbarProps as MuiSnackbarProps,
} from "@mui/material/Snackbar"
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import CloseIcon from "@mui/icons-material/Close"
import { FC } from "react"
import { combineClasses } from "../../utils/combineClasses"
Expand Down Expand Up @@ -42,7 +42,11 @@ export const EnterpriseSnackbar: FC<
action={
<div className={styles.actionWrapper}>
{action}
<IconButton onClick={onClose} className={styles.iconButton} size="large">
<IconButton
onClick={onClose}
className={styles.iconButton}
size="large"
>
<CloseIcon className={styles.closeIcon} aria-label="close" />
</IconButton>
</div>
Expand All @@ -58,7 +62,7 @@ export const EnterpriseSnackbar: FC<
}}
onClose={onClose}
/>
);
)
}

const useStyles = makeStyles((theme) => ({
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/FileUpload/FileUpload.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import { Stack } from "components/Stack/Stack"
import { FC, DragEvent, useRef, ReactNode } from "react"
import UploadIcon from "@mui/icons-material/CloudUploadOutlined"
Expand Down
12 changes: 6 additions & 6 deletions site/src/components/Form/Form.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import {
FormFooterProps as BaseFormFooterProps,
FormFooter as BaseFormFooter,
Expand Down Expand Up @@ -122,7 +122,7 @@ const useStyles = makeStyles((theme) => ({
gap: ({ direction }: FormContextValue = {}) =>
direction === "horizontal" ? theme.spacing(10) : theme.spacing(5),

[theme.breakpoints.down('md')]: {
[theme.breakpoints.down("md")]: {
gap: theme.spacing(8),
},
},
Expand All @@ -135,7 +135,7 @@ const useStyles = makeStyles((theme) => ({
flexDirection: ({ direction }: FormContextValue = {}) =>
direction === "horizontal" ? "row" : "column",

[theme.breakpoints.down('md')]: {
[theme.breakpoints.down("md")]: {
flexDirection: "column",
gap: theme.spacing(2),
},
Expand All @@ -150,7 +150,7 @@ const useStyles = makeStyles((theme) => ({
direction === "horizontal" ? "sticky" : undefined,
top: theme.spacing(3),

[theme.breakpoints.down('md')]: {
[theme.breakpoints.down("md")]: {
width: "100%",
position: "initial",
},
Expand Down Expand Up @@ -180,7 +180,7 @@ const useFormFooterStyles = makeStyles((theme) => ({
button: {
minWidth: theme.spacing(23),

[theme.breakpoints.down('md')]: {
[theme.breakpoints.down("md")]: {
width: "100%",
},
},
Expand All @@ -191,7 +191,7 @@ const useFormFooterStyles = makeStyles((theme) => ({
flexDirection: "row-reverse",
gap: theme.spacing(2),

[theme.breakpoints.down('md')]: {
[theme.breakpoints.down("md")]: {
flexDirection: "column",
gap: theme.spacing(1),
},
Expand Down
4 changes: 2 additions & 2 deletions site/src/components/FormCloseButton/FormCloseButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import IconButton from "@mui/material/IconButton"
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import Typography from "@mui/material/Typography"
import { useEffect, FC, PropsWithChildren } from "react"
import { CloseIcon } from "../Icons/CloseIcon"
Expand Down Expand Up @@ -48,7 +48,7 @@ const useStyles = makeStyles((theme) => ({
opacity: 1,
},

[theme.breakpoints.down('md')]: {
[theme.breakpoints.down("md")]: {
top: theme.spacing(1),
right: theme.spacing(1),
},
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/FormFooter/FormFooter.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Button from "@mui/material/Button"
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import { ClassNameMap } from "@mui/material/styles/withStyles"
import { FC } from "react"
import { LoadingButton } from "../LoadingButton/LoadingButton"
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/FullPageForm/FullPageForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
PageHeaderTitle,
PageHeaderSubtitle,
} from "components/PageHeader/PageHeader"
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"

export interface FullPageFormProps {
title: string
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/GlobalSnackbar/GlobalSnackbar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { makeStyles } from "@mui/material/styles"
import { makeStyles } from "@mui/styles"
import { useCallback, useState, FC } from "react"
import { useCustomEvent } from "../../hooks/events"
import { CustomEventListener } from "../../utils/events"
Expand Down
Loading