-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 공통 네비바 + 대시보드 + 즐겨찾기 단축키 + 선택 다시 풀기 #13
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
cb1ecb4
feat: 공통 네비바 추가 (홈/문제풀이/복습/대시보드)
ginaseo 704bb57
feat: 대시보드 화면 (오늘/전체 풀이수·정답률)
ginaseo 3dae858
feat: 즐겨찾기에 키보드 단축키(F) 추가
ginaseo fc97b81
feat: 복습 화면에 선택 다시 풀기 추가
ginaseo 4df02dc
fix: 대시보드 조회 실패 시 빈 값 대신 오류 표시, 네비바 aria-current 추가
ginaseo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| "use client"; | ||
|
|
||
| import { useEffect, useState } from "react"; | ||
| import { IndexedDbProgressRepository } from "@/repositories/ProgressRepository"; | ||
| import type { DashboardSummary } from "@/types/progress"; | ||
|
|
||
| const progressRepository = new IndexedDbProgressRepository(); | ||
|
|
||
| function formatPercent(ratio: number): string { | ||
| return `${Math.round(ratio * 100)}%`; | ||
| } | ||
|
|
||
| export default function DashboardPage() { | ||
| const [summary, setSummary] = useState<DashboardSummary | null>(null); | ||
| const [error, setError] = useState(false); | ||
|
|
||
| useEffect(() => { | ||
| progressRepository.getDashboardSummary().then( | ||
| (result) => setSummary(result), | ||
| (err) => { | ||
| console.error("getDashboardSummary failed:", err); | ||
| setError(true); | ||
| } | ||
| ); | ||
| }, []); | ||
|
|
||
| if (error) { | ||
| return ( | ||
| <p className="text-center p-10 text-red-700"> | ||
| 학습 기록을 불러오지 못했다. 다시 시도해달라. | ||
| </p> | ||
| ); | ||
| } | ||
|
|
||
| if (!summary) { | ||
| return <p className="text-center p-10">불러오는 중...</p>; | ||
| } | ||
|
|
||
| return ( | ||
| <div className="max-w-xl mx-auto p-6 flex flex-col gap-6"> | ||
| <h1 className="text-xl font-bold">대시보드</h1> | ||
| <div className="grid grid-cols-2 gap-4"> | ||
| <div className="p-4 rounded border flex flex-col gap-1"> | ||
| <span className="text-sm text-gray-500">오늘 풀이수</span> | ||
| <span className="text-2xl font-bold">{summary.todayCount}</span> | ||
| </div> | ||
| <div className="p-4 rounded border flex flex-col gap-1"> | ||
| <span className="text-sm text-gray-500">오늘 정답률</span> | ||
| <span className="text-2xl font-bold">{formatPercent(summary.todayAccuracy)}</span> | ||
| </div> | ||
| <div className="p-4 rounded border flex flex-col gap-1"> | ||
| <span className="text-sm text-gray-500">전체 풀이수</span> | ||
| <span className="text-2xl font-bold">{summary.totalCount}</span> | ||
| </div> | ||
| <div className="p-4 rounded border flex flex-col gap-1"> | ||
| <span className="text-sm text-gray-500">전체 정답률</span> | ||
| <span className="text-2xl font-bold">{formatPercent(summary.totalAccuracy)}</span> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| "use client"; | ||
|
|
||
| import Link from "next/link"; | ||
| import { usePathname } from "next/navigation"; | ||
|
|
||
| const LINKS = [ | ||
| { href: "/", label: "홈" }, | ||
| { href: "/practice", label: "문제풀이" }, | ||
| { href: "/review", label: "복습" }, | ||
| { href: "/dashboard", label: "대시보드" }, | ||
| ] as const; | ||
|
|
||
| export function NavBar() { | ||
| const pathname = usePathname(); | ||
|
|
||
| return ( | ||
| <nav className="flex gap-4 px-6 py-3 border-b text-sm"> | ||
| {LINKS.map((link) => ( | ||
| <Link | ||
| key={link.href} | ||
| href={link.href} | ||
| aria-current={pathname === link.href ? "page" : undefined} | ||
| className={pathname === link.href ? "font-bold" : "text-gray-500"} | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| > | ||
| {link.label} | ||
| </Link> | ||
| ))} | ||
| </nav> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -83,6 +83,8 @@ export function PracticeSession({ questions, theoryMap, onFinish }: PracticeSess | |
| goTo(current + 1); | ||
| } else if (e.key === "ArrowLeft") { | ||
| goTo(current - 1); | ||
| } else if (e.key === "f" || e.key === "F") { | ||
| toggleFavorite(); | ||
|
Comment on lines
+86
to
+87
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win F 단축키가 실제로 즐겨찾기를 전환하도록 수정하세요. 현재 수정 예시 function toggleFavorite() {
- if (favorited[current]) return;
- setFavorited((prev) => ({ ...prev, [current]: true }));
- progressRepository
- .addFavorite(question.questionId)
+ const nextFavorited = !(favorited[current] ?? false);
+ setFavorited((prev) => ({ ...prev, [current]: nextFavorited }));
+ const update = nextFavorited
+ ? progressRepository.addFavorite(question.questionId)
+ : progressRepository.removeFavorite(question.questionId);
+ update
.catch((err) => console.error("addFavorite failed:", err));
}Also applies to: 124-124 🤖 Prompt for AI Agents |
||
| } | ||
| } | ||
| window.addEventListener("keydown", handleKeyDown); | ||
|
|
@@ -119,7 +121,7 @@ export function PracticeSession({ questions, theoryMap, onFinish }: PracticeSess | |
| > | ||
| ← 이전 | ||
| </button> | ||
| <span>Space: 다음 · 1~4: 답 선택</span> | ||
| <span>Space: 다음 · 1~4: 답 선택 · F: 즐겨찾기</span> | ||
| {current === questions.length - 1 ? ( | ||
| <button | ||
| type="button" | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
조회 실패를 빈 학습 기록으로 표시하지 마세요.
getDashboardSummary()가 실패했을 때EMPTY_SUMMARY를 렌더링하면 IndexedDB 오류가 “풀이 0건, 정답률 0%”로 오인됩니다. 오류 상태를 별도로 저장하고 재시도 또는 오류 안내를 표시해야 합니다.수정 예시
📝 Committable suggestion
🤖 Prompt for AI Agents