Skip to content

Commit 786a68e

Browse files
gitcoder89431claude
andcommitted
chore: silent clipboard copy on Settings — remove notice feedback
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent daaa61a commit 786a68e

2 files changed

Lines changed: 4 additions & 27 deletions

File tree

internal/app/update.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,6 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
109109
return m, cmd
110110
}
111111
return m, nil
112-
case screens.SettingsClearNoticeMsg:
113-
if s, ok := m.screens["settings"].(screens.Settings); ok {
114-
updated, cmd := s.Update(msg)
115-
m.screens["settings"] = updated
116-
return m, cmd
117-
}
118-
return m, nil
119112
case tea.KeyPressMsg:
120113
return m.handleKey(msg)
121114
}

internal/screens/settings.go

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"os/exec"
66
"runtime"
77
"strings"
8-
"time"
98

109
tea "charm.land/bubbletea/v2"
1110
"charm.land/lipgloss/v2"
@@ -25,33 +24,21 @@ type SettingsState struct {
2524
}
2625

2726
type Settings struct {
28-
state SettingsState
29-
theme theme.Theme
30-
notice string
27+
state SettingsState
28+
theme theme.Theme
3129
}
3230

33-
type SettingsClearNoticeMsg struct{}
34-
3531
func NewSettings(state SettingsState, t theme.Theme) Settings {
3632
return Settings{state: state, theme: t}
3733
}
3834

3935
func (s Settings) Init() tea.Cmd { return nil }
4036

4137
func (s Settings) Update(msg tea.Msg) (Screen, tea.Cmd) {
42-
switch msg := msg.(type) {
43-
case tea.KeyPressMsg:
38+
if msg, ok := msg.(tea.KeyPressMsg); ok {
4439
if msg.String() == "c" && s.state.DeviceID != "" {
45-
err := copyToClipboard(s.state.DeviceID)
46-
if err != nil {
47-
s.notice = "copy failed: " + err.Error()
48-
} else {
49-
s.notice = "copied!"
50-
}
51-
return s, tea.Tick(2*time.Second, func(time.Time) tea.Msg { return SettingsClearNoticeMsg{} })
40+
_ = copyToClipboard(s.state.DeviceID)
5241
}
53-
case SettingsClearNoticeMsg:
54-
s.notice = ""
5542
}
5643
return s, nil
5744
}
@@ -91,9 +78,6 @@ func (s Settings) View(width, height int) string {
9178
if s.state.DeviceID != "" {
9279
lines = append(lines, row("Device ID", s.state.DeviceID))
9380
}
94-
if s.notice != "" {
95-
lines = append(lines, "", s.theme.Success.Render(" "+s.notice))
96-
}
9781

9882
return lipgloss.NewStyle().Width(width).Height(height).Render(strings.Join(lines, "\n"))
9983
}

0 commit comments

Comments
 (0)