From 95bb8c70a98fabae2a60b251489a59065b2978d1 Mon Sep 17 00:00:00 2001
From: nsfisis <nsfisis@gmail.com>
Date: Sun, 15 Feb 2026 17:09:51 +0900
Subject: fix(types): use CardStateType instead of number for card state fields

Card and StudyCard interfaces used generic number for state, causing
type errors when indexing Record<CardStateType, ...> maps. Also adds
missing FSRS fields to client Card interface to match API response.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---
 src/client/pages/DeckCardsPage.tsx | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'src/client/pages/DeckCardsPage.tsx')

diff --git a/src/client/pages/DeckCardsPage.tsx b/src/client/pages/DeckCardsPage.tsx
index b7bf7e4..2b2ca88 100644
--- a/src/client/pages/DeckCardsPage.tsx
+++ b/src/client/pages/DeckCardsPage.tsx
@@ -30,6 +30,7 @@ import { EditCardModal } from "../components/EditCardModal";
 import { EditNoteModal } from "../components/EditNoteModal";
 import { ErrorBoundary } from "../components/ErrorBoundary";
 import { ImportNotesModal } from "../components/ImportNotesModal";
+import type { CardStateType } from "../db";
 import { queryClient } from "../queryClient";
 
 /** Combined type for display: note group */
@@ -37,14 +38,14 @@ type CardDisplayItem = { type: "note"; noteId: string; cards: Card[] };
 
 const CARDS_PER_PAGE = 50;
 
-const CardStateLabels: Record<number, string> = {
+const CardStateLabels: Record<CardStateType, string> = {
 	0: "New",
 	1: "Learning",
 	2: "Review",
 	3: "Relearning",
 };
 
-const CardStateColors: Record<number, string> = {
+const CardStateColors: Record<CardStateType, string> = {
 	0: "bg-info/10 text-info",
 	1: "bg-warning/10 text-warning",
 	2: "bg-success/10 text-success",
-- 
cgit v1.3-1-g0d28

