Skip to content

Commit 1612fa6

Browse files
authored
Merge pull request #2 from ezeoleaf/feature/filter_words
Removed unnecesary code
2 parents 5aa5909 + e83dc2c commit 1612fa6

3 files changed

Lines changed: 10 additions & 25 deletions

File tree

app/app.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,17 @@ func Setup() App {
3232

3333
// Shortcuts to navigate the slides.
3434
app.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
35-
if event.Key() == tcell.KeyCtrlH {
35+
switch ek := event.Key(); ek {
36+
case tcell.KeyCtrlH:
3637
goToSection(helpSection)
37-
return nil
38-
} else if event.Key() == tcell.KeyCtrlB {
38+
case tcell.KeyCtrlB:
3939
goToSection(blogsSection)
40-
return nil
41-
} else if event.Key() == tcell.KeyCtrlT {
40+
case tcell.KeyCtrlT:
4241
goToSection(homeSection)
43-
return nil
44-
} else if event.Key() == tcell.KeyCtrlP {
42+
case tcell.KeyCtrlP:
4543
goToSection(savedPostsSection)
46-
return nil
47-
} else if event.Key() == tcell.KeyCtrlX {
44+
case tcell.KeyCtrlX:
4845
goToSection(settingsSection)
49-
return nil
5046
}
5147
return event
5248
})

app/home.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func generateHomeList() {
1717
appCfg := cfg.GetAPPConfig()
1818

1919
if len(appCfg.FollowingBlogs) == 0 {
20-
listHome.AddItem("You're not following blogs", "Try follow a blog with Ctrl+S from the Blogs (Ctrl+B) page", ' ', nil)
20+
listHome.AddItem("Welcome! You're not following any blog", "Try follow a blog with Ctrl+S from the Blogs (Ctrl+B) page", ' ', nil)
2121
} else {
2222
listHome.Clear()
2323

app/pages.go

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"fmt"
55
"strconv"
66

7-
"github.com/ezeoleaf/tblogs/cfg"
87
"github.com/rivo/tview"
98
)
109

@@ -20,24 +19,14 @@ const (
2019
)
2120

2221
func getPagesInfo() (*tview.Pages, *tview.TextView) {
23-
appCfg := cfg.GetAPPConfig()
22+
// appCfg := cfg.GetAPPConfig()
2423
// The presentation slides.
2524
slides := []slide{
2625
homePage,
2726
savedPostsPage,
2827
blogsPage,
2928
settingsPage,
30-
}
31-
32-
highlight := homeSection
33-
34-
if appCfg.FirstUse {
35-
slides = append([]slide{helpPage}, slides...)
36-
appCfg.FirstUse = false
37-
highlight = helpSection
38-
cfg.UpdateAppConfig(appCfg)
39-
} else {
40-
slides = append(slides, helpPage)
29+
helpPage,
4130
}
4231

4332
pages := tview.NewPages()
@@ -62,7 +51,7 @@ func getPagesInfo() (*tview.Pages, *tview.TextView) {
6251
pages.AddPage(title, primitive, true, index == 0)
6352
fmt.Fprintf(info, `%d ["%s"][darkcyan]%s[white][""] `, index+1, title, title)
6453
}
65-
info.Highlight(highlight)
54+
info.Highlight(homeSection)
6655

6756
return pages, info
6857
}

0 commit comments

Comments
 (0)