Skip to content

Commit

Permalink
wip save
Browse files Browse the repository at this point in the history
  • Loading branch information
jzyinq committed Jun 5, 2024
1 parent c8565bb commit bbf81e3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
24 changes: 24 additions & 0 deletions gojira/help.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package gojira

import "github.com/rivo/tview"

type Help struct {
*tview.TextView
}

func NewHelpView() *Help {
help := &Help{
TextView: tview.NewTextView(),
}
help.SetText("Shortcuts:\n\n" +
"<- - previous day\n" +
"-> - next day\n" +
"shift + -> - next month\n" +
"shift + <- - previous month\n" +
"/ - search\n" +
"del - delete log\n" +
"enter - add/edit log\n" +
"tab - switch between lists",
)
return help
}
6 changes: 4 additions & 2 deletions gojira/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type UserInteface struct {
dayView *DayView
errorView *ErrorView
loaderView *LoaderView
helpView *Help
}

func newUi() {
Expand All @@ -24,7 +25,7 @@ func newUi() {
app.ui.dayView = NewDayView()
app.ui.errorView = NewErrorView()
app.ui.loaderView = NewLoaderView()

app.ui.helpView = NewHelpView()
app.ui.grid = tview.NewGrid().
SetRows(1, 0, 0).
SetColumns(0, 0, 27).
Expand All @@ -36,6 +37,7 @@ func newUi() {
// Layout for screens wider than 100 cells.
app.ui.grid.AddItem(app.ui.pages, 0, 0, 3, 2, 0, 100, true).
AddItem(app.ui.summary, 0, 2, 1, 1, 0, 100, false).
AddItem(app.ui.calendar, 1, 2, 2, 1, 0, 100, false)
AddItem(app.ui.calendar, 1, 2, 1, 1, 0, 100, false).
AddItem(app.ui.helpView, 2, 2, 1, 1, 0, 100, false)
app.ui.app.SetRoot(app.ui.grid, true).SetFocus(app.ui.pages)
}

0 comments on commit bbf81e3

Please sign in to comment.