mirror of
https://github.com/urbit/shrub.git
synced 2024-12-19 16:51:42 +03:00
launch: get tutorial state from zustand
The check for rendering the tutorial modal was relying on a passed prop that does not exist now.
This commit is contained in:
parent
5c3bce8dbe
commit
4e6655db3b
@ -49,7 +49,18 @@ export default function LaunchApp(props) {
|
|||||||
const baseHash = useLaunchState(state => state.baseHash);
|
const baseHash = useLaunchState(state => state.baseHash);
|
||||||
const [hashText, setHashText] = useState(baseHash);
|
const [hashText, setHashText] = useState(baseHash);
|
||||||
const [exitingTut, setExitingTut] = useState(false);
|
const [exitingTut, setExitingTut] = useState(false);
|
||||||
|
const seen = useSettingsState(s => s?.tutorial?.seen) ?? true;
|
||||||
const associations = useMetadataState(s => s.associations);
|
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 = (
|
const hashBox = (
|
||||||
<Box
|
<Box
|
||||||
position={["relative", "absolute"]}
|
position={["relative", "absolute"]}
|
||||||
@ -88,14 +99,6 @@ export default function LaunchApp(props) {
|
|||||||
}
|
}
|
||||||
}, [query]);
|
}, [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({
|
const { modal, showModal } = useModal({
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
maxWidth: '350px',
|
maxWidth: '350px',
|
||||||
@ -141,14 +144,14 @@ export default function LaunchApp(props) {
|
|||||||
</Box>
|
</Box>
|
||||||
<Text mb="3" lineHeight="tall" fontWeight="medium">Welcome</Text>
|
<Text mb="3" lineHeight="tall" fontWeight="medium">Welcome</Text>
|
||||||
<Text mb="3" lineHeight="tall">
|
<Text mb="3" lineHeight="tall">
|
||||||
You have been invited to use Landscape, an interface to chat
|
You have been invited to use Landscape, an interface to chat
|
||||||
and interact with communities
|
and interact with communities
|
||||||
<br />
|
<br />
|
||||||
Would you like a tour of Landscape?
|
Would you like a tour of Landscape?
|
||||||
</Text>
|
</Text>
|
||||||
<Row gapX="2" justifyContent="flex-end">
|
<Row gapX="2" justifyContent="flex-end">
|
||||||
<Button
|
<Button
|
||||||
backgroundColor="washedGray"
|
backgroundColor="washedGray"
|
||||||
onClick={() => setExitingTut(true)}
|
onClick={() => setExitingTut(true)}
|
||||||
>Skip</Button>
|
>Skip</Button>
|
||||||
<StatelessAsyncButton primary onClick={onContinue}>
|
<StatelessAsyncButton primary onClick={onContinue}>
|
||||||
@ -158,17 +161,12 @@ export default function LaunchApp(props) {
|
|||||||
</Col>
|
</Col>
|
||||||
)}
|
)}
|
||||||
});
|
});
|
||||||
const contacts = useContactState(state => state.contacts);
|
|
||||||
const hasLoaded = useMemo(() => Object.keys(contacts).length > 0, [contacts]);
|
|
||||||
|
|
||||||
const notificationsCount = useHarkState(state => state.notificationsCount);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const seenTutorial = _.get(props.settings, ['tutorial', 'seen'], true);
|
if(hasLoaded && !seen && tutorialProgress === 'hidden') {
|
||||||
if(hasLoaded && !seenTutorial && tutorialProgress === 'hidden') {
|
|
||||||
showModal();
|
showModal();
|
||||||
}
|
}
|
||||||
}, [props.settings, hasLoaded]);
|
}, [seen, hasLoaded]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
Loading…
Reference in New Issue
Block a user