mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-04-06 02:01:58 +02:00
Fix/gui reset all (#298)
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
import { useState } from 'react';
|
||||
import { RpcMessage, SkeletonResetAllRequestT } from 'solarxr-protocol';
|
||||
import {
|
||||
AutoboneContextC,
|
||||
useProvideAutobone,
|
||||
} from '../../../../hooks/autobone';
|
||||
import { useOnboarding } from '../../../../hooks/onboarding';
|
||||
import { useWebsocketAPI } from '../../../../hooks/websocket-api';
|
||||
import { ArrowLink } from '../../../commons/ArrowLink';
|
||||
import { Button } from '../../../commons/Button';
|
||||
import { Typography } from '../../../commons/Typography';
|
||||
@@ -10,10 +13,24 @@ import { AutoboneStepper } from './AutoboneStepper';
|
||||
|
||||
export function AutomaticProportionsPage() {
|
||||
const { applyProgress, skipSetup, state } = useOnboarding();
|
||||
const { sendRPCPacket } = useWebsocketAPI();
|
||||
const context = useProvideAutobone();
|
||||
const [resetDisabled, setResetDisabled] = useState(false);
|
||||
|
||||
applyProgress(0.9);
|
||||
|
||||
const resetAll = () => {
|
||||
sendRPCPacket(
|
||||
RpcMessage.SkeletonResetAllRequest,
|
||||
new SkeletonResetAllRequestT()
|
||||
);
|
||||
setResetDisabled(true);
|
||||
|
||||
setTimeout(() => {
|
||||
setResetDisabled(false);
|
||||
}, 3000);
|
||||
};
|
||||
|
||||
return (
|
||||
<AutoboneContextC.Provider value={context}>
|
||||
<div className="flex flex-col gap-5 h-full items-center w-full justify-center">
|
||||
@@ -42,12 +59,19 @@ export function AutomaticProportionsPage() {
|
||||
</div>
|
||||
</div>
|
||||
<div className="w-full pb-4 flex flex-row">
|
||||
<div className="flex flex-grow">
|
||||
<div className="flex flex-grow gap-3">
|
||||
{!state.alonePage && (
|
||||
<Button variant="secondary" to="/" onClick={skipSetup}>
|
||||
Skip setup
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
variant="secondary"
|
||||
onClick={resetAll}
|
||||
disabled={resetDisabled}
|
||||
>
|
||||
Reset all proportions
|
||||
</Button>
|
||||
</div>
|
||||
<div className="flex gap-3">
|
||||
<Button
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { RpcMessage, SkeletonResetAllRequestT } from 'solarxr-protocol';
|
||||
import { useOnboarding } from '../../../../hooks/onboarding';
|
||||
import { useWebsocketAPI } from '../../../../hooks/websocket-api';
|
||||
import { ArrowLink } from '../../../commons/ArrowLink';
|
||||
import { Button } from '../../../commons/Button';
|
||||
import { CheckBox } from '../../../commons/Checkbox';
|
||||
@@ -9,6 +11,7 @@ import { BodyProportions } from './BodyProportions';
|
||||
|
||||
export function ManualProportionsPage() {
|
||||
const { applyProgress, skipSetup, state } = useOnboarding();
|
||||
const { sendRPCPacket } = useWebsocketAPI();
|
||||
|
||||
applyProgress(0.9);
|
||||
|
||||
@@ -17,6 +20,13 @@ export function ManualProportionsPage() {
|
||||
});
|
||||
const { precise } = watch();
|
||||
|
||||
const resetAll = () => {
|
||||
sendRPCPacket(
|
||||
RpcMessage.SkeletonResetAllRequest,
|
||||
new SkeletonResetAllRequestT()
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="flex flex-col gap-5 h-full items-center w-full justify-center">
|
||||
@@ -50,12 +60,15 @@ export function ManualProportionsPage() {
|
||||
</div>
|
||||
</div>
|
||||
<div className="w-full py-4 flex flex-row">
|
||||
<div className="flex flex-grow">
|
||||
<div className="flex flex-grow gap-3">
|
||||
{!state.alonePage && (
|
||||
<Button variant="secondary" to="/" onClick={skipSetup}>
|
||||
Skip setup
|
||||
</Button>
|
||||
)}
|
||||
<Button variant="secondary" onClick={resetAll}>
|
||||
Reset all proportions
|
||||
</Button>
|
||||
</div>
|
||||
<div className="flex gap-3">
|
||||
<Button
|
||||
|
||||
Reference in New Issue
Block a user