Skip to content
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] 이벤트페이지 #174

Merged
merged 51 commits into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
5464385
Feat: 이벤트 윗부분
Young2un Jul 17, 2024
3585ab6
Feat: 이벤트 타이틀 컴포넌트 구현
Young2un Jul 17, 2024
07b7962
Fix: hasShop 옵셔널로 변경
Young2un Jul 17, 2024
3434630
Feat: 가입혜택 하는 중
Young2un Jul 17, 2024
4c7434b
Feat: 이벤트 상단고정탭 제작중 (수정 예정)
Young2un Jul 17, 2024
5f5dacf
Feat: 레이아웃 구성 중
Young2un Jul 17, 2024
7ec731b
Merge: branch 'develop' of https://github.com/Quad8/quad8-front into …
Young2un Jul 19, 2024
b8c42d7
Style: alt 속성 추가
Young2un Jul 19, 2024
4f9dbd0
Style: 오타 수정
Young2un Jul 22, 2024
a9f9a2f
Feat: 1차 휠 구현
Young2un Jul 22, 2024
da20a7a
Feat: 룰렛 로직까지 구현
Young2un Jul 30, 2024
0b6cc42
Style: 페이지네이션 글씨 크기 수정
Young2un Aug 2, 2024
3913bf6
Style: 카테고리 클릭범위 스타일 수정
Young2un Aug 2, 2024
00b884f
Style: 오타있길래 수정했슴당
Young2un Aug 3, 2024
75fb6a3
Style: 토큰 필요없는 부분이라 삭제
Young2un Aug 3, 2024
12651ab
Feat: 이미지 추가
Young2un Aug 4, 2024
5aead6f
Feat: 룰렛 1일 1회 로직 추가
Young2un Aug 4, 2024
ca7fa53
Chore: 컨페티 라이브러리 설치
Young2un Aug 4, 2024
ca49a68
Feat: 이벤트 프리패치, 기타적인거 수정
Young2un Aug 4, 2024
735f7b8
Style: 오타수정
Young2un Aug 11, 2024
e3d8034
Style: 오타수정
Young2un Aug 11, 2024
f337081
Merge: branch 'develop' of https://github.com/Quad8/quad8-front into …
Young2un Aug 12, 2024
2758e85
Docs: 이미지, 아이콘 추가
Young2un Aug 12, 2024
c506339
Feat: 배송비무료 부분 완성
Young2un Aug 12, 2024
1c1c547
Refactor: 뮤테이션 커스텀 훅으로 빼고 기타 수정
Young2un Aug 12, 2024
59ea522
Feat: 이벤트 마지막부분 수정
Young2un Aug 12, 2024
251f43a
Feat: 회원가입 쿠폰존 구현
Young2un Aug 12, 2024
ef5ee18
Fix: post 시 메세지를 활용할 수 있게 api 변경
Young2un Aug 12, 2024
f674c3a
Feat: 스크롤 감지 active
Young2un Aug 12, 2024
126cb0b
Style: px 실수 수정
Young2un Aug 12, 2024
ffd4a89
Refactor: 대소문자 수정
Young2un Aug 12, 2024
8008500
Fix: src/types/CouponTypes.ts 삭제
Young2un Aug 12, 2024
2c35cbd
Merge: branch '161-feat-이벤트페이지' of https://github.com/Quad8/quad8-fro…
Young2un Aug 12, 2024
ac1caed
Refactor: 베럴 방식으로 변경
Young2un Aug 13, 2024
607b245
Refactor: 리뷰 반영
Young2un Aug 13, 2024
676151b
Style: 사소한 단어 수정
Young2un Aug 13, 2024
5f5b68a
Merge branch 'develop' into 161-feat-이벤트페이지
Young2un Aug 13, 2024
245737f
Merge: branch '161-feat-이벤트페이지' of https://github.com/Quad8/quad8-fro…
Young2un Aug 13, 2024
f77406b
Merge: 풀당겨온거 머지
Young2un Aug 13, 2024
1d9e9f3
Style: 대소문자 이슈,,
Young2un Aug 13, 2024
72afd5a
Style: type 추가
Young2un Aug 16, 2024
c742f0b
Fix: 민정님 요청 변경사항
Young2un Aug 16, 2024
b3f1f28
Style: 대소문자 오타 수정
Young2un Aug 16, 2024
bbacd7a
Refactor: 보경님 리뷰 반영
Young2un Aug 16, 2024
909a0a3
Fix: 머지 안되는 이슈
Young2un Aug 16, 2024
5fddf24
Fix: 풀안되는 이슈
Young2un Aug 16, 2024
2fe7576
Merge: branch 'develop' of https://github.com/Quad8/quad8-front into …
Young2un Aug 16, 2024
ed83118
Fix: import 오류 수정
Young2un Aug 16, 2024
227db85
Chore: 이거 안올리니까 푸시가 안됨
Young2un Aug 16, 2024
d458106
Fix: import 이슈
Young2un Aug 16, 2024
a78119b
Merge branch 'develop' into 161-feat-이벤트페이지
Young2un Aug 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,260 changes: 258 additions & 1,002 deletions package-lock.json

Large diffs are not rendered by default.

Binary file added public/images/backconfetti.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/couponDown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/delivery.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/eventTop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/point.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/roulette.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 11 additions & 1 deletion public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export { default as LinkCopyIcon } from '@/public/svgs/link.svg';
export { default as ShareIcon } from '@/public/svgs/share.svg';

export { default as CalendarIcon } from './svgs/calendar.svg';
export { default as FreeIcon } from './svgs/free.svg';
export { default as KeydeukBlueIcon } from './svgs/keydeukBlueIcon.svg';
export { default as ResetIcon } from './svgs/reset.svg';
export { default as SearchIcon } from './svgs/search.svg';
export { default as SoundVibrationIcon } from './svgs/soundVibration.svg';
Expand All @@ -47,17 +49,21 @@ export { default as ThumbIcon } from './svgs/thumb.svg';
export { default as UserIcon } from './svgs/user.svg';
export { default as VerticalTripleDotIcon } from './svgs/verticalTripleDot.svg';
export { default as WarnCircleIcon } from './svgs/warnCircle.svg';
export { default as KeydeukBlueIcon } from './svgs/keydeukBlueIcon.svg';

export { default as eventTopImg } from './images/eventTop.png';
export { default as ErrorIcon } from './svgs/404.svg';
export { default as CloverIcon } from './svgs/clover.svg';
export { default as FailIcon } from './svgs/failIcon.svg';

export { default as backConfettiImg } from './images/backconfetti.png';
export { default as banner1Img } from './images/banner1.png';
export { default as banner2Img } from './images/banner2.png';
export { default as blackSwitchImg } from './images/blackSwitch.jpg';
export { default as blueSwitchImg } from './images/blueSwitch.jpg';
export { default as brownSwitchImg } from './images/brownSwitch.jpg';
export { default as deliveryImg } from './images/delivery.png';
export { default as errorImg } from './images/error.png';

export { default as guide1Img } from './images/guide1.png';
export { default as guide2Img } from './images/guide2.png';
export { default as guide3Img } from './images/guide3.png';
Expand All @@ -68,6 +74,10 @@ export { default as heroItem3Img } from './images/heroItem3.png';
export { default as heroItem4Img } from './images/heroItem4.png';
export { default as heroItem5Img } from './images/heroItem5.png';
export { default as heroItem6Img } from './images/heroItem6.png';
export { default as pointImg } from './images/point.png';
export { default as rouletteImg } from './images/roulette.png';

export { default as couponDownImg } from './images/couponDown.png';
export { default as keydeukProfileImg } from './images/kedeukProfile.png';
export { default as keydeukImg } from './images/keydeuk.png';
export { default as myProfileImg } from './images/myProfile.jpeg';
Expand Down
10 changes: 10 additions & 0 deletions public/svgs/clover.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/svgs/free.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 25 additions & 12 deletions src/api/couponAPI.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,43 @@
import { getCookie } from '@/libs/manageCookie';
import { CouponTypes } from '@/types/couponType';
import { CouponResponse, CreateCouponType } from '@/types/couponType';

const BASE_URL = process.env.NEXT_PUBLIC_KEYDEUK_API_BASE_URL;

export const getCoupons = async (): Promise<CouponTypes[] | null> => {
export const postCreateCoupon = async (payload: CreateCouponType) => {
const token = await getCookie('accessToken');

if (!token) {
return null;
try {
const response = await fetch(`${BASE_URL}/api/v1/coupon/create`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`,
},
body: JSON.stringify(payload),
});
if (!response.ok) {
const errorData = await response.json(); // 서버에서 반환된 에러 메시지를 추출
throw new Error(errorData.message || '쿠폰 생성에 실패했습니다.'); // 에러 메시지를 포함시켜 에러 던지기
}
} catch (error) {
throw error;
}
};

export const getCoupon = async (): Promise<CouponResponse[]> => {
const token = await getCookie('accessToken');

try {
const res = await fetch(`${BASE_URL}/api/v1/user/coupon`, {
const response = await fetch(`${BASE_URL}/api/v1/user/coupon`, {
cache: 'no-cache',
headers: {
'Cache-Control': 'no-cache',
Authorization: `Bearer ${token}`,
Authorization: token ? `Bearer ${token}` : '',
},
});
const { data } = await res.json();

if (res.ok) {
return data;
}
const rawData = await response.json();

throw new Error(data.message || '쿠폰을 가져오는데 실패하였습니다.');
return rawData.data;
} catch (error) {
throw error;
}
Expand Down
3 changes: 0 additions & 3 deletions src/api/productAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,11 @@ export const getProductDetail = async (productId: number): Promise<ProductType>
};

export async function getAllProductList({ sort, page, size }: ProductParams): Promise<ProductListResponse> {
const token = await getCookie('accessToken');

try {
const response = await fetch(`${BASE_URL}/api/v1/product/all?&sort=${sort}&page=${page}&size=${size}`, {
cache: 'no-cache',
headers: {
'Cache-Control': 'no-cache',
Authorization: token ? `Bearer ${token}` : '',
},
});
const rawData: ProductListResponse = await response.json();
Expand Down
2 changes: 1 addition & 1 deletion src/app/(test)/dw/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export default function Page() {
<div className={cn('auth-section-wrapper')}>
{AUTH_SECTION.map((text, i) => (
<div key={text} className={cn('auth-section')}>
<div className={cn('auth-section-text')} onClick={() => handleClickLink(ROUTER.AHTH.SIGN_UP)}>
<div className={cn('auth-section-text')} onClick={() => handleClickLink(ROUTER.AUTH.SIGN_UP)}>
{text}
</div>
{i === 2 || <div className={cn('bar')}>|</div>}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import type {
CustomKeyboardStepTypes,
OptionDataType,
} from '@/types/customKeyboardType';
import CartModal from './CartModal';
import OptionProductModal from './OptionProductModal';

import CartModal from './CartModal';
import styles from './TotalCostWithNavigation.module.scss';

const cn = classNames.bind(styles);
Expand Down Expand Up @@ -152,7 +152,7 @@ export default function TotalCostWithNavigation() {
setIsOpenCartModal(true);
};

const handleCloseCartMoal = () => {
const handleCloseCartModal = () => {
if (isOpenAnyModalOnCartModal) {
return;
}
Expand Down Expand Up @@ -229,13 +229,13 @@ export default function TotalCostWithNavigation() {
openCartModal={handleOpenCartModal}
/>
</Modal>
<Modal isOpen={isOpenCartModal} onClose={handleCloseCartMoal}>
<Modal isOpen={isOpenCartModal} onClose={handleCloseCartModal}>
<CartModal
optionData={optionData}
optionPrice={optionPrice}
isOpenConfirmDialog={isOpenConfirmDialog}
isOpenLoginModal={isOpenLoginModal}
onClose={handleCloseCartMoal}
onClose={handleCloseCartModal}
updateOptionPrice={updateOptionPrice}
changeConfirmDialog={handleConfirmDialog}
changeLoginModal={setIsOpenLoginModal}
Expand Down
34 changes: 34 additions & 0 deletions src/app/event/_components/BenefitDelivery.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.container {
width: 100%;
background-color: $white;
scroll-margin-top: 10rem;
}

.inner {
@include inner;
}

.delivery-img-wrap {
position: relative;
}

.delivery-img-wrap,
.center {
@include flex-center;
}

.center {
@include pretendard-16-400;

width: 49.4rem;
margin: 0 auto 20rem;
padding: 3rem;
border: 0.1rem solid $gray-50;
color: $gray-50;
}

.icon {
position: absolute;
top: 0;
right: 20rem;
}
23 changes: 23 additions & 0 deletions src/app/event/_components/BenefitDelivery.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { FreeIcon, deliveryImg } from '@/public/index';
import classNames from 'classnames/bind';
import Image from 'next/image';
import styles from './BenefitDelivery.module.scss';
import EventTitle from './EventTitle';

const cn = classNames.bind(styles);
export default function BenefitDelivery() {
return (
<section id='delivery' className={cn('container')}>
<EventTitle title='배송비 FREE' color='black'>
키득은 하나를 사도 <br /> 배송비 무료
</EventTitle>
<div className={cn('inner')}>
<div className={cn('delivery-img-wrap')}>
<Image src={deliveryImg} width={557} height={526} alt='무료배송이미지' className={cn('delivery-img')} />
<FreeIcon className={cn('icon')} />
</div>
<span className={cn('center')}> 📌 키캡은 세트 구매시에만 적용됩니다</span>
</div>
</section>
);
}
54 changes: 54 additions & 0 deletions src/app/event/_components/BenefitJoin.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
.container {
width: 100%;
background-image: linear-gradient(#ecf5fe, #fff);
scroll-margin-top: 10rem;
}

.inner {
@include inner;
}

.coupon-area {
@include flex-center;

flex-wrap: wrap;
margin: 8rem 0;
gap: 5.2rem;
}

.coupon-down {
position: relative;
width: 49.4rem;
height: 24rem;
}

.coupon {
position: absolute;
top: 0;
left: 0;
}

.discount {
position: absolute;
top: 10rem;
left: 3.6rem;
color: $white;
font-size: 7.4rem;
font-style: normal;
font-weight: 900;
line-height: 3.2rem;
}

.min-price {
position: absolute;
top: 15rem;
left: 4rem;
color: $white;
@include pretendard-24-500;
}

.button {
max-width: 49.4rem;
margin: 0 auto 16rem;
background-color: #212530;
}
67 changes: 67 additions & 0 deletions src/app/event/_components/BenefitJoin.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
'use client';

import { Button } from '@/components';
import SignInModal from '@/components/SignInModal/SignInModal';
import { COUPON_LIST } from '@/constants/event';
import { useCreateCouponMutation } from '@/hooks/useCreateCouponMutation';
import { couponDownImg } from '@/public/index';
import type { CouponDataType } from '@/types/couponType';
import { useQueryClient } from '@tanstack/react-query';
import classNames from 'classnames/bind';
import Image from 'next/image';
import Link from 'next/link';
import { useState } from 'react';
import styles from './BenefitJoin.module.scss';
import EventTitle from './EventTitle';

const cn = classNames.bind(styles);

export default function BenefitJoin() {
const [isLoginOpen, setIsLoginOpen] = useState(false);
const queryClient = useQueryClient();

const { mutate: createCoupon } = useCreateCouponMutation();

const handleClick = async (price: number, minPrice: string) => {
const couponData = queryClient.getQueryData<CouponDataType>(['userData']);

if (!couponData?.data) {
setIsLoginOpen(true);
return;
}
createCoupon({
name: '웰컴 쿠폰',
price,
minPrice: +minPrice.slice(0, 1) * 10000,
expiredDate: new Date(),
isWelcome: true,
});
};
return (
<section id='join' className={cn('container')}>
<EventTitle title='WELCOME 쿠폰' color='black'>
즉시 사용가능한 <br /> 신규 가입 쿠폰 증정
</EventTitle>
<div className={cn('inner')}>
<div className={cn('coupon-area')}>
{COUPON_LIST.map(({ price, minPrice }) => (
<button
className={cn('coupon-down')}
key={minPrice}
type='button'
onClick={() => handleClick(price, minPrice)}
>
<Image className={cn('coupon')} src={couponDownImg} alt='쿠폰이미지' fill />
<h3 className={cn('discount')}>{price.toLocaleString()}</h3>
<span className={cn('min-price')}>{minPrice}</span>
</button>
Comment on lines +48 to +57
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

크기가 커서 버튼 말고 div로 감싸도 될 것 같다는 개인적인 생각입니다~

))}
</div>
<Button className={cn('button')} as={Link} href='/'>
쿠폰함 가기
</Button>
</div>
<SignInModal isOpen={isLoginOpen} onClose={() => setIsLoginOpen(false)} />
</section>
);
}
9 changes: 9 additions & 0 deletions src/app/event/_components/BenefitRoulette.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.container {
width: 100%;
background-color: #3363ff;
scroll-margin-top: 10rem;
}

.inner {
@include inner;
}
19 changes: 19 additions & 0 deletions src/app/event/_components/BenefitRoulette.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import classNames from 'classnames/bind';
import styles from './BenefitRoulette.module.scss';
import EventTitle from './EventTitle';
import Wheel from './Wheel';

const cn = classNames.bind(styles);

export default function BenefitRoulette() {
return (
<section id='roulette' className={cn('container')}>
<EventTitle title='랜덤쿠폰 증정' color='white'>
매일 9시 한번 100% 당첨 <br /> 쿠폰 룰렛 돌리기!
</EventTitle>
<div className={cn('roulette-zone')}>
<Wheel />
</div>
</section>
);
}
Loading