aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/client/pages/HomePage.tsx
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-12-07 17:51:34 +0900
committernsfisis <nsfisis@gmail.com>2025-12-07 17:51:34 +0900
commit020803f7dfd094dcf5157943644a28d601629b35 (patch)
tree9d89864d0f0a03f5b5f50504a767da4edf3efa2e /src/client/pages/HomePage.tsx
parentef40cc0f3b1b3013046820b84e8482f1c6a29533 (diff)
downloadkioku-020803f7dfd094dcf5157943644a28d601629b35.tar.gz
kioku-020803f7dfd094dcf5157943644a28d601629b35.tar.zst
kioku-020803f7dfd094dcf5157943644a28d601629b35.zip
feat(client): add create deck modal with form validation
Add CreateDeckModal component that allows users to create new decks with name and optional description fields. Integrates with HomePage via a "Create Deck" button that opens the modal, and refreshes the deck list after successful creation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'src/client/pages/HomePage.tsx')
-rw-r--r--src/client/pages/HomePage.tsx22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/client/pages/HomePage.tsx b/src/client/pages/HomePage.tsx
index c9d0843..d753aa1 100644
--- a/src/client/pages/HomePage.tsx
+++ b/src/client/pages/HomePage.tsx
@@ -1,5 +1,6 @@
import { useCallback, useEffect, useState } from "react";
import { ApiClientError, apiClient } from "../api";
+import { CreateDeckModal } from "../components/CreateDeckModal";
import { useAuth } from "../stores";
interface Deck {
@@ -16,6 +17,7 @@ export function HomePage() {
const [decks, setDecks] = useState<Deck[]>([]);
const [isLoading, setIsLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
+ const [isCreateModalOpen, setIsCreateModalOpen] = useState(false);
const fetchDecks = useCallback(async () => {
setIsLoading(true);
@@ -69,7 +71,19 @@ export function HomePage() {
</header>
<main>
- <h2>Your Decks</h2>
+ <div
+ style={{
+ display: "flex",
+ justifyContent: "space-between",
+ alignItems: "center",
+ marginBottom: "1rem",
+ }}
+ >
+ <h2 style={{ margin: 0 }}>Your Decks</h2>
+ <button type="button" onClick={() => setIsCreateModalOpen(true)}>
+ Create Deck
+ </button>
+ </div>
{isLoading && <p>Loading decks...</p>}
@@ -116,6 +130,12 @@ export function HomePage() {
</ul>
)}
</main>
+
+ <CreateDeckModal
+ isOpen={isCreateModalOpen}
+ onClose={() => setIsCreateModalOpen(false)}
+ onDeckCreated={fetchDecks}
+ />
</div>
);
}