From 1bc7310d51d26463ce9c7d3fa984cc3e82c0259b Mon Sep 17 00:00:00 2001 From: nsfisis Date: Fri, 13 Feb 2026 20:25:26 +0900 Subject: feat(deck): add "Add Note" button to deck detail page Allow creating notes directly from the deck detail page without navigating through View Cards first. Co-Authored-By: Claude Opus 4.6 --- src/client/pages/DeckDetailPage.tsx | 44 ++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) (limited to 'src/client') diff --git a/src/client/pages/DeckDetailPage.tsx b/src/client/pages/DeckDetailPage.tsx index d717d60..bb8d42a 100644 --- a/src/client/pages/DeckDetailPage.tsx +++ b/src/client/pages/DeckDetailPage.tsx @@ -2,14 +2,17 @@ import { faChevronLeft, faCirclePlay, faLayerGroup, + faPlus, } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { useAtomValue } from "jotai"; -import { Suspense } from "react"; +import { Suspense, useState } from "react"; import { Link, useParams } from "wouter"; import { cardsByDeckAtomFamily, deckByIdAtomFamily } from "../atoms"; +import { CreateNoteModal } from "../components/CreateNoteModal"; import { ErrorBoundary } from "../components/ErrorBoundary"; import { LoadingSpinner } from "../components/LoadingSpinner"; +import { queryClient } from "../queryClient"; function DeckHeader({ deckId }: { deckId: string }) { const { data: deck } = useAtomValue(deckByIdAtomFamily(deckId)); @@ -46,7 +49,13 @@ function DeckStats({ deckId }: { deckId: string }) { ); } -function DeckContent({ deckId }: { deckId: string }) { +function DeckContent({ + deckId, + onCreateNote, +}: { + deckId: string; + onCreateNote: () => void; +}) { return (
{/* Deck Header */} @@ -100,6 +109,20 @@ function DeckContent({ deckId }: { deckId: string }) { Study Now + {/* Add Note Button */} + + {/* View Cards Link */} (); + const [isCreateModalOpen, setIsCreateModalOpen] = useState(false); if (!deckId) { return ( @@ -159,10 +183,24 @@ export function DeckDetailPage() {
}> - + setIsCreateModalOpen(true)} + />
+ + setIsCreateModalOpen(false)} + onNoteCreated={() => { + queryClient.invalidateQueries({ + queryKey: ["decks", deckId, "cards"], + }); + }} + />
); } -- cgit v1.3-1-g0d28