Skip to content

Commit 8bf785d

Browse files
committed
Refined styling and moved text strings to strings.go
1 parent cfc821b commit 8bf785d

3 files changed

Lines changed: 39 additions & 8 deletions

File tree

tui/internal/constants/strings.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,13 @@ const (
124124
WelcomeCTA = "> ENTER <"
125125
)
126126

127+
// Update notice (welcome view)
128+
const (
129+
UpdateNoticeFormat = "Update available: %s (current: %s)"
130+
UpdateNoticeHintCopy = "Press c to copy update command"
131+
UpdateNoticeCopied = "Copied to clipboard!"
132+
)
133+
127134
// Auth view
128135
const (
129136
AuthOpeningBrowser = "Opening browser for Skene authentication"
@@ -222,6 +229,7 @@ const (
222229
HelpKeyG = "g"
223230
HelpKeyM = "m"
224231
HelpKeyR = "r"
232+
HelpKeyC = "c"
225233
)
226234

227235
// Help descriptions
@@ -265,4 +273,5 @@ const (
265273
HelpDescToggleOption = "toggle option"
266274
HelpDescOpenFolder = "open folder"
267275
HelpDescTabs = "tabs"
276+
HelpDescCopyUpdateCmd = "copy update cmd"
268277
)

tui/internal/tui/styles/styles.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,12 @@ var FooterHelp lipgloss.Style
174174
// Spinner style
175175
var Spinner lipgloss.Style
176176

177+
// UpdateNotice style — framed box for update + hint
178+
var UpdateNotice lipgloss.Style
179+
180+
// UpdateNoticeText style — main update message (white)
181+
var UpdateNoticeText lipgloss.Style
182+
177183
// rebuildStyles constructs all lipgloss styles from the current color
178184
// variables. Called by Init() after colors have been set.
179185
func rebuildStyles() {
@@ -290,6 +296,15 @@ func rebuildStyles() {
290296

291297
// Spinner style
292298
Spinner = lipgloss.NewStyle().Foreground(Amber)
299+
300+
// UpdateNotice — bordered box for update + hint (no bg; centered text)
301+
UpdateNotice = lipgloss.NewStyle().
302+
Border(lipgloss.RoundedBorder()).
303+
BorderForeground(MidGray).
304+
Padding(1, 1).
305+
Align(lipgloss.Center).
306+
MarginTop(1)
307+
UpdateNoticeText = lipgloss.NewStyle().Foreground(White)
293308
}
294309

295310
// init sets up the default dark-theme styles at package load time.

tui/internal/tui/views/welcome.go

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,23 @@ func (v *WelcomeView) Render() string {
107107
// Version info
108108
version := center.Render(styles.Muted.Render(constants.Version + " • " + constants.Repository))
109109

110-
// Update notification
110+
// Update notification — bordered block with update + hint
111111
var updateNotice string
112112
if v.newVersion != "" {
113-
notice := fmt.Sprintf("Update available: %s (current: %s)", v.newVersion, constants.Version)
114-
updateNotice = center.Render(styles.Accent.Render(notice))
113+
notice := fmt.Sprintf(constants.UpdateNoticeFormat, v.newVersion, constants.Version)
114+
hintRaw := constants.UpdateNoticeHintCopy
115115
if v.copied {
116-
updateNotice += "\n" + center.Render(styles.Muted.Render("Copied to clipboard!"))
117-
} else {
118-
updateNotice += "\n" + center.Render(styles.Muted.Render("Press c to copy update command"))
116+
hintRaw = constants.UpdateNoticeCopied
119117
}
118+
hint := styles.Muted.Render(hintRaw)
119+
blockWidth := lipgloss.Width(notice)
120+
if w := lipgloss.Width(hintRaw); w > blockWidth {
121+
blockWidth = w
122+
}
123+
blockWidth += 4 // padding
124+
content := styles.UpdateNoticeText.Render(notice) + "\n" + hint
125+
block := styles.UpdateNotice.Width(blockWidth).Render(content)
126+
updateNotice = center.Render(block)
120127
}
121128

122129
// Footer help
@@ -125,7 +132,7 @@ func (v *WelcomeView) Render() string {
125132
{Key: constants.HelpKeyCtrlC, Desc: constants.HelpDescQuit},
126133
}
127134
if v.newVersion != "" {
128-
helpItems = append(helpItems, components.HelpItem{Key: "c", Desc: "copy update cmd"})
135+
helpItems = append(helpItems, components.HelpItem{Key: constants.HelpKeyC, Desc: constants.HelpDescCopyUpdateCmd})
129136
}
130137
footer := components.FooterHelp(helpItems)
131138

@@ -173,7 +180,7 @@ func (v *WelcomeView) GetHelpItems() []components.HelpItem {
173180
{Key: constants.HelpKeyCtrlC, Desc: constants.HelpDescQuit},
174181
}
175182
if v.newVersion != "" {
176-
items = append(items, components.HelpItem{Key: "c", Desc: "copy update cmd"})
183+
items = append(items, components.HelpItem{Key: constants.HelpKeyC, Desc: constants.HelpDescCopyUpdateCmd})
177184
}
178185
return items
179186
}

0 commit comments

Comments
 (0)