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

Fix: 상품리스트 QA 반영 #254

Merged
merged 6 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/pages/home/components/SpecialServices/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const SpecialServices = () => {
<div className="title">
<div>
<h2>HAPPY NEW YEAR</h2>
<h3>새해 핫플레이스 양도숙박권 모음</h3>
<h3>2024년을 시작하는 신년 파티룸</h3>
</div>
<ArrowRight />
</div>
Expand Down
30 changes: 16 additions & 14 deletions src/pages/products/components/NoProduct/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,22 @@ import * as S from "./styles";
const NoProduct = () => {
return (
<S.Container>
<NoProductIcon />
<S.BannerWrapper
initial={{ y: "30px", opacity: 0.3 }}
animate={{
y: 15,
opacity: 1,
transition: {
duration: 0.3,
ease: "easeOut"
}
}}
>
<NoProductBanner />
</S.BannerWrapper>
<a href="https://www.yanolja.com/" target="_blank">
<NoProductIcon />
<S.BannerWrapper
initial={{ y: "30px", opacity: 0.3 }}
animate={{
y: 15,
opacity: 1,
transition: {
duration: 0.3,
ease: "easeOut"
}
}}
>
<NoProductBanner />
</S.BannerWrapper>
</a>
</S.Container>
);
};
Expand Down
6 changes: 3 additions & 3 deletions src/pages/products/components/Order/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ const orderList = [
];

const Order = () => {
const [open, setOpen] = useState(false);
const [searchParams, setSearchParams] = useSearchParams();
const orderParams = searchParams.get("order");

const [open, setOpen] = useState(false);
const { isCheck, setIsCheck } = CheckStore(); // useState 호출을 조건부 렌더링 외부로 이동

const handleClick = (orderId: string) => {
searchParams.set("order", orderId);
setSearchParams(searchParams);
};

const { isCheck, setIsCheck } = CheckStore();

const orderLabel = orderList.find((list) => list.id === orderParams);

return (
Expand Down
44 changes: 23 additions & 21 deletions src/pages/products/components/ProductCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ interface ProductCardProps {
}

const ProductCard = ({ product }: ProductCardProps) => {
const { isCheck } = CheckStore();

if (product.status === "SOLD_OUT" && isCheck) {
return null;
}

const { recentItem, setRecentItem } = RecentStore();

useEffect(() => {
Expand All @@ -32,6 +26,12 @@ const ProductCard = ({ product }: ProductCardProps) => {
}
}, [recentItem]);

const { isCheck } = CheckStore();

if (product.status === "SOLD_OUT" && isCheck) {
return null;
}

const handleLocalStorage = () => {
const updateRecentItem: RecentType = {
id: product.id,
Expand Down Expand Up @@ -77,21 +77,23 @@ const ProductCard = ({ product }: ProductCardProps) => {
</S.UserContainer>
</S.StarUserContainer>
<S.RightInnerContainer>
<S.TimerNegoContainer>
<S.TimerContainer>
<S.TimerIcon />
<S.TimerText>{formatRemainingTime(product.saleEnd)}</S.TimerText>
</S.TimerContainer>
{product.canNegotiate ? (
<S.NegoContainer>
<p>가격제안가능</p>
</S.NegoContainer>
) : (
<S.NoNegoContainer>
<p>가격제안불가</p>
</S.NoNegoContainer>
)}
</S.TimerNegoContainer>
{product.status !== "SOLD_OUT" && (
<S.TimerNegoContainer>
<S.TimerContainer>
<S.TimerIcon />
<S.TimerText>{formatRemainingTime(product.saleEnd)}</S.TimerText>
</S.TimerContainer>
{product.canNegotiate ? (
<S.NegoContainer>
<p>가격제안가능</p>
</S.NegoContainer>
) : (
<S.NoNegoContainer>
<p>가격제안불가</p>
</S.NoNegoContainer>
)}
</S.TimerNegoContainer>
)}
<S.PriceContainer>
<S.PriceText>원가</S.PriceText>
<S.Price>{numberFormat(product.price)}</S.Price>
Expand Down
12 changes: 8 additions & 4 deletions src/pages/products/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ const Products = () => {
const navigate = useNavigate();

const customBack = () => {
setMapOpen();
navigate(location.pathname);
if (isMapOpen) {
setMapOpen();
navigate(location.pathname);
} else {
navigate("/");
}
};

return (
Expand All @@ -27,8 +31,8 @@ const Products = () => {
title={isMapOpen ? "지도검색" : "상품리스트"}
type={isMapOpen ? "backClose" : "back"}
hasBorder={false}
isCustom={isMapOpen}
{...(isMapOpen && { customBack: customBack })}
isCustom={true}
{...{ customBack: customBack }}
/>
<S.Container>
<Link to="/search">
Expand Down
2 changes: 1 addition & 1 deletion src/pages/products/stores/checkStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ interface CheckState {
setIsCheck: (check: boolean) => void;
}

const CheckStore = create<CheckState>((set) => ({
const CheckStore = create<CheckState>()((set) => ({
isCheck: false,
setIsCheck: (check: boolean) =>
set({
Expand Down
4 changes: 2 additions & 2 deletions src/pages/speicialProducts/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import UpperNavBar from "@components/navBar/upperNavBar";
import useProducts from "@pages/products/api/queries";
// import Order from "@pages/products/components/Order";
import Order from "@pages/products/components/Order";
import ProductCard from "@pages/products/components/ProductCard";
import logo from "@assets/2024_dragon.png";
import { ScrollRestoration } from "react-router-dom";
Expand All @@ -22,7 +22,7 @@ const SpecialProducts = () => {
<p>2024년을 시작하는 신년 파티룸</p>
</div>
</S.Wrapper>
{/* <Order /> */}
<Order />
{products.map((product) => (
<ProductCard key={product.id} product={product} />
))}
Expand Down
Loading