Vervollständigt die Cardecky-Web-Parität für Deck- und Card-Workflows. γ-1+γ-2 (AI-Deck-Generierung) - 4-Modi-Picker im DeckEditorView Create-Sheet: Leer/KI/Bild/CSV - POST /api/v1/decks/generate für Text-Prompt + 10/min Rate-Limit-UI - POST /api/v1/decks/from-image mit PhotosPicker + PDF-Importer (max 5 Files, 10 MiB/Bild, 30 MiB/PDF), Multipart-Body in CardsAPI+Generation - Loading-Overlay mit Task-Cancellation, Error-Mapping für 429/413/502 γ-3 (Card-Edit) - CardEditorView mit Mode .create(deckId:) / .edit(card:) - Image-Occlusion + Audio-Front behalten bestehenden Media-Ref, solange User nicht ersetzt — MediaCache lädt Bild nach - Type-Picker im Edit-Modus aus (Server-immutable) - CardEditorPayload + CardEditorMediaFields als Sub-Views γ-4 (Pull-Update + Duplicate + Archive) - POST /marketplace/private/:id/pull-update mit Smart-Merge-Anzeige - POST /decks/:id/duplicate - Archive-Toggle im Edit-Modus, Server filtert Liste serverseitig - DeckSecondaryActions als eigenes Sub-View γ-6 (CSV-Import) - RFC-4180-ish Parser (Quote-Escape, Header-Detect, BOM-strip) - Preview-Liste + sequentielle Card-Inserts mit Live-Progress - Image-Occlusion/Audio-Front werden geskipped (UI flaggt) γ-7 (Marketplace-Publish) + Follow-up (Report + Block + Re-Publish) - MarketplacePublishView mit lazy Author-Setup + Init + Publish 1.0.0 - Re-Publish-Modus: Picker für eigene Marketplace-Decks + Auto-Semver-Bump (Minor +1) - MarketplaceCardConverter (typing → type-in, audio-front → skipped, image-occlusion → skipped — Server hat keinen MP-Media-Re-Upload) - Toolbar-Menü auf PublicDeckView: „Deck melden …" + Author-Blockieren (App-Store-Guideline 5.1.1(v)) - ReportDeckSheet mit Reason-Picker (6 Kategorien) + optional Message - BlockedAuthorsView in Settings mit Swipe-Entblocken γ-8 (PDF-Export) - DeckPrintView mit SFSafariViewController auf cardecky.mana.how/decks/:id/print — iOS Share-Sheet → PDF speichern Side-Fixes (mid-stream) - StudySessionView: Card-Aspect-Ratio springt nicht mehr beim Flip (Bottom-Bar in ZStack fixer Höhe) - RootView: Glass-Pille für „Neues Deck"-Accessory + .guest- und .twoFactorRequired-Cases nachgezogen - DeckListView: Account-Toolbar-Button entfernt (Account-Tab unten ist alleinige Anlaufstelle) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
138 lines
4.8 KiB
Swift
138 lines
4.8 KiB
Swift
import SwiftUI
|
|
|
|
/// Sekundär-Action-Buttons unterhalb der Lern-/Karten-hinzufügen-Buttons
|
|
/// in `DeckDetailView`. Eigenständige View, damit `DeckDetailView` selbst
|
|
/// nicht über die Type-Body-Length-Grenze rutscht und die einzelnen
|
|
/// Aktionen einzeln (z.B. via Snapshot-Tests) prüfbar bleiben.
|
|
///
|
|
/// Reines Layout — alle Side-Effects laufen über die Callbacks im Parent.
|
|
struct DeckSecondaryActions: View {
|
|
let isForkedFromMarketplace: Bool
|
|
let isPullingUpdate: Bool
|
|
let isDuplicating: Bool
|
|
let onPullUpdate: () -> Void
|
|
let onDuplicate: () -> Void
|
|
let onPublish: () -> Void
|
|
let onPrint: () -> Void
|
|
let onEdit: () -> Void
|
|
let onDelete: () -> Void
|
|
|
|
var body: some View {
|
|
if isForkedFromMarketplace {
|
|
updateButton
|
|
} else {
|
|
publishButton
|
|
}
|
|
duplicateButton
|
|
printButton
|
|
editDeleteRow
|
|
}
|
|
|
|
private var printButton: some View {
|
|
Button(action: onPrint) {
|
|
HStack {
|
|
Image(systemName: "printer")
|
|
Text("Druck-Ansicht / PDF")
|
|
}
|
|
.frame(maxWidth: .infinity)
|
|
.padding(.vertical, 10)
|
|
.background(CardsTheme.surface, in: RoundedRectangle(cornerRadius: 10))
|
|
.foregroundStyle(CardsTheme.foreground)
|
|
.overlay(
|
|
RoundedRectangle(cornerRadius: 10)
|
|
.stroke(CardsTheme.border, lineWidth: 1)
|
|
)
|
|
}
|
|
.buttonStyle(.plain)
|
|
}
|
|
|
|
private var publishButton: some View {
|
|
Button(action: onPublish) {
|
|
HStack {
|
|
Image(systemName: "globe.badge.chevron.backward")
|
|
Text("Im Marketplace veröffentlichen")
|
|
}
|
|
.frame(maxWidth: .infinity)
|
|
.padding(.vertical, 10)
|
|
.background(CardsTheme.surface, in: RoundedRectangle(cornerRadius: 10))
|
|
.foregroundStyle(CardsTheme.primary)
|
|
.overlay(
|
|
RoundedRectangle(cornerRadius: 10)
|
|
.stroke(CardsTheme.primary.opacity(0.3), lineWidth: 1)
|
|
)
|
|
}
|
|
.buttonStyle(.plain)
|
|
}
|
|
|
|
private var updateButton: some View {
|
|
Button(action: onPullUpdate) {
|
|
HStack {
|
|
if isPullingUpdate {
|
|
ProgressView().tint(CardsTheme.primary)
|
|
} else {
|
|
Image(systemName: "arrow.triangle.2.circlepath")
|
|
}
|
|
Text(isPullingUpdate ? "Wird geprüft …" : "Updates aus Marketplace prüfen")
|
|
}
|
|
.frame(maxWidth: .infinity)
|
|
.padding(.vertical, 10)
|
|
.background(CardsTheme.surface, in: RoundedRectangle(cornerRadius: 10))
|
|
.foregroundStyle(CardsTheme.primary)
|
|
.overlay(
|
|
RoundedRectangle(cornerRadius: 10)
|
|
.stroke(CardsTheme.primary.opacity(0.3), lineWidth: 1)
|
|
)
|
|
}
|
|
.buttonStyle(.plain)
|
|
.disabled(isPullingUpdate)
|
|
}
|
|
|
|
private var duplicateButton: some View {
|
|
Button(action: onDuplicate) {
|
|
HStack {
|
|
if isDuplicating {
|
|
ProgressView().tint(CardsTheme.foreground)
|
|
} else {
|
|
Image(systemName: "doc.on.doc")
|
|
}
|
|
Text(isDuplicating ? "Wird dupliziert …" : "Deck duplizieren")
|
|
}
|
|
.frame(maxWidth: .infinity)
|
|
.padding(.vertical, 10)
|
|
.background(CardsTheme.surface, in: RoundedRectangle(cornerRadius: 10))
|
|
.foregroundStyle(CardsTheme.foreground)
|
|
.overlay(
|
|
RoundedRectangle(cornerRadius: 10)
|
|
.stroke(CardsTheme.border, lineWidth: 1)
|
|
)
|
|
}
|
|
.buttonStyle(.plain)
|
|
.disabled(isDuplicating)
|
|
}
|
|
|
|
private var editDeleteRow: some View {
|
|
HStack(spacing: 12) {
|
|
Button(action: onEdit) {
|
|
Label("Bearbeiten", systemImage: "pencil")
|
|
.frame(maxWidth: .infinity)
|
|
.padding(.vertical, 10)
|
|
.background(CardsTheme.surface, in: RoundedRectangle(cornerRadius: 10))
|
|
.foregroundStyle(CardsTheme.foreground)
|
|
.overlay(
|
|
RoundedRectangle(cornerRadius: 10)
|
|
.stroke(CardsTheme.border, lineWidth: 1)
|
|
)
|
|
}
|
|
.buttonStyle(.plain)
|
|
|
|
Button(action: onDelete) {
|
|
Label("Löschen", systemImage: "trash")
|
|
.frame(maxWidth: .infinity)
|
|
.padding(.vertical, 10)
|
|
.background(CardsTheme.error.opacity(0.1), in: RoundedRectangle(cornerRadius: 10))
|
|
.foregroundStyle(CardsTheme.error)
|
|
}
|
|
.buttonStyle(.plain)
|
|
}
|
|
}
|
|
}
|