Skip to content

Commit

Permalink
Merge pull request #2 from ezeoleaf/feature/filter_words
Browse files Browse the repository at this point in the history
Removed unnecesary code
  • Loading branch information
ezeoleaf authored Nov 9, 2020
2 parents 5aa5909 + e83dc2c commit 1612fa6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 25 deletions.
16 changes: 6 additions & 10 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,17 @@ func Setup() App {

// Shortcuts to navigate the slides.
app.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
if event.Key() == tcell.KeyCtrlH {
switch ek := event.Key(); ek {
case tcell.KeyCtrlH:
goToSection(helpSection)
return nil
} else if event.Key() == tcell.KeyCtrlB {
case tcell.KeyCtrlB:
goToSection(blogsSection)
return nil
} else if event.Key() == tcell.KeyCtrlT {
case tcell.KeyCtrlT:
goToSection(homeSection)
return nil
} else if event.Key() == tcell.KeyCtrlP {
case tcell.KeyCtrlP:
goToSection(savedPostsSection)
return nil
} else if event.Key() == tcell.KeyCtrlX {
case tcell.KeyCtrlX:
goToSection(settingsSection)
return nil
}
return event
})
Expand Down
2 changes: 1 addition & 1 deletion app/home.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func generateHomeList() {
appCfg := cfg.GetAPPConfig()

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

Expand Down
17 changes: 3 additions & 14 deletions app/pages.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"fmt"
"strconv"

"github.com/ezeoleaf/tblogs/cfg"
"github.com/rivo/tview"
)

Expand All @@ -20,24 +19,14 @@ const (
)

func getPagesInfo() (*tview.Pages, *tview.TextView) {
appCfg := cfg.GetAPPConfig()
// appCfg := cfg.GetAPPConfig()
// The presentation slides.
slides := []slide{
homePage,
savedPostsPage,
blogsPage,
settingsPage,
}

highlight := homeSection

if appCfg.FirstUse {
slides = append([]slide{helpPage}, slides...)
appCfg.FirstUse = false
highlight = helpSection
cfg.UpdateAppConfig(appCfg)
} else {
slides = append(slides, helpPage)
helpPage,
}

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

return pages, info
}
Expand Down

0 comments on commit 1612fa6

Please sign in to comment.