Skip to content
This repository was archived by the owner on Feb 8, 2025. It is now read-only.

Commit 1fd6e56

Browse files
committed
feat(app): persist getting started expansion (closed by default)
1 parent 22e2cb8 commit 1fd6e56

File tree

1 file changed

+5
-5
lines changed
  • app/src/components/home/GettingStarted

1 file changed

+5
-5
lines changed

app/src/components/home/GettingStarted/index.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import Animated, { FadeIn, SlideOutRight } from 'react-native-reanimated';
1818
import { Button } from '~/components/Button';
1919
import { Chevron } from '~/components/Chevron';
2020
import { FormattedNumber } from '~/components/format/FormattedNumber';
21-
import { useToggle } from '~/hooks/useToggle';
2221

2322
const Query = gql(/* GraphQL */ `
2423
fragment GettingStarted_Query on Query @argumentDefinitions(account: { type: "UAddress!" }) {
@@ -44,7 +43,8 @@ const Account = gql(/* GraphQL */ `
4443
}
4544
`);
4645

47-
const dismissedAtom = persistedAtom<boolean>('gettingStartedDismissed', false);
46+
const expandedAtom = persistedAtom<boolean>('getting-started.expanded', false);
47+
const dismissedAtom = persistedAtom<boolean>('getting-started.dismissed', false);
4848

4949
const AnimatedSurface = Animated.createAnimatedComponent(Surface);
5050

@@ -57,13 +57,13 @@ export interface GettingStartedProps {
5757
}
5858

5959
export function GettingStarted({ style, then, ...props }: GettingStartedProps) {
60-
const { styles, breakpoint } = useStyles(stylesheet);
60+
const { styles } = useStyles(stylesheet);
6161
const query = useFragment(Query, props.query);
6262
const user = useFragment(User, props.user);
6363
const account = useFragment(Account, props.account);
6464

65+
const [expanded, setExpanded] = useAtom(expandedAtom);
6566
const [dismissed, setDismissed] = useAtom(dismissedAtom);
66-
const [expanded, toggleExpanded] = useToggle(breakpoint === 'expanded');
6767

6868
const suggestions = [
6969
useLinkGoogleSuggestion({ user }),
@@ -81,7 +81,7 @@ export function GettingStarted({ style, then, ...props }: GettingStartedProps) {
8181

8282
return (
8383
<AnimatedSurface style={[styles.surface, style]} entering={FadeIn} exiting={SlideOutRight}>
84-
<TouchableRipple style={styles.overview(expanded)} onPress={toggleExpanded}>
84+
<TouchableRipple style={styles.overview(expanded)} onPress={() => setExpanded((v) => !v)}>
8585
<>
8686
<View style={styles.headerContainer}>
8787
<Text variant="titleSmall" style={[styles.text, styles.title]}>

0 commit comments

Comments
 (0)