Skip to content

Commit 4536ff5

Browse files
authored
merge: mypage mock api연결 (#32)
2 parents 0e50da0 + 0f58242 commit 4536ff5

File tree

13 files changed

+89
-55
lines changed

13 files changed

+89
-55
lines changed

packages/react-native/src/apis/mutations/useRecordRepresentativeMutation.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ export default function useRecordRepresentativeMutation() {
1313
const queryClient = useQueryClient();
1414
return useMutation({
1515
mutationFn: async ({ region, imageUri }: MutationRequestParams) => {
16+
const prevImages = await AppStorage.getData('representImage');
1617
await AppStorage.saveData({
1718
key: 'representImage',
1819
value: {
20+
...prevImages,
1921
[region]: imageUri,
2022
},
2123
});

packages/react-native/src/apis/queries/quiz/useQuizzesQuery.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default function useQuizzesQuery({ location }: UseQuizzesQueryParams) {
4040
return useSuspenseQuery({
4141
queryKey: ['Quizzes', location],
4242
queryFn: async () => {
43-
if (!location) {
43+
if (!location?.latitude || !location.longitude) {
4444
return null;
4545
}
4646

packages/react-native/src/apis/queries/useDetailQuery.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ const mockData: SpotAroundData = {
88
title: '관광지 정보',
99
content:
1010
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
11-
backgroundImage:
12-
'https://i.namu.wiki/i/rPbIK73UvaZkqrOVZ2XUs2bqFr8krBAeJRDZIu9dy_2lNEVv2A8ukPsMT2WCQg0mcAIKmVqw7YhdXMek2BUPLUu7pBrT9RRwvnfMRzwLxUL3k7Amfo44GQWagFtAIRfbVPWuGDAHTBDOWN5asD7o7A.webp',
11+
backgroundImage: 'https://cdn.hankyung.com/photo/202208/03.30909476.1.jpg',
1312
address: '강원 강릉시 주문진읍 해안로 1609',
1413
};
1514

packages/react-native/src/apis/queries/useNicknameQuery.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ import { useQuery } from '@tanstack/react-query';
33
import { AppStorage } from '@/utils/storage';
44

55
interface UseNicknameQueryReturn {
6-
nickname: string;
6+
nickname?: {
7+
value: string;
8+
colorSet?: {
9+
color: string;
10+
bgColor: string;
11+
};
12+
};
713
isLoading: boolean;
814
isError: boolean;
915
refetch: () => void;
@@ -21,7 +27,9 @@ export default function useNicknameQuery() {
2127
}
2228

2329
// TODO: 서버데이터 패칭 로직 추가 필요
24-
return '';
30+
return {
31+
value: '',
32+
};
2533
},
2634
});
2735

packages/react-native/src/pages/Detail/DetailSpot.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,22 @@ const mockData = [
66
{
77
id: 1,
88
title: '관광지 정보1',
9-
backgroundImage:
10-
'https://i.namu.wiki/i/rPbIK73UvaZkqrOVZ2XUs2bqFr8krBAeJRDZIu9dy_2lNEVv2A8ukPsMT2WCQg0mcAIKmVqw7YhdXMek2BUPLUu7pBrT9RRwvnfMRzwLxUL3k7Amfo44GQWagFtAIRfbVPWuGDAHTBDOWN5asD7o7A.webp',
9+
backgroundImage: 'https://cdn.hankyung.com/photo/202208/03.30909476.1.jpg',
1110
},
1211
{
1312
id: 2,
1413
title: '관광지 정보2',
15-
backgroundImage:
16-
'https://i.namu.wiki/i/rPbIK73UvaZkqrOVZ2XUs2bqFr8krBAeJRDZIu9dy_2lNEVv2A8ukPsMT2WCQg0mcAIKmVqw7YhdXMek2BUPLUu7pBrT9RRwvnfMRzwLxUL3k7Amfo44GQWagFtAIRfbVPWuGDAHTBDOWN5asD7o7A.webp',
14+
backgroundImage: 'https://cdn.hankyung.com/photo/202208/03.30909476.1.jpg',
1715
},
1816
{
1917
id: 3,
2018
title: '관광지 정보3',
21-
backgroundImage:
22-
'https://i.namu.wiki/i/rPbIK73UvaZkqrOVZ2XUs2bqFr8krBAeJRDZIu9dy_2lNEVv2A8ukPsMT2WCQg0mcAIKmVqw7YhdXMek2BUPLUu7pBrT9RRwvnfMRzwLxUL3k7Amfo44GQWagFtAIRfbVPWuGDAHTBDOWN5asD7o7A.webp',
19+
backgroundImage: 'https://cdn.hankyung.com/photo/202208/03.30909476.1.jpg',
2320
},
2421
{
2522
id: 4,
2623
title: '관광지 정보4',
27-
backgroundImage:
28-
'https://i.namu.wiki/i/rPbIK73UvaZkqrOVZ2XUs2bqFr8krBAeJRDZIu9dy_2lNEVv2A8ukPsMT2WCQg0mcAIKmVqw7YhdXMek2BUPLUu7pBrT9RRwvnfMRzwLxUL3k7Amfo44GQWagFtAIRfbVPWuGDAHTBDOWN5asD7o7A.webp',
24+
backgroundImage: 'https://cdn.hankyung.com/photo/202208/03.30909476.1.jpg',
2925
},
3026
];
3127

packages/react-native/src/pages/Gamification/Gamification.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default withSuspense(
1818
longitude: res?.coords.longitude,
1919
});
2020
});
21-
});
21+
}, []);
2222

2323
if (!data) {
2424
return <QuizLoading />;

packages/react-native/src/pages/Gamification/Quiz.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@ export default withSuspense(function Quiz() {
3232
</View>
3333
<View className="flex flex-col justify-start gap-2.5 ">
3434
{data.choices.map((content) => (
35-
<View>
35+
<View key={content}>
3636
<QuizSelection
37-
key={content}
3837
onPress={() => setSelectedContent(content)}
3938
isSelected={selectedContent === content}
4039
content={content}

packages/react-native/src/pages/Home.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ const mockData: SpotData[] = [
2626
],
2727
isLiked: false,
2828
likeCount: 20,
29-
backgroundImage:
30-
'https://i.namu.wiki/i/rPbIK73UvaZkqrOVZ2XUs2bqFr8krBAeJRDZIu9dy_2lNEVv2A8ukPsMT2WCQg0mcAIKmVqw7YhdXMek2BUPLUu7pBrT9RRwvnfMRzwLxUL3k7Amfo44GQWagFtAIRfbVPWuGDAHTBDOWN5asD7o7A.webp',
29+
backgroundImage: 'https://cdn.hankyung.com/photo/202208/03.30909476.1.jpg',
3130
},
3231
{
3332
spotId: 2,
@@ -36,8 +35,7 @@ const mockData: SpotData[] = [
3635
tags: ['바다', '도깨비'],
3736
isLiked: false,
3837
likeCount: 20,
39-
backgroundImage:
40-
'https://i.namu.wiki/i/rPbIK73UvaZkqrOVZ2XUs2bqFr8krBAeJRDZIu9dy_2lNEVv2A8ukPsMT2WCQg0mcAIKmVqw7YhdXMek2BUPLUu7pBrT9RRwvnfMRzwLxUL3k7Amfo44GQWagFtAIRfbVPWuGDAHTBDOWN5asD7o7A.webp',
38+
backgroundImage: 'https://cdn.hankyung.com/photo/202208/03.30909476.1.jpg',
4139
},
4240
{
4341
spotId: 3,
@@ -46,8 +44,7 @@ const mockData: SpotData[] = [
4644
tags: ['바다', '도깨비'],
4745
isLiked: false,
4846
likeCount: 20,
49-
backgroundImage:
50-
'https://i.namu.wiki/i/rPbIK73UvaZkqrOVZ2XUs2bqFr8krBAeJRDZIu9dy_2lNEVv2A8ukPsMT2WCQg0mcAIKmVqw7YhdXMek2BUPLUu7pBrT9RRwvnfMRzwLxUL3k7Amfo44GQWagFtAIRfbVPWuGDAHTBDOWN5asD7o7A.webp',
47+
backgroundImage: 'https://cdn.hankyung.com/photo/202208/03.30909476.1.jpg',
5148
},
5249
{
5350
spotId: 4,
@@ -56,8 +53,7 @@ const mockData: SpotData[] = [
5653
tags: ['바다', '도깨비'],
5754
isLiked: false,
5855
likeCount: 20,
59-
backgroundImage:
60-
'https://i.namu.wiki/i/rPbIK73UvaZkqrOVZ2XUs2bqFr8krBAeJRDZIu9dy_2lNEVv2A8ukPsMT2WCQg0mcAIKmVqw7YhdXMek2BUPLUu7pBrT9RRwvnfMRzwLxUL3k7Amfo44GQWagFtAIRfbVPWuGDAHTBDOWN5asD7o7A.webp',
56+
backgroundImage: 'https://cdn.hankyung.com/photo/202208/03.30909476.1.jpg',
6157
},
6258
];
6359

@@ -74,7 +70,7 @@ export default function Home({ navigation }: HomeScreenProps) {
7470
<View className="flex flex-col gap-10 p-4">
7571
<View>
7672
<Font type="title1" color="white">
77-
안녕하세요, {nickname}{'\n'}오늘은 어디로 가 볼까요?
73+
안녕하세요, {nickname?.value}{'\n'}오늘은 어디로 가 볼까요?
7874
</Font>
7975
{/* FIXME: 추후 삭제 */}
8076
<Button onPress={() => navigation.navigate('Camera')}>

packages/react-native/src/pages/MyPage.tsx

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TouchableOpacity, View } from 'react-native';
1+
import { Text, TouchableOpacity, View } from 'react-native';
22
import { Font } from 'design-system';
33
import BackGroundGradient from '@/layouts/BackGroundGradient';
44
import SelectProfile from '@/assets/SelectProfile';
@@ -22,7 +22,25 @@ export default function MyPage({ navigation }: MyPageProps) {
2222
<View className="flex items-center gap-7">
2323
{/* FIXME: 실제 이미지 받아와서 설정 */}
2424
<View className="relative">
25-
<SelectProfile />
25+
{nickname?.colorSet ? (
26+
<View
27+
className="w-[140px] h-[140px] rounded-full justify-center items-center"
28+
style={{
29+
backgroundColor: nickname.colorSet.bgColor,
30+
}}
31+
>
32+
<Text
33+
className="font-Pretendard-Medium text-[40px]"
34+
style={{
35+
color: nickname.colorSet.color,
36+
}}
37+
>
38+
{nickname.value}
39+
</Text>
40+
</View>
41+
) : (
42+
<SelectProfile />
43+
)}
2644
<View className="absolute right-0 bottom-0">
2745
<EditButton
2846
onPress={() => navigation.navigate('MyPage/EditProfile')}
@@ -36,7 +54,7 @@ export default function MyPage({ navigation }: MyPageProps) {
3654
<View className="mt-2">
3755
{/* FIXME: 실제 닉네임 받아와서 설정 */}
3856
<Font type="mainTitle" color="white">
39-
{nickname}
57+
{nickname?.value}
4058
</Font>
4159
</View>
4260
</View>

packages/react-native/src/pages/MyPage/MySpot.tsx

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,48 +6,42 @@ const mockData = [
66
{
77
id: 1,
88
title: '여행',
9-
backgroundImage:
10-
'https://i.namu.wiki/i/rPbIK73UvaZkqrOVZ2XUs2bqFr8krBAeJRDZIu9dy_2lNEVv2A8ukPsMT2WCQg0mcAIKmVqw7YhdXMek2BUPLUu7pBrT9RRwvnfMRzwLxUL3k7Amfo44GQWagFtAIRfbVPWuGDAHTBDOWN5asD7o7A.webp',
9+
backgroundImage: 'https://cdn.hankyung.com/photo/202208/03.30909476.1.jpg',
1110
location: '주문진 방파제',
1211
date: '2024.01.01',
1312
},
1413
{
1514
id: 2,
1615
title: '여행',
17-
backgroundImage:
18-
'https://i.namu.wiki/i/rPbIK73UvaZkqrOVZ2XUs2bqFr8krBAeJRDZIu9dy_2lNEVv2A8ukPsMT2WCQg0mcAIKmVqw7YhdXMek2BUPLUu7pBrT9RRwvnfMRzwLxUL3k7Amfo44GQWagFtAIRfbVPWuGDAHTBDOWN5asD7o7A.webp',
16+
backgroundImage: 'https://cdn.hankyung.com/photo/202208/03.30909476.1.jpg',
1917
location: '주문진 방파제',
2018
date: '2024.01.02',
2119
},
2220
{
2321
id: 3,
2422
title: '여행',
25-
backgroundImage:
26-
'https://i.namu.wiki/i/rPbIK73UvaZkqrOVZ2XUs2bqFr8krBAeJRDZIu9dy_2lNEVv2A8ukPsMT2WCQg0mcAIKmVqw7YhdXMek2BUPLUu7pBrT9RRwvnfMRzwLxUL3k7Amfo44GQWagFtAIRfbVPWuGDAHTBDOWN5asD7o7A.webp',
23+
backgroundImage: 'https://cdn.hankyung.com/photo/202208/03.30909476.1.jpg',
2724
location: '주문진 방파제',
2825
date: '2024.01.03',
2926
},
3027
{
3128
id: 4,
3229
title: '여행',
33-
backgroundImage:
34-
'https://i.namu.wiki/i/rPbIK73UvaZkqrOVZ2XUs2bqFr8krBAeJRDZIu9dy_2lNEVv2A8ukPsMT2WCQg0mcAIKmVqw7YhdXMek2BUPLUu7pBrT9RRwvnfMRzwLxUL3k7Amfo44GQWagFtAIRfbVPWuGDAHTBDOWN5asD7o7A.webp',
30+
backgroundImage: 'https://cdn.hankyung.com/photo/202208/03.30909476.1.jpg',
3531
location: '주문진 방파제',
3632
date: '2024.01.04',
3733
},
3834
{
3935
id: 5,
4036
title: '여행',
41-
backgroundImage:
42-
'https://i.namu.wiki/i/rPbIK73UvaZkqrOVZ2XUs2bqFr8krBAeJRDZIu9dy_2lNEVv2A8ukPsMT2WCQg0mcAIKmVqw7YhdXMek2BUPLUu7pBrT9RRwvnfMRzwLxUL3k7Amfo44GQWagFtAIRfbVPWuGDAHTBDOWN5asD7o7A.webp',
37+
backgroundImage: 'https://cdn.hankyung.com/photo/202208/03.30909476.1.jpg',
4338
location: '주문진 방파제',
4439
date: '2024.01.05',
4540
},
4641
{
4742
id: 6,
4843
title: '여행',
49-
backgroundImage:
50-
'https://i.namu.wiki/i/rPbIK73UvaZkqrOVZ2XUs2bqFr8krBAeJRDZIu9dy_2lNEVv2A8ukPsMT2WCQg0mcAIKmVqw7YhdXMek2BUPLUu7pBrT9RRwvnfMRzwLxUL3k7Amfo44GQWagFtAIRfbVPWuGDAHTBDOWN5asD7o7A.webp',
44+
backgroundImage: 'https://cdn.hankyung.com/photo/202208/03.30909476.1.jpg',
5145
location: '주문진 방파제',
5246
date: '2024.01.06',
5347
},

0 commit comments

Comments
 (0)