Skip to content

Commit

Permalink
be able to jump through calendar by a month using shift+arrows (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
jzyinq authored Jun 3, 2024
1 parent 6c09304 commit c8565bb
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

## [0.9.0] - 2024-06-03
### Added
- Jump by a month on calendar using shift + left/right arrow key

## [0.8.1] - 2024-05-08
### Fixed
- Calendar control stopped working after introducing delete on worklog list
Expand Down Expand Up @@ -113,7 +117,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Added
- Initial release of gojira

[Unreleased]: https://github.com/jzyinq/gojira/compare/0.8.1...master
[Unreleased]: https://github.com/jzyinq/gojira/compare/0.9.0...master
[0.9.0]: https://github.com/jzyinq/gojira/compare/0.8.1...0.9.0
[0.8.1]: https://github.com/jzyinq/gojira/compare/0.8.0...0.8.1
[0.8.0]: https://github.com/jzyinq/gojira/compare/0.7.0...0.8.0
[0.7.0]: https://github.com/jzyinq/gojira/compare/0.6.0...0.7.0
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ Just remember to urldecode it. Save it and you should ready to go!
## [Changelog](./CHANGELOG.md)

## Todo list

- [ ] Refactor ShowError focus return
- [ ] Open issue in modal if it's the only result?
- [ ] Prompt `are you sure want to exit` on escape key
Expand All @@ -83,6 +82,7 @@ Just remember to urldecode it. Save it and you should ready to go!
- `gojira log -i TICKET -t 1h30m`
- `gojira` -> `gojira recent`
- `gojira` -> `gojira --help`
- [x] `shift+arrow` for jumping between months instead of days
- [x] trigger ui updates after worklog change more efficiently
- [x] unify workLogs and worklogsIssues structs - use one for both
- [x] Reduce jira/tempo spaghetti and unnecessary structs and functions
Expand Down Expand Up @@ -111,4 +111,4 @@ Just remember to urldecode it. Save it and you should ready to go!
- [x] While deleting freshly set worklog, fetch it's data from jira to delete it properly - currently there is:
```
The worklog has either been deleted or you no longer have permission to view it
```
```
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module gojira
go 1.22

require (
github.com/charmbracelet/bubbles v0.18.0
github.com/charmbracelet/huh v0.3.0
github.com/charmbracelet/huh/spinner v0.0.0-20240328185852-590ecabc34b9
github.com/gdamore/tcell/v2 v2.7.4
Expand All @@ -16,7 +17,6 @@ require (
github.com/atotto/clipboard v0.1.4 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/catppuccin/go v0.2.0 // indirect
github.com/charmbracelet/bubbles v0.18.0 // indirect
github.com/charmbracelet/bubbletea v0.25.0 // indirect
github.com/charmbracelet/lipgloss v0.10.0 // indirect
github.com/containerd/console v1.0.4 // indirect
Expand Down
27 changes: 23 additions & 4 deletions gojira/calendar.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,32 @@ func (c *Calendar) setDays() {
}

func controlCalendar(event *tcell.EventKey) *tcell.EventKey {
select {
case loading := <-loadingWorklogs:
if loading {
return event // If loadingWorklogs has a true value, return early
}
default:
}

switch event.Key() {
case tcell.KeyLeft, tcell.KeyRight:
timePeriod := -time.Hour * 24
if event.Key() == tcell.KeyRight {
timePeriod = time.Hour * 24
var newTime time.Time
if event.Modifiers() == tcell.ModShift {
var datePeriod int
if event.Key() == tcell.KeyRight {
datePeriod = 1
} else {
datePeriod = -1
}
newTime = app.time.AddDate(0, datePeriod, 1)
} else {
timePeriod := -time.Hour * 24
if event.Key() == tcell.KeyRight {
timePeriod = time.Hour * 24
}
newTime = app.time.Add(timePeriod)
}
newTime := app.time.Add(timePeriod)
logrus.Debug("Changing date to ", newTime)
app.time = &newTime
loadWorklogs()
Expand Down

0 comments on commit c8565bb

Please sign in to comment.