-
-
Notifications
You must be signed in to change notification settings - Fork 223
Onboarding Quiz #1751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Aed-1
wants to merge
23
commits into
SlimeVR:main
Choose a base branch
from
Aed-1:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Onboarding Quiz #1751
Changes from 14 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
d78f874
onboarding quiz (WIP)
Aed-1 f42f970
onboarding quiz
Aed-1 e8edd04
Delete gui/src/components/onboarding/pages/Quiz.tsx
Aed-1 a357d00
move mocap mode outside of developer mode
Aed-1 3029a61
small fixes
Aed-1 8d774e9
remove uneeded imports
Aed-1 8ae9bf2
fuck lint
Aed-1 6ffb61e
fuck lint (x2)
Aed-1 ad02ced
add suggested changes
Aed-1 d9edeb8
Delete gui/src/components/onboarding/pages/Quiz/QuizSteps/Question1.tsx
Aed-1 431733f
Delete gui/src/components/onboarding/pages/Quiz/QuizSteps/Question2.tsx
Aed-1 b7258af
Delete gui/src/components/onboarding/pages/Quiz/QuizSteps/Question3.tsx
Aed-1 e49ab38
Delete gui/src/components/onboarding/pages/Quiz/QuizSteps/Question4.tsx
Aed-1 43f619b
added suggestions
Aed-1 db30a43
fix flashing in onboarding
Aed-1 f1d0d8d
add suggestions
Aed-1 b30072e
fuck lint (x3)
Aed-1 ff181e5
woo
Aed-1 b048b97
translation lower case
Aed-1 434c8a9
Update gui/public/i18n/en/translation.ftl
Aed-1 3dcb0fe
Update gui/public/i18n/en/translation.ftl
Aed-1 601c8e4
more options
Aed-1 d2d5e18
Update gui/public/i18n/en/translation.ftl
Aed-1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import { Localized } from '@fluent/react'; | ||
| import { useOnboarding } from '@/hooks/onboarding'; | ||
| import { Button } from '@/components/commons/Button'; | ||
| import { Typography } from '@/components/commons/Typography'; | ||
| import classNames from 'classnames'; | ||
| import { USBIcon } from '@/components/commons/icon/UsbIcon'; | ||
| import { WarningBox } from '@/components/commons/TipBox'; | ||
|
|
||
| export function DonglePage() { | ||
| const { applyProgress, state } = useOnboarding(); | ||
|
|
||
| applyProgress(0.5); | ||
|
|
||
| return ( | ||
| <div className="flex flex-col w-full h-full xs:justify-center items-center"> | ||
| <div className="flex flex-col gap-2"> | ||
| <div className="flex gap-2 items-center"> | ||
| <div className="bg-accent-background-30 rounded-full p-2 fill-background-10"> | ||
| <USBIcon size={24} /> | ||
| </div> | ||
| <Typography | ||
| variant="main-title" | ||
| id="onboarding-wifi_creds-dongle-title" | ||
| /> | ||
| </div> | ||
| <div className={classNames('flex flex-col gap-2 flex-grow p-2')}> | ||
| <Typography | ||
| whitespace="whitespace-pre-wrap" | ||
| id="onboarding-wifi_creds-dongle-description" | ||
| /> | ||
| <Localized id="onboarding-wifi_creds-dongle-wip"> | ||
| <WarningBox whitespace>WARNING</WarningBox> | ||
| </Localized> | ||
| </div> | ||
| <div className="flex px-2 p-6"> | ||
| <Button | ||
| variant="primary" | ||
| to={state.alonePage ? '/' : '/onboarding/trackers-assign'} | ||
| id="onboarding-wifi_creds-dongle-continue" | ||
| /> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
146 changes: 146 additions & 0 deletions
146
gui/src/components/onboarding/pages/Quiz/QuizSteps/MocapPosQuestionLast.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,146 @@ | ||
| import { useOnboarding } from '@/hooks/onboarding'; | ||
| import classNames from 'classnames'; | ||
| import { useState, useEffect, createContext } from 'react'; | ||
| import { Typography } from '@/components/commons/Typography'; | ||
| import { Button } from '@/components/commons/Button'; | ||
| import { useWebsocketAPI } from '@/hooks/websocket-api'; | ||
| import { Localized } from '@fluent/react'; | ||
| import { | ||
| RpcMessage, | ||
| SettingsResponseT, | ||
| ChangeSettingsRequestT, | ||
| ModelSettingsT, | ||
| SettingsRequestT, | ||
| ResetsSettingsT, | ||
| ModelTogglesT, | ||
| } from 'solarxr-protocol'; | ||
| export const LevelContext = createContext(1); | ||
|
|
||
| export function QuizMocapPosQuestion() { | ||
| const { applyProgress, setMocapPos, usage, slimeSet, update, mocapPos } = | ||
| useOnboarding(); | ||
| const { sendRPCPacket, useRPCPacket } = useWebsocketAPI(); | ||
| const [settings, setSettings] = useState<SettingsResponseT>(); | ||
| const [to, setTo] = useState(''); | ||
| const [disabled, setDisabled] = useState(true); | ||
|
|
||
| applyProgress(0.4); | ||
|
|
||
| useEffect(() => { | ||
| sendRPCPacket(RpcMessage.SettingsRequest, new SettingsRequestT()); | ||
| }, []); | ||
|
|
||
| useRPCPacket(RpcMessage.SettingsResponse, (settings: SettingsResponseT) => { | ||
| setSettings(settings); | ||
| }); | ||
|
|
||
| const updateTo = () => { | ||
| if (slimeSet === 'butterfly') { | ||
| setTo('/onboarding/dongle'); | ||
| } else { | ||
| if (update === true) { | ||
| setTo('/onboarding/firmware-tool'); | ||
| } else { | ||
| setTo('/onboarding/wifi-creds'); | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| const applySettings = () => { | ||
| if (!settings?.modelSettings || !settings?.vrcOsc) | ||
| throw 'settings should be set'; | ||
| const req = new ChangeSettingsRequestT(); | ||
| const modelSettings = new ModelSettingsT(); | ||
| const resetSettings = new ResetsSettingsT(); | ||
|
|
||
| if (usage === 'mocap') { | ||
| const toggles = Object.assign( | ||
| new ModelTogglesT(), | ||
| settings.modelSettings.toggles | ||
| ); | ||
| toggles.selfLocalization = true; | ||
| modelSettings.toggles = toggles; | ||
| req.modelSettings = modelSettings; | ||
|
|
||
| if (mocapPos === 'forehead') { | ||
| const resets = Object.assign(resetSettings, settings.resetsSettings); | ||
| resets.resetHmdPitch = true; | ||
| req.resetsSettings = resets; | ||
| } | ||
| } | ||
|
|
||
| sendRPCPacket(RpcMessage.ChangeSettingsRequest, req); | ||
| }; | ||
|
|
||
| applyProgress(0.2); | ||
|
|
||
| return ( | ||
| <div className="flex flex-col w-full h-full xs:justify-center items-center"> | ||
| <div className="flex flex-col gap-2"> | ||
| <div className="flex gap-2 items-center"> | ||
| <Typography | ||
| variant="main-title" | ||
| id="onboarding-quiz-mocapPos-title" | ||
| /> | ||
| </div> | ||
| <div className=""> | ||
| <div className={classNames('flex flex-col gap-2 flex-grow p-2')}> | ||
| <Typography | ||
| whitespace="whitespace-pre-wrap" | ||
| id="onboarding-quiz-mocapPos-description" | ||
| /> | ||
| </div> | ||
| <div className="flex gap-2 px-2 p-6"> | ||
| <div | ||
| onClick={() => { | ||
| setMocapPos('forehead'); | ||
| updateTo(); | ||
| setDisabled(false); | ||
| }} | ||
| className={classNames( | ||
| 'rounded-lg overflow-hidden transition-[box-shadow] duration-200 ease-linear hover:bg-background-50 cursor-pointer bg-background-60', | ||
| mocapPos === 'forehead' && | ||
| 'outline outline-3 outline-accent-background-40' | ||
| )} | ||
| > | ||
| <div className="flex flex-col justify-center rounded-md py-3 pr-4 pl-4 w-full gap-2 box-border"> | ||
| <div className="min-h-9 flex text-default justify-center gap-5 flex-wrap items-center"> | ||
| <Typography id="onboarding-quiz-mocapPos-answer-forehead" /> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div | ||
| onClick={() => { | ||
| setMocapPos('face'); | ||
| updateTo(); | ||
| setDisabled(false); | ||
| }} | ||
| className={classNames( | ||
| 'rounded-lg overflow-hidden transition-[box-shadow] duration-200 ease-linear hover:bg-background-50 cursor-pointer bg-background-60', | ||
| mocapPos === 'face' && | ||
| 'outline outline-3 outline-accent-background-40' | ||
| )} | ||
| > | ||
| <div className="flex flex-col justify-center rounded-md py-3 pr-4 pl-4 w-full gap-2 box-border"> | ||
| <div className="min-h-9 flex text-default justify-center gap-5 flex-wrap items-center"> | ||
| <Typography id="onboarding-quiz-mocapPos-answer-face" /> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div className="flex px-2 p-6"> | ||
| <Localized id="onboarding-quiz_continue"> | ||
| <Button | ||
| to={to} | ||
| children="Continue" | ||
| variant="primary" | ||
| onClick={applySettings} | ||
| disabled={disabled} | ||
| /> | ||
| </Localized> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.