Skip to content

Commit

Permalink
refactor: profile tab to my
Browse files Browse the repository at this point in the history
  • Loading branch information
hyochan committed Aug 12, 2024
1 parent 8d2f56d commit eb2b137
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 9 deletions.
33 changes: 25 additions & 8 deletions app/(app)/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {useEffect, useRef} from 'react';
import * as Notifications from 'expo-notifications';
import {RectButton} from 'react-native-gesture-handler';
import {css} from '@emotion/native';
import {Image} from 'expo-image';
import {IC_ICON} from '../../../src/icons';

function SettingsMenu(): JSX.Element {
const {theme} = useDooboo();
Expand All @@ -25,11 +27,7 @@ function SettingsMenu(): JSX.Element {
margin-right: 4px;
`}
>
<Icon
color={theme.text.basic}
name="List"
size={22}
/>
<Icon color={theme.text.basic} name="List" size={22} />
</RectButton>
);
}
Expand Down Expand Up @@ -82,10 +80,29 @@ export default function TabLayout(): JSX.Element {
}}
/>
<Tabs.Screen
name="profile"
name="my"
options={{
title: t('common.profile'),
tabBarIcon: ({color}) => <Icon color={color} name="User" size={24} />,
title: t('common.my'),
tabBarIcon: ({focused}) => (
<View
style={css`
width: 24px;
height: 24px;
border-radius: 12px;
background-color: ${theme.bg.paper};
overflow: hidden;
`}
>
<Image
source={user?.avatar_url ? {uri: user.avatar_url} : IC_ICON}
style={css`
width: 24px;
height: 24px;
opacity: ${focused ? '1' : '0.5'};
`}
/>
</View>
),
headerRight: () => <View>{SettingsMenu()}</View>,
}}
/>
Expand Down
2 changes: 1 addition & 1 deletion app/(app)/(tabs)/profile.tsx → app/(app)/(tabs)/my.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export default function Profile(): JSX.Element {

return (
<ErrorBoundary FallbackComponent={FallbackComponent}>
<Stack.Screen options={{title: t('profile.title')}} />
<Stack.Screen options={{title: t('common.my')}} />
<Container>
<CustomScrollView bounces={false}>
<ProfileHeader>
Expand Down
61 changes: 61 additions & 0 deletions app/[...unmatched].tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import {useEffect, useState} from 'react';
import {css} from '@emotion/native';
import {Button} from 'dooboo-ui';
import {usePathname, useRouter} from 'expo-router';

import {t} from '../src/STRINGS';
import {showAlert} from '../src/utils/alert';
import CustomLoadingIndicator from '../src/components/uis/CustomLoadingIndicator';

/*
For android redirect. This looks like expo router bug.
issue: https://github.com/expo/router/issues/157
*/
export default function Unmatched(): JSX.Element {
const [showReload] = useState(false);
const {replace, canGoBack, back} = useRouter();
const pathname = usePathname();

useEffect(() => {
// ios 신규 설치 버그 수정
// https://github.com/dooboolab/dooboo-task/issues/101
if (pathname === '/google/link') {
if (canGoBack()) {
back();
return;
}

replace('/');

return;
}
}, [back, canGoBack, pathname, replace]);

return (
<CustomLoadingIndicator>
{showReload ? (
<Button
borderRadius={28}
color="light"
onPress={() => replace('/')}
style={css`
margin-top: 14px;
`}
styles={{
text: css`
font-size: 14px;
font-family: Pretendard-Bold;
`,
}}
text={t('common.retry')}
touchableHighlightProps={{
onLongPress: () => {
showAlert(pathname);
},
}}
type="outlined"
/>
) : null}
</CustomLoadingIndicator>
);
}
1 change: 1 addition & 0 deletions assets/langs/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"invalidUrl": "Invalid URL",
"latest": "Latest",
"leaveComment": "Leave a comment",
"my": "My",
"newReplyOnTitle": "New reply on {{title}}",
"noComment": "No comments",
"notFound": "Not found",
Expand Down
1 change: 1 addition & 0 deletions assets/langs/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"invalidUrl": "유효하지 않은 URL",
"latest": "최신순",
"leaveComment": "댓글 남기기",
"my": "",
"newReplyOnTitle": "\"{{title}}\"에 새로운 댓글이 달렸습니다",
"noComment": "댓글이 없습니다",
"notFound": "찾을 수 없습니다",
Expand Down

0 comments on commit eb2b137

Please sign in to comment.