fix: reaplce loading button
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import TextField from "@mui/material/TextField";
|
import TextField from "@mui/material/TextField";
|
||||||
import Button from "@mui/material/Button";
|
import Button from "@mui/material/Button";
|
||||||
import CircularProgress from "@mui/material/CircularProgress";
|
import LoadingButton from "@mui/lab/LoadingButton";
|
||||||
import {
|
import {
|
||||||
OPT_TRANS_ALL,
|
OPT_TRANS_ALL,
|
||||||
OPT_TRANS_MICROSOFT,
|
OPT_TRANS_MICROSOFT,
|
||||||
@@ -89,14 +89,15 @@ function TestButton({ translator, api }) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (loading) {
|
|
||||||
return <CircularProgress size={16} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button size="small" variant="contained" onClick={handleApiTest}>
|
<LoadingButton
|
||||||
|
size="small"
|
||||||
|
variant="contained"
|
||||||
|
onClick={handleApiTest}
|
||||||
|
loading={loading}
|
||||||
|
>
|
||||||
{i18n("click_test")}
|
{i18n("click_test")}
|
||||||
</Button>
|
</LoadingButton>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { useSync } from "../../hooks/Sync";
|
|||||||
import Alert from "@mui/material/Alert";
|
import Alert from "@mui/material/Alert";
|
||||||
import Link from "@mui/material/Link";
|
import Link from "@mui/material/Link";
|
||||||
import MenuItem from "@mui/material/MenuItem";
|
import MenuItem from "@mui/material/MenuItem";
|
||||||
|
import LoadingButton from "@mui/lab/LoadingButton";
|
||||||
import {
|
import {
|
||||||
URL_KISS_WORKER,
|
URL_KISS_WORKER,
|
||||||
OPT_SYNCTYPE_ALL,
|
OPT_SYNCTYPE_ALL,
|
||||||
@@ -14,10 +15,8 @@ import {
|
|||||||
} from "../../config";
|
} from "../../config";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { syncSettingAndRules } from "../../libs/sync";
|
import { syncSettingAndRules } from "../../libs/sync";
|
||||||
import Button from "@mui/material/Button";
|
|
||||||
import { useAlert } from "../../hooks/Alert";
|
import { useAlert } from "../../hooks/Alert";
|
||||||
import SyncIcon from "@mui/icons-material/Sync";
|
import SyncIcon from "@mui/icons-material/Sync";
|
||||||
import CircularProgress from "@mui/material/CircularProgress";
|
|
||||||
import { useSetting } from "../../hooks/Setting";
|
import { useSetting } from "../../hooks/Setting";
|
||||||
import { kissLog } from "../../libs/log";
|
import { kissLog } from "../../libs/log";
|
||||||
|
|
||||||
@@ -123,16 +122,16 @@ export default function SyncSetting() {
|
|||||||
useFlexGap
|
useFlexGap
|
||||||
flexWrap="wrap"
|
flexWrap="wrap"
|
||||||
>
|
>
|
||||||
<Button
|
<LoadingButton
|
||||||
size="small"
|
size="small"
|
||||||
variant="contained"
|
variant="contained"
|
||||||
disabled={!syncUrl || !syncKey || loading}
|
disabled={!syncUrl || !syncKey || loading}
|
||||||
onClick={handleSyncTest}
|
onClick={handleSyncTest}
|
||||||
startIcon={<SyncIcon />}
|
startIcon={<SyncIcon />}
|
||||||
|
loading={loading}
|
||||||
>
|
>
|
||||||
{i18n("sync_now")}
|
{i18n("sync_now")}
|
||||||
</Button>
|
</LoadingButton>
|
||||||
{loading && <CircularProgress size={16} />}
|
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
Reference in New Issue
Block a user