Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/catchroom/FE_CatchRoom into …
Browse files Browse the repository at this point in the history
…feature/#288
  • Loading branch information
LikeFireAndSky committed Jan 27, 2024
2 parents d3155f3 + 422d0d8 commit fd70f77
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 12 deletions.
6 changes: 3 additions & 3 deletions components/home/review/reviewSwiper/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ const ReviewSwiper = () => {
if (isLoading) return <ReviewSkeletonUI />;
return (
<Swiper spaceBetween={12} slidesPerView={1.2} loop={true}>
{data?.list.map((item: ReviewItemType) => {
{data?.list.map((item: ReviewItemType, index: number) => {
return (
<SwiperSlide key={item?.productName}>
<SwiperSlide key={item?.productName + index}>
<ReviewItem
key={item?.productName}
key={item?.productName + index}
productName={item?.productName}
content={item?.content}
date={item?.date}
Expand Down
29 changes: 23 additions & 6 deletions components/mypage/items/sellingItems/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { isProductState } from '@/atoms/sale/productAtom';
import { getReviewState, getSellState } from '@/utils/mypage-utils';
import ReEnrollButton from '../reEnrollButton';
import { mypageRoutingAtom } from '@/atoms/mypage/mypageRoutingAtom';
import { getDotDate } from '@/utils/get-dot-date';

const MItem = ({ item }: { item: MypageSellingType }) => {
const setIsProduct = useSetRecoilState(isProductState);
Expand All @@ -34,6 +35,25 @@ const MItem = ({ item }: { item: MypageSellingType }) => {
// 게시만료일때만 => 판매완료, 기한만료, 판매불가 따지기
const isNothing = item?.dealState ? true : false;

const renderDealState = (dealState: string) => {
switch (dealState) {
case 'EXPIRED':
return (
<>
<p>{getSellState(dealState)}</p>
<ReEnrollButton dealState={dealState} fn={handleEditDate} />
</>
);
case 'DONEDEAL':
return <p>판매일 : {getDotDate(item.endDate, true, true, true)}</p>;
case 'UNSOLD':
case 'UNABLESELL':
return <p>{getSellState(dealState)}</p>;
default:
return <p>게시만료일 ~ {getDotDate(item.endDate, true, true, true)}</p>;
}
};

return (
<div className="w-full px-5 py-3 flex flex-col gap-3">
<div id="container" className="w-full flex flex-col ">
Expand Down Expand Up @@ -67,6 +87,7 @@ const MItem = ({ item }: { item: MypageSellingType }) => {
캐치특가
</span>
)}
s
</div>
{/* 호텔 이름과 가격 정보 */}
<div className="flex flex-col justify-between grow">
Expand All @@ -93,16 +114,12 @@ const MItem = ({ item }: { item: MypageSellingType }) => {
</div>
</div>
<div className="flex gap-2 text-sub text-t3 font-medium">
<p>{getSellState(item.dealState as string)}</p>
<ReEnrollButton
dealState={item?.dealState as string}
fn={handleEditDate}
/>
{renderDealState(item.dealState as string)}
</div>
</div>
</div>
</div>
{item && item.dealState && (
{item && item.dealState === 'DONEDEAL' && (
<ReviewButtons
id={parseInt(item.productId)}
type={listState}
Expand Down
4 changes: 2 additions & 2 deletions components/review/InfiniteScrollWrapper/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ const InfiniteScrollWrapper = () => {
{data ? (
data.pages.map((page, pageIndex) => (
<div key={pageIndex} className="flex flex-col gap-8">
{page.list.map((item: ReviewItemType) => (
{page.list.map((item: ReviewItemType, index: number) => (
<ReviewItem
key={item?.productName}
key={item?.productName + index}
productName={item?.productName}
userName={item?.userName}
date={item?.date}
Expand Down
2 changes: 1 addition & 1 deletion utils/mypage-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const noMask = (value: string) => {
export const getSellState = (state: string) => {
switch (state) {
case 'EXPIRED':
return '기한 만료';
return '게시 기한 만료';
case 'UNSOLD':
return '체크인 만료';
case 'UNABLESELL':
Expand Down

0 comments on commit fd70f77

Please sign in to comment.