From 471df4d7a1654f35756a202e26a5d28815222012 Mon Sep 17 00:00:00 2001 From: David Schlachter Date: Thu, 8 Jan 2026 11:14:39 -0500 Subject: More flexible and better documentation --- ui.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ui.go') diff --git a/ui.go b/ui.go index 966243b..9855203 100644 --- a/ui.go +++ b/ui.go @@ -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: -- cgit v1.2.3