summaryrefslogtreecommitdiffstats
path: root/web/react/components/post_list.jsx
diff options
context:
space:
mode:
authornickago <ngonella@calpoly.edu>2015-07-31 16:45:14 -0700
committernickago <ngonella@calpoly.edu>2015-08-12 09:28:54 -0700
commitea4250bbbc21492a7f114daca30d839bc7644e90 (patch)
tree7bfaea982474307ca1e5d5a18820bdad29d7b4e5 /web/react/components/post_list.jsx
parentb50ba05626599d54f4fe6a391d66cbc71051b7ac (diff)
downloadchat-ea4250bbbc21492a7f114daca30d839bc7644e90.tar.gz
chat-ea4250bbbc21492a7f114daca30d839bc7644e90.tar.bz2
chat-ea4250bbbc21492a7f114daca30d839bc7644e90.zip
Added comments to confusing post list method
Diffstat (limited to 'web/react/components/post_list.jsx')
-rw-r--r--web/react/components/post_list.jsx9
1 files changed, 8 insertions, 1 deletions
diff --git a/web/react/components/post_list.jsx b/web/react/components/post_list.jsx
index 83f806b79..e7d57df8d 100644
--- a/web/react/components/post_list.jsx
+++ b/web/react/components/post_list.jsx
@@ -29,12 +29,15 @@ function getStateFromStores() {
module.exports = React.createClass({
displayName: "PostList",
scrollPosition: 0,
- preventScrollTrigger: false,
+ preventScrollTrigger: false, // Can't think of an intuitive name, but when true,
+ // scrollPosition is affected by the 'on scroll' event below
gotMorePosts: false,
oldScrollHeight: 0,
oldZoom: 0,
scrolledToNew: false,
componentDidMount: function() {
+
+ // Add CSS required to have the theme colors
var user = UserStore.getCurrentUser();
if (user.props && user.props.theme) {
utils.changeCss('div.theme', 'background-color:'+user.props.theme+';');
@@ -55,11 +58,13 @@ module.exports = React.createClass({
$('.team__header').addClass('theme--gray');
}
+ // Start our Store listeners
PostStore.addChangeListener(this._onChange);
ChannelStore.addChangeListener(this._onChange);
UserStore.addStatusesChangeListener(this._onTimeChange);
SocketStore.addChangeListener(this._onSocketChange);
+ // Initialize perfect scrollbar
$(".post-list-holder-by-time").perfectScrollbar();
this.resize();
@@ -69,6 +74,8 @@ module.exports = React.createClass({
this.oldScrollHeight = post_holder.scrollHeight;
this.oldZoom = (window.outerWidth - 8) / window.innerWidth;
+ /*************** End of 'run on mount' code, Start of event listeners *****************/
+
var self = this;
$(window).resize(function(){
$(post_holder).perfectScrollbar('update');