chore: more todos

This commit is contained in:
decentral1se 2023-05-10 16:45:23 +02:00
parent 1715eecaf0
commit 6a33e78d01
No known key found for this signature in database
GPG Key ID: 03789458B3D0C410

View File

@ -56,6 +56,7 @@ type model struct {
dataSheetViewport viewport.Model dataSheetViewport viewport.Model
} }
// TODO: cache this somewhere, it's called several times... in the model?
func (m model) dataSheetNames() []string { func (m model) dataSheetNames() []string {
var names []string var names []string
for _, datasheet := range m.datasheets { for _, datasheet := range m.datasheets {
@ -153,7 +154,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
// TODO: implement cursor for scrolling up/down filtered // TODO: implement cursor for scrolling up/down filtered
// results so we can view the PDF contents as desired // results so we can view the PDF contents as desired
// it's currently just the last one (closed to input) // it's currently just the last one (closest to input)
lastDatasheet := m.dataSheetsView[len(m.dataSheetsView)-1] lastDatasheet := m.dataSheetsView[len(m.dataSheetsView)-1]
viewportText := m.datasheetFromName(lastDatasheet) viewportText := m.datasheetFromName(lastDatasheet)
m.dataSheetViewport.SetContent(viewportText) m.dataSheetViewport.SetContent(viewportText)
@ -182,7 +183,10 @@ func (m model) View() string {
// TODO: paginate / trim view to last 10 or something? // TODO: paginate / trim view to last 10 or something?
sheets := strings.Join(m.dataSheetsView, "\n") sheets := strings.Join(m.dataSheetsView, "\n")
// TODO: style further with lipgloss, e.g. borders, margins, etc.
panes := lipgloss.JoinHorizontal(lipgloss.Left, sheets, m.dataSheetViewport.View()) panes := lipgloss.JoinHorizontal(lipgloss.Left, sheets, m.dataSheetViewport.View())
body.WriteString(panes) body.WriteString(panes)
body.WriteString("\n" + m.filterInput.View()) body.WriteString("\n" + m.filterInput.View())