diff --git a/src/app/shared/[classSlug]/[type]/[token]/SharedViewer.tsx b/src/app/shared/[classSlug]/[type]/[token]/SharedViewer.tsx index dce55ab..87d77ce 100644 --- a/src/app/shared/[classSlug]/[type]/[token]/SharedViewer.tsx +++ b/src/app/shared/[classSlug]/[type]/[token]/SharedViewer.tsx @@ -3,6 +3,7 @@ import { useState } from "react"; import { FlashcardViewer } from "@/components/flashcards/FlashcardViewer"; import { QuizViewer } from "@/components/quizzes/QuizViewer"; +import { CardList } from "@/components/flashcards/CardList"; interface SharedViewerProps { type: string; @@ -11,6 +12,7 @@ interface SharedViewerProps { export function SharedViewer({ type, data }: SharedViewerProps) { const [restartKey, setRestartKey] = useState(0); + const [view, setView] = useState<"study" | "list">("study"); return (
@@ -29,26 +31,57 @@ export function SharedViewer({ type, data }: SharedViewerProps) { )}
-
- +
+ {view === "study" && ( + + )} + + {type === "flashcards" && ( +
+ + +
+ )}
{type === "flashcards" ? ( - + view === "study" ? ( + + ) : ( + + ) ) : ( +
+ {cards.length} {cards.length === 1 ? "card" : "cards"} +
+ + {cards.map((card, index) => ( +
+
+
+
+ + {index + 1} + + Front +
+
+ {card.front} +
+
+
+
+ + {index + 1} + + Back +
+
+ {card.back} +
+
+
+
+ ))} + + ); +}