From 6084374dcb9035b53c420b82b17927c13cdd9d17 Mon Sep 17 00:00:00 2001 From: jeungseulki Date: Tue, 4 Aug 2026 09:58:21 +0900 Subject: [PATCH 1/9] =?UTF-8?q?feat:=20=EC=83=81=EC=84=B8=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20ghost=20=EB=92=A4=EB=A1=9C=EA=B0=80?= =?UTF-8?q?=EA=B8=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 기사·견적 상세 Header에 작은 뒤로가기를 두고, 이력이 없으면 목록 fallback으로 이동한다. Co-authored-by: Cursor --- src/components/common/DetailBackButton.tsx | 42 ++++++++++++++++++ .../estimate/detail/EstimateDetailHeader.tsx | 44 +++++++++++++------ .../estimate/detail/EstimateDetailLayout.tsx | 20 +++++++-- .../estimate/detail/EstimateDetailView.tsx | 12 ++++- .../pending/PendingEstimateDetailView.tsx | 12 ++++- .../requests/EstimateRequestDetailView.tsx | 8 +++- .../mover/detail/MoverDetailView.tsx | 40 ++++++++++++----- src/hooks/useDetailBackNavigation.ts | 20 +++++++++ src/icons/index.ts | 3 ++ 9 files changed, 167 insertions(+), 34 deletions(-) create mode 100644 src/components/common/DetailBackButton.tsx create mode 100644 src/hooks/useDetailBackNavigation.ts diff --git a/src/components/common/DetailBackButton.tsx b/src/components/common/DetailBackButton.tsx new file mode 100644 index 00000000..2d9b97d7 --- /dev/null +++ b/src/components/common/DetailBackButton.tsx @@ -0,0 +1,42 @@ +"use client"; + +import { Text } from "@/components/common/Text"; +import { useDetailBackNavigation } from "@/hooks/useDetailBackNavigation"; +import { ArrowLeftIcon } from "@/icons"; +import { cn } from "@/lib/utils/cn"; + +interface DetailBackButtonProps { + /** 이력이 없을 때 이동할 목록 경로 (`APP_ROUTES`) */ + fallbackHref: string; + className?: string; +} + +/** + * 상세 페이지 ghost 뒤로가기 (‹ 뒤로) + * 시각 크기는 작게, 터치 영역만 min 44px 확보 + * // 2026.08.03 정슬기 - [추가] + */ +export default function DetailBackButton({ fallbackHref, className }: DetailBackButtonProps) { + const goBack = useDetailBackNavigation(fallbackHref); + + return ( + + ); +} diff --git a/src/components/estimate/detail/EstimateDetailHeader.tsx b/src/components/estimate/detail/EstimateDetailHeader.tsx index f5b1db88..086b9912 100644 --- a/src/components/estimate/detail/EstimateDetailHeader.tsx +++ b/src/components/estimate/detail/EstimateDetailHeader.tsx @@ -1,32 +1,48 @@ +"use client"; + import type { ReactNode } from "react"; +import DetailBackButton from "@/components/common/DetailBackButton"; import { Text } from "@/components/common/Text"; interface EstimateDetailHeaderProps { title?: string; - /** Header 우측 액션 슬롯 (보낸 요청 취소 등). 다른 상세에는 영향 없음 */ + /** 있으면 제목 위 ghost 뒤로가기 표시 */ + // 2026.08.03 정슬기 - [추가] + backFallbackHref?: string; + /** Header 우측 액션 슬롯 (optional — 다른 상세 화면 무영향) */ // 2026.08.03 정슬기 - [추가] optional actions actions?: ReactNode; } +/** + * 견적·기사 상세 공통 페이지 헤더 + * // 2026.08.03 정슬기 - [수정] optional 뒤로가기 — 제목 위 별도 행 + * // 2026.08.04 정슬기 - [수정] Desktop padding/타이포를 xl로 — Tablet 가로 스크롤 방지 + */ export default function EstimateDetailHeader({ title = "견적 상세", + backFallbackHref, actions, }: EstimateDetailHeaderProps) { return ( - // 2026.07.24 정슬기 - [수정] Figma Mobile/Tablet 페이지 헤더 높이·여백 - // 2026.08.04 정슬기 - [수정] Desktop padding/타이포를 xl로 — Tablet(lg) 과다 padding·가로 스크롤 방지 -
-
-

- - {title} - - - {title} - -

- {actions ?
{actions}
: null} + // 고정 높이 대신 padding으로 두 행(뒤로+제목)을 수용 — 과도한 확장 방지 + // 2026.08.04 정슬기 - [수정] Desktop padding/타이포를 xl로 +
+
+ {backFallbackHref ? : null} + +
+

+ + {title} + + + {title} + +

+ {actions ?
{actions}
: null} +
); diff --git a/src/components/estimate/detail/EstimateDetailLayout.tsx b/src/components/estimate/detail/EstimateDetailLayout.tsx index 493aafad..72172252 100644 --- a/src/components/estimate/detail/EstimateDetailLayout.tsx +++ b/src/components/estimate/detail/EstimateDetailLayout.tsx @@ -16,8 +16,10 @@ export const ESTIMATE_DETAIL_LAYOUT_CLASSES = { // 본문+aside 블록을 컨테이너 안에서 가운데로 모아 좌측 치우침을 줄인다 rowClassName: "gap-32 md:gap-40 xl:justify-center xl:gap-40", // Desktop 본문 840 + aside 320 + gap 40 = 1200 (container) + // overflow-clip 제거 — focus ring이 aside 경계에서 잘리지 않도록 폭만으로 제한 + // 2026.08.04 정슬기 - [수정] mainClassName: "gap-24 md:gap-30 xl:w-210 xl:shrink-0", - asideClassName: "gap-28 md:gap-40 xl:w-80 xl:shrink-0 xl:overflow-clip", + asideClassName: "gap-28 md:gap-40 xl:w-80 xl:shrink-0", } as const; interface EstimateDetailLayoutProps { @@ -29,6 +31,9 @@ interface EstimateDetailLayoutProps { /** Header 우측 액션 (optional — 다른 상세 화면 무영향) */ // 2026.08.03 정슬기 - [추가] headerActions?: ReactNode; + /** 상세 Header 뒤로가기 fallback 목록 경로 */ + // 2026.08.03 정슬기 - [추가] + backFallbackHref?: string; main: ReactNode; aside?: ReactNode; /** main+aside 바깥 여백·폭. Figma 화면별로 다를 수 있음 */ @@ -53,6 +58,7 @@ export default function EstimateDetailLayout({ heroName = "", showProfile = true, headerActions, + backFallbackHref, main, aside, contentClassName, @@ -63,7 +69,11 @@ export default function EstimateDetailLayout({ }: EstimateDetailLayoutProps) { return (
- +
void; /** 에러 시 목록 링크 등 추가 액션 */ secondaryAction?: ReactNode; + /** 로딩·에러 Header 뒤로가기 fallback */ + // 2026.08.03 정슬기 - [추가] + backFallbackHref?: string; } /** 상세 로딩·에러 — Header만 두고 상태 메시지 표시 */ @@ -109,10 +122,11 @@ export function EstimateDetailQueryState({ actionLabel, onAction, secondaryAction, + backFallbackHref, }: EstimateDetailQueryStateProps) { return (
- +
diff --git a/src/components/estimate/detail/EstimateDetailView.tsx b/src/components/estimate/detail/EstimateDetailView.tsx index f3dd65fc..9c72259f 100644 --- a/src/components/estimate/detail/EstimateDetailView.tsx +++ b/src/components/estimate/detail/EstimateDetailView.tsx @@ -18,6 +18,7 @@ import { useConfirmEstimate } from "@/hooks/useConfirmEstimate"; import { useEstimateDetail } from "@/hooks/useEstimateDetail"; import { useEstimateRequestCancelFlow } from "@/hooks/useEstimateRequestCancelFlow"; import { getApiErrorMessage } from "@/lib/api/getApiErrorMessage"; +import { APP_ROUTES } from "@/lib/constants/appRoutes"; import { cn } from "@/lib/utils/cn"; import { isCancelableEstimateRequestStatus } from "@/lib/utils/estimateFormat"; import type { EstimateDetail } from "@/types/estimate"; @@ -61,6 +62,7 @@ function EstimateDetailContent({ estimateId, data }: EstimateDetailContentProps) rowClassName={ESTIMATE_DETAIL_LAYOUT_CLASSES.rowClassName} mainClassName={ESTIMATE_DETAIL_LAYOUT_CLASSES.mainClassName} asideClassName={cn(ESTIMATE_DETAIL_LAYOUT_CLASSES.asideClassName, "xl:pt-40")} + backFallbackHref={APP_ROUTES.ESTIMATES.RECEIVED} main={ <>
@@ -120,13 +122,18 @@ function EstimateDetailContent({ estimateId, data }: EstimateDetailContentProps) * 받았던 견적 상세 * // 2026.07.24 정슬기 - [추가] * // 2026.07.30 정슬기 - [수정] EstimateDetailLayout·공통 Actions 사용 - * // 2026.08.03 정슬기 - [수정] 레이아웃·코멘트·요청 취소 액션 + * // 2026.08.03 정슬기 - [수정] 레이아웃·코멘트·요청 취소 액션 · Header 뒤로가기 */ export default function EstimateDetailView({ estimateId }: EstimateDetailViewProps) { const { data, isLoading, isError, error, refetch } = useEstimateDetail(estimateId); if (isLoading) { - return ; + return ( + + ); } if (isError || !data) { @@ -137,6 +144,7 @@ export default function EstimateDetailView({ estimateId }: EstimateDetailViewPro onAction={() => { void refetch(); }} + backFallbackHref={APP_ROUTES.ESTIMATES.RECEIVED} /> ); } diff --git a/src/components/estimate/pending/PendingEstimateDetailView.tsx b/src/components/estimate/pending/PendingEstimateDetailView.tsx index 8fcb24d5..2912de69 100644 --- a/src/components/estimate/pending/PendingEstimateDetailView.tsx +++ b/src/components/estimate/pending/PendingEstimateDetailView.tsx @@ -17,6 +17,7 @@ import { useConfirmEstimate } from "@/hooks/useConfirmEstimate"; import { useEstimateDetail } from "@/hooks/useEstimateDetail"; import { useEstimateRequestCancelFlow } from "@/hooks/useEstimateRequestCancelFlow"; import { getApiErrorMessage } from "@/lib/api/getApiErrorMessage"; +import { APP_ROUTES } from "@/lib/constants/appRoutes"; import { cn } from "@/lib/utils/cn"; import { isCancelableEstimateRequestStatus } from "@/lib/utils/estimateFormat"; import type { EstimateDetail } from "@/types/estimate"; @@ -59,6 +60,7 @@ function PendingEstimateDetailContent({ estimateId, data }: PendingEstimateDetai rowClassName={ESTIMATE_DETAIL_LAYOUT_CLASSES.rowClassName} mainClassName={ESTIMATE_DETAIL_LAYOUT_CLASSES.mainClassName} asideClassName={cn(ESTIMATE_DETAIL_LAYOUT_CLASSES.asideClassName, "xl:gap-80 xl:pt-40")} + backFallbackHref={APP_ROUTES.ESTIMATES.PENDING} main={ <>
@@ -116,13 +118,18 @@ function PendingEstimateDetailContent({ estimateId, data }: PendingEstimateDetai * 대기 견적 상세 Desktop (Figma 8091:47263) * // 2026.07.25 정슬기 - [추가] * // 2026.07.30 정슬기 - [수정] useEstimateDetail·Layout·Actions 통합 - * // 2026.08.03 정슬기 - [수정] 레이아웃·코멘트·요청 취소 액션 + * // 2026.08.03 정슬기 - [수정] 레이아웃·코멘트·요청 취소 액션 · Header 뒤로가기 */ export default function PendingEstimateDetailView({ estimateId }: PendingEstimateDetailViewProps) { const { data, isLoading, isError, error, refetch } = useEstimateDetail(estimateId); if (isLoading) { - return ; + return ( + + ); } if (isError || !data) { @@ -133,6 +140,7 @@ export default function PendingEstimateDetailView({ estimateId }: PendingEstimat onAction={() => { void refetch(); }} + backFallbackHref={APP_ROUTES.ESTIMATES.PENDING} /> ); } diff --git a/src/components/estimate/requests/EstimateRequestDetailView.tsx b/src/components/estimate/requests/EstimateRequestDetailView.tsx index 2be8c041..a2659cff 100644 --- a/src/components/estimate/requests/EstimateRequestDetailView.tsx +++ b/src/components/estimate/requests/EstimateRequestDetailView.tsx @@ -117,7 +117,11 @@ export default function EstimateRequestDetailView({ if (isLoading) { return ( - + ); } @@ -138,6 +142,7 @@ export default function EstimateRequestDetailView({ onAction={() => { void refetch(); }} + backFallbackHref={APP_ROUTES.ESTIMATES.REQUESTS} secondaryAction={
; + return ( +
+ + +
+ ); } if (!detail) { if (isNotFound) { - return ; + return ( +
+ + +
+ ); } return ( -
- { - void query.refetch(); - }} - /> +
+ +
+ { + void query.refetch(); + }} + /> +
); } @@ -87,6 +102,7 @@ export default function MoverDetailView({ moverId }: MoverDetailViewProps) { return (
+
diff --git a/src/hooks/useDetailBackNavigation.ts b/src/hooks/useDetailBackNavigation.ts new file mode 100644 index 00000000..76da2ccd --- /dev/null +++ b/src/hooks/useDetailBackNavigation.ts @@ -0,0 +1,20 @@ +"use client"; + +import { useRouter } from "next/navigation"; +import { useCallback } from "react"; + +/** + * 상세 뒤로가기 — 이력이 있으면 back, 없으면 fallback 목록으로 이동 + * // 2026.08.03 정슬기 - [추가] + */ +export function useDetailBackNavigation(fallbackHref: string) { + const router = useRouter(); + + return useCallback(() => { + if (typeof window !== "undefined" && window.history.length > 1) { + router.back(); + return; + } + router.push(fallbackHref); + }, [fallbackHref, router]); +} diff --git a/src/icons/index.ts b/src/icons/index.ts index a4952c21..cc7b04ff 100644 --- a/src/icons/index.ts +++ b/src/icons/index.ts @@ -3,6 +3,9 @@ export { default as BoxIcon } from "./box.svg"; export { default as CalendarIcon } from "./calendar.svg"; export { default as ChevronDownIcon } from "./chevron-down.svg"; export { default as ChevronLeftIcon } from "./chevron-left.svg"; +/** 상세 뒤로가기 등 — ChevronLeft와 동일 SVG (ArrowLeft 의미) */ +// 2026.08.03 정슬기 - [추가] +export { default as ArrowLeftIcon } from "./chevron-left.svg"; export { default as ChevronLeftThinIcon } from "./chevron-left-thin.svg"; export { default as ChevronRightIcon } from "./chevron-right.svg"; export { default as ChevronRightThinIcon } from "./chevron-right-thin.svg"; From a61af227e7e7d76ee318079cfe6b2be936d07091 Mon Sep 17 00:00:00 2001 From: jeungseulki Date: Tue, 4 Aug 2026 09:59:36 +0900 Subject: [PATCH 2/9] =?UTF-8?q?feat:=20=EA=B3=B5=ED=86=B5=20Scroll=20To=20?= =?UTF-8?q?Top=20=EB=B2=84=ED=8A=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AppShell에 컬러 캐릭터 TOP 버튼을 마운트하고, 인증·프로필 화면에서는 숨긴다. Co-authored-by: Cursor --- src/components/common/ScrollToTopButton.tsx | 113 ++++++++++++++++++++ src/components/layout/AppShell.tsx | 3 + 2 files changed, 116 insertions(+) create mode 100644 src/components/common/ScrollToTopButton.tsx diff --git a/src/components/common/ScrollToTopButton.tsx b/src/components/common/ScrollToTopButton.tsx new file mode 100644 index 00000000..97446494 --- /dev/null +++ b/src/components/common/ScrollToTopButton.tsx @@ -0,0 +1,113 @@ +"use client"; + +import Image from "next/image"; +import { usePathname } from "next/navigation"; +import { useEffect, useState } from "react"; + +import { Text } from "@/components/common/Text"; +import { APP_ROUTES } from "@/lib/constants/appRoutes"; +import { cn } from "@/lib/utils/cn"; + +/** Auth/프로필 등에서 쓰는 공식 컬러 캐릭터 */ +const CHARACTER_SRC = "/images/profile-character.png"; + +/** 이 스크롤 위치(px) 이상이면 버튼 노출 (300~500 구간) */ +const SCROLL_SHOW_THRESHOLD_PX = 400; + +/** 로그인·회원가입·프로필·인증 화면 — Scroll To Top 미노출 */ +const SCROLL_TO_TOP_HIDDEN_PATHS = new Set([ + APP_ROUTES.LOGIN, + APP_ROUTES.SIGN_UP, + APP_ROUTES.MOVER_LOGIN, + APP_ROUTES.MOVER_SIGN_UP, + APP_ROUTES.PROFILE, + APP_ROUTES.PROFILE_EDIT, + APP_ROUTES.MOVER_PROFILE, +]); + +function shouldHideScrollToTop(pathname: string): boolean { + if (pathname.startsWith("/oauth/")) { + return true; + } + return SCROLL_TO_TOP_HIDDEN_PATHS.has(pathname); +} + +/** 기사 상세(`/movers/:id`) — Mobile sticky CTA와 겹침 방지 */ +function isMoverDetailPath(pathname: string): boolean { + if (pathname === APP_ROUTES.MOVERS.ROOT || pathname === APP_ROUTES.MOVERS.FAVORITES) { + return false; + } + return pathname.startsWith(`${APP_ROUTES.MOVERS.ROOT}/`); +} + +/** + * 공통 Scroll To Top (캐릭터 + TOP) + * AppShell에서 1회 마운트 — 짧은 페이지·제외 경로에서는 자연스럽게 숨김 + * // 2026.08.03 정슬기 - [추가] + */ +export default function ScrollToTopButton() { + const pathname = usePathname(); + const [scrolledPastThreshold, setScrolledPastThreshold] = useState(false); + const hiddenByRoute = shouldHideScrollToTop(pathname); + const raiseForStickyCta = isMoverDetailPath(pathname); + const show = !hiddenByRoute && scrolledPastThreshold; + + useEffect(() => { + if (hiddenByRoute) { + return; + } + + const updateVisibility = () => { + setScrolledPastThreshold(window.scrollY >= SCROLL_SHOW_THRESHOLD_PX); + }; + + updateVisibility(); + window.addEventListener("scroll", updateVisibility, { passive: true }); + return () => { + window.removeEventListener("scroll", updateVisibility); + }; + }, [pathname, hiddenByRoute]); + + if (hiddenByRoute) { + return null; + } + + return ( + + ); +} diff --git a/src/components/layout/AppShell.tsx b/src/components/layout/AppShell.tsx index f4b38b59..14d20b05 100644 --- a/src/components/layout/AppShell.tsx +++ b/src/components/layout/AppShell.tsx @@ -4,6 +4,7 @@ import { type ReactNode } from "react"; import Footer from "@/components/common/Footer/Footer"; import Header from "@/components/common/Header/Header"; +import ScrollToTopButton from "@/components/common/ScrollToTopButton"; import type { AuthRole } from "@/lib/auth/role"; import { AppProviders } from "@/providers/AppProviders"; @@ -20,6 +21,7 @@ interface AppShellProps { * @param initialIsLogin - 초기 로그인 상태 * @param initialNickname - 초기 닉네임 * @param initialRole - 초기 role (nav 분기 SSR 힌트) + * // 2026.08.03 정슬기 - [수정] 공통 ScrollToTopButton 마운트 */ export const AppShell = ({ children, @@ -36,6 +38,7 @@ export const AppShell = ({ />
{children}