-
Notifications
You must be signed in to change notification settings - Fork 0
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/243 #345
Merged
Merged
Feat/243 #345
Changes from 30 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
13ccf39
[feat]:펀딩내역 내부 레이아웃 구현(#243)
devkyoung2 95569f5
[feat] : 펀딩내역 아이템 컴포넌트 구현(#243)
devkyoung2 9797db1
[feat] : 펀딩내역 아이템 타입 지정(#243)
devkyoung2 c64a33f
[feat]: 펀딩내역 api 요청을 위한 함수 구현(#243)
devkyoung2 17b3407
[fix]: getContributedFundingHistory api/응답타입수정(#243)
devkyoung2 7159bb9
Merge branch 'dev' into feat/243
devkyoung2 4896ec9
Merge branch 'dev' into feat/243
devkyoung2 83153dc
[fix]: 잘못된 useDateFilter 상태값 수정(#243)
devkyoung2 8637138
[feat]: 펀딩내역 EmptyItem 추가&춘식이 이미지 임로트 경로 수정(#243)
devkyoung2 610593d
[feat]: 기여한 펀딩내역탭 구현(#243)
devkyoung2 21302e1
[refactor]: 불필요한 타입단언 제거(#243)
devkyoung2 57df1f1
Merge branch 'dev' into feat/243
devkyoung2 a35c3d9
Merge branch 'dev' into feat/243
devkyoung2 fd0ac00
[fix]: 등록한 펀딩내역 api 요청 함수 수정(#243)
devkyoung2 9fb573e
[refactor]: 펀딩내역아이템 타입 파일 분리(#243)
devkyoung2 41fc60b
[feat]: 등록한 펀딩내역탭 구현(#243)
devkyoung2 f77aa3c
[fix]: 잘못된 props 수정(#243)
devkyoung2 43fbf6c
[fix]: 렌더링 로직 수정 및 파일 임포트 경로 수정(#243)
devkyoung2 53d3515
[refactor]: 타입 이름 수정(#243)
devkyoung2 1e3c789
[feat]: 등록한 펀딩 아이템 레이아웃 구현(#243)
devkyoung2 f766e51
[remove]: 필요없는 파일 삭제(#243)
devkyoung2 bb0bed1
[feat]: 기여한 펀딩 아이템 레이아웃 구현(#243)
devkyoung2 19f5d92
[feat]: 등록한 펀딩 아이템 api 연동(#243)
devkyoung2 efe6437
[feat]: 기여한 펀딩 아이템 api 연동(#243)
devkyoung2 d5e5d45
[refactor]: 등록한 펀딩 아이템 상태 타입 상수화(#243)
devkyoung2 4f47087
[feat]: 등록한 펀딩 아이템 등록한 날짜 응답값 추가(#243)
devkyoung2 48fec41
[fix]: 임의의 날짜값 제거 및 필요한 props 전달 (#243)
devkyoung2 18791c1
[feat]: 날짜시간 포매탕 함수 구현(#243)
devkyoung2 1ef3a85
[feat]: 기여한 펀딩 취소시 흐림효과 구현(#243)
devkyoung2 57ae477
[feat]: 등록한 펀딩 취소시 스타일 적용(#243)
devkyoung2 bfa0fa7
Merge branch 'dev' into feat/243
devkyoung2 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
86 changes: 86 additions & 0 deletions
86
...layouts/MyPage/FundingHistory/ContributedFunding/ContributedFundingItem/index.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,86 @@ | ||
@import 'styles/mixins.module'; | ||
|
||
.txt_date { | ||
@include font(15px, 400); | ||
|
||
margin-bottom: 10px; | ||
|
||
.num_data { | ||
@include font(15px, 700); | ||
|
||
margin-left: 5px; | ||
} | ||
} | ||
|
||
.cancel { | ||
opacity: 0.5; | ||
} | ||
|
||
.wrapper_history { | ||
margin-bottom: 30px; | ||
border: 2px solid #ededed; | ||
border-radius: 8px; | ||
box-shadow: 0 1px 2px -1px rgba(0, 0, 0, 6%); | ||
|
||
.section_status { | ||
position: relative; | ||
padding: 16px; | ||
border-bottom: 1px solid #ededed; | ||
|
||
.ico_receiver { | ||
@include ico-gift-order(-125px, -15px, 18px, 12px); | ||
|
||
display: inline-block; | ||
margin: 2px 3px 0 0; | ||
} | ||
|
||
.txt_detail { | ||
@include font(13px, 400, #666); | ||
|
||
position: absolute; | ||
right: 16px; | ||
line-height: 16px; | ||
letter-spacing: -0.024em; | ||
|
||
.ico_detail { | ||
@include ico-gift-order(-100px, -15px, 6px, 10px); | ||
|
||
margin: 0 0 0 4px; | ||
} | ||
} | ||
} | ||
|
||
.section_product { | ||
display: flex; | ||
padding: 16px; | ||
|
||
.thumb_product { | ||
@include size(96px, 96px, 0 10px 0 0, 0); | ||
} | ||
|
||
.info_product { | ||
line-height: 18px; | ||
|
||
.txt_brand { | ||
@include font(14px, 400, #888); | ||
} | ||
|
||
.txt_title { | ||
@include font(14px, 400, #222); | ||
@include text-ellipsis(2); | ||
|
||
display: block; | ||
overflow: hidden; | ||
padding: 4px 0; | ||
} | ||
|
||
.num_price { | ||
@include font(14px, 700, #000); | ||
|
||
.txt_unit { | ||
@include font(14px, 400, #000); | ||
} | ||
} | ||
} | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
src/layouts/MyPage/FundingHistory/ContributedFunding/ContributedFundingItem/index.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,65 @@ | ||
import clsx from 'clsx'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
import { formatNumberWithComma, formatDateAndTime } from 'utils/format'; | ||
|
||
import { ContributedFundingItemType } from 'types/fundingHistory'; | ||
|
||
import styles from './index.module.scss'; | ||
|
||
type ContributedFundingItemProps = { item: ContributedFundingItemType }; | ||
|
||
const ContributedFundingItem = ({ item }: ContributedFundingItemProps) => { | ||
const { product, fundingDetail } = item; | ||
const { productId, name, photo, brandName } = product; | ||
const { contributedAt, creatorName, contributedAmount, status } = | ||
fundingDetail; | ||
|
||
return ( | ||
<Link to={`/product/${productId}`}> | ||
<p | ||
className={clsx(styles.txt_date, { | ||
[styles.cancel]: status === 'CANCEL_REFUND', | ||
})} | ||
> | ||
기여한 날짜 | ||
<span className={styles.num_data}> | ||
{formatDateAndTime(contributedAt)} | ||
</span> | ||
</p> | ||
|
||
<div className={styles.wrapper_history}> | ||
<div className={styles.section_status}> | ||
<span className={styles.ico_receiver} /> | ||
{creatorName} | ||
<span className={styles.txt_detail}> | ||
상세보기 | ||
<span className={styles.ico_detail} /> | ||
</span> | ||
</div> | ||
|
||
<div | ||
className={clsx(styles.section_product, { | ||
[styles.cancel]: status === 'CANCEL_REFUND', | ||
})} | ||
> | ||
<img | ||
src={photo} | ||
alt={`${name}상품이미지`} | ||
className={styles.thumb_product} | ||
/> | ||
<div className={styles.info_product}> | ||
<p className={styles.txt_brand}>{brandName}</p> | ||
<strong className={styles.txt_title}>{name}</strong> | ||
<em className={styles.num_price}> | ||
{formatNumberWithComma(contributedAmount)} | ||
<span className={styles.txt_unit}>원</span> | ||
</em> | ||
</div> | ||
</div> | ||
</div> | ||
</Link> | ||
); | ||
}; | ||
|
||
export default ContributedFundingItem; |
3 changes: 3 additions & 0 deletions
3
src/layouts/MyPage/FundingHistory/ContributedFunding/index.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,3 @@ | ||
.area_funding { | ||
padding: 30px 0 100px; | ||
} |
71 changes: 71 additions & 0 deletions
71
src/layouts/MyPage/FundingHistory/ContributedFunding/index.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,71 @@ | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
import { useEffect, useState } from 'react'; | ||
|
||
import EmptyItem from 'components/feature/EmptyItem'; | ||
import FilterBar from 'components/ui/FilterBar'; | ||
import Spinner from 'components/ui/Spinner'; | ||
|
||
import { useDateFilter } from 'hooks/useDateFilter'; | ||
import { useInfinityScroll } from 'hooks/useInfinityScroll'; | ||
import { getContributedFundingHistory } from 'services/api/v1/fundingHistory'; | ||
|
||
import { ContributedFundingItemType } from 'types/fundingHistory'; | ||
|
||
import ContributedFundingItem from './ContributedFundingItem'; | ||
|
||
import styles from './index.module.scss'; | ||
|
||
const ContributedFunding = () => { | ||
const [fundingItems, setFundingItems] = useState< | ||
ContributedFundingItemType[] | ||
>([]); | ||
const [hasNext, setHasNext] = useState<boolean>(true); | ||
const [page, setPage] = useState<number>(0); | ||
|
||
const { startDate, endDate } = useDateFilter(); | ||
|
||
const { data, isLoading, refetch, isFetched } = useQuery({ | ||
queryKey: ['contributedFundingHistory', startDate, endDate], | ||
queryFn: () => getContributedFundingHistory(startDate, endDate), | ||
}); | ||
|
||
const observingTarget = useInfinityScroll(() => { | ||
if (data) setPage(data.pageNumber + 1); | ||
}, hasNext); | ||
|
||
useEffect(() => { | ||
refetch(); | ||
}, [page]); | ||
|
||
useEffect(() => { | ||
if (data) { | ||
setFundingItems(data.items); | ||
setHasNext(data.hasNext); | ||
} | ||
}, [data]); | ||
|
||
return ( | ||
<> | ||
<section className={styles.area_funding}> | ||
<FilterBar /> | ||
{isFetched && | ||
(fundingItems.length === 0 ? ( | ||
<EmptyItem type="funding_contributed" /> | ||
) : ( | ||
<ul> | ||
{fundingItems.map((item) => ( | ||
<li key={item.fundingDetail.fundingId}> | ||
<ContributedFundingItem item={item} /> | ||
</li> | ||
))} | ||
</ul> | ||
))} | ||
</section> | ||
{isLoading && <Spinner />} | ||
{!isLoading && hasNext && <div ref={observingTarget} />} | ||
</> | ||
); | ||
}; | ||
|
||
export default ContributedFunding; |
87 changes: 87 additions & 0 deletions
87
src/layouts/MyPage/FundingHistory/RegisteredFunding/RegisteredFundingItem/index.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,87 @@ | ||
@import 'styles/mixins.module'; | ||
|
||
.txt_date { | ||
@include font(15px, 400); | ||
|
||
margin-bottom: 10px; | ||
|
||
.num_data { | ||
@include font(15px, 700); | ||
|
||
margin-left: 5px; | ||
} | ||
} | ||
|
||
.wrapper_history { | ||
margin-bottom: 30px; | ||
border: 2px solid #ededed; | ||
border-radius: 8px; | ||
box-shadow: 0 1px 2px -1px rgba(0, 0, 0, 6%); | ||
|
||
.section_status { | ||
position: relative; | ||
padding: 16px; | ||
border-bottom: 1px solid #ededed; | ||
|
||
.txt_detail { | ||
@include font(13px, 400, #666); | ||
|
||
position: absolute; | ||
right: 16px; | ||
line-height: 16px; | ||
letter-spacing: -0.024em; | ||
|
||
.ico_detail { | ||
@include ico-gift-order(-100px, -15px, 6px, 10px); | ||
|
||
margin: 0 0 0 4px; | ||
} | ||
} | ||
} | ||
|
||
.cancel { | ||
color: #f00; | ||
} | ||
} | ||
|
||
.section_product { | ||
display: flex; | ||
padding: 16px; | ||
|
||
.thumb_product { | ||
@include size(96px, 96px, 0 10px 0 0, 0); | ||
} | ||
|
||
.info_product { | ||
line-height: 18px; | ||
|
||
.txt_brand { | ||
@include font(14px, 400, #888); | ||
} | ||
|
||
.txt_title { | ||
@include font(14px, 400, #222); | ||
@include text-ellipsis(2); | ||
|
||
display: block; | ||
overflow: hidden; | ||
padding: 4px 0; | ||
} | ||
} | ||
} | ||
|
||
.txt_price { | ||
@include font(14px, 400, #a5a5a5); | ||
|
||
padding: 5px 6px 0 0; | ||
|
||
.num_price { | ||
@include font(14px, 700, #000); | ||
|
||
margin-left: 10px; | ||
} | ||
|
||
.txt_unit { | ||
@include font(14px, 400, #000); | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
src/layouts/MyPage/FundingHistory/RegisteredFunding/RegisteredFundingItem/index.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,63 @@ | ||
import clsx from 'clsx'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
import { formatNumberWithComma, formatDateAndTime } from 'utils/format'; | ||
|
||
import { | ||
REGISTERED_ITEM_STATUS, | ||
RegisteredFundingItemType, | ||
} from 'types/fundingHistory'; | ||
|
||
import styles from './index.module.scss'; | ||
|
||
type RegisteredFundingItemProps = { | ||
item: RegisteredFundingItemType; | ||
}; | ||
|
||
const RegisteredFundingItem = ({ item }: RegisteredFundingItemProps) => { | ||
return ( | ||
<Link to={`/product/${item.productId}`}> | ||
<p className={styles.txt_date}> | ||
등록한 날짜 | ||
<span className={styles.num_data}> | ||
{formatDateAndTime(item.createdAt)} | ||
</span> | ||
</p> | ||
|
||
<div className={styles.wrapper_history}> | ||
<div | ||
className={clsx(styles.section_status, { | ||
[styles.cancel]: item.status === 'CANCEL', | ||
})} | ||
> | ||
{REGISTERED_ITEM_STATUS[item.status]} | ||
<span className={styles.txt_detail}> | ||
상세보기 | ||
<span className={styles.ico_detail} /> | ||
</span> | ||
</div> | ||
|
||
<div className={styles.section_product}> | ||
<img | ||
src={item.productImage} | ||
alt={`${item.productName}상품이미지`} | ||
className={styles.thumb_product} | ||
/> | ||
<div className={styles.info_product}> | ||
<p className={styles.txt_brand}>{item.brandName}</p> | ||
<strong className={styles.txt_title}>{item.productName}</strong> | ||
<p className={styles.txt_price}> | ||
목표 금액 | | ||
<em className={styles.num_price}> | ||
{formatNumberWithComma(item.goalAmount)} | ||
</em> | ||
<span className={styles.txt_unit}>원</span> | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
</Link> | ||
); | ||
}; | ||
|
||
export default RegisteredFundingItem; |
3 changes: 3 additions & 0 deletions
3
src/layouts/MyPage/FundingHistory/RegisteredFunding/index.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,3 @@ | ||
.area_funding { | ||
padding: 30px 0 100px; | ||
} |
Oops, something went wrong.
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.
PR 내용에 올려주신 사진에는 시간이 undefined로 뜨고 있는데, 실제 API 응답으로 테스트를 못해서 임의의 값을 넣느라고 이런 이슈가 생긴 걸까요?
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.
네! 원래는 이 부분에 등록한 날짜가 와야하는데 지금은 만료일만 받고 있어서 만료일로 테스트 했습니다. 테스트 한 만료일에는 날짜정보밖에 없어서
undefined
가 뜨는데 태환님께 시간정보 포함한 등록한 날짜 추가요청 드렸어요.