Skip to content

Commit 9e1bb16

Browse files
authored
Merge pull request #27 from AtThePlace1/develop
Refact: 확인 및 버튼 색상 변수로 저장 / authStore setUserInfo를 각 key값의 값이 변경될때 변경된 key가 있을때만 업데이트 / naver map API 인증 실패로 인해 삭제한 app.tsx 다시 생성
2 parents d6648de + e222c9e commit 9e1bb16

15 files changed

Lines changed: 73 additions & 35 deletions

File tree

src/app/_app.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import '@/app/globals.css';
2+
import Script from 'next/script';
3+
import RootLayout from './layout';
4+
import type { AppProps } from 'next/app';
5+
6+
export default function Myapp({ Component, pageProps }: AppProps) {
7+
return (
8+
<>
9+
<Script
10+
type="text/javascript"
11+
strategy="afterInteractive"
12+
src={`https://openapi.map.naver.com/openapi/v3/maps.js?ncpClientId=${process.env.NEXT_PUBLIC_NAVER_MAP_KEY}`}
13+
></Script>
14+
<RootLayout>
15+
<Component {...pageProps} />
16+
</RootLayout>
17+
</>
18+
);
19+
}

src/app/_components/DetailHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default function DetailHeader({
3636
closeModal();
3737
router.push('/login');
3838
}}
39-
className="w-full rounded bg-[#FF6347] px-4 py-2 text-white"
39+
className="w-full rounded bg-confirmColor px-4 py-2 text-white"
4040
>
4141
확인
4242
</button>

src/app/_components/ProfileImageModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export default function ProfileImageModal({
6060
<div className="mt-4 flex justify-center gap-4">
6161
<button
6262
onClick={handleUploadClick}
63-
className="rounded bg-[#FF6347] px-4 py-2 text-white"
63+
className="bg-confirmColor rounded px-4 py-2 text-white"
6464
>
6565
6666
</button>

src/app/_components/StaticMap.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default function StaticMap({ latitude, longitude }: StaticMapProps) {
99
const mapUrl = `https://naveropenapi.apigw.ntruss.com/map-static/v2/raster?&center=${longitude},${latitude}&level=15&w=300&h=200&format=png&markers=type:d|size:small|pos:${longitude} ${latitude}&X-NCP-APIGW-API-KEY-ID=${process.env.NEXT_PUBLIC_NAVER_ID_KEY}&X-NCP-APIGW-API-KEY=${process.env.NEXT_PUBLIC_NAVER_MAP_KEY}`;
1010

1111
return (
12-
<div className="flexCenter mt-5 h-full">
12+
<div className="flexCenter mt-5 h-full w-2/3">
1313
<Image
1414
src={mapUrl}
1515
width={180}

src/app/detail/[cafeId]/page.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,21 +121,26 @@ export default function Detail() {
121121
'X'
122122
)}
123123
</li>
124+
<li className="cafeInfo" role="contentInfo">
125+
<h3 className="cafeInfoKey">연락처 </h3>
126+
<p className="cafeInfoValue">
127+
<StaticMap
128+
latitude={cafeInfo.latitude}
129+
longitude={cafeInfo.longitude}
130+
/>
131+
</p>
132+
</li>
124133
</ul>
125134

126-
<div className="flexBetween mt-5 gap-4">
127-
<Image
135+
<div className="flexCenter mt-5 gap-4">
136+
{/* <Image
128137
src={cafeInfo.image_menu}
129138
alt="메뉴판"
130139
width={140}
131140
height={200}
132141
priority
133142
style={{ width: '300', height: 'aut0' }}
134-
/>
135-
<StaticMap
136-
latitude={cafeInfo.latitude}
137-
longitude={cafeInfo.longitude}
138-
/>
143+
/> */}
139144
</div>
140145
</section>
141146
</div>

src/app/findingCafe/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export default function FindingCafe() {
9191
setAnswers({});
9292
setCurrentStep(1);
9393
}}
94-
className="mt-4 w-full rounded bg-[#FF6347] px-4 py-2 text-white"
94+
className="bg-confirmColor mt-4 w-full rounded px-4 py-2 text-white"
9595
>
9696
확인
9797
</button>

src/app/globals.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ body {
7171
}
7272

7373
.inputCommon {
74-
@apply border-b border-gray-600 bg-transparent py-2 text-sm focus:border-gray-300 focus:outline-none;
74+
@apply w-full border-b border-gray-600 bg-transparent py-2 text-sm focus:border-gray-300 focus:outline-none;
7575
}
7676

7777
.buttonStyle {

src/app/hooks/useAuthQuery.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useEffect } from 'react';
12
import { AxiosError } from 'axios';
23
import { useAuthStore } from '../store/authStore';
34
import { useUserInfoStore } from '../store/authStore';
@@ -45,6 +46,7 @@ export const useLoginMutation = () => {
4546

4647
// 유저 정보 Query 훅
4748
export const useUserInfoQuery = () => {
49+
const { setUserInfo } = useUserInfoStore();
4850
const token =
4951
typeof window !== 'undefined' ? localStorage.getItem('token') : null;
5052

@@ -56,10 +58,18 @@ export const useUserInfoQuery = () => {
5658
}
5759

5860
const response = await fetchUserInfo();
61+
console.log(response.userInfo);
5962
return response.userInfo;
6063
},
6164
enabled: !!token,
6265
staleTime: 1000 * 60 * 5,
6366
});
67+
68+
useEffect(() => {
69+
if (query.isSuccess && query.data) {
70+
setUserInfo(query.data);
71+
}
72+
}, [query.isSuccess, query.data, setUserInfo]);
73+
6474
return query;
6575
};

src/app/layout.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import './globals.css';
22
import type { Metadata } from 'next';
33
import Header from './_components/Header';
4-
import UseReactQuery from './hooks/UseReactQuey';
54
import Modal from './_components/Modal';
6-
import Script from 'next/script';
5+
import UseReactQuery from './hooks/UseReactQuey';
76

87
export const metadata: Metadata = {
98
title: 'At The Place',
@@ -34,19 +33,15 @@ export default function RootLayout({
3433
children: React.ReactNode;
3534
}>) {
3635
return (
37-
<html lang="en">
38-
<Script
39-
strategy="afterInteractive"
40-
src={`https://openapi.map.naver.com/openapi/v3/maps.js?ncpClientId=${process.env.NEXT_PUBLIC_NAVER_MAP_KEY}`}
41-
></Script>
36+
<html lang="ko">
4237
<body className="relative mx-auto flex h-dvh min-w-360pxr max-w-[1280px] flex-col">
4338
<UseReactQuery>
4439
<Header />
4540
<main className="flex min-h-screen flex-col items-center">
4641
{children}
4742
</main>
43+
<Modal />
4844
</UseReactQuery>
49-
<Modal />
5045
</body>
5146
</html>
5247
);

src/app/login/page.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22

33
import Link from 'next/link';
44
import Image from 'next/image';
5+
56
import { useState } from 'react';
67
import { useRouter } from 'next/navigation';
8+
79
import { LoginForm } from '../api/authApi';
810
import { useAuthStore } from '../store/authStore';
911
import { useLoginMutation } from '../hooks/useAuthQuery';
12+
1013
import KakaoLogin from '../_components/KakaoLogin';
1114

1215
export default function Login() {
@@ -59,7 +62,7 @@ export default function Login() {
5962
id="email"
6063
value={loginData.email}
6164
onChange={handleChange}
62-
className="inputCommon w-full"
65+
className="inputCommon"
6366
placeholder="아이디(이메일) 입력"
6467
required
6568
/>
@@ -73,7 +76,8 @@ export default function Login() {
7376
id="password"
7477
value={loginData.password}
7578
onChange={handleChange}
76-
className="inputCommon w-full"
79+
autoComplete="off"
80+
className="inputCommon"
7781
placeholder="비밀번호 입력"
7882
required
7983
/>
@@ -85,9 +89,9 @@ export default function Login() {
8589
<div className="mb-4 mt-6">
8690
<button
8791
type="submit"
88-
className="w-full rounded-sm bg-[#FF6347] py-3 font-semibold text-white"
92+
className="bg-confirmColor w-full rounded-sm py-3 font-semibold text-white"
8993
>
90-
{loginMutation.isPending ? '로그인 중...' : '로그인'}
94+
로그인
9195
</button>
9296
</div>
9397
<div className="my-2">

0 commit comments

Comments
 (0)