Skip to content

Commit 53979bb

Browse files
committed
fix: redirect to intro on signout
1 parent e0401fd commit 53979bb

File tree

10 files changed

+89
-59
lines changed

10 files changed

+89
-59
lines changed

app/(home)/(tabs)/my.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const ProfileHeader = styled.View`
2727
`;
2828

2929
const Content = styled.View`
30-
padding: 24px;
30+
padding: 16px;
3131
`;
3232

3333
const UserAvatar = styled.Image`

app/(home)/_layout.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {WEB_URL} from '../../src/utils/constants';
88
import {css} from '@emotion/native';
99
import {useAuth} from '@clerk/clerk-expo';
1010

11-
export default function Layout() {
11+
export default function HomeLayout() {
1212
const {theme} = useDooboo();
1313
const {back, replace} = useRouter();
1414
const {isSignedIn} = useAuth();
@@ -46,6 +46,7 @@ export default function Layout() {
4646
: css`
4747
border-radius: 48px;
4848
margin-left: -8px;
49+
margin-top: 4px;
4950
`
5051
}
5152
>

app/(home)/onboarding.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ export default function Onboarding(): JSX.Element {
214214
top: 8,
215215
}}
216216
style={css`
217+
margin-top: 4px;
217218
align-items: center;
218219
justify-content: center;
219220
padding: 2px;

app/(home)/post/[id]/index.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export default function PostDetails(): JSX.Element {
138138
const handlePressUser = useCallback(() => {
139139
if (post?.user.display_name) {
140140
push({
141-
pathname: `/[displayName]`,
141+
pathname: `/user/[displayName]`,
142142
params: {displayName: `@${post.user.display_name}`},
143143
});
144144
}
@@ -331,7 +331,7 @@ export default function PostDetails(): JSX.Element {
331331
<ErrorBoundary FallbackComponent={FallbackComponent}>
332332
<Stack.Screen
333333
options={{
334-
title: post?.title || t('common.post'),
334+
title: (post?.title || t('common.post')).substring(0, 29),
335335
headerRight: () =>
336336
authId ? (
337337
<View
@@ -346,6 +346,7 @@ export default function PostDetails(): JSX.Element {
346346
onPress={handlePressMore}
347347
activeOpacity={0}
348348
style={css`
349+
margin-top: 4px;
349350
margin-right: -8px;
350351
border-radius: 48px;
351352
`}

app/(home)/post/[id]/update.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,12 @@ export default function PostUpdate(): JSX.Element {
312312
top: 8,
313313
}}
314314
style={css`
315-
align-items: center;
316-
justify-content: center;
315+
margin-top: 4px;
317316
margin-right: -4px;
318317
border-radius: 99px;
318+
319+
align-items: center;
320+
justify-content: center;
319321
`}
320322
>
321323
{isSubmitting ? (

app/(home)/post/write.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,12 @@ export default function PostWrite(): JSX.Element {
125125
onPress={handleSubmit(handleWritePost)}
126126
activeOpacity={0}
127127
style={css`
128-
align-items: center;
129-
justify-content: center;
128+
margin-top: 4px;
130129
margin-right: -4px;
131130
border-radius: 99px;
131+
132+
align-items: center;
133+
justify-content: center;
132134
`}
133135
hitSlop={{
134136
bottom: 8,

app/(home)/settings/login-info.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export default function LoginInfo(): JSX.Element {
121121
tags: [],
122122
});
123123

124-
replace('/');
124+
replace('/intro');
125125
};
126126

127127
const handleWithdrawUser = async (): Promise<void> => {

app/(home)/settings/profile-update.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -565,10 +565,12 @@ export default function ProfileUpdate(): JSX.Element {
565565
onPress={handleSubmit(handleProfileUpdate)}
566566
hitSlop={{bottom: 8, left: 8, right: 8, top: 8}}
567567
style={css`
568-
align-items: center;
569-
justify-content: center;
568+
margin-top: 4px;
570569
margin-right: -4px;
571570
border-radius: 99px;
571+
572+
align-items: center;
573+
justify-content: center;
572574
`}
573575
>
574576
{isSubmitting ? (

app/[displayName].tsx renamed to app/(home)/user/[displayName].tsx

+68-47
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
import React, {useEffect, useState} from 'react';
1+
import React, {useCallback, useEffect, useState} from 'react';
22
import styled from '@emotion/native';
33
import {Stack, useLocalSearchParams} from 'expo-router';
44
import {Button, Icon, Typography, useDooboo} from 'dooboo-ui';
55
import {css} from '@emotion/native';
6-
import {Pressable} from 'react-native';
6+
import {Pressable, RefreshControl} from 'react-native';
77
import ErrorBoundary from 'react-native-error-boundary';
8-
import FallbackComponent from '../src/components/uis/FallbackComponent';
9-
import CustomScrollView from '../src/components/uis/CustomScrollView';
10-
import {IC_ICON} from '../src/icons';
11-
import {openURL, removeLeadingAt} from '../src/utils/common';
12-
import DoobooStats from '../src/components/fragments/DoobooStats';
13-
import {t} from '../src/STRINGS';
14-
import {fetchUserWithDisplayName} from '../src/apis/profileQueries';
15-
import CustomLoadingIndicator from '../src/components/uis/CustomLoadingIndicator';
8+
import FallbackComponent from '../../../src/components/uis/FallbackComponent';
9+
import CustomScrollView from '../../../src/components/uis/CustomScrollView';
10+
import {IC_ICON} from '../../../src/icons';
11+
import {openURL, removeLeadingAt} from '../../../src/utils/common';
12+
import DoobooStats from '../../../src/components/fragments/DoobooStats';
13+
import {t} from '../../../src/STRINGS';
14+
import {fetchUserWithDisplayName} from '../../../src/apis/profileQueries';
15+
import CustomLoadingIndicator from '../../../src/components/uis/CustomLoadingIndicator';
1616
import {useRecoilValue} from 'recoil';
17-
import {authRecoilState} from '../src/recoil/atoms';
17+
import {authRecoilState} from '../../../src/recoil/atoms';
1818
import {
1919
fetchFollowCounts,
2020
fetchFollowUser,
2121
fetchIsAFollowing,
22-
} from '../src/apis/followQueries';
23-
import useSupabase from '../src/hooks/useSupabase';
22+
} from '../../../src/apis/followQueries';
23+
import useSupabase from '../../../src/hooks/useSupabase';
2424

2525
const Container = styled.SafeAreaView`
2626
flex: 1;
@@ -36,7 +36,7 @@ const ProfileHeader = styled.View`
3636
`;
3737

3838
const Content = styled.View`
39-
padding: 24px;
39+
padding: 16px;
4040
`;
4141

4242
const UserAvatar = styled.Image`
@@ -148,62 +148,83 @@ export default function DisplayName(): JSX.Element {
148148
}
149149
};
150150

151-
useEffect(() => {
152-
async function fetchData() {
153-
if (!supabase) return;
154-
155-
try {
156-
const {profile, userTags} = await fetchUserWithDisplayName({
157-
displayName,
158-
supabase,
159-
});
151+
const fetchData = useCallback(async () => {
152+
if (!supabase) return;
160153

161-
setUser(profile);
162-
setTags(userTags);
163-
164-
// Check if the current user is following this profile
165-
if (authId) {
166-
if (profile.id !== authId) {
167-
const isUserFollowing = await fetchIsAFollowing({
168-
authId,
169-
followingId: profile.id,
170-
supabase,
171-
});
154+
try {
155+
const {profile, userTags} = await fetchUserWithDisplayName({
156+
displayName,
157+
supabase,
158+
});
172159

173-
setIsFollowing(isUserFollowing);
174-
}
160+
setUser(profile);
161+
setTags(userTags);
175162

176-
const followingsData = await fetchFollowCounts({
177-
userId: profile.id,
163+
// Check if the current user is following this profile
164+
if (authId) {
165+
if (profile.id !== authId) {
166+
const isUserFollowing = await fetchIsAFollowing({
167+
authId,
168+
followingId: profile.id,
178169
supabase,
179170
});
180171

181-
setFollowingCount(followingsData.followingCount);
172+
setIsFollowing(isUserFollowing);
182173
}
183-
} catch (err: any) {
184-
throw new Error(err.message);
185-
} finally {
186-
setLoading(false);
174+
175+
const followingsData = await fetchFollowCounts({
176+
userId: profile.id,
177+
supabase,
178+
});
179+
180+
setFollowingCount(followingsData.followerCount);
187181
}
182+
} catch (err: any) {
183+
throw new Error(err.message);
184+
} finally {
185+
setLoading(false);
188186
}
187+
}, [supabase, displayName, authId]);
189188

189+
const onRefresh = async () => {
190+
fetchData();
191+
};
192+
193+
useEffect(() => {
190194
fetchData();
191-
}, [authId, displayName, supabase]);
195+
}, [fetchData]);
192196

193197
if (loading) {
194198
return (
195199
<>
196-
<Stack.Screen options={{title: displayName || t('common.profile')}} />
200+
<Stack.Screen
201+
options={{
202+
headerShown: true,
203+
title: displayName || t('common.profile'),
204+
}}
205+
/>
197206
<CustomLoadingIndicator />
198207
</>
199208
);
200209
}
201210

202211
return (
203212
<ErrorBoundary FallbackComponent={FallbackComponent}>
204-
<Stack.Screen options={{title: displayName || t('common.profile')}} />
205213
<Container>
206-
<CustomScrollView bounces={false}>
214+
<Stack.Screen
215+
options={{
216+
headerShown: true,
217+
title: displayName || t('common.profile'),
218+
}}
219+
/>
220+
<CustomScrollView
221+
bounces={false}
222+
scrollViewProps={{
223+
refreshControl: (
224+
<RefreshControl refreshing={loading} onRefresh={onRefresh} />
225+
),
226+
}}
227+
>
207228
<ProfileHeader>
208229
<UserAvatar
209230
style={css`

src/components/uis/ReplyItem.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export default function ReplyItem({
8888
<Pressable
8989
onPress={() => {
9090
push({
91-
pathname: `/[displayName]`,
91+
pathname: `/user/[displayName]`,
9292
params: {displayName: `@${item.user.display_name}`},
9393
});
9494
}}

0 commit comments

Comments
 (0)