mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-24 02:51:20 -08:00
Try forcing manual mounting on setup (#852)
Co-authored-by: Erimel <[email protected]>
This commit is contained in:
1 parent
751c2e2f3b
commit
cc5bd5d938
6 files changed
+113
-4
No files matched your search
@@ -720,7 +720,12 @@ onboarding-choose_mounting-manual_mounting = Manual mounting
|
||||
# Italized text
|
||||
onboarding-choose_mounting-manual_mounting-label = Recommended
|
||||
onboarding-choose_mounting-manual_mounting-description = This will let you choose the mounting direction manually for each tracker
|
||||
|
||||
# Multiline text
|
||||
onboarding-choose_mounting-manual_modal-title = Are you sure you want to do
|
||||
the automatic mounting calibration?
|
||||
onboarding-choose_mounting-manual_modal-description = <b>The manual mounting calibration is recommended for new users</b>, as the automatic mounting calibration's poses can be hard to get right first and may require some practice.
|
||||
onboarding-choose_mounting-manual_modal-confirm = I'm sure of what I'm doing
|
||||
onboarding-choose_mounting-manual_modal-cancel = Cancel
|
||||
|
||||
## Tracker manual mounting setup
|
||||
onboarding-manual_mounting-back = Go Back to Enter VR
|
||||
|
||||
@@ -8,6 +8,7 @@ export function Typography({
|
||||
whitespace = 'whitespace-normal',
|
||||
children,
|
||||
italic = false,
|
||||
textAlign,
|
||||
}: {
|
||||
variant?:
|
||||
| 'main-title'
|
||||
@@ -25,6 +26,13 @@ export function Typography({
|
||||
| 'whitespace-pre'
|
||||
| 'whitespace-pre-line'
|
||||
| 'whitespace-pre-wrap';
|
||||
textAlign?:
|
||||
| 'text-left'
|
||||
| 'text-center'
|
||||
| 'text-right'
|
||||
| 'text-justify'
|
||||
| 'text-start'
|
||||
| 'text-end';
|
||||
children?: ReactNode;
|
||||
}) {
|
||||
const tag = useMemo(() => {
|
||||
@@ -55,6 +63,7 @@ export function Typography({
|
||||
color === 'secondary' && 'text-background-30',
|
||||
typeof color === 'string' && color,
|
||||
whitespace,
|
||||
textAlign,
|
||||
italic && 'italic',
|
||||
]),
|
||||
},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useMemo, useState } from 'react';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { AssignTrackerRequestT, BodyPart, RpcMessage } from 'solarxr-protocol';
|
||||
import { FlatDeviceTracker } from '@/hooks/app';
|
||||
import { useOnboarding } from '@/hooks/onboarding';
|
||||
@@ -13,12 +13,14 @@ import { MountingSelectionMenu } from './MountingSelectionMenu';
|
||||
import { useLocalization } from '@fluent/react';
|
||||
import { useBreakpoint } from '@/hooks/breakpoint';
|
||||
import { Quaternion } from 'three';
|
||||
import { useConfig } from '@/hooks/config';
|
||||
|
||||
export function ManualMountingPage() {
|
||||
const { isMobile } = useBreakpoint('mobile');
|
||||
const { l10n } = useLocalization();
|
||||
const { applyProgress, state } = useOnboarding();
|
||||
const { sendRPCPacket } = useWebsocketAPI();
|
||||
const { setConfig } = useConfig();
|
||||
|
||||
const [selectedRole, setSelectRole] = useState<BodyPart>(BodyPart.NONE);
|
||||
|
||||
@@ -27,6 +29,10 @@ export function ManualMountingPage() {
|
||||
const { useAssignedTrackers } = useTrackers();
|
||||
const assignedTrackers = useAssignedTrackers();
|
||||
|
||||
useEffect(() => {
|
||||
setConfig({ doneManualMounting: true });
|
||||
}, []);
|
||||
|
||||
const trackerPartGrouped = useMemo(
|
||||
() =>
|
||||
assignedTrackers.reduce<{ [key: number]: FlatDeviceTracker[] }>(
|
||||
|
||||
@@ -5,12 +5,18 @@ import { SkipSetupWarningModal } from '@/components/onboarding/SkipSetupWarningM
|
||||
import classNames from 'classnames';
|
||||
import { Typography } from '@/components/commons/Typography';
|
||||
import { Button } from '@/components/commons/Button';
|
||||
import { TryManualFirstModal } from './TryManualFirstModal';
|
||||
import { useConfig } from '@/hooks/config';
|
||||
import { useNavigate } from 'react-router';
|
||||
|
||||
export function MountingChoose() {
|
||||
const { l10n } = useLocalization();
|
||||
const { applyProgress, skipSetup, state } = useOnboarding();
|
||||
const navigate = useNavigate();
|
||||
const { config, setConfig } = useConfig();
|
||||
const [animated, setAnimated] = useState(false);
|
||||
const [skipWarning, setSkipWarning] = useState(false);
|
||||
const [manualModal, setManualModal] = useState(false);
|
||||
|
||||
applyProgress(0.65);
|
||||
|
||||
@@ -66,7 +72,16 @@ export function MountingChoose() {
|
||||
</div>
|
||||
<Button
|
||||
variant={!state.alonePage ? 'secondary' : 'tertiary'}
|
||||
to="/onboarding/mounting/auto"
|
||||
to={
|
||||
config?.doneManualMounting
|
||||
? '/onboarding/mounting/auto'
|
||||
: undefined
|
||||
}
|
||||
onClick={
|
||||
!config?.doneManualMounting
|
||||
? () => setManualModal(true)
|
||||
: undefined
|
||||
}
|
||||
className="self-start mt-auto"
|
||||
state={{ alonePage: state.alonePage }}
|
||||
>
|
||||
@@ -137,6 +152,14 @@ export function MountingChoose() {
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<TryManualFirstModal
|
||||
isOpen={manualModal}
|
||||
accept={() => {
|
||||
setConfig({ doneManualMounting: true });
|
||||
navigate('/onboarding/mounting/auto');
|
||||
}}
|
||||
cancel={() => setManualModal(false)}
|
||||
></TryManualFirstModal>
|
||||
<SkipSetupWarningModal
|
||||
accept={skipSetup}
|
||||
onClose={() => setSkipWarning(false)}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
import { BaseModal } from '@/components/commons/BaseModal';
|
||||
import { Button } from '@/components/commons/Button';
|
||||
import { Typography } from '@/components/commons/Typography';
|
||||
import { Localized, useLocalization } from '@fluent/react';
|
||||
|
||||
export function TryManualFirstModal({
|
||||
isOpen = true,
|
||||
cancel,
|
||||
accept,
|
||||
}: {
|
||||
/**
|
||||
* Is the parent/sibling component opened?
|
||||
*/
|
||||
isOpen: boolean;
|
||||
/**
|
||||
* Function to trigger when they want to do automatic anyways
|
||||
*/
|
||||
accept: () => void;
|
||||
/**
|
||||
* Function to trigger when they agree to do manual
|
||||
*/
|
||||
cancel?: () => void;
|
||||
}) {
|
||||
const { l10n } = useLocalization();
|
||||
|
||||
return (
|
||||
<BaseModal isOpen={isOpen} onRequestClose={cancel}>
|
||||
<div className="flex flex-col gap-3">
|
||||
<>
|
||||
<div className="flex flex-col items-center gap-3 fill-accent-background-20">
|
||||
<div className="flex flex-col items-center gap-2">
|
||||
<Typography
|
||||
variant="main-title"
|
||||
whitespace="whitespace-pre"
|
||||
textAlign="text-center"
|
||||
>
|
||||
{l10n.getString(
|
||||
'onboarding-choose_mounting-manual_modal-title'
|
||||
)}
|
||||
</Typography>
|
||||
<div className="w-[30vw] min-w-fit">
|
||||
<Localized
|
||||
id="onboarding-choose_mounting-manual_modal-description"
|
||||
elems={{ b: <b></b> }}
|
||||
>
|
||||
<Typography variant="standard">
|
||||
You should do manual mounting first!
|
||||
</Typography>
|
||||
</Localized>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Button variant="primary" onClick={accept}>
|
||||
{l10n.getString('onboarding-choose_mounting-manual_modal-confirm')}
|
||||
</Button>
|
||||
<Button variant="tertiary" onClick={cancel}>
|
||||
{l10n.getString('onboarding-choose_mounting-manual_modal-cancel')}
|
||||
</Button>
|
||||
</>
|
||||
</div>
|
||||
</BaseModal>
|
||||
);
|
||||
}
|
||||
@@ -25,6 +25,7 @@ export interface Config {
|
||||
textSize: number;
|
||||
fonts: string[];
|
||||
advancedAssign: boolean;
|
||||
doneManualMounting: boolean;
|
||||
}
|
||||
|
||||
export interface ConfigContext {
|
||||
@@ -34,7 +35,7 @@ export interface ConfigContext {
|
||||
loadConfig: () => Promise<Config | null>;
|
||||
}
|
||||
|
||||
export const defaultConfig = {
|
||||
export const defaultConfig: Omit<Config, 'devSettings'> = {
|
||||
lang: 'en',
|
||||
debug: false,
|
||||
doneOnboarding: false,
|
||||
@@ -46,6 +47,7 @@ export const defaultConfig = {
|
||||
textSize: 12,
|
||||
fonts: ['poppins'],
|
||||
advancedAssign: false,
|
||||
doneManualMounting: false,
|
||||
};
|
||||
|
||||
function fallbackToDefaults(loadedConfig: any): Config {
|
||||
|
||||
Reference in new issue
Block a user