Skip to content

Conversation

@RobertJoonas
Copy link
Contributor

Changes

Note: this PR targets the liveview-dashboard POC branch, not master.

Adds optimistic datepicker label updates as well as arrows for prev/next period navigation. The arrows currently need to be clicked. Keyboard shortcuts are out of scope. The logic is built up as follows:

  • LiveView generates an array of dates by shifting the current dashboard relative_date (or today by default) in both directions by 10 units (either day, month, or year). Any future dates are cut off by today(site.timezone). Also, currently out of scope, but we should also cut off any dates that fall before site.stats_start_date.
  • The current dashboard relative_date also belongs to this array. Its index is passed as a data-* attribute as well.
  • Given the array and the index, the JS hook can do the following:
    • Increase/decrease the index by one and optimistically update the period label
    • when the index hits 0, left arrow instantly becomes disabled (same with index being of the last array element and right arrow becoming disabled)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants