summaryrefslogtreecommitdiff
path: root/ui.go
diff options
context:
space:
mode:
Diffstat (limited to 'ui.go')
-rw-r--r--ui.go8
1 files changed, 6 insertions, 2 deletions
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: