Skip to content

Commit

Permalink
Merge pull request #21 from New-Syatte/19-refactor
Browse files Browse the repository at this point in the history
19 refactor
  • Loading branch information
ruddnjs3769 authored Apr 4, 2024
2 parents 85e073b + a4f582b commit de5eeb6
Show file tree
Hide file tree
Showing 113 changed files with 915 additions and 1,879 deletions.
2 changes: 2 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
const nextConfig = {
images: {
domains: ["cdn.sanity.io"],
deviceSizes: [320, 420, 768, 1024, 1200],
imageSizes: [16, 32, 48, 64, 96, 128, 256, 512],
},
experimental: {
// serverActions 기능을 활성화합니다.
Expand Down
16 changes: 13 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"@tosspayments/payment-sdk": "^1.6.1",
"@tosspayments/payment-widget-sdk": "^0.10.1",
"axios": "^1.6.7",
"classnames": "^2.3.2",
"dayjs": "^1.11.10",
"eslint": "8.41.0",
"eslint-config-next": "13.4.4",
Expand All @@ -36,7 +35,6 @@
"react-slick": "^0.30.1",
"react-toastify": "^9.1.3",
"react-youtube": "^10.1.0",
"sass": "^1.62.1",
"slick-carousel": "^1.8.1",
"swr": "^2.2.4",
"typescript": "^5.0.4"
Expand Down
3 changes: 1 addition & 2 deletions src/app/(auth)/signin/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ type Props = {
};
};

export default async function SingPage({
export default async function SignInPage({
searchParams: { callbackUrl },
}: Props) {
const session = await getServerSession(authOptions); // 서버에서 session 정보 호출

if (session) {
alert("이미 로그인 되어있습니다.");
redirect("/");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { GrNext, GrPrevious } from "react-icons/gr";
import logo from "public/brand/midasmetall-img/midasmetall-logo.png";
import YouTubeVideo from "@/components/youTubeVideo/YouTubeVideo";
import SubTitleBox from "@/components/subTitleBox/SubTitleBox";
import BrandSlider from "@/components/brandSlider/BrandSlider";
// import BrandSlider from "@/components/brandSlider/BrandSlider";
import StoreSlider from "@/components/storeSlider/StoreSlider";
import { useState } from "react";
import ProductInfoList from "@/components/productInfoList/ProductInfoList";
Expand Down
82 changes: 0 additions & 82 deletions src/app/(cart)/cart/CartClient.module.scss

This file was deleted.

34 changes: 13 additions & 21 deletions src/app/(cart)/cart/CartClient.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"use client";

import { useRouter } from "next/navigation";
import styles from "./CartClient.module.scss"; // 스타일 설정
import Image from "next/image";
import { useDispatch, useSelector } from "react-redux";
import {
Expand All @@ -21,9 +20,10 @@ import Heading from "@/components/heading/Heading";
import Link from "next/link";
import priceFormat from "@/utils/priceFormat";
import Button from "@/components/button/Button";
import { ICartItem } from "@/type";
import { CartItem } from "@/type/cart";
import { AiFillCaretDown, AiFillCaretUp } from "react-icons/ai";
import deliveryFee from "@/constants/deliveryFee";
import URLS from "@/constants/urls";

const ICON_CLASS =
"flex text-[24px] transition-all cursor-pointer hover:text-brand hover:scale-200 mx-1 ";
Expand All @@ -36,16 +36,14 @@ export default function CartClient() {
const dispatch = useDispatch();
const router = useRouter();

const increaseCart = (cart: ICartItem) => {
// 일단 타입을 any 로 임시 지정
const increaseCart = (cart: CartItem) => {
dispatch(ADD_TO_CART(cart));
};
const decreaseCart = (cart: ICartItem) => {
// 일단 타입을 any 로 임시 지정
const decreaseCart = (cart: CartItem) => {
dispatch(DECREASE_CART(cart));
};

const removeCart = (cart: ICartItem) => {
const removeCart = (cart: CartItem) => {
dispatch(REMOVE_FROM_CART(cart));
};

Expand All @@ -55,7 +53,7 @@ export default function CartClient() {

const url = typeof window !== "undefined" ? window.location.href : "";
const checkout = () => {
router.push("/checkout-address");
router.push(URLS.CHECKOUT_ADDRESS);
};
// url, checkout은 사용되지 않고 잇다

Expand All @@ -66,7 +64,7 @@ export default function CartClient() {
}, [dispatch, cartItems]);

return (
<section className={styles.table}>
<section className="w-[1280px] mx-auto my-12 min-h-[44.6vh]">
<Heading title={"장바구니"} />
{cartItems.length === 0 ? (
<>
Expand All @@ -76,7 +74,7 @@ export default function CartClient() {
<div
className={"text-center font-bold text-[30px] border-[2px] mt-4"}
>
<Link href={"/products/all"}>계속 쇼핑하기</Link>
<Link href={URLS.PRODUCT_STORE}>계속 쇼핑하기</Link>
</div>
</>
) : (
Expand All @@ -85,7 +83,7 @@ export default function CartClient() {
{cartItems.map(cart => {
const { id, name, imageURL, price, cartQuantity } = cart;
return (
<>
<div key={cart.id}>
<div
className={"flex justify-between items-center px-3"}
key={id}
Expand Down Expand Up @@ -117,27 +115,21 @@ export default function CartClient() {
{priceFormat(price * cartQuantity)}
</p>
<div>
<Button
type="button"
style="py-3 px-12"
onClick={() => removeCart(cart)}
>
삭 제
</Button>
<Button onClick={() => removeCart(cart)}>삭 제</Button>
</div>
</div>
<div className={"border-[1px] mt-4"} />
</>
</div>
);
})}
</>
)}
<div className={styles.summary}>
<div className="mt-8 flex justify-between items-start">
<Button type="button" style="py-3 px-12" onClick={clearCart}>
카트 비우기
</Button>

<div className={styles.checkout}>
<div>
<div className={"flex justify-between items-center"}>
<p className={"text-[20px]"}>전체 상품 개수</p>
<p className={"text-[24px]"}>{cartTotalQuantity}</p>
Expand Down
4 changes: 2 additions & 2 deletions src/app/(cart)/cart/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import CartClient from "@/app/(cart)/cart/CartClient";
import { authOptions } from "@/app/api/auth/[...nextauth]/route";
import URLS from "@/constants/urls";
import { getServerSession } from "next-auth";
import { redirect } from "next/navigation";

export default async function CartPage() {
const session = await getServerSession(authOptions);
console.log(session);
if (!session) {
redirect("/signin");
redirect(URLS.SIGNIN);
}

return (
Expand Down
40 changes: 0 additions & 40 deletions src/app/(checkout)/checkout-address/CheckoutAddress.module.scss

This file was deleted.

Loading

0 comments on commit de5eeb6

Please sign in to comment.