diff --git a/gui/public/i18n/en/translation.ftl b/gui/public/i18n/en/translation.ftl index 7fec60085..878a25cf2 100644 --- a/gui/public/i18n/en/translation.ftl +++ b/gui/public/i18n/en/translation.ftl @@ -557,6 +557,7 @@ settings-stay_aligned-relaxed_poses-sitting = Adjust trackers while sitting in a settings-stay_aligned-relaxed_poses-flat = Adjust trackers while sitting on the floor, or lying on your back settings-stay_aligned-relaxed_poses-save_pose = Save pose settings-stay_aligned-relaxed_poses-reset_pose = Reset pose +settings-stay_aligned-relaxed_poses-close = Close settings-stay_aligned-debug-label = Debugging settings-stay_aligned-debug-description = Please include your settings when reporting problems about Stay Aligned. settings-stay_aligned-debug-copy-label = Copy settings to clipboard diff --git a/gui/src/components/settings/pages/components/StayAlignedPoseModal.tsx b/gui/src/components/settings/pages/components/StayAlignedPoseModal.tsx new file mode 100644 index 000000000..0a1c40b56 --- /dev/null +++ b/gui/src/components/settings/pages/components/StayAlignedPoseModal.tsx @@ -0,0 +1,142 @@ +import { BaseModal } from '@/components/commons/BaseModal'; +import { Button } from '@/components/commons/Button'; +import { Typography } from '@/components/commons/Typography'; +import { + DetectRelaxedPoseButton, + ResetRelaxedPoseButton, +} from '@/components/stay-aligned/RelaxedPose'; +import { useLocalization } from '@fluent/react'; +import { Dispatch, ReactNode, SetStateAction } from 'react'; +import { StayAlignedRelaxedPose } from 'solarxr-protocol'; + +function StaAlignedPoseModal({ + open, + title, + descriptionKeys, + children, + relaxedPose, +}: { + open: [boolean, Dispatch>]; + title: string; + descriptionKeys: string[]; + children: ReactNode; + relaxedPose: StayAlignedRelaxedPose; + lastStep?: boolean; +}) { + const { l10n } = useLocalization(); + + return ( + { + open[1](false); + }} + > +
+
+ {l10n.getString(title)} +
+
+ {descriptionKeys.map((descriptionKey) => ( + + {l10n.getString(descriptionKey)} + + ))} +
+
+ {children} +
+
+ +
+ { + open[1](false); + }} + pose={relaxedPose} + > + {l10n.getString('settings-stay_aligned-relaxed_poses-reset_pose')} + + { + open[1](false); + }} + pose={relaxedPose} + /> +
+
+
+
+ ); +} + +export const StandingRelaxedPoseModal = ({ + open, +}: { + open: [boolean, Dispatch>]; +}) => ( + + Reset position + +); + +export const SittingRelaxedPoseModal = ({ + open, +}: { + open: [boolean, Dispatch>]; +}) => ( + + Reset position + +); + +export const FlatRelaxedPoseModal = ({ + open, +}: { + open: [boolean, Dispatch>]; +}) => ( + + Reset position + +); diff --git a/gui/src/components/settings/pages/components/StayAlignedSettings.tsx b/gui/src/components/settings/pages/components/StayAlignedSettings.tsx index 66fde638a..4a05108f6 100644 --- a/gui/src/components/settings/pages/components/StayAlignedSettings.tsx +++ b/gui/src/components/settings/pages/components/StayAlignedSettings.tsx @@ -6,11 +6,17 @@ import { CheckBox } from '@/components/commons/Checkbox'; import { WrenchIcon } from '@/components/commons/icon/WrenchIcons'; import { Typography } from '@/components/commons/Typography'; import { SettingsPagePaneLayout } from '@/components/settings/SettingsPageLayout'; -import { useLocalization } from '@fluent/react'; +import { Localized, useLocalization } from '@fluent/react'; import { useAtomValue } from 'jotai'; import { connectedIMUTrackersAtom } from '@/store/app-store'; import { bodypartToString } from '@/utils/formatting'; import { useLocaleConfig } from '@/i18n/config'; +import { + FlatRelaxedPoseModal, + SittingRelaxedPoseModal, + StandingRelaxedPoseModal, +} from './StayAlignedPoseModal'; +import { useState } from 'react'; export type StayAlignedSettingsForm = { enabled: boolean; @@ -165,106 +171,153 @@ export function StayAlignedSettings({ config.flatLowerLegAngle !== 0.0 || config.flatFootAngle !== 0.0; + const openStanding = useState(false); + const openSitting = useState(false); + const openFlat = useState(false); + return ( - } id="stayaligned"> - - {l10n.getString('settings-stay_aligned')} - -
- - {l10n.getString('settings-stay_aligned-description')} - - - {l10n.getString('settings-stay_aligned-setup-description')} - -
- -
-
-
- - {l10n.getString('settings-stay_aligned-general-label')} - -
- - -
-
-
- - {l10n.getString('settings-stay_aligned-relaxed_poses-label')} + <> + } id="stayaligned"> + + {l10n.getString('settings-stay_aligned')}
- {l10n.getString('settings-stay_aligned-relaxed_poses-description')} + {l10n.getString('settings-stay_aligned-description')} -
-
- - - -
-
-
- - {l10n.getString('settings-stay_aligned-debug-label')} - -
- {l10n.getString('settings-stay_aligned-debug-description')} + {l10n.getString('settings-stay_aligned-setup-description')} +
+ +
-
- +
+ + {l10n.getString('settings-stay_aligned-general-label')} + +
+ + +
-
- +
+ + {l10n.getString('settings-stay_aligned-relaxed_poses-label')} + +
+ + {l10n.getString( + 'settings-stay_aligned-relaxed_poses-description' + )} + +
+
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+
+
+ + {l10n.getString('settings-stay_aligned-debug-label')} + +
+ + {l10n.getString('settings-stay_aligned-debug-description')} + +
+
+ +
+
+ + ); }