Soften TUI surfaces, typography and loading indicators
This commit is contained in:
+8
-10
@@ -184,7 +184,7 @@ func New(ctx context.Context, url string) Model {
|
||||
ctx: ctx, url: url, status: "Connecting…", width: 80, height: 24,
|
||||
help: newHelp(),
|
||||
runPrompt: textarea.New(),
|
||||
runSpinner: spinner.New(spinner.WithSpinner(spinner.Dot), spinner.WithStyle(lipgloss.NewStyle().Foreground(themeAccent))),
|
||||
runSpinner: spinner.New(spinner.WithSpinner(spinner.Spinner{Frames: []string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"}, FPS: time.Second / 12}), spinner.WithStyle(lipgloss.NewStyle().Foreground(themeAccent))),
|
||||
keys: keyMap{
|
||||
commands: key.NewBinding(key.WithKeys(":"), key.WithHelp(":", "commands")),
|
||||
search: key.NewBinding(key.WithKeys("/"), key.WithHelp("/", "search")),
|
||||
@@ -618,6 +618,9 @@ func (m *Model) appendLine(line string) {
|
||||
|
||||
func (m Model) View() string {
|
||||
connection := m.status
|
||||
if m.conn == nil {
|
||||
connection = m.loading(connection)
|
||||
}
|
||||
if len(m.notificationEndpoints) > 0 {
|
||||
endpoint := m.notificationEndpoints[0]
|
||||
address := endpoint.ServerURL
|
||||
@@ -658,14 +661,9 @@ func (m Model) View() string {
|
||||
}
|
||||
gap := max(0, m.width-lipgloss.Width(title)-lipgloss.Width(status))
|
||||
headerLine := lipgloss.NewStyle().Bold(true).Foreground(themeAccent).Render(title) + strings.Repeat(" ", gap) + lipgloss.NewStyle().Foreground(themeMuted).Render(status)
|
||||
header := lipgloss.NewStyle().
|
||||
BorderStyle(lipgloss.NormalBorder()).BorderBottom(true).
|
||||
BorderForeground(themeMuted).
|
||||
Width(m.width).Render(headerLine)
|
||||
footer := lipgloss.NewStyle().
|
||||
BorderStyle(lipgloss.NormalBorder()).BorderTop(true).
|
||||
BorderForeground(themeMuted).
|
||||
Width(m.width).Render(m.footerContent())
|
||||
header := lipgloss.NewStyle().Background(themeSurface).Foreground(themeText).
|
||||
Width(m.width).Render(surfaceContent(headerLine, themeSurface)) + "\n"
|
||||
footer := "\n" + lipgloss.NewStyle().Width(m.width).Render(m.footerContent())
|
||||
if m.height < 4 {
|
||||
return lipgloss.NewStyle().MaxHeight(m.height).Render(header + "\n" + footer)
|
||||
}
|
||||
@@ -715,7 +713,7 @@ func (m Model) View() string {
|
||||
content = m.statusView(bodyHeight)
|
||||
}
|
||||
if m.editorChecking {
|
||||
content = popup(m.width, bodyHeight, 76, []string{"Checking published edits", "Refreshing pipeline information…", "Local draft remains retained."})
|
||||
content = popup(m.width, bodyHeight, 76, []string{"Checking published edits", m.loading("Refreshing pipeline information…"), "Local draft remains retained."})
|
||||
}
|
||||
parts = append(parts, content)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user