Skip to content

Commit efee0da

Browse files
Refactor: Replace internal changelog UI with external link
1 parent 6b7a6f5 commit efee0da

6 files changed

Lines changed: 31 additions & 120 deletions

File tree

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,6 @@ UI Re-render → Instant User Feedback
400400
│ ├── sync
401401
│ │ └── engine.go
402402
│ ├── ui
403-
│ │ ├── changelog
404-
│ │ │ └── model.go
405403
│ │ ├── detail
406404
│ │ │ └── model.go
407405
│ │ ├── editor

configs/kairo.example.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,5 @@ manage_plugins = "p"
5050
open_plugin_dir = "ctrl+g"
5151
toggle_strike = "z"
5252
help = "?"
53+
issues = "i"
54+
changelog = "c"

internal/app/model.go

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"github.com/programmersd21/kairo/internal/search"
2424
"github.com/programmersd21/kairo/internal/service"
2525
ksync "github.com/programmersd21/kairo/internal/sync"
26-
"github.com/programmersd21/kairo/internal/ui/changelog"
2726
"github.com/programmersd21/kairo/internal/ui/detail"
2827
"github.com/programmersd21/kairo/internal/ui/editor"
2928
"github.com/programmersd21/kairo/internal/ui/help"
@@ -85,7 +84,6 @@ const (
8584
ModeThemeMenu
8685
ModePluginMenu
8786
ModeTagFilter
88-
ModeChangelog
8987
)
9088

9189
type Model struct {
@@ -112,7 +110,6 @@ type Model struct {
112110
det detail.Model
113111
edit *editor.Model
114112
hlp help.Model
115-
cl changelog.Model
116113
tm theme_menu.Model
117114
pm plugin_menu.Model
118115

@@ -174,7 +171,6 @@ func New(ctx context.Context, cfg config.Config, svc service.TaskService) (tea.M
174171
m.pal = palette.New(m.s)
175172
m.det = detail.New(m.s)
176173
m.hlp = help.New(m.s, m.km)
177-
m.cl = changelog.New(m.s)
178174
m.tm = theme_menu.New(m.s)
179175
m.pm = plugin_menu.New(m.s)
180176

@@ -266,28 +262,13 @@ func (m *Model) isInputFocused() bool {
266262
}
267263
}
268264

269-
type changelogLoadedMsg struct {
270-
Content string
271-
}
272-
273265
func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
274266
switch x := msg.(type) {
275267
case tea.WindowSizeMsg:
276268
m.width, m.height = x.Width, x.Height
277269
m.rebuildComponentSizes()
278270
return m, nil
279271

280-
case changelogLoadedMsg:
281-
m.cl.SetContent(x.Content)
282-
m.mode = ModeChangelog
283-
return m, nil
284-
285-
case changelog.CloseMsg:
286-
if m.mode == ModeChangelog {
287-
m.mode = ModeList
288-
}
289-
return m, nil
290-
291272
case errMsg:
292273
m.statusText = x.Err.Error()
293274
m.isErr = true
@@ -593,7 +574,7 @@ func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
593574
return m, openURLCmd("https://github.com/programmersd21/kairo/issues")
594575
}
595576
if keymapMatch(m.km.Changelog, km) {
596-
return m, m.loadChangelogCmd()
577+
return m, openURLCmd("https://github.com/programmersd21/kairo/blob/main/CHANGELOG.md")
597578
}
598579

599580
// Plugin reload - single character keybinding only valid in ModeList
@@ -916,7 +897,9 @@ func (m *Model) renderFooter() string {
916897
fk(m.km.Back)+" back • "+
917898
fk(m.km.EditTask)+" edit • "+
918899
fk(m.km.Palette)+" palette • "+
919-
fk(m.km.Help)+" help",
900+
fk(m.km.Help)+" help • "+
901+
fk(m.km.Issues)+" issues • "+
902+
fk(m.km.Changelog)+" changelog",
920903
)
921904
case ModeEditor:
922905
left = " " + m.s.Muted.Render("ctrl+s "+styles.IconDone+"save • esc "+styles.IconError+"cancel • tab navigate")
@@ -935,6 +918,8 @@ func (m *Model) renderFooter() string {
935918
fk(m.km.ToggleStrike)+" "+styles.IconStrike+" • "+
936919
fk(m.km.DeleteTask)+" "+styles.IconDelete+" • "+
937920
fk(m.km.Help)+" "+styles.IconHelp+" • "+
921+
fk(m.km.Issues)+" issues • "+
922+
fk(m.km.Changelog)+" changelog • "+
938923
"1-9 "+styles.IconView+" ",
939924
)
940925
}
@@ -1125,7 +1110,6 @@ func (m *Model) refreshStyles() {
11251110
m.pal = palette.New(m.s)
11261111
m.det = detail.New(m.s)
11271112
m.hlp = help.New(m.s, m.km)
1128-
m.cl = changelog.New(m.s)
11291113
m.tm = theme_menu.New(m.s)
11301114
m.pm = plugin_menu.New(m.s)
11311115

@@ -1291,6 +1275,26 @@ func (m *Model) syncNowCmd() tea.Cmd {
12911275
}
12921276
}
12931277

1278+
func openURLCmd(url string) tea.Cmd {
1279+
return func() tea.Msg {
1280+
var cmd *exec.Cmd
1281+
switch runtime.GOOS {
1282+
case "windows":
1283+
// Start detached and non-blocking
1284+
cmd = exec.Command("cmd", "/c", "start", url)
1285+
case "darwin":
1286+
cmd = exec.Command("open", url)
1287+
case "linux":
1288+
cmd = exec.Command("xdg-open", url)
1289+
default:
1290+
return errMsg{Err: fmt.Errorf("unsupported platform")}
1291+
}
1292+
// Run without waiting
1293+
_ = cmd.Start()
1294+
return nil
1295+
}
1296+
}
1297+
12941298
func openFolderCmd(path string) tea.Cmd {
12951299
return func() tea.Msg {
12961300
var err error

internal/ui/changelog/model.go

Lines changed: 0 additions & 94 deletions
This file was deleted.

internal/ui/help/model.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ func (m Model) View() string {
9090
{getK(m.km.OpenPluginDir), "Open plugins folder"},
9191
{getK(m.km.ManagePlugins), "Manage plugins"},
9292
{getK(m.km.Help), "Show help"},
93+
{getK(m.km.Issues), "Open GitHub issues"},
94+
{getK(m.km.Changelog), "Show changelog"},
9395
{getK(m.km.Quit), "Quit"},
9496
},
9597
},

internal/ui/keymap/keymap.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,9 @@ func FromConfig(c config.KeymapConfig) Keymap {
5858
ToggleStrike: bind(c.ToggleStrike, "strike", "toggle completion with animation"),
5959
Help: bind(c.Help, "help", "show help"),
6060
Issues: bind(c.Issues, "issues", "open github issues"),
61-
Changelog: bind(c.Changelog, "changelog", "show changelog"),
61+
Changelog: bind(c.Changelog, "changelog", "open changelog"),
6262
}
6363
}
64-
6564
func bind(keys, helpKey, helpDesc string) key.Binding {
6665
ks := parseKeys(keys)
6766
return key.NewBinding(key.WithKeys(ks...), key.WithHelp(helpKey, helpDesc))

0 commit comments

Comments
 (0)