works now

This commit is contained in:
Robin Olsen
2026-03-18 11:58:31 +01:00
parent 40d25cc716
commit 3e9a903506
24 changed files with 154 additions and 99 deletions

View File

@@ -54,7 +54,7 @@ func (m tuiModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.width = msg.Width
m.height = msg.Height
return m, nil
case tea.KeyMsg:
case tea.KeyPressMsg:
switch msg.String() {
case "q", "esc", "ctrl+c":
select {
@@ -69,11 +69,14 @@ func (m tuiModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, nil
}
func (m tuiModel) View() string {
return lipgloss.Place(m.width, m.height, lipgloss.Center, lipgloss.Center, fmt.Sprintf(
func (m tuiModel) View() tea.View {
content := lipgloss.Place(m.width, m.height, lipgloss.Center, lipgloss.Center, fmt.Sprintf(
"Web server running at %s\n\nPress q, esc, or Ctrl+C to stop the task and server.\n",
m.address,
))
v := tea.NewView(content)
v.AltScreen = true
return v
}
func (w *Web) Run(ctx context.Context, config Config) error {
@@ -106,7 +109,6 @@ func (w *Web) Run(ctx context.Context, config Config) error {
address: address,
quitChan: uiQuitChan,
},
tea.WithAltScreen(),
)
screenDone = make(chan struct{})