Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement sticky date separators #1353

Merged
merged 5 commits into from
Sep 5, 2017
Merged

Conversation

lukebarnard1
Copy link
Contributor

@lukebarnard1 lukebarnard1 commented Aug 30, 2017

Use react-sticky to implement sticky date separators. This will pin a date separator to the top of the timeline panel when the separator scrolls out of the top of the view.

A known issue of this is that the spinner, which is in line with event tiles in the timeline, will appear to push the stuck date separator down. In reality the first date separator after the spinner is in line with event tiles and is not stuck because the spinner forces the timeline to be scrolled slightly further down than it would be otherwise. But also, date separators in the timeline (not "stuck") have a greater height.

Ideally the date separator would be suppressed whilst back paginating, but this will cause the stuck separator to flicker on and off. This is why the suppression has been removed.

Also, DateUtils.formatDateSeparator was factored out of DateSeparator and fixed so that it will now display:

  • Today
  • Yesterday
  • Wednesday
  • Tuesday
  • Sat, Aug 26
  • Friday, Feb 23 2013

codep element-hq/element-web#4939

Use `react-sticky` to implement sticky date separators. This will pin a date separator to the top of the timeline panel when the separator scrolls out of the top of the view.

A known issue of this is that the spinner, which is in line with event tiles in the timeline, will appear to push the stuck date separator down. In reality the first date separator after the spinner is in line with event tiles and is not stuck because the spinner forces the timeline to be scrolled slightly further down than it would be otherwise. But also, date separators in the timeline (not "stuck") have a greater height.

Ideally the date separator would be suppressed whilst back paginating, but this will cause the stuck separator to flicker on and off. This is why the suppression has been removed.
lukebarnard1 pushed a commit to element-hq/element-web that referenced this pull request Aug 30, 2017
Copy link
Member

@dbkr dbkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, lots of stuff in this PR and not easy to see what's actually going on. I think this is fine other than comments though.

});
}
},

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, you've done this now but we really should be using the i18n for date formatting: https://github.com/martinandert/counterpart#localization

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh cool, I'll do that instead

var sn = this._getScrollNode();
debuglog("Scroll event: offset now:", sn.scrollTop,
"_lastSetScroll:", this._lastSetScroll);

this.node = sn;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually no, this is why any of the sticky stuff works and I 100% should have commented as such.

@dbkr dbkr assigned lukebarnard1 and unassigned dbkr Aug 31, 2017
@lukebarnard1
Copy link
Contributor Author

lots of stuff in this PR

Should I split it up into several commits? I realise that it's all been done in one blob but need not go down in history as such.

@lukebarnard1 lukebarnard1 assigned dbkr and unassigned lukebarnard1 Aug 31, 2017
@lukebarnard1
Copy link
Contributor Author

@dbkr dbkr merged commit 262d66f into develop Sep 5, 2017
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.

None yet

2 participants