diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-01-02 23:53:06 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-01-02 23:56:00 +0900 |
| commit | abce2aaa274f83f53de2fb88fd81e3da664317fd (patch) | |
| tree | fc5f462434d68e9b6e0f6518c3ed6d40d7895634 /src/client | |
| parent | 2fb6471a685bec1433be3335f377a1a2313e4820 (diff) | |
| download | kioku-abce2aaa274f83f53de2fb88fd81e3da664317fd.tar.gz kioku-abce2aaa274f83f53de2fb88fd81e3da664317fd.tar.zst kioku-abce2aaa274f83f53de2fb88fd81e3da664317fd.zip | |
feat(import): simplify CSV format by removing deck column
Since import is initiated from deck context, the deck is already known
via props. Simplifies CSV format to: note_type,Field1,Field2,...
BREAKING CHANGE: CSV format changed from deck,note_type,... to note_type,...
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/components/ImportNotesModal.tsx | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/client/components/ImportNotesModal.tsx b/src/client/components/ImportNotesModal.tsx index a7a88c5..2eb0922 100644 --- a/src/client/components/ImportNotesModal.tsx +++ b/src/client/components/ImportNotesModal.tsx @@ -142,22 +142,20 @@ export function ImportNotesModal({ const { headers, rows } = parseResult.data; - // Validate headers: must have deck, note_type, and at least one field - if (headers.length < 3) { - setError( - "CSV must have at least 3 columns: deck, note_type, and field(s)", - ); + // Validate headers: must have note_type and at least one field + if (headers.length < 2) { + setError("CSV must have at least 2 columns: note_type and field(s)"); setPhase("upload"); return; } - if (headers[0] !== "deck" || headers[1] !== "note_type") { - setError("First two columns must be 'deck' and 'note_type'"); + if (headers[0] !== "note_type") { + setError("First column must be 'note_type'"); setPhase("upload"); return; } - const fieldNames = headers.slice(2); + const fieldNames = headers.slice(1); const validated: ValidatedRow[] = []; const errors: ValidationError[] = []; @@ -316,9 +314,9 @@ export function ImportNotesModal({ <div className="bg-ivory rounded-lg px-4 py-3 text-sm text-muted"> <p className="font-medium text-slate mb-1">Expected format:</p> <code className="text-xs"> - deck,note_type,Front,Back + note_type,Front,Back <br /> - MyDeck,Basic,hello,world + Basic,hello,world </code> </div> </div> |
