Skip to content

Commit

Permalink
Merge pull request #52 from prgrms-web-devcourse-final-project/featur…
Browse files Browse the repository at this point in the history
…e/homepage

Fix: 각종 오류 및 요구사항 수정
  • Loading branch information
cho1ys authored Dec 9, 2024
2 parents e53ce7a + 20fca33 commit 1ad09dc
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 19 deletions.
20 changes: 8 additions & 12 deletions src/components/common/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,6 @@ const Header = () => {
setIsMobileMenuOpen(!isMobileMenuOpen);
};

const handleCommunityClick = (
e: React.MouseEvent<HTMLAnchorElement, MouseEvent>
) => {
if (!isLoggedIn || !isAdmin) {
e.preventDefault();
alert('로그인 후 이용할 수 있는 페이지입니다.');
setIsMobileMenuOpen(!isMobileMenuOpen);
}
};

return (
<HeaderContainer>
<HeaderContent>
Expand Down Expand Up @@ -57,15 +47,21 @@ const Header = () => {
</StyledLink>
</NavItem>
<NavItem>
<StyledLink to="/community/post" onClick={handleCommunityClick}>
<StyledLink to="/community/post" onClick={toggleMobileMenu}>
Community
</StyledLink>
</NavItem>
<NavItem>
{isLoggedIn && (
<StyledLink
to={isAdmin ? '#' : '/mypage/setting'}
onClick={toggleMobileMenu}
onClick={(e) => {
if (isAdmin) {
e.preventDefault(); // Admin일 경우 링크 동작 차단
} else {
toggleMobileMenu();
}
}}
>
{isAdmin ? 'Admin Page' : 'My Page'}
</StyledLink>
Expand Down
4 changes: 2 additions & 2 deletions src/components/pages/Payment/PaymentFailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const PaymentFailPage = () => {
const productId = Number(id);
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const amount = urlParams.get('totalAmount');
const price = urlParams.get('price');
const { data: product, isLoading, isError } = useProductQuery(productId);

if (!product) {
Expand All @@ -33,7 +33,7 @@ const PaymentFailPage = () => {
</SummaryRow>
<SummaryRow>
<Label>결제 금액</Label>
<Value>{amount}</Value>
<Value>{price}</Value>
</SummaryRow>
</OrderSummary>
</FailureSection>
Expand Down
4 changes: 2 additions & 2 deletions src/components/pages/Payment/PaymentSuccessPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const PaymentSuccessPage = () => {
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);

const amount = urlParams.get('totalAmount');
const price = urlParams.get('price');

const { data: product, isLoading, isError } = useProductQuery(productId);

Expand All @@ -34,7 +34,7 @@ const PaymentSuccessPage = () => {
</SummaryRow>
<SummaryRow>
<Label>결제 금액</Label>
<Value>{amount}</Value>
<Value>{price}</Value>
</SummaryRow>
</OrderSummary>
</SuccessSection>
Expand Down
4 changes: 2 additions & 2 deletions src/components/pages/ProductDetailPage/ProductDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const ProductDetail: React.FC = () => {
const { quantity, setQuantity } = useQuantity();
const [remainingTime, setRemainingTime] = useState('');
const navigate = useNavigate();
const isOutOfStock = product ? product.now >= product.currentStock : false;
const isOutOfStock = product ? product.currentStock < 0 : false;
const isDeadlinePassed = remainingTime === '마감되었습니다.';
const isButtonDisabled = isOutOfStock || isDeadlinePassed;
useEffect(() => {
Expand Down Expand Up @@ -209,7 +209,7 @@ const Stars = styled.div`
position: absolute;
font-size: 20px;
color: #ffaa00;
bottom: 80px;
bottom: 13%;
right: 2%;
@media (min-width: 768px) and (max-width: 1024px) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/ProductPage/ProductComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const ProductComponent: React.FC<ProductComponentProps> = ({
const filteredProducts =
selectedText === '마감 상품'
? products.filter(
(p) => p.available === false && new Date(p.deadline) < new Date()
(p) => p.available === false || new Date(p.deadline) < new Date()
)
: products.filter(
(p) => p.available === true && new Date(p.deadline) > new Date()
Expand Down

0 comments on commit 1ad09dc

Please sign in to comment.