Skip to content

chore: replace MUI LoadingButton - 3 #17833

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 1 commit into from
May 15, 2025
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
25 changes: 13 additions & 12 deletions site/src/pages/ResetPasswordPage/RequestOTPPage.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { type Interpolation, type Theme, useTheme } from "@emotion/react";
import LoadingButton from "@mui/lab/LoadingButton";
import Button from "@mui/material/Button";
import MuiButton from "@mui/material/Button";
import TextField from "@mui/material/TextField";
import { requestOneTimePassword } from "api/queries/users";
import { ErrorAlert } from "components/Alert/ErrorAlert";
import { Button } from "components/Button/Button";
import { CustomLogo } from "components/CustomLogo/CustomLogo";
import { Spinner } from "components/Spinner/Spinner";
import { Stack } from "components/Stack/Stack";
import type { FC } from "react";
import { Helmet } from "react-helmet-async";
Expand Down Expand Up @@ -88,24 +89,24 @@ const RequestOTP: FC<RequestOTPProps> = ({
/>

<Stack spacing={1}>
<LoadingButton
loading={isRequesting}
<Button
disabled={isRequesting}
type="submit"
size="large"
fullWidth
variant="contained"
size="lg"
className="w-full"
>
<Spinner loading={isRequesting} />
Reset password
</LoadingButton>
<Button
</Button>
<MuiButton
component={RouterLink}
size="large"
fullWidth
variant="text"
to="/login"
>
Cancel
</Button>
</MuiButton>
</Stack>
</Stack>
</fieldset>
Expand Down Expand Up @@ -150,9 +151,9 @@ const RequestOTPSuccess: FC<{ email: string }> = ({ email }) => {
Contact your deployment administrator if you encounter issues.
</p>

<Button component={RouterLink} to="/login">
<MuiButton component={RouterLink} to="/login">
Back to login
</Button>
</MuiButton>
</div>
</div>
);
Expand Down
20 changes: 11 additions & 9 deletions site/src/pages/SetupPage/SetupPageView.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import GitHubIcon from "@mui/icons-material/GitHub";
import LoadingButton from "@mui/lab/LoadingButton";
import AlertTitle from "@mui/material/AlertTitle";
import Autocomplete from "@mui/material/Autocomplete";
import Button from "@mui/material/Button";
import MuiButton from "@mui/material/Button";
import Checkbox from "@mui/material/Checkbox";
import Link from "@mui/material/Link";
import MenuItem from "@mui/material/MenuItem";
Expand All @@ -11,10 +10,12 @@ import { countries } from "api/countriesGenerated";
import type * as TypesGen from "api/typesGenerated";
import { isAxiosError } from "axios";
import { Alert, AlertDetail } from "components/Alert/Alert";
import { Button } from "components/Button/Button";
import { FormFields, VerticalForm } from "components/Form/Form";
import { CoderIcon } from "components/Icons/CoderIcon";
import { PasswordField } from "components/PasswordField/PasswordField";
import { SignInLayout } from "components/SignInLayout/SignInLayout";
import { Spinner } from "components/Spinner/Spinner";
import { Stack } from "components/Stack/Stack";
import { type FormikContextType, useFormik } from "formik";
import type { ChangeEvent, FC } from "react";
Expand Down Expand Up @@ -172,7 +173,7 @@ export const SetupPageView: FC<SetupPageViewProps> = ({
<FormFields>
{authMethods?.github.enabled && (
<>
<Button
<MuiButton
fullWidth
component="a"
href="/api/v2/users/oauth2/github/callback"
Expand All @@ -182,7 +183,7 @@ export const SetupPageView: FC<SetupPageViewProps> = ({
size="xlarge"
>
{Language.githubCreate}
</Button>
</MuiButton>
<div className="flex items-center gap-4">
<div className="h-[1px] w-full bg-border" />
<div className="shrink-0 text-xs uppercase text-content-secondary tracking-wider">
Expand Down Expand Up @@ -376,15 +377,16 @@ export const SetupPageView: FC<SetupPageViewProps> = ({
</Alert>
)}

<LoadingButton
fullWidth
loading={isLoading}
<Button
className="w-full"
disabled={isLoading}
type="submit"
data-testid="create"
size="xlarge"
size="lg"
>
<Spinner loading={isLoading} />
{Language.create}
</LoadingButton>
</Button>
</FormFields>
</VerticalForm>
</SignInLayout>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { Interpolation, Theme } from "@emotion/react";
import PersonAdd from "@mui/icons-material/PersonAdd";
import LoadingButton from "@mui/lab/LoadingButton";
import MenuItem from "@mui/material/MenuItem";
import Select, { type SelectProps } from "@mui/material/Select";
import Table from "@mui/material/Table";
Expand Down Expand Up @@ -29,6 +28,7 @@ import {
} from "components/DropdownMenu/DropdownMenu";
import { EmptyState } from "components/EmptyState/EmptyState";
import { PageHeader, PageHeaderTitle } from "components/PageHeader/PageHeader";
import { Spinner } from "components/Spinner/Spinner";
import { Stack } from "components/Stack/Stack";
import { TableLoader } from "components/TableLoader/TableLoader";
import { EllipsisVertical } from "lucide-react";
Expand Down Expand Up @@ -116,15 +116,15 @@ const AddTemplateUserOrGroup: FC<AddTemplateUserOrGroupProps> = ({
</MenuItem>
</Select>

<LoadingButton
loadingPosition="start"
disabled={!selectedRole || !selectedOption}
<Button
disabled={!selectedRole || !selectedOption || isLoading}
type="submit"
startIcon={<PersonAdd />}
loading={isLoading}
>
<Spinner loading={isLoading}>
<PersonAdd />
</Spinner>
Add member
</LoadingButton>
</Button>
</Stack>
</form>
);
Expand Down
8 changes: 5 additions & 3 deletions site/src/pages/UserSettingsPage/AccountPage/AccountForm.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import LoadingButton from "@mui/lab/LoadingButton";
import TextField from "@mui/material/TextField";
import type { UpdateUserProfileRequest } from "api/typesGenerated";
import { ErrorAlert } from "components/Alert/ErrorAlert";
import { Button } from "components/Button/Button";
import { Form, FormFields } from "components/Form/Form";
import { Spinner } from "components/Spinner/Spinner";
import { type FormikTouched, useFormik } from "formik";
import type { FC } from "react";
import {
Expand Down Expand Up @@ -86,9 +87,10 @@ export const AccountForm: FC<AccountFormProps> = ({
/>

<div>
<LoadingButton loading={isLoading} type="submit" variant="contained">
<Button disabled={isLoading} type="submit">
<Spinner loading={isLoading} />
{Language.updateSettings}
</LoadingButton>
</Button>
</div>
</FormFields>
</Form>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useTheme } from "@emotion/react";
import AutorenewIcon from "@mui/icons-material/Autorenew";
import LoadingButton from "@mui/lab/LoadingButton";
import Table from "@mui/material/Table";
import TableBody from "@mui/material/TableBody";
import TableCell from "@mui/material/TableCell";
Expand All @@ -25,6 +24,7 @@ import {
DropdownMenuTrigger,
} from "components/DropdownMenu/DropdownMenu";
import { Loader } from "components/Loader/Loader";
import { Spinner } from "components/Spinner/Spinner";
import { Stack } from "components/Stack/Stack";
import { TableEmpty } from "components/TableEmpty/TableEmpty";
import { EllipsisVertical } from "lucide-react";
Expand Down Expand Up @@ -165,17 +165,16 @@ const ExternalAuthRow: FC<ExternalAuthRowProps> = ({
</Stack>
</TableCell>
<TableCell css={{ textAlign: "right" }}>
<LoadingButton
disabled={authenticated}
variant="contained"
loading={externalAuthPollingState === "polling"}
<Button
disabled={authenticated || externalAuthPollingState === "polling"}
onClick={() => {
window.open(authURL, "_blank", "width=900,height=600");
startPollingExternalAuth();
}}
>
<Spinner loading={externalAuthPollingState === "polling"} />
{authenticated ? "Authenticated" : "Click to Login"}
</LoadingButton>
</Button>
</TableCell>
<TableCell>
<DropdownMenu>
Expand Down
Loading