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
Fix filter size
  • Loading branch information
BrunoQuaresma committed May 9, 2023
commit a0bbf8f3b768ce906cded136d41894e1f0e1dda9
4 changes: 0 additions & 4 deletions site/src/components/Dialogs/DeleteDialog/DeleteDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,7 @@ export const DeleteDialog: FC<PropsWithChildren<DeleteDialogProps>> = ({
<p>{t("deleteDialog.confirm", { entity })}</p>

<TextField
variant="standard"
fullWidth
InputLabelProps={{
shrink: true,
}}
autoFocus
className={styles.textField}
name="confirmation"
Expand Down
6 changes: 5 additions & 1 deletion site/src/components/Form/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ export const FormSection: FC<
export const FormFields: FC<PropsWithChildren> = ({ children }) => {
const styles = useStyles()
return (
<Stack direction="column" className={styles.formSectionFields}>
<Stack
direction="column"
spacing={2.5}
className={styles.formSectionFields}
>
{children}
</Stack>
)
Expand Down
55 changes: 17 additions & 38 deletions site/src/components/GitAuth/GitAuth.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import Button from "@mui/material/Button"
import FormHelperText from "@mui/material/FormHelperText"
import { makeStyles } from "@mui/styles"
import { SvgIconProps } from "@mui/material/SvgIcon"
import Tooltip from "@mui/material/Tooltip"
import GitHub from "@mui/icons-material/GitHub"
import * as TypesGen from "api/typesGenerated"
import { AzureDevOpsIcon } from "components/Icons/AzureDevOpsIcon"
import { BitbucketIcon } from "components/Icons/BitbucketIcon"
import { GitlabIcon } from "components/Icons/GitlabIcon"
import { Typography } from "components/Typography/Typography"
import { FC } from "react"
import { Theme } from "@mui/material/styles"
import Link from "@mui/material/Link"
import { makeStyles } from "@mui/styles"

export interface GitAuthProps {
type: TypesGen.GitProvider
Expand Down Expand Up @@ -59,9 +58,8 @@ export const GitAuth: FC<GitAuthProps> = ({
}
>
<div>
<a
<Link
href={authenticateURL}
className={styles.link}
onClick={(event) => {
event.preventDefault()
// If the user is already authenticated, we don't want to redirect them
Expand All @@ -71,46 +69,27 @@ export const GitAuth: FC<GitAuthProps> = ({
window.open(authenticateURL, "_blank", "width=900,height=600")
}}
>
<Button className={styles.button} disabled={authenticated} fullWidth>
<div className={styles.root}>
<Icon className={styles.icon} />
<Typography variant="body2">
{authenticated
? `You're authenticated with ${prettyName}!`
: `Click to login with ${prettyName}!`}
</Typography>
</div>
<Button
size="large"
startIcon={<Icon />}
disabled={authenticated}
className={styles.button}
color={error ? "error" : undefined}
fullWidth
>
{authenticated
? `You're authenticated with ${prettyName}!`
: `Click to login with ${prettyName}!`}
</Button>
</a>
</Link>
{error && <FormHelperText error>{error}</FormHelperText>}
</div>
</Tooltip>
)
}

const useStyles = makeStyles<
Theme,
{
error: boolean
}
>((theme) => ({
link: {
textDecoration: "none",
},
root: {
padding: 4,
display: "flex",
gap: 12,
alignItems: "center",
textAlign: "left",
},
const useStyles = makeStyles(() => ({
button: {
height: "unset",
border: ({ error }) =>
error ? `1px solid ${theme.palette.error.main}` : "unset",
},
icon: {
width: 32,
height: 32,
height: 52,
},
}))
9 changes: 3 additions & 6 deletions site/src/components/IconField/IconField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { colors } from "theme/colors"
import { useTranslation } from "react-i18next"
import data from "@emoji-mart/data/sets/14/twitter.json"
import { IconFieldProps } from "./types"
import { Stack } from "components/Stack/Stack"

const IconField: FC<IconFieldProps> = ({ onPickEmoji, ...textFieldProps }) => {
if (
Expand All @@ -26,7 +27,7 @@ const IconField: FC<IconFieldProps> = ({ onPickEmoji, ...textFieldProps }) => {
const hasIcon = textFieldProps.value && textFieldProps.value !== ""

return (
<div className={styles.iconField}>
<Stack spacing={1}>
<TextField
{...textFieldProps}
fullWidth
Expand All @@ -50,7 +51,6 @@ const IconField: FC<IconFieldProps> = ({ onPickEmoji, ...textFieldProps }) => {
<Button
fullWidth
ref={emojiButtonRef}
size="small"
endIcon={<OpenDropdown />}
onClick={() => {
setIsEmojiPickerOpen((v) => !v)
Expand Down Expand Up @@ -81,7 +81,7 @@ const IconField: FC<IconFieldProps> = ({ onPickEmoji, ...textFieldProps }) => {
}}
/>
</Popover>
</div>
</Stack>
)
}

Expand All @@ -104,9 +104,6 @@ const useStyles = makeStyles((theme) => ({
maxWidth: "100%",
},
},
iconField: {
paddingBottom: theme.spacing(0.5),
},
}))

export default IconField
5 changes: 2 additions & 3 deletions site/src/components/ParameterInput/ParameterInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const ParameterInput: FC<ParameterInputProps> = ({
const styles = useStyles()

return (
<Stack direction="column" spacing={0.75}>
<Stack direction="column" spacing={2}>
<ParameterLabel schema={schema} />
<div className={styles.input}>
<ParameterField
Expand All @@ -70,7 +70,6 @@ const ParameterField: React.FC<ParameterInputProps> = ({
if (schema.validation_contains && schema.validation_contains.length > 0) {
return (
<TextField
variant="standard"
id={schema.name}
size="small"
defaultValue={defaultValue ?? schema.default_source_value}
Expand Down Expand Up @@ -121,7 +120,6 @@ const ParameterField: React.FC<ParameterInputProps> = ({
// we should break this out into more finely scoped input fields.
return (
<TextField
variant="standard"
id={schema.name}
size="small"
disabled={disabled}
Expand All @@ -146,6 +144,7 @@ const useStyles = makeStyles((theme) => ({
color: theme.palette.text.primary,
display: "block",
fontWeight: 600,
lineHeight: "24px", // Keep the same as ParameterInput
},
input: {
display: "flex",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ const TooltipView: React.FC<PortForwardButtonProps> = (props) => {
className={styles.form}
>
<TextField
variant="standard"
label="Port"
type="number"
value={port}
Expand Down
5 changes: 2 additions & 3 deletions site/src/components/RichParameterInput/RichParameterInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const RichParameterInput: FC<RichParameterInputProps> = ({
const styles = useStyles()

return (
<Stack direction="column" spacing={0.75}>
<Stack direction="column" spacing={2}>
<ParameterLabel id={fieldProps.id} parameter={parameter} />
<div className={styles.input}>
<RichParameterField
Expand Down Expand Up @@ -191,7 +191,6 @@ const RichParameterField: React.FC<RichParameterInputProps> = ({
// we should break this out into more finely scoped input fields.
return (
<TextField
variant="standard"
{...props}
type={parameter.type}
size="small"
Expand Down Expand Up @@ -224,7 +223,7 @@ const useStyles = makeStyles((theme) => ({

"& p": {
margin: 0,
lineHeight: "20px", // Keep the same as ParameterInput
lineHeight: "24px", // Keep the same as ParameterInput
},
},
labelImmutable: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export const SearchBarWithFilter: React.FC<
<Button
aria-controls="filter-menu"
aria-haspopup="true"
size="large"
onClick={handleClick}
className={styles.buttonRoot}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,29 +77,20 @@ export const SecurityForm: FC<SecurityFormProps> = ({
)}
<TextField
{...getFieldHelpers("old_password")}
InputLabelProps={{
shrink: true,
}}
autoComplete="old_password"
fullWidth
label={Language.oldPasswordLabel}
type="password"
/>
<TextField
{...getFieldHelpers("password")}
InputLabelProps={{
shrink: true,
}}
autoComplete="password"
fullWidth
label={Language.newPasswordLabel}
type="password"
/>
<TextField
{...getFieldHelpers("confirm_password")}
InputLabelProps={{
shrink: true,
}}
autoComplete="confirm_password"
fullWidth
label={Language.confirmPasswordLabel}
Expand Down
5 changes: 0 additions & 5 deletions site/src/components/TemplateVersionEditor/FileDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export const CreateFileDialog: FC<{
slashes too.
</Typography>
<TextField
variant="standard"
autoFocus
onKeyDown={(event) => {
if (event.key === "Enter") {
Expand All @@ -81,9 +80,6 @@ export const CreateFileDialog: FC<{
value={pathValue}
onChange={handleChange}
label="File Path"
InputLabelProps={{
shrink: true,
}}
/>
</Stack>
}
Expand Down Expand Up @@ -180,7 +176,6 @@ export const RenameFileDialog: FC<{
contain slashes too!
</p>
<TextField
variant="standard"
autoFocus
onKeyDown={(event) => {
if (event.key === "Enter") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,10 @@ export const PublishTemplateVersionDialog: FC<
<p>You are about to publish a new version of this template.</p>
<FormFields>
<TextField
variant="standard"
{...getFieldHelpers("name")}
label="Version name"
autoFocus
disabled={isPublishing}
InputLabelProps={{
shrink: true,
}}
/>

<FormControlLabel
Expand Down
6 changes: 4 additions & 2 deletions site/src/components/UserAutocomplete/UserAutocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { User } from "api/typesGenerated"
import { Avatar } from "components/Avatar/Avatar"
import { AvatarData } from "components/AvatarData/AvatarData"
import debounce from "just-debounce-it"
import { ChangeEvent, FC, useEffect, useState } from "react"
import { ChangeEvent, ComponentProps, FC, useEffect, useState } from "react"
import { searchUserMachine } from "xServices/users/searchUserXService"
import { useTranslation } from "react-i18next"
import Box from "@mui/material/Box"
Expand All @@ -17,13 +17,15 @@ export type UserAutocompleteProps = {
onChange: (user: User | null) => void
label?: string
className?: string
size?: ComponentProps<typeof TextField>["size"]
}

export const UserAutocomplete: FC<UserAutocompleteProps> = ({
value,
onChange,
label,
className,
size = "small",
}) => {
const styles = useStyles()
const { t } = useTranslation("common")
Expand Down Expand Up @@ -89,7 +91,7 @@ export const UserAutocomplete: FC<UserAutocompleteProps> = ({
<TextField
{...params}
fullWidth
size="small"
size={size}
label={label}
placeholder="User email or username"
className={styles.textField}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,23 +299,15 @@ export const WorkspaceScheduleForm: FC<
/>
<Stack direction="row">
<TextField
variant="standard"
{...formHelpers("startTime")}
disabled={isLoading || !form.values.autostartEnabled}
InputLabelProps={{
shrink: true,
}}
label={Language.startTimeLabel}
type="time"
fullWidth
/>
<TextField
variant="standard"
{...formHelpers("timezone")}
disabled={isLoading || !form.values.autostartEnabled}
InputLabelProps={{
shrink: true,
}}
label={Language.timezoneLabel}
select
fullWidth
Expand All @@ -328,11 +320,7 @@ export const WorkspaceScheduleForm: FC<
</TextField>
</Stack>

<FormControl
variant="standard"
component="fieldset"
error={Boolean(form.errors.monday)}
>
<FormControl component="fieldset" error={Boolean(form.errors.monday)}>
<FormLabel className={styles.daysOfWeekLabel} component="legend">
{Language.daysOfWeekLabel}
</FormLabel>
Expand Down Expand Up @@ -381,7 +369,6 @@ export const WorkspaceScheduleForm: FC<
label={Language.stopSwitch}
/>
<TextField
variant="standard"
{...formHelpers("ttl", ttlShutdownAt(form.values.ttl), "ttl_ms")}
disabled={isLoading || !form.values.autostopEnabled}
inputProps={{ min: 0, step: 1 }}
Expand Down
Loading