|
|
@ -56,6 +56,7 @@ type model struct { |
|
|
|
dataSheetViewport viewport.Model |
|
|
|
} |
|
|
|
|
|
|
|
// TODO: cache this somewhere, it's called several times... in the model?
|
|
|
|
func (m model) dataSheetNames() []string { |
|
|
|
var names []string |
|
|
|
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
|
|
|
|
// 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] |
|
|
|
viewportText := m.datasheetFromName(lastDatasheet) |
|
|
|
m.dataSheetViewport.SetContent(viewportText) |
|
|
@ -182,7 +183,10 @@ func (m model) View() string { |
|
|
|
|
|
|
|
// TODO: paginate / trim view to last 10 or something?
|
|
|
|
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()) |
|
|
|
|
|
|
|
body.WriteString(panes) |
|
|
|
|
|
|
|
body.WriteString("\n" + m.filterInput.View()) |
|
|
|