feat(decks): Card-Liste im DeckDetailView + listCards-API
Bisher zeigte DeckDetailView nur 4 Action-Buttons (Lernen, Hinzufügen, Bearbeiten, Löschen) — Karten waren nur via Study-Loop sichtbar. User-Feedback: "ich sehe keine Karten im Deck". Geändert: - CardsAPI.listCards(deckId:) → [Card] (war nur cardCount via /total) - CardListResponse: nimmt cards-Array zusätzlich zu total - DeckDetailView: ScrollView statt VStack, neue Sektion "Karten" unter den Action-Buttons mit CardPreviewRow pro Karte - CardPreviewRow: Type-Icon + Front-Preview (basic/cloze/audio/ image-occlusion adaptiv) + Type-Label - task(id:) + refreshable triggern loadCards() - Nach CardEditor-Save reloaded die Liste Build 4 → 5. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
f528ea448a
commit
e8b898a51d
4 changed files with 169 additions and 17 deletions
|
|
@ -44,6 +44,14 @@ actor CardsAPI {
|
|||
return try decoder.decode(CardListResponse.self, from: data).total
|
||||
}
|
||||
|
||||
/// `GET /api/v1/cards?deck_id=...` — komplette Liste der Karten
|
||||
/// für den Browse-Modus im DeckDetailView.
|
||||
func listCards(deckId: String) async throws -> [Card] {
|
||||
let (data, http) = try await transport.request(path: "/api/v1/cards?deck_id=\(deckId)")
|
||||
try ensureOK(http, data: data)
|
||||
return try decoder.decode(CardListResponse.self, from: data).cards
|
||||
}
|
||||
|
||||
/// `GET /api/v1/reviews/due?deck_id=...&limit=500` — Anzahl fälliger
|
||||
/// Reviews in einem Deck.
|
||||
func dueCount(deckId: String) async throws -> Int {
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@ struct DeckListResponse: Decodable, Sendable {
|
|||
|
||||
/// Server-Response von `GET /api/v1/cards?deck_id=...`.
|
||||
struct CardListResponse: Decodable, Sendable {
|
||||
let cards: [Card]
|
||||
let total: Int
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue