From 69e10dbf925fdf67f4ab9b771cbe3bd42d81d116 Mon Sep 17 00:00:00 2001 From: JovannMC Date: Tue, 24 Sep 2024 16:21:44 +0300 Subject: [PATCH 1/3] Add warning to proportions reset --- gui/public/i18n/en/translation.ftl | 6 ++ .../body-proportions/AutomaticProportions.tsx | 14 ++++- .../body-proportions/ManualProportions.tsx | 14 ++++- .../ProportionsResetModal.tsx | 63 +++++++++++++++++++ 4 files changed, 94 insertions(+), 3 deletions(-) create mode 100644 gui/src/components/onboarding/pages/body-proportions/ProportionsResetModal.tsx diff --git a/gui/public/i18n/en/translation.ftl b/gui/public/i18n/en/translation.ftl index 783ab650a4..3a6e3c91ec 100644 --- a/gui/public/i18n/en/translation.ftl +++ b/gui/public/i18n/en/translation.ftl @@ -74,6 +74,12 @@ skeleton_bone-ELBOW_OFFSET = Elbow Offset ## Tracker reset buttons reset-reset_all = Reset all proportions +reset-reset_all_warning = + Warning: This will reset your proportions to the defaults. + Are you sure you want to do this? +reset-reset_all_warning-reset = Reset proportions +reset-reset_all_warning-cancel = Cancel + reset-full = Full Reset reset-mounting = Reset Mounting reset-yaw = Yaw Reset diff --git a/gui/src/components/onboarding/pages/body-proportions/AutomaticProportions.tsx b/gui/src/components/onboarding/pages/body-proportions/AutomaticProportions.tsx index e9f832febf..9354d3fcc4 100644 --- a/gui/src/components/onboarding/pages/body-proportions/AutomaticProportions.tsx +++ b/gui/src/components/onboarding/pages/body-proportions/AutomaticProportions.tsx @@ -15,6 +15,8 @@ import { VerifyResultsStep } from './autobone-steps/VerifyResults'; import { useCountdown } from '@/hooks/countdown'; import { CheckHeight } from './autobone-steps/CheckHeight'; import { PreparationStep } from './autobone-steps/Preparation'; +import { useState } from 'react'; +import { ProportionsResetModal } from './ProportionsResetModal'; export function AutomaticProportionsPage() { const { l10n } = useLocalization(); @@ -30,6 +32,8 @@ export function AutomaticProportionsPage() { }, }); + const [skipWarning, setSkipWarning] = useState(false); + applyProgress(0.9); return ( @@ -65,7 +69,7 @@ export function AutomaticProportionsPage() {
+ { + startCountdown(); + setSkipWarning(false); + }} + onClose={() => setSkipWarning(false)} + isOpen={skipWarning} + > ); diff --git a/gui/src/components/onboarding/pages/body-proportions/ManualProportions.tsx b/gui/src/components/onboarding/pages/body-proportions/ManualProportions.tsx index 55a0ad7855..c6bca5f747 100644 --- a/gui/src/components/onboarding/pages/body-proportions/ManualProportions.tsx +++ b/gui/src/components/onboarding/pages/body-proportions/ManualProportions.tsx @@ -7,15 +7,17 @@ import { CheckBox } from '@/components/commons/Checkbox'; import { Typography } from '@/components/commons/Typography'; import { BodyProportions } from './BodyProportions'; import { useLocalization } from '@fluent/react'; -import { useEffect, useMemo } from 'react'; +import { useEffect, useMemo, useState } from 'react'; import { useBreakpoint } from '@/hooks/breakpoint'; import { SkeletonVisualizerWidget } from '@/components/widgets/SkeletonVisualizerWidget'; +import { ProportionsResetModal } from './ProportionsResetModal'; export function ButtonsControl() { const { l10n } = useLocalization(); const { state } = useOnboarding(); const { sendRPCPacket } = useWebsocketAPI(); + const [skipWarning, setSkipWarning] = useState(false); const resetAll = () => { sendRPCPacket( RpcMessage.SkeletonResetAllRequest, @@ -32,9 +34,17 @@ export function ButtonsControl() { > {l10n.getString('onboarding-previous_step')} - + { + resetAll(); + setSkipWarning(false); + }} + onClose={() => setSkipWarning(false)} + isOpen={skipWarning} + > {!state.alonePage && ( + + + + + + ); +} From dbad2c83ed5be23a13c15ea7f895e12e5ca1c71c Mon Sep 17 00:00:00 2001 From: JovannMC Date: Tue, 24 Sep 2024 19:09:34 +0300 Subject: [PATCH 2/3] Code suggestion change Co-Authored-By: Uriel --- gui/public/i18n/en/translation.ftl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/public/i18n/en/translation.ftl b/gui/public/i18n/en/translation.ftl index 3a6e3c91ec..ac5fed41f6 100644 --- a/gui/public/i18n/en/translation.ftl +++ b/gui/public/i18n/en/translation.ftl @@ -75,7 +75,7 @@ skeleton_bone-ELBOW_OFFSET = Elbow Offset ## Tracker reset buttons reset-reset_all = Reset all proportions reset-reset_all_warning = - Warning: This will reset your proportions to the defaults. + Warning: This will reset your proportions to being just based on your height. Are you sure you want to do this? reset-reset_all_warning-reset = Reset proportions reset-reset_all_warning-cancel = Cancel From 7658741460581ff445fc7f8ea65bdb7bf38b8400 Mon Sep 17 00:00:00 2001 From: JovannMC Date: Tue, 8 Oct 2024 16:12:19 +0300 Subject: [PATCH 3/3] Code review suggestions renames "skipWarning to "showWarning" (other files had "skipWarning" renamed also) & updates fallback warning text Co-Authored-By: Butterscotch! <5095026+ButterscotchV@users.noreply.github.com> --- gui/src/components/onboarding/OnboardingLayout.tsx | 10 +++++----- .../pages/body-proportions/AutomaticProportions.tsx | 10 +++++----- .../pages/body-proportions/ManualProportions.tsx | 10 +++++----- .../pages/body-proportions/ProportionsResetModal.tsx | 3 ++- .../onboarding/pages/mounting/MountingChoose.tsx | 6 +++--- 5 files changed, 20 insertions(+), 19 deletions(-) diff --git a/gui/src/components/onboarding/OnboardingLayout.tsx b/gui/src/components/onboarding/OnboardingLayout.tsx index 1949e70dd8..671ada5e6d 100644 --- a/gui/src/components/onboarding/OnboardingLayout.tsx +++ b/gui/src/components/onboarding/OnboardingLayout.tsx @@ -10,7 +10,7 @@ import './OnboardingLayout.scss'; export function OnboardingLayout({ children }: { children: ReactNode }) { const { isMobile } = useBreakpoint('mobile'); const { state, skipSetup } = useOnboarding(); - const [skipWarning, setSkipWarning] = useState(false); + const [showWarning, setShowWarning] = useState(false); return !state.alonePage ? (
@@ -21,15 +21,15 @@ export function OnboardingLayout({ children }: { children: ReactNode }) {
setSkipWarning(true)} + modalVisible={showWarning} + onClick={() => setShowWarning(true)} >
{children}
setSkipWarning(false)} - isOpen={skipWarning} + onClose={() => setShowWarning(false)} + isOpen={showWarning} >
diff --git a/gui/src/components/onboarding/pages/body-proportions/AutomaticProportions.tsx b/gui/src/components/onboarding/pages/body-proportions/AutomaticProportions.tsx index 9354d3fcc4..b843ba1352 100644 --- a/gui/src/components/onboarding/pages/body-proportions/AutomaticProportions.tsx +++ b/gui/src/components/onboarding/pages/body-proportions/AutomaticProportions.tsx @@ -32,7 +32,7 @@ export function AutomaticProportionsPage() { }, }); - const [skipWarning, setSkipWarning] = useState(false); + const [showWarning, setShowWarning] = useState(false); applyProgress(0.9); @@ -69,7 +69,7 @@ export function AutomaticProportionsPage() {
- { resetAll(); - setSkipWarning(false); + setShowWarning(false); }} - onClose={() => setSkipWarning(false)} - isOpen={skipWarning} + onClose={() => setShowWarning(false)} + isOpen={showWarning} > {!state.alonePage && (