From f05fb42233353fdb493e943773d036e838aa2d89 Mon Sep 17 00:00:00 2001 From: y00eunji Date: Mon, 1 Jun 2026 08:40:41 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20onClick=20navigate=20=EB=8C=80=EC=8B=A0?= =?UTF-8?q?=20Link=EB=A5=BC=20=EC=82=AC=EC=9A=A9=ED=95=B4=20Ctrl+=ED=81=B4?= =?UTF-8?q?=EB=A6=AD(=EC=83=88=20=ED=83=AD)=20=EB=8F=99=EC=9E=91=20?= =?UTF-8?q?=EC=A7=80=EC=9B=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 사용자 사이트(2025/2026/participant-portal)의 클릭 이동을 component={Link} 기반으로 전환: - 장바구니 아이콘, 로그인 버튼, 유저 메뉴(주문내역/로그인) - 프로필 편집/감사/세션 목록, 프로필 메뉴 결제·로그인 완료 후 프로그램 이동과 Router 컨텍스트 밖 스낵바 버튼은 navigate() 유지. --- .../layout/CartBadgeButton/index.tsx | 9 ++++---- .../components/layout/SignInButton/index.tsx | 19 ++++++---------- .../layout/CartBadgeButton/index.tsx | 14 ++++-------- .../layout/UserMenuButton/index.tsx | 10 ++++----- .../src/components/layout.tsx | 22 ++++++++----------- .../src/components/pages/home.tsx | 10 ++++----- 6 files changed, 33 insertions(+), 51 deletions(-) diff --git a/apps/pyconkr-2025/src/components/layout/CartBadgeButton/index.tsx b/apps/pyconkr-2025/src/components/layout/CartBadgeButton/index.tsx index b3ac586..abd1033 100644 --- a/apps/pyconkr-2025/src/components/layout/CartBadgeButton/index.tsx +++ b/apps/pyconkr-2025/src/components/layout/CartBadgeButton/index.tsx @@ -3,27 +3,26 @@ import { ShoppingCart } from "@mui/icons-material"; import { Badge, badgeClasses, IconButton, styled } from "@mui/material"; import { ErrorBoundary, Suspense } from "@suspensive/react"; import { FC } from "react"; -import { useNavigate } from "react-router-dom"; +import { Link as RouterLink } from "react-router-dom"; type InnerCartBadgeButtonPropType = { loading?: boolean; count?: number; }; +// `as typeof IconButton`으로 styled가 잃어버린 polymorphic 타입(component/to)을 복원한다. const ColoredIconButton = styled(IconButton)(({ theme }) => ({ color: theme.palette.primary.nonFocus, "&:hover": { color: theme.palette.primary.dark }, "&:active": { color: theme.palette.primary.main }, transition: "color 0.4s ease, background-color 0.4s ease", -})); +})) as typeof IconButton; const InnerCartBadge = styled(Badge)({ [`& .${badgeClasses.badge}`]: { top: "-12px", right: "-3px" } }); const InnerCartBadgeButton: FC = ({ loading, count }) => { - const navigate = useNavigate(); - return ( - navigate("/store/cart")}> + {count !== undefined && count > 0 && } diff --git a/apps/pyconkr-2025/src/components/layout/SignInButton/index.tsx b/apps/pyconkr-2025/src/components/layout/SignInButton/index.tsx index 6fd174e..e2dacdd 100644 --- a/apps/pyconkr-2025/src/components/layout/SignInButton/index.tsx +++ b/apps/pyconkr-2025/src/components/layout/SignInButton/index.tsx @@ -2,7 +2,7 @@ import { useShopClient, useSignOutMutation, useUserStatus } from "@frontend/shop import { Login, Logout } from "@mui/icons-material"; import { Button, Stack } from "@mui/material"; import { ErrorBoundary, Suspense } from "@suspensive/react"; -import { useNavigate } from "react-router-dom"; +import { Link as RouterLink } from "react-router-dom"; import { useAppContext } from "@apps/pyconkr-2025/contexts/app_context"; @@ -23,24 +23,20 @@ const InnerSignInButtonImpl: React.FC = ({ isMainPath = true, onClose, }) => { - const navigate = useNavigate(); const { language } = useAppContext(); const signInBtnStr = language === "ko" ? "로그인" : "Sign In"; const signOutBtnStr = language === "ko" ? "로그아웃" : "Sign Out"; - const handleClick = () => { - if (signedIn) { - onSignOut?.(); - } else { - onClose?.(); - navigate("/account/sign-in"); - } - }; + // 로그인 상태에 따라: 로그아웃은 클릭 액션, 로그인은 Ctrl+클릭(새 탭)이 동작하도록 Link로 이동. + const navProps = signedIn + ? { onClick: () => onSignOut?.() } + : ({ component: RouterLink, to: "/account/sign-in", onClick: () => onClose?.() } as const); if (isMobile) { return (