Code + Identity-Rename zur Vorbereitung auf Apple-Dev-Portal-Aktion (Bundle ev.mana.wordeck, App-Group group.ev.mana.wordeck, AASA applinks:wordeck.com). Build bleibt funktional, aber gegen die neue text-only-API können image-occlusion-Creates 422 zurückgeben — das wird mit der Wordeck-Native v1.0-Welle (parallele Apple-Aktion) sauber gemacht. Umbenennung: - 41 Files: cardecky/Cardecky → wordeck/Wordeck (Display, Strings, Kommentare) - 57 Files: CardsNative → WordeckNative, CardsAPI → WordeckAPI, CardsTheme → WordeckTheme, CardsBrand → WordeckBrand, CardsWidget → WordeckWidget, CardsDueWidget → WordeckDueWidget - Bundle-ID ev.mana.cardecky → ev.mana.wordeck (project.yml, Info.plist, entitlements, Keychain-Service, App-Group) - AASA applinks:cardecky.mana.how → applinks:wordeck.com - API-Base cardecky-api.mana.how → api.wordeck.com - 10 Files renamed (App-Entry, API-Extensions, Theme, Widget, Entitlements, Tests) - xcodeproj regenerated via xcodegen → WordeckNative.xcodeproj - MaskRegionsTests.swift gelöscht (image-occlusion entfällt mit Wordeck text-only) Forgejo-Repo git.mana.how/till/cards-native → wordeck-native umbenannt (Auto-Redirect aktiv). Lokales Verzeichnis Code/cards-native/ bleibt vorerst — wird beim nächsten Apple-Setup mit Bundle-Test umbenannt. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
82 lines
2.7 KiB
Swift
82 lines
2.7 KiB
Swift
import SwiftUI
|
|
|
|
/// CSV-Import-Form für den `.csv`-Sub-Modus in `DeckEditorView`. Zeigt
|
|
/// File-Picker-Button, Deck-Namens-Feld und eine Preview-Liste der
|
|
/// erkannten Karten.
|
|
///
|
|
/// State (Datei-Picker-Bool, geparste Rows, Deck-Name) lebt im Parent —
|
|
/// dieser View arbeitet nur über `@Binding`.
|
|
struct CSVImportFormSections: View {
|
|
@Binding var rows: [CSVRow]
|
|
@Binding var deckName: String
|
|
@Binding var showImporter: Bool
|
|
|
|
var body: some View {
|
|
Section {
|
|
Button {
|
|
showImporter = true
|
|
} label: {
|
|
Label(rows.isEmpty ? "CSV-Datei wählen" : "Andere Datei wählen", systemImage: "doc.text")
|
|
}
|
|
} header: {
|
|
Text("Datei")
|
|
} footer: {
|
|
Text("Format pro Zeile: vorne,hinten,typ. Typ-Spalte optional (Default basic).")
|
|
}
|
|
|
|
if !rows.isEmpty {
|
|
Section("Deck-Name") {
|
|
TextField("Deck-Name", text: $deckName)
|
|
.textInputAutocapitalization(.sentences)
|
|
}
|
|
|
|
Section {
|
|
preview
|
|
} header: {
|
|
Text("Vorschau (\(rows.count) Karten)")
|
|
} footer: {
|
|
Text("Image-Occlusion und Audio-Cards werden im CSV-Import übersprungen — die brauchen Datei-Uploads.")
|
|
}
|
|
}
|
|
}
|
|
|
|
@ViewBuilder
|
|
private var preview: some View {
|
|
let visible = rows.prefix(8)
|
|
ForEach(Array(visible.enumerated()), id: \.offset) { _, row in
|
|
VStack(alignment: .leading, spacing: 4) {
|
|
Text(row.front)
|
|
.font(.subheadline)
|
|
.lineLimit(2)
|
|
.foregroundStyle(WordeckTheme.foreground)
|
|
Text(row.back)
|
|
.font(.caption)
|
|
.lineLimit(2)
|
|
.foregroundStyle(WordeckTheme.mutedForeground)
|
|
if row.type != .basic {
|
|
Text(typeLabel(row.type))
|
|
.font(.caption2)
|
|
.foregroundStyle(WordeckTheme.primary)
|
|
}
|
|
}
|
|
.padding(.vertical, 2)
|
|
}
|
|
if rows.count > visible.count {
|
|
Text("… und \(rows.count - visible.count) weitere")
|
|
.font(.caption)
|
|
.foregroundStyle(WordeckTheme.mutedForeground)
|
|
}
|
|
}
|
|
|
|
private func typeLabel(_ type: CardType) -> String {
|
|
switch type {
|
|
case .basic: "Einfach"
|
|
case .basicReverse: "Beidseitig"
|
|
case .cloze: "Lückentext"
|
|
case .typing: "Eintippen"
|
|
case .multipleChoice: "Multiple Choice"
|
|
case .imageOcclusion: "Bild-Verdeckung (übersprungen)"
|
|
case .audioFront: "Audio (übersprungen)"
|
|
}
|
|
}
|
|
}
|