Skip to content

Commit f4f9473

Browse files
committed
fix: window.history.back 교체 및 GNB 네이밍 누락 반영
1 parent c1f36c8 commit f4f9473

2 files changed

Lines changed: 47 additions & 20 deletions

File tree

‎src/features/group-detail/components/group-detail-error-view.tsx‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,14 @@ export const GroupDetailErrorView = ({ error, groupId }: Props) => {
6161
<BaseLayout>
6262
<div className="mx-auto max-w-6xl p-6 text-center space-y-3">
6363
{errorCode && (
64-
<p className="text-sm font-mono text-muted-foreground">{errorCode}</p>
64+
<p className="text-sm font-mono text-muted-foreground">
65+
{errorCode}
66+
</p>
6567
)}
66-
<p className="text-red-500">{errorMessage || "오류가 발생했습니다."}</p>
67-
<Button onClick={() => window.history.back()} variant="outline">
68+
<p className="text-red-500">
69+
{errorMessage || "오류가 발생했습니다."}
70+
</p>
71+
<Button onClick={() => router.history.go(-1)} variant="outline">
6872
돌아가기
6973
</Button>
7074
</div>
@@ -75,7 +79,9 @@ export const GroupDetailErrorView = ({ error, groupId }: Props) => {
7579
return (
7680
<BaseLayout>
7781
<div className="mx-auto max-w-6xl p-6">
78-
<p className="text-center text-muted-foreground">그룹을 찾을 수 없습니다.</p>
82+
<p className="text-center text-muted-foreground">
83+
그룹을 찾을 수 없습니다.
84+
</p>
7985
</div>
8086
</BaseLayout>
8187
);

‎src/pages/learn/memoize-mode.tsx‎

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useEffect, useState } from "react";
22
import { useQuery } from "@tanstack/react-query";
3-
import GNB from "@/shared/layouts/gnb";
3+
import GrobalNavigationBar from "@/shared/layouts/gnb";
44
import FlipCard from "@/shared/components/flip-card";
55
import {
66
Carousel,
@@ -28,12 +28,36 @@ import { cardApi, type CardResponse } from "@/shared/apis/card";
2828
// [DEV_MOCK] UI 작업용 임시 목 데이터 - 작업 완료 후 제거
2929
const DEV_MOCK = true;
3030
const MOCK_CARDS: CardResponse[] = [
31-
{ id: "1", question: "React에서 상태 관리를 위한 기본 훅은 무엇인가?", answer: "useState" },
32-
{ id: "2", question: "컴포넌트의 사이드 이펙트를 처리하는 훅은 무엇인가?", answer: "useEffect" },
33-
{ id: "3", question: "컨텍스트 값을 구독할 때 사용하는 훅은 무엇인가?", answer: "useContext" },
34-
{ id: "4", question: "이전 렌더링 값을 기억할 때 사용하는 훅은 무엇인가?", answer: "useRef" },
35-
{ id: "5", question: "비용이 큰 계산 결과를 메모이제이션할 때 사용하는 훅은?", answer: "useMemo" },
36-
{ id: "6", question: "함수를 메모이제이션할 때 사용하는 훅은?", answer: "useCallback" },
31+
{
32+
id: "1",
33+
question: "React에서 상태 관리를 위한 기본 훅은 무엇인가?",
34+
answer: "useState",
35+
},
36+
{
37+
id: "2",
38+
question: "컴포넌트의 사이드 이펙트를 처리하는 훅은 무엇인가?",
39+
answer: "useEffect",
40+
},
41+
{
42+
id: "3",
43+
question: "컨텍스트 값을 구독할 때 사용하는 훅은 무엇인가?",
44+
answer: "useContext",
45+
},
46+
{
47+
id: "4",
48+
question: "이전 렌더링 값을 기억할 때 사용하는 훅은 무엇인가?",
49+
answer: "useRef",
50+
},
51+
{
52+
id: "5",
53+
question: "비용이 큰 계산 결과를 메모이제이션할 때 사용하는 훅은?",
54+
answer: "useMemo",
55+
},
56+
{
57+
id: "6",
58+
question: "함수를 메모이제이션할 때 사용하는 훅은?",
59+
answer: "useCallback",
60+
},
3761
];
3862

3963
type MemoizeControllerProps = {
@@ -166,7 +190,7 @@ const MemoizeController = ({
166190
onChange={(e) =>
167191
setSettings((prev) => ({
168192
...prev,
169-
autoTimerSeconds: parseInt(e.target.value) || 5,
193+
autoTimerSeconds: Number.parseInt(e.target.value) || 5,
170194
}))
171195
}
172196
className="w-16 text-center"
@@ -179,7 +203,6 @@ const MemoizeController = ({
179203
);
180204
};
181205

182-
183206
type CardCarouselProps = {
184207
cards: CardResponse[];
185208
api: CarouselApi;
@@ -222,11 +245,9 @@ const CardCarousel = ({
222245
} else {
223246
api.scrollNext();
224247
}
225-
} else {
248+
} else if (api.canScrollNext()) {
226249
// 마지막 슬라이드면 멈춤
227-
if (api.canScrollNext()) {
228-
api.scrollNext();
229-
}
250+
api.scrollNext();
230251
}
231252
}, duration);
232253

@@ -321,7 +342,7 @@ const MemoizeMode = ({ settings: studySettings }: MemoizeModeProps) => {
321342
if (isLoading) {
322343
return (
323344
<div className="h-dvh flex flex-col overflow-hidden">
324-
<GNB />
345+
<GrobalNavigationBar />
325346
<div className="flex-1 flex items-center justify-center">
326347
<Loader2 className="h-8 w-8 animate-spin text-gray-500" />
327348
</div>
@@ -332,7 +353,7 @@ const MemoizeMode = ({ settings: studySettings }: MemoizeModeProps) => {
332353
if (isError || cards.length === 0) {
333354
return (
334355
<div className="h-dvh flex flex-col overflow-hidden">
335-
<GNB />
356+
<GrobalNavigationBar />
336357
<div className="flex-1 flex items-center justify-center">
337358
<p className="text-gray-500">카드를 불러올 수 없습니다.</p>
338359
</div>
@@ -342,7 +363,7 @@ const MemoizeMode = ({ settings: studySettings }: MemoizeModeProps) => {
342363

343364
return (
344365
<div className="h-dvh flex flex-col overflow-hidden">
345-
<GNB />
366+
<GrobalNavigationBar />
346367
<div className="flex-1 min-h-0 flex items-center justify-center px-4 pb-32">
347368
<CardCarousel
348369
cards={cards}

0 commit comments

Comments
 (0)