Refactoring and color improvements
This commit is contained in:
11
README.md
11
README.md
@@ -35,6 +35,7 @@
|
|||||||
- [x] Set Task due date with quick input buttons (today, +1 day, -1 day)
|
- [x] Set Task due date with quick input buttons (today, +1 day, -1 day)
|
||||||
- [x] Update Task Title
|
- [x] Update Task Title
|
||||||
- [x] Tasklist items should indicate status (done, pending, overdue) using colors
|
- [x] Tasklist items should indicate status (done, pending, overdue) using colors
|
||||||
|
- [ ] Pin Tasks
|
||||||
- [x] Shortcut for Adding new Project and Task
|
- [x] Shortcut for Adding new Project and Task
|
||||||
- [x] Global shortcuts for jumping to Projects or Tasks panel anytime
|
- [x] Global shortcuts for jumping to Projects or Tasks panel anytime
|
||||||
- [x] Cleanup all completed tasks of project
|
- [x] Cleanup all completed tasks of project
|
||||||
@@ -46,7 +47,9 @@
|
|||||||
- Today - Due Today and overdue
|
- Today - Due Today and overdue
|
||||||
- Tomorrow
|
- Tomorrow
|
||||||
- Upcoming - Due in next 7 days
|
- Upcoming - Due in next 7 days
|
||||||
- [ ] [Habitica](https://habitica.com/)<sup>3</sup> integration - Use it as Habitica client or use Habitica for cloud backup
|
- [ ] Integrations
|
||||||
|
- Google Tasks
|
||||||
|
- (Share your ideas)
|
||||||
- [ ] Time tracking
|
- [ ] Time tracking
|
||||||
|
|
||||||
### :rocket: Ready for action (installing and running)
|
### :rocket: Ready for action (installing and running)
|
||||||
@@ -81,7 +84,7 @@ You'll see a currently focused pane bordered with double line.
|
|||||||
In case writing in a text input (e,g, new project/task, due date), you have to `Enter` to submit/save.
|
In case writing in a text input (e,g, new project/task, due date), you have to `Enter` to submit/save.
|
||||||
|
|
||||||
| Context | Shortcut | Action |
|
| Context | Shortcut | Action |
|
||||||
|---|:---:|---|
|
| --- | :---: | --- |
|
||||||
| Global | `p` | Go to Project list |
|
| Global | `p` | Go to Project list |
|
||||||
| Global | `t` | Go to Task list |
|
| Global | `t` | Go to Task list |
|
||||||
| Projects | `n` | New Project |
|
| Projects | `n` | New Project |
|
||||||
@@ -96,7 +99,7 @@ In case writing in a text input (e,g, new project/task, due date), you have to `
|
|||||||
| Task Detail | `d` | Set Due date |
|
| Task Detail | `d` | Set Due date |
|
||||||
| Task Detail | `↓`/`↑` | Scroll Up/Down the note editor |
|
| Task Detail | `↓`/`↑` | Scroll Up/Down the note editor |
|
||||||
| Task Detail | `e` | Activate note editor for modification |
|
| Task Detail | `e` | Activate note editor for modification |
|
||||||
| Task Detail | `v` | Edit task details in external editor (default `vim`) _Known Bug<sup>[4](#footnotes)</sup>_ |
|
| Task Detail | `v` | Edit task details in external editor (default `vim`) |
|
||||||
| Task Detail | `r` | Rename Task Title |
|
| Task Detail | `r` | Rename Task Title |
|
||||||
| Active Note Editor | `Esc` | Deactivate note editor and save content |
|
| Active Note Editor | `Esc` | Deactivate note editor and save content |
|
||||||
|
|
||||||
@@ -174,7 +177,5 @@ You may :thumbsup: issues if you want to increase priority of a feature.
|
|||||||
### Footnotes
|
### Footnotes
|
||||||
1. In my Macbook Air, 1.6 GHz Dual-Core Intel Core i5, RAM: 8 GB 1600 MHz DDR3
|
1. In my Macbook Air, 1.6 GHz Dual-Core Intel Core i5, RAM: 8 GB 1600 MHz DDR3
|
||||||
2. Using [monakai](https://github.com/sickill/vim-monokai) color scheme for markdown syntax
|
2. Using [monakai](https://github.com/sickill/vim-monokai) color scheme for markdown syntax
|
||||||
3. Habitica is a free habit and productivity app that treats your real life like a game
|
|
||||||
4. Known Bug: Mouse events (click) don't work after getting back from Editor.
|
|
||||||
---
|
---
|
||||||
> "This is the Book about which there is no doubt, a guidance for those conscious of Allah" - [Al-Quran](http://quran.com)
|
> "This is the Book about which there is no doubt, a guidance for those conscious of Allah" - [Al-Quran](http://quran.com)
|
||||||
|
|||||||
59
app/cli.go
59
app/cli.go
@@ -40,44 +40,28 @@ func main() {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
if len(os.Args) > 1 && os.Args[1] == "migrate" {
|
if len(os.Args) > 1 && os.Args[1] == "migrate" {
|
||||||
migrate()
|
migrate(db)
|
||||||
}
|
} else {
|
||||||
|
|
||||||
projectRepo = repo.NewProjectRepository(db)
|
projectRepo = repo.NewProjectRepository(db)
|
||||||
taskRepo = repo.NewTaskRepository(db)
|
taskRepo = repo.NewTaskRepository(db)
|
||||||
|
|
||||||
titleText := tview.NewTextView().SetText("[lime::b]Geek-life [::-]- Task Manager for geeks!").SetDynamicColors(true)
|
|
||||||
cloudStatus := tview.NewTextView().SetText("[::d]Version: 0.1.0").SetTextAlign(tview.AlignRight).SetDynamicColors(true)
|
|
||||||
|
|
||||||
titleBar := tview.NewFlex().
|
|
||||||
AddItem(titleText, 0, 2, false).
|
|
||||||
AddItem(cloudStatus, 0, 1, false)
|
|
||||||
|
|
||||||
statusBar = makeStatusBar(app)
|
|
||||||
projectPane = NewProjectPane(projectRepo)
|
|
||||||
taskPane = NewTaskPane(projectRepo, taskRepo)
|
|
||||||
projectDetailPane = NewProjectDetailPane()
|
|
||||||
taskDetailPane = NewTaskDetailPane(taskRepo)
|
|
||||||
|
|
||||||
contents = tview.NewFlex().
|
|
||||||
AddItem(projectPane, 25, 1, true).
|
|
||||||
AddItem(taskPane, 0, 2, false)
|
|
||||||
|
|
||||||
layout = tview.NewFlex().SetDirection(tview.FlexRow).
|
layout = tview.NewFlex().SetDirection(tview.FlexRow).
|
||||||
AddItem(titleBar, 2, 1, false).
|
AddItem(makeTitleBar(), 2, 1, false).
|
||||||
AddItem(contents, 0, 2, true).
|
AddItem(prepareContentPages(), 0, 2, true).
|
||||||
AddItem(statusBar, 1, 1, false)
|
AddItem(prepareStatusBar(app), 1, 1, false)
|
||||||
|
|
||||||
setKeyboardShortcuts()
|
setKeyboardShortcuts()
|
||||||
|
|
||||||
if err := app.SetRoot(layout, true).EnableMouse(true).Run(); err != nil {
|
if err := app.SetRoot(layout, true).EnableMouse(true).Run(); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func migrate() {
|
func migrate(database *storm.DB) {
|
||||||
util.FatalIfError(db.ReIndex(&model.Project{}), "Error in migrating Projects")
|
util.FatalIfError(database.ReIndex(&model.Project{}), "Error in migrating Projects")
|
||||||
util.FatalIfError(db.ReIndex(&model.Task{}), "Error in migrating Tasks")
|
util.FatalIfError(database.ReIndex(&model.Task{}), "Error in migrating Tasks")
|
||||||
|
|
||||||
fmt.Println("Migration completed. Start geek-life normally.")
|
fmt.Println("Migration completed. Start geek-life normally.")
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
@@ -112,3 +96,26 @@ func setKeyboardShortcuts() *tview.Application {
|
|||||||
return event
|
return event
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func prepareContentPages() *tview.Flex {
|
||||||
|
projectPane = NewProjectPane(projectRepo)
|
||||||
|
taskPane = NewTaskPane(projectRepo, taskRepo)
|
||||||
|
projectDetailPane = NewProjectDetailPane()
|
||||||
|
taskDetailPane = NewTaskDetailPane(taskRepo)
|
||||||
|
|
||||||
|
contents = tview.NewFlex().
|
||||||
|
AddItem(projectPane, 25, 1, true).
|
||||||
|
AddItem(taskPane, 0, 2, false)
|
||||||
|
|
||||||
|
return contents
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func makeTitleBar() *tview.Flex {
|
||||||
|
titleText := tview.NewTextView().SetText("[lime::b]Geek-life [::-]- Task Manager for geeks!").SetDynamicColors(true)
|
||||||
|
versionInfo := tview.NewTextView().SetText("[::d]Version: 0.1.1").SetTextAlign(tview.AlignRight).SetDynamicColors(true)
|
||||||
|
|
||||||
|
return tview.NewFlex().
|
||||||
|
AddItem(titleText, 0, 2, false).
|
||||||
|
AddItem(versionInfo, 0, 1, false)
|
||||||
|
}
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ const (
|
|||||||
messagePage = "message"
|
messagePage = "message"
|
||||||
)
|
)
|
||||||
|
|
||||||
func makeStatusBar(app *tview.Application) *StatusBar {
|
func prepareStatusBar(app *tview.Application) *StatusBar {
|
||||||
statusBar := StatusBar{
|
statusBar = &StatusBar{
|
||||||
Pages: tview.NewPages(),
|
Pages: tview.NewPages(),
|
||||||
message: tview.NewTextView().SetDynamicColors(true).SetText("Loading..."),
|
message: tview.NewTextView().SetDynamicColors(true).SetText("Loading..."),
|
||||||
container: app,
|
container: app,
|
||||||
@@ -39,7 +39,7 @@ func makeStatusBar(app *tview.Application) *StatusBar {
|
|||||||
true,
|
true,
|
||||||
)
|
)
|
||||||
|
|
||||||
return &statusBar
|
return statusBar
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bar *StatusBar) showForSeconds(message string, timeout int) {
|
func (bar *StatusBar) showForSeconds(message string, timeout int) {
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ func NewTaskPane(projectRepo repository.ProjectRepository, taskRepo repository.T
|
|||||||
hint: tview.NewTextView().SetTextColor(tcell.ColorYellow).SetTextAlign(tview.AlignCenter),
|
hint: tview.NewTextView().SetTextColor(tcell.ColorYellow).SetTextAlign(tview.AlignCenter),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pane.list.SetSelectedBackgroundColor(tcell.ColorDarkBlue)
|
||||||
pane.list.SetDoneFunc(func() {
|
pane.list.SetDoneFunc(func() {
|
||||||
app.SetFocus(projectPane)
|
app.SetFocus(projectPane)
|
||||||
})
|
})
|
||||||
|
|||||||
17
app/util.go
17
app/util.go
@@ -34,9 +34,9 @@ func makeHorizontalLine(lineChar rune, color tcell.Color) *tview.TextView {
|
|||||||
func makeLightTextInput(placeholder string) *tview.InputField {
|
func makeLightTextInput(placeholder string) *tview.InputField {
|
||||||
return tview.NewInputField().
|
return tview.NewInputField().
|
||||||
SetPlaceholder(placeholder).
|
SetPlaceholder(placeholder).
|
||||||
SetPlaceholderTextColor(tcell.ColorYellow).
|
SetPlaceholderTextColor(tcell.ColorDarkSlateBlue).
|
||||||
SetFieldTextColor(tcell.ColorBlack).
|
SetFieldTextColor(tcell.ColorBlack).
|
||||||
SetFieldBackgroundColor(tcell.ColorGray)
|
SetFieldBackgroundColor(tcell.ColorLightBlue)
|
||||||
}
|
}
|
||||||
|
|
||||||
// If input text is a valid date, parse it. Or get current date
|
// If input text is a valid date, parse it. Or get current date
|
||||||
@@ -78,12 +78,19 @@ func removeThirdCol() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getTaskTitleColor(task model.Task) string {
|
func getTaskTitleColor(task model.Task) string {
|
||||||
colorName := "olive"
|
colorName := "smokewhite"
|
||||||
|
|
||||||
if task.Completed {
|
if task.Completed {
|
||||||
colorName = "lime"
|
colorName = "green"
|
||||||
} else if task.DueDate != 0 && task.DueDate < time.Now().Truncate(24*time.Hour).Unix() {
|
} else if task.DueDate != 0 {
|
||||||
|
dayDiff := int(time.Unix(task.DueDate, 0).Sub(time.Now()).Hours() / 24)
|
||||||
|
|
||||||
|
if dayDiff == 0 {
|
||||||
|
colorName = "orange"
|
||||||
|
} else if dayDiff < 0 {
|
||||||
colorName = "red"
|
colorName = "red"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return colorName
|
return colorName
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user