-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feat] 마이페이지 - 기본 페이지 구현 #81
Merged
The head ref may contain hidden characters: "70-feat-\uB9C8\uC774\uD398\uC774\uC9C0-=-\uAE30\uBCF8-\uD398\uC774\uC9C0-\uAD6C\uD604"
Merged
Changes from 27 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
438e27f
Feat: page 레이아웃 구성
bokeeeey 2117d0f
Feat: userProfile 컴포넌트 추가
bokeeeey c693aca
Feat: my-info page => barrel import export 적용
bokeeeey 7fd54e6
Feat: EdiProfile Modal => Form 기본 틀 작성
bokeeeey 26d6123
Feat: nickname 중복확인 구현
bokeeeey 4346f66
Feat: phone value값 편집
bokeeeey 8d418aa
Feat: PutEditProfile mutate 구현
bokeeeey 3f6e6cc
Merge: develop pull & merge
bokeeeey 814c729
Fix: env 파일 삭제
bokeeeey f409b57
Fix: env 파일 삭제
bokeeeey 279523b
Fix: 필요없는 주석 제거
bokeeeey dc4effa
Fix: RecentProduct text => children으로 수정
bokeeeey 1ad7aae
Fix: fontSize Mixin 수정
bokeeeey 500e2e7
Fix: radio 관련 버그 발견 => 잠시 주석처리
bokeeeey 0c304dd
Fix: API호출 console 제거
bokeeeey 9548fe8
Refactor: Dropdown => hover borderRadius수정
bokeeeey f0c96f1
Fix: Dropdown 컴포넌트 디버깅중
bokeeeey d57eb8d
Fix: Dropdown 컴포넌트 디버깅중
bokeeeey 42b0986
Fix: dropdown에서 onChange 사용 추가
bokeeeey 5c23f2f
Fix: Dropdown useEffect 제거
bokeeeey 1e87fbd
Fix: radioField 수정: onChange => onClick
bokeeeey dfa233d
Fix: console.log 주석처리
bokeeeey da3697b
Fix: Input컴포넌트 props 수정
bokeeeey be867c1
Merge: devalop pull & merge
bokeeeey 3e8dfba
Fix: API env 수정 및 api base_url 수정
bokeeeey 620b8cf
Feat: token값의 변경이 있을때마다 쿼리 갱신 설정
bokeeeey 472c13c
Fix: phone number fommetter 수정
bokeeeey d512fb9
Feat: refreshToken api함수 추가
bokeeeey 76ea46a
Feat: toasity 설치
bokeeeey 7e2a7f8
Fix: header css수정중
bokeeeey 282550b
Merge: develop pull & merge
bokeeeey de44d2e
Fix: header css 수정
bokeeeey cb15f77
Feat: Add my-page redirecting
bokeeeey 90b8798
Style: header border botton 추가
bokeeeey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ yarn-error.log* | |
|
||
# local env files | ||
.env*.local | ||
.env* | ||
|
||
# vercel | ||
.vercel | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import { FieldValues } from 'react-hook-form'; | ||
|
||
const BASE_URL = process.env.NEXT_PUBLIC_KEYDEUK_API_BASE_URL; | ||
|
||
interface PutEditProfileProps { | ||
payload: FieldValues; | ||
token: string | null; | ||
} | ||
|
||
/** | ||
* 주어진 토큰을 사용하여 사용자 데이터를 호출 | ||
* | ||
* @param {string} token - 인증 토큰입니다. | ||
* @returns {Promise<Object>} - 사용자 데이터를 반환합니다. | ||
* @throws {Error} - 요청이 실패한 경우 에러를 던집니다. | ||
*/ | ||
export async function getUserData(token: string | null) { | ||
if (!token) { | ||
return null; | ||
} | ||
|
||
try { | ||
const res = await fetch(`${BASE_URL}/api/v1/users/me`, { | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}); | ||
|
||
const data = await res.json(); | ||
return data; | ||
} catch (error) { | ||
throw error; | ||
} | ||
} | ||
|
||
/** | ||
* 주어진 payload로 사용자 프로필을 업데이트 | ||
* | ||
* @param {FieldValues} payload - 사용자 프로필을 업데이트할 데이터입니다. | ||
* @returns {Promise<Object>} - 응답 데이터를 반환합니다. | ||
* @throws {Error} - 요청이 실패한 경우 에러를 던집니다. | ||
*/ | ||
bokeeeey marked this conversation as resolved.
Show resolved
Hide resolved
|
||
export async function putEditProfile({ payload, token }: PutEditProfileProps) { | ||
try { | ||
const res = await fetch(`${BASE_URL}/api/v1/users/me`, { | ||
method: 'PUT', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
body: JSON.stringify(payload), | ||
}); | ||
|
||
const result = await res.json(); | ||
return result; | ||
} catch (error) { | ||
throw error; | ||
} | ||
} | ||
|
||
/** | ||
* 주어진 닉네임이 사용 가능한지 확인 | ||
* | ||
* @param {string} nickname - 확인할 닉네임입니다. | ||
* @returns {Promise<Object>} - 닉네임이 사용 가능한지 여부를 나타내는 응답 데이터를 반환합니다. | ||
* @throws {Error} - 요청이 실패한 경우 에러를 던집니다. | ||
*/ | ||
export async function checkNickname(nickname: string) { | ||
try { | ||
const res = await fetch(`${BASE_URL}/api/v1/users/check/nickname?nickname=${nickname}`, { | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
}); | ||
|
||
const result = await res.json(); | ||
return result; | ||
} catch (error) { | ||
throw error; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,7 @@ | ||
'use client'; | ||
|
||
import { InputField } from '@/components'; | ||
import Dropdown from '@/components/Dropdown/Dropdown'; | ||
import classNames from 'classnames/bind'; | ||
import { FormEvent } from 'react'; | ||
|
||
import Breadcrumb from '@/components/Breadcrumb/Breadcrumb'; | ||
import styles from './page.module.scss'; | ||
|
||
const cn = classNames.bind(styles); | ||
|
||
const OPTIONS = ['인기순', '조회순', '최신순', '가격 낮은순', '가격 높은순', '직접 입력']; | ||
import EditProfileModal from '@/app/my-info/_components/UserProfile/EditProfileModal/EditProfileModal'; | ||
|
||
export default function Page() { | ||
const handleSubmit = (e: FormEvent<HTMLFormElement>) => { | ||
e.preventDefault(); | ||
|
||
// const formData = new FormData(e.currentTarget); | ||
// const payload = Object.fromEntries(formData.entries()); | ||
// console.log(payload); | ||
}; | ||
|
||
// const handleClick = (e: MouseEvent<HTMLInputElement>) => { | ||
// console.log('onClick', true, e.currentTarget.value); | ||
// }; | ||
const handleClick = () => {}; | ||
|
||
return ( | ||
<form onSubmit={handleSubmit}> | ||
<InputField | ||
label='비밀번호' | ||
id='이메일' | ||
name='인풋' | ||
type='password' | ||
placeholder='이메일을 입력해 주세요' | ||
suffixIcon='eye' | ||
sizeVariant='md' | ||
/> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<div style={{ width: '600px' }}> | ||
<Dropdown | ||
options={OPTIONS} | ||
name='드롭다운' | ||
sizeVariant='md' | ||
placeholder='fdsa' | ||
onClick={handleClick} | ||
className={cn('dropdown')} | ||
/> | ||
</div> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
{/* <TextField label='텍스트필드' id='텍스트' name='텍스트' placeholder='최소 20자 이상 입력해 주세요' /> */} | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
{/* <RadioField options={OPTIONS} label='숫자' value='6' /> */} | ||
{/* <ItemOverview /> */} | ||
<Breadcrumb /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<button style={{ border: '1px solid', width: '100%', height: '10vh', textAlign: 'center' }} type='submit'> | ||
테스트 | ||
</button> | ||
</form> | ||
); | ||
return <EditProfileModal />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/app/my-info/_components/DeliveryStatus/DeliveryStatus.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// init |
26 changes: 26 additions & 0 deletions
26
src/app/my-info/_components/DeliveryStatus/DeliveryStatus.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import classNames from 'classnames/bind'; | ||
import styles from './DeliveryStatus.module.scss'; | ||
|
||
const cn = classNames.bind(styles); | ||
|
||
const DELIVERY_STATUS_LIST = [ | ||
{ label: '주문접수', count: 1 }, | ||
{ label: '결제완료', count: 0 }, | ||
{ label: '배송준비중', count: 0 }, | ||
{ label: '배송중', count: 0 }, | ||
{ label: '배송완료', count: 0 }, | ||
]; | ||
|
||
export default function DeliveryStatus() { | ||
return ( | ||
<ul className={cn('status-list')}> | ||
{DELIVERY_STATUS_LIST.map((status, i) => ( | ||
<li key={status.label} className={cn('status-item')}> | ||
<span className={cn('status-count', { active: status.count > 0 })}>{status.count}</span> | ||
<span className={cn('status-label', { active: status.count > 0 })}>{status.label}</span> | ||
{i < DELIVERY_STATUS_LIST.length - 1 && <span className={cn('separator')}>></span>} | ||
bokeeeey marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</li> | ||
))} | ||
</ul> | ||
); | ||
} |
23 changes: 23 additions & 0 deletions
23
src/app/my-info/_components/MyInfoEmptyCase/MyInfoEmptyCase.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.empty-case { | ||
flex-direction: column; | ||
width: 100%; | ||
gap: 2.4rem; | ||
padding: 8rem 3.2rem; | ||
border-radius: 0.8rem; | ||
@include flex-center; | ||
|
||
.empty-case-text { | ||
color: $gray-40; | ||
@include pretendard-20-600; | ||
} | ||
|
||
.empty-case-button { | ||
width: 12.8rem; | ||
height: 4rem; | ||
@include pretendard-16-500; | ||
} | ||
} | ||
|
||
.background-color { | ||
background-color: $gray-10; | ||
} |
32 changes: 32 additions & 0 deletions
32
src/app/my-info/_components/MyInfoEmptyCase/MyInfoEmptyCase.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Button } from '@/components'; | ||
import { ROUTER } from '@/constants/route'; | ||
import { AlertIcon } from '@/public/index'; | ||
import classNames from 'classnames/bind'; | ||
import Link from 'next/link'; | ||
import styles from './MyInfoEmptyCase.module.scss'; | ||
|
||
const cn = classNames.bind(styles); | ||
|
||
interface MyInfoEmptyCaseProps { | ||
children: string; | ||
isBackgroundColor?: boolean; | ||
} | ||
|
||
export default function MyInfoEmptyCase({ children, isBackgroundColor }: MyInfoEmptyCaseProps) { | ||
return ( | ||
<div className={cn('empty-case', { 'background-color': isBackgroundColor })}> | ||
<AlertIcon /> | ||
<p className={cn('empty-case-text')}>{children}</p> | ||
<Button | ||
as={Link} | ||
bokeeeey marked this conversation as resolved.
Show resolved
Hide resolved
|
||
href={ROUTER.SHOP.ALL} | ||
backgroundColor='background-gray-40' | ||
className={cn('empty-case-button')} | ||
paddingVertical={8} | ||
radius={4} | ||
> | ||
키득 둘러보기 | ||
</Button> | ||
</div> | ||
); | ||
} |
8 changes: 8 additions & 0 deletions
8
src/app/my-info/_components/RecentProducts/RecentProducts.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.recent { | ||
@include flex-column(4rem); | ||
|
||
.recent-title { | ||
color: $black; | ||
@include pretendard-20-600; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/app/my-info/_components/RecentProducts/RecentProducts.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import classNames from 'classnames/bind'; | ||
import MyInfoEmptyCase from '../MyInfoEmptyCase/MyInfoEmptyCase'; | ||
import styles from './RecentProducts.module.scss'; | ||
|
||
const cn = classNames.bind(styles); | ||
|
||
export default function RecentProducts() { | ||
return ( | ||
<article className={cn('recent')}> | ||
bokeeeey marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<h1 className={cn('recent-title')}>최근 본 상품</h1> | ||
<MyInfoEmptyCase isBackgroundColor>최근 본 상품이 없습니다</MyInfoEmptyCase> | ||
</article> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
환경 변수 config에 등록 안해도 되지 않나요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저도 안올라갈줄 알았는데 이전 커밋 확인해보시면 올라가더라구요
.local붙혀서 수정하긴 했는데 보험차원에서 작성했읍니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
env에 이름을 NEXT_PUBLIC_KEYDEUK_API_BASE_URL라고 등록하면 여기엔 안써도 되는 것 같습니다??