diff --git a/README.md b/README.md new file mode 100644 index 00000000..e69de29b diff --git a/bamboohr/item.go b/bamboohr/item.go index 7a8d185d..39bdeab0 100644 --- a/bamboohr/item.go +++ b/bamboohr/item.go @@ -22,6 +22,10 @@ func (item *Item) String() string { /* -------------------- Public Functions -------------------- */ +func (item *Item) IsOneDay() bool { + return item.Start == item.End +} + func (item *Item) Name() string { if (item.Employee != Employee{}) { return item.Employee.Name diff --git a/bamboohr/widget.go b/bamboohr/widget.go index 917905e9..9b84e474 100644 --- a/bamboohr/widget.go +++ b/bamboohr/widget.go @@ -12,15 +12,26 @@ func Widget() tview.Primitive { widget := tview.NewTextView() widget.SetBorder(true) widget.SetDynamicColors(true) - widget.SetTitle(" 🐨 Away ") + widget.SetTitle(fmt.Sprintf(" 🐨 Away (%d)", len(items))) data := "" for _, item := range items { - str := fmt.Sprintf(" [green]%s[white]\n %s - %s\n\n", item.Name(), item.PrettyStart(), item.PrettyEnd()) - data = data + str + data = data + display(item) } fmt.Fprintf(widget, "%s", data) return widget } + +func display(item Item) string { + var str string + + if item.IsOneDay() { + str = fmt.Sprintf(" [green]%s[white]\n %s\n\n", item.Name(), item.PrettyEnd()) + } else { + str = fmt.Sprintf(" [green]%s[white]\n %s - %s\n\n", item.Name(), item.PrettyStart(), item.PrettyEnd()) + } + + return str +} diff --git a/weather/widget.go b/weather/widget.go index 5335e803..b4e469bc 100644 --- a/weather/widget.go +++ b/weather/widget.go @@ -29,3 +29,8 @@ func Widget() tview.Primitive { return widget } + +// icon returns an emoji for the current weather +func icon() string { + return "" +} diff --git a/wtf.go b/wtf.go index c6516a82..a48bfc7d 100644 --- a/wtf.go +++ b/wtf.go @@ -12,7 +12,7 @@ func main() { app := tview.NewApplication() grid := tview.NewGrid() - grid.SetRows(10, 40, 4) // How _high_ the row is, in terminal rows + grid.SetRows(14, 36, 4) // How _high_ the row is, in terminal rows grid.SetColumns(40, 40) // How _wide_ the column is, in terminal columns grid.SetBorder(false)