launch: get tutorial state from zustand
The check for rendering the tutorial modal
was relying on a passed prop that does not exist now.
@@ -49,7 +49,18 @@ export default function LaunchApp(props) {
const baseHash = useLaunchState(state => state.baseHash);
const [hashText, setHashText] = useState(baseHash);
const [exitingTut, setExitingTut] = useState(false);
+ const seen = useSettingsState(s => s?.tutorial?.seen) ?? true;
const associations = useMetadataState(s => s.associations);
+ const contacts = useContactState(state => state.contacts);
+ const hasLoaded = useMemo(() => Object.keys(contacts).length > 0, [contacts]);
+ const notificationsCount = useHarkState(state => state.notificationsCount);
+ const calmState = useSettingsState(selectCalmState);
+ const { hideUtilities } = calmState;
+ const { tutorialProgress, nextTutStep } = useLocalState(tutSelector);
+ let { hideGroups } = useLocalState(tutSelector);
+ !hideGroups ? { hideGroups } = calmState : null;
+
+ const waiter = useWaitForProps({ ...props, associations });
const hashBox = (
<Box
position={["relative", "absolute"]}
@@ -88,14 +99,6 @@ export default function LaunchApp(props) {
}
}, [query]);
- const calmState = useSettingsState(selectCalmState);
- const { hideUtilities } = calmState;
- const { tutorialProgress, nextTutStep } = useLocalState(tutSelector);
- let { hideGroups } = useLocalState(tutSelector);
- !hideGroups ? { hideGroups } = calmState : null;
-
- const waiter = useWaitForProps({ ...props, associations });
-
const { modal, showModal } = useModal({
position: 'relative',
maxWidth: '350px',
@@ -158,17 +161,12 @@ export default function LaunchApp(props) {
</Col>
)}
});
- const contacts = useContactState(state => state.contacts);
- const hasLoaded = useMemo(() => Object.keys(contacts).length > 0, [contacts]);
-
- const notificationsCount = useHarkState(state => state.notificationsCount);
useEffect(() => {
- const seenTutorial = _.get(props.settings, ['tutorial', 'seen'], true);
- if(hasLoaded && !seenTutorial && tutorialProgress === 'hidden') {
+ if(hasLoaded && !seen && tutorialProgress === 'hidden') {
showModal();
}
- }, [props.settings, hasLoaded]);
+ }, [seen, hasLoaded]);
return (
<>
