{t('toast.close')}
diff --git a/ui/src/components/index.tsx b/ui/src/components/index.tsx
index a4dfa62..51e6ef0 100644
--- a/ui/src/components/index.tsx
+++ b/ui/src/components/index.tsx
@@ -1,3 +1,4 @@
+export * from './AlertDialog';
export * from './Animation';
export * from './Button';
export * from './Collapsible';
diff --git a/ui/src/mocks/handlers.ts b/ui/src/mocks/handlers.ts
index 3ed623d..ce247c8 100644
--- a/ui/src/mocks/handlers.ts
+++ b/ui/src/mocks/handlers.ts
@@ -2,6 +2,7 @@ import { rest } from 'msw';
import type {
Fseq,
Led,
+ MotionSensorCalibration,
Profile,
Profiles,
System,
@@ -36,21 +37,7 @@ const mock: {
system: SystemInfo;
};
motion: {
- // TODO: Update type
- motionSensorCalibration: {
- accXRaw: number;
- accYRaw: number;
- accZRaw: number;
- gyroXRaw: number;
- gyroYRaw: number;
- gyroZRaw: number;
- accXG: number;
- accYG: number;
- accZG: number;
- gyroXDeg: number;
- gyroYDeg: number;
- gyroZDeg: number;
- };
+ motionSensorCalibration: MotionSensorCalibration;
};
fseq: {
fileList: Fseq[];
@@ -358,7 +345,10 @@ export const handlers = [
rest.patch('/api/config/motion', async (_req, res, ctx) => {
console.debug(`Patch motion configuration: ${mock.motion}`);
- return res(ctx.status(200), ctx.json({ status: 200, message: 'ok' }));
+ return throttledRes(
+ ctx.status(200),
+ ctx.json({ status: 200, message: 'ok' }),
+ );
}),
// ---------------
diff --git a/ui/src/pages/Settings.tsx b/ui/src/pages/Settings.tsx
index 5dd2304..6b8f34a 100644
--- a/ui/src/pages/Settings.tsx
+++ b/ui/src/pages/Settings.tsx
@@ -4,6 +4,7 @@ import { ErrorBoundary } from 'react-error-boundary';
import { useForm } from 'react-hook-form';
import { useTranslation } from 'react-i18next';
import {
+ AlertDialog,
Button,
Error,
InputPassword,
@@ -19,6 +20,7 @@ import {
import i18n from '../i18n';
import { changeTheme, toPercentage } from '../libs';
import {
+ useAutoMotionSensorCalibration,
useSystem,
useSystemInfo,
useUi,
@@ -134,6 +136,13 @@ const Form = (): JSX.Element => {
isError: isUiError,
error: uiError,
} = useUpdateUi();
+ const {
+ mutateAsync: mutateAsyncAutoMotionSensorCalibration,
+ isSuccess: isAutoMotionSensorCalibrationSuccess,
+ isLoading: isAutoMotionSensorCalibrationLoading,
+ isError: isAutoMotionSensorCalibrationError,
+ error: autoMotionSensorCalibrationError,
+ } = useAutoMotionSensorCalibration();
const {
handleSubmit,
@@ -262,6 +271,10 @@ const Form = (): JSX.Element => {
)}
+ {isAutoMotionSensorCalibrationSuccess && (
+
+ )}
+
{isSystemError && (
)}
@@ -272,6 +285,15 @@ const Form = (): JSX.Element => {
{isUiError &&
}
+ {isAutoMotionSensorCalibrationError && (
+
+ )}
+
+ {isAutoMotionSensorCalibrationLoading &&
}
+
{Number(values.system.fanMode) === FanMode.Automatic &&
!hasTemperatureSensors && (
{
)}
+ {(systemInfo?.hardwareInfo.mpu6050 ?? 0) > 0 && (
+
+ )}
+