diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-02-25 23:02:35 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-02-25 23:02:35 +0900 |
| commit | 38b8fc0e9927c4146b4c8b309b2bcc644abd63d0 (patch) | |
| tree | f76ba23251645e552fccd201362064b06de50bdd /src/client/pages | |
| parent | 7a77e72bb49ed3990a0c4581292a37a8a4f35231 (diff) | |
| download | kioku-38b8fc0e9927c4146b4c8b309b2bcc644abd63d0.tar.gz kioku-38b8fc0e9927c4146b4c8b309b2bcc644abd63d0.tar.zst kioku-38b8fc0e9927c4146b4c8b309b2bcc644abd63d0.zip | |
Allow each deck to specify a default note type that is auto-selected
when creating new notes. Includes DB schema migration, server API
updates, sync layer support, and UI for editing the default in the
deck settings modal.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/client/pages')
| -rw-r--r-- | src/client/pages/DeckCardsPage.test.tsx | 1 | ||||
| -rw-r--r-- | src/client/pages/DeckCardsPage.tsx | 10 | ||||
| -rw-r--r-- | src/client/pages/DeckDetailPage.test.tsx | 1 | ||||
| -rw-r--r-- | src/client/pages/DeckDetailPage.tsx | 5 | ||||
| -rw-r--r-- | src/client/pages/HomePage.test.tsx | 4 |
5 files changed, 19 insertions, 2 deletions
diff --git a/src/client/pages/DeckCardsPage.test.tsx b/src/client/pages/DeckCardsPage.test.tsx index 58107d4..6e8f444 100644 --- a/src/client/pages/DeckCardsPage.test.tsx +++ b/src/client/pages/DeckCardsPage.test.tsx @@ -73,6 +73,7 @@ const mockDeck = { id: "deck-1", name: "Japanese Vocabulary", description: "Common Japanese words", + defaultNoteTypeId: null, dueCardCount: 0, newCardCount: 0, totalCardCount: 0, diff --git a/src/client/pages/DeckCardsPage.tsx b/src/client/pages/DeckCardsPage.tsx index 8c839da..b791eac 100644 --- a/src/client/pages/DeckCardsPage.tsx +++ b/src/client/pages/DeckCardsPage.tsx @@ -22,7 +22,12 @@ import { } from "react"; import { useDebouncedCallback } from "use-debounce"; import { Link, useParams } from "wouter"; -import { type Card, cardsByDeckAtomFamily, deckByIdAtomFamily } from "../atoms"; +import { + type Card, + cardsByDeckAtomFamily, + type Deck, + deckByIdAtomFamily, +} from "../atoms"; import { CreateNoteModal } from "../components/CreateNoteModal"; import { DeleteCardModal } from "../components/DeleteCardModal"; import { DeleteNoteModal } from "../components/DeleteNoteModal"; @@ -638,6 +643,9 @@ export function DeckCardsPage() { <CreateNoteModal isOpen={isCreateModalOpen} deckId={deckId} + defaultNoteTypeId={ + queryClient.getQueryData<Deck>(["decks", deckId])?.defaultNoteTypeId + } onClose={() => setIsCreateModalOpen(false)} onNoteCreated={handleCardMutation} /> diff --git a/src/client/pages/DeckDetailPage.test.tsx b/src/client/pages/DeckDetailPage.test.tsx index bb9d80c..c473275 100644 --- a/src/client/pages/DeckDetailPage.test.tsx +++ b/src/client/pages/DeckDetailPage.test.tsx @@ -60,6 +60,7 @@ const mockDeck = { id: "deck-1", name: "Japanese Vocabulary", description: "Common Japanese words", + defaultNoteTypeId: null, dueCardCount: 0, newCardCount: 0, totalCardCount: 0, diff --git a/src/client/pages/DeckDetailPage.tsx b/src/client/pages/DeckDetailPage.tsx index 0a02051..99e919b 100644 --- a/src/client/pages/DeckDetailPage.tsx +++ b/src/client/pages/DeckDetailPage.tsx @@ -8,7 +8,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { useAtomValue } from "jotai"; import { Suspense, useState } from "react"; import { Link, useParams } from "wouter"; -import { cardsByDeckAtomFamily, deckByIdAtomFamily } from "../atoms"; +import { cardsByDeckAtomFamily, type Deck, deckByIdAtomFamily } from "../atoms"; import { CreateNoteModal } from "../components/CreateNoteModal"; import { ErrorBoundary } from "../components/ErrorBoundary"; import { LoadingSpinner } from "../components/LoadingSpinner"; @@ -204,6 +204,9 @@ export function DeckDetailPage() { <CreateNoteModal isOpen={isCreateModalOpen} deckId={deckId} + defaultNoteTypeId={ + queryClient.getQueryData<Deck>(["decks", deckId])?.defaultNoteTypeId + } onClose={() => setIsCreateModalOpen(false)} onNoteCreated={() => { queryClient.invalidateQueries({ diff --git a/src/client/pages/HomePage.test.tsx b/src/client/pages/HomePage.test.tsx index de7a768..adcc651 100644 --- a/src/client/pages/HomePage.test.tsx +++ b/src/client/pages/HomePage.test.tsx @@ -92,6 +92,7 @@ const mockDecks = [ id: "deck-1", name: "Japanese Vocabulary", description: "Common Japanese words", + defaultNoteTypeId: null, dueCardCount: 5, newCardCount: 0, totalCardCount: 100, @@ -103,6 +104,7 @@ const mockDecks = [ id: "deck-2", name: "Spanish Verbs", description: null, + defaultNoteTypeId: null, dueCardCount: 0, newCardCount: 0, totalCardCount: 0, @@ -258,6 +260,7 @@ describe("HomePage", () => { id: "deck-1", name: "No Description Deck", description: null, + defaultNoteTypeId: null, dueCardCount: 0, newCardCount: 0, totalCardCount: 0, @@ -340,6 +343,7 @@ describe("HomePage", () => { id: "deck-new", name: "New Deck", description: "A new deck", + defaultNoteTypeId: null, dueCardCount: 0, newCardCount: 0, totalCardCount: 0, |
