|
@@ -35,20 +35,19 @@ const HEADER_TEMPLATE = `
|
|
`
|
|
`
|
|
|
|
|
|
const TASK_ITEM = `
|
|
const TASK_ITEM = `
|
|
-Title: {{.Title}}
|
|
|
|
--------------------------
|
|
|
|
-{{.Desc}}
|
|
|
|
-
|
|
|
|
-Due: {{.Due}}
|
|
|
|
-Priority: {{.Priority}}
|
|
|
|
-Done?: {{.Priority}}
|
|
|
|
-
|
|
|
|
|
|
++------------------------------------
|
|
|
|
+|
|
|
|
|
+| Title: {{.Title}}
|
|
|
|
+| {{.Desc}}
|
|
|
|
+| Due: {{.Due}}
|
|
|
|
+| Priority: {{.Priority}}
|
|
|
|
+| Done?: {{.Priority}}
|
|
|
|
+|
|
|
|
|
++---------------------------
|
|
`
|
|
`
|
|
|
|
|
|
const TIME_TO_TEMPLATE = `{{.Hours}}H, {{.Minutes}}M`
|
|
const TIME_TO_TEMPLATE = `{{.Hours}}H, {{.Minutes}}M`
|
|
|
|
|
|
-const HOME_TEMPLATE = ``
|
|
|
|
-
|
|
|
|
// TODO: put all templates in their own file
|
|
// TODO: put all templates in their own file
|
|
|
|
|
|
type HeaderData struct {
|
|
type HeaderData struct {
|
|
@@ -152,7 +151,7 @@ func (u UserImplementation) getTimeToEod(ts time.Time) TimeToSunShift {
|
|
dur := time.Until(out)
|
|
dur := time.Until(out)
|
|
hours := dur.Minutes() / 60
|
|
hours := dur.Minutes() / 60
|
|
hours = math.Floor(hours)
|
|
hours = math.Floor(hours)
|
|
- minutes := (hours * 60) - dur.Minutes()
|
|
|
|
|
|
+ minutes := dur.Minutes() - (hours * 60)
|
|
|
|
|
|
return TimeToSunShift{Hours: int(hours), Minutes: int(minutes)}
|
|
return TimeToSunShift{Hours: int(hours), Minutes: int(minutes)}
|
|
}
|
|
}
|
|
@@ -165,7 +164,13 @@ func (u UserImplementation) getSunCycle(ts time.Time) string {
|
|
return "☼"
|
|
return "☼"
|
|
}
|
|
}
|
|
func (u UserImplementation) getTime(ts time.Time) string {
|
|
func (u UserImplementation) getTime(ts time.Time) string {
|
|
- return fmt.Sprintf("%v:%v", ts.Hour(), ts.Minute())
|
|
|
|
|
|
+ var hour int
|
|
|
|
+ if ts.Hour() == 0 {
|
|
|
|
+ hour = 12
|
|
|
|
+ } else {
|
|
|
|
+ hour = ts.Hour()
|
|
|
|
+ }
|
|
|
|
+ return fmt.Sprintf("%v:%v", hour, ts.Minute())
|
|
}
|
|
}
|
|
func (u UserImplementation) getDate(ts time.Time) string {
|
|
func (u UserImplementation) getDate(ts time.Time) string {
|
|
return fmt.Sprintf("%s %v, %v", ts.Month().String(), ts.Day(), ts.Year())
|
|
return fmt.Sprintf("%s %v, %v", ts.Month().String(), ts.Day(), ts.Year())
|
|
@@ -277,11 +282,12 @@ func (m model) View() string {
|
|
}
|
|
}
|
|
|
|
|
|
// Is this choice selected?
|
|
// Is this choice selected?
|
|
|
|
+ var taskrender string
|
|
checked := " " // not selected
|
|
checked := " " // not selected
|
|
if _, ok := m.selected[i]; ok {
|
|
if _, ok := m.selected[i]; ok {
|
|
for x := range shelf.Tasks {
|
|
for x := range shelf.Tasks {
|
|
if shelf.Tasks[x].Title == choice {
|
|
if shelf.Tasks[x].Title == choice {
|
|
- return shelf.RenderTask(shelf.Tasks[x])
|
|
|
|
|
|
+ taskrender = shelf.RenderTask(shelf.Tasks[x])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
checked = "x" // selected!
|
|
checked = "x" // selected!
|
|
@@ -290,6 +296,7 @@ func (m model) View() string {
|
|
|
|
|
|
// Render the row
|
|
// Render the row
|
|
s += fmt.Sprintf("%s [%s] %s\n", cursor, checked, choice)
|
|
s += fmt.Sprintf("%s [%s] %s\n", cursor, checked, choice)
|
|
|
|
+ s += taskrender
|
|
}
|
|
}
|
|
|
|
|
|
// The footer
|
|
// The footer
|