Skip to content

Commit b79ccd3

Browse files
gitcoder89431claude
andcommitted
feat: route connect actions to Activity log, remove floating Done notice
Accept, dismiss, remove, and pair actions now append a timestamped entry to Activity ("MacBook removed", "MacBook accepted", etc.) instead of showing a floating "Done." on the Connect screen. Errors still show inline on Connect since they need immediate attention. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5d8e5db commit b79ccd3

2 files changed

Lines changed: 27 additions & 8 deletions

File tree

internal/app/update.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,22 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
100100
return m, cmd
101101
}
102102
return m, nil
103+
case screens.ConnectionActionMsg:
104+
if s, ok := m.screens["connect"].(screens.Connections); ok {
105+
updated, cmd := s.Update(msg)
106+
m.screens["connect"] = updated
107+
if msg.Err == nil && msg.Message != "" {
108+
m.activity = append(m.activity, screens.ActivityEntry{
109+
Time: time.Now(),
110+
Icon: "✓",
111+
Kind: "success",
112+
Message: msg.Message,
113+
})
114+
m.updateActivityScreen()
115+
}
116+
return m, cmd
117+
}
118+
return m, nil
103119
case screens.ConnectionRenameMsg:
104120
// route to connect screen
105121
if s, ok := m.screens["connect"].(screens.Connections); ok {

internal/screens/connections.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ type ConnectionsLoadedMsg struct {
1919
Err error
2020
}
2121

22-
type ConnectionActionMsg struct{ Err error }
22+
type ConnectionActionMsg struct {
23+
Err error
24+
Message string // logged to Activity on success, e.g. "MacBook removed"
25+
}
2326

2427
type ConnectionRenameMsg struct{ Err error }
2528

@@ -73,7 +76,7 @@ func (c Connections) Update(msg tea.Msg) (Screen, tea.Cmd) {
7376
if msg.Err != nil {
7477
c.notice = "Error: " + msg.Err.Error()
7578
} else {
76-
c.notice = "Done."
79+
c.notice = ""
7780
}
7881
return c, c.loadCmd()
7982

@@ -103,7 +106,7 @@ func (c Connections) handleKey(msg tea.KeyPressMsg) (Screen, tea.Cmd) {
103106
c.pairing = false
104107
c.pairInput = ""
105108
return c, func() tea.Msg {
106-
return ConnectionActionMsg{Err: client.AcceptDevice(id, "")}
109+
return ConnectionActionMsg{Err: client.AcceptDevice(id, ""), Message: firstSegment(id) + " paired"}
107110
}
108111
}
109112
c.pairing = false
@@ -179,21 +182,21 @@ func (c Connections) handleKey(msg tea.KeyPressMsg) (Screen, tea.Cmd) {
179182
if dev := c.selectedPending(); dev != nil {
180183
client, id, name := c.client, dev.ID, dev.Name
181184
return c, func() tea.Msg {
182-
return ConnectionActionMsg{Err: client.AcceptDevice(id, name)}
185+
return ConnectionActionMsg{Err: client.AcceptDevice(id, name), Message: name + " accepted"}
183186
}
184187
}
185188
case "i":
186189
if dev := c.selectedPending(); dev != nil {
187-
client, id := c.client, dev.ID
190+
client, id, name := c.client, dev.ID, dev.Name
188191
return c, func() tea.Msg {
189-
return ConnectionActionMsg{Err: client.DismissDevice(id)}
192+
return ConnectionActionMsg{Err: client.DismissDevice(id), Message: name + " dismissed"}
190193
}
191194
}
192195
case "d":
193196
if dev := c.selectedApproved(); dev != nil && dev.ID != c.local.ID {
194-
client, id := c.client, dev.ID
197+
client, id, name := c.client, dev.ID, dev.Name
195198
return c, func() tea.Msg {
196-
return ConnectionActionMsg{Err: client.RemoveDevice(id)}
199+
return ConnectionActionMsg{Err: client.RemoveDevice(id), Message: name + " removed"}
197200
}
198201
}
199202
case "p":

0 commit comments

Comments
 (0)