diff options
| author | David Schlachter <t480-debian-git@schlachter.ca> | 2026-01-08 11:14:39 -0500 |
|---|---|---|
| committer | David Schlachter <t480-debian-git@schlachter.ca> | 2026-01-08 11:14:39 -0500 |
| commit | 471df4d7a1654f35756a202e26a5d28815222012 (patch) | |
| tree | 743a150149b1c0083c125da4c7c0ca487b2d600f /ui.go | |
| parent | 10f8e8c5ea5d3dd191d7e51682efc237d34cded4 (diff) | |
More flexible and better documentation
Diffstat (limited to 'ui.go')
| -rw-r--r-- | ui.go | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -25,6 +25,8 @@ type model struct { wordAddStatus string p bluemonday.Policy vp viewport.Model + ankiDeck string + ankiModel string } type ( @@ -33,7 +35,7 @@ type ( wordAddedMsg string ) -func initialModel(c *http.Client, db *sql.DB) model { +func initialModel(c *http.Client, db *sql.DB, ankiDeck, ankiModel string) model { ti := textinput.New() ti.Placeholder = "" ti.Focus() @@ -49,6 +51,8 @@ func initialModel(c *http.Client, db *sql.DB) model { wordAddStatus: "", p: *bluemonday.StrictPolicy(), vp: vp, + ankiDeck: ankiDeck, + ankiModel: ankiModel, } } @@ -105,7 +109,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { m.wordInput.SetValue("") m.vp.SetContent("") case tea.KeyEnter: - return m, addCard(m.c, m.currentWord, m.currentDefinition) + return m, addCard(m.c, m.ankiDeck, m.ankiModel, m.currentWord, m.currentDefinition) } case errMsg: |
