WIP
This commit is contained in:
23
ui/view.go
23
ui/view.go
@@ -14,6 +14,21 @@ import (
|
||||
|
||||
var panelStyle = lipgloss.NewStyle().Border(lipgloss.NormalBorder()).Padding(0, 1)
|
||||
|
||||
func flattenDict(m map[string]interface{}, indent int) []string {
|
||||
lines := []string{}
|
||||
prefix := strings.Repeat(" ", indent)
|
||||
for k, v := range m {
|
||||
switch val := v.(type) {
|
||||
case map[string]interface{}:
|
||||
lines = append(lines, fmt.Sprintf("%s%s:", prefix, k))
|
||||
lines = append(lines, flattenDict(val, indent+1)...)
|
||||
default:
|
||||
lines = append(lines, fmt.Sprintf("%s%s: %v", prefix, k, val))
|
||||
}
|
||||
}
|
||||
return lines
|
||||
}
|
||||
|
||||
func (m Model) View() string {
|
||||
var buf bytes.Buffer
|
||||
lexer := lexers.Get("python")
|
||||
@@ -54,9 +69,15 @@ func (m Model) View() string {
|
||||
Width(m.codeViewer.Width - wFrame).
|
||||
Render(m.codeViewer.View())
|
||||
|
||||
bottomPanel := panelStyle.Height(m.stdoutOutput.Height - hFrame).
|
||||
bottomLeftPanel := panelStyle.Height(m.stdoutOutput.Height - hFrame).
|
||||
Width(m.stdoutOutput.Width - wFrame).
|
||||
Render(m.stdoutOutput.View())
|
||||
|
||||
bottomRightPanel := panelStyle.Height(m.stdoutOutput.Height - hFrame).
|
||||
Width(m.stdoutOutput.Width - wFrame).
|
||||
Render(m.localsViewer.View())
|
||||
|
||||
bottomPanel := lipgloss.JoinHorizontal(lipgloss.Top, bottomLeftPanel, bottomRightPanel)
|
||||
|
||||
return lipgloss.JoinVertical(lipgloss.Top, topPanel, bottomPanel)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user