proxy-based Twister client written with react-js
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

52 lines
1.5 KiB

var React = require('react');
var MiniProfile = require("../common/MiniProfile.js");
var Postboard = require("../common/Postboard.js");
var SetIntervalMixin = require("../common/SetIntervalMixin.js");
var StreamMixin = require("../common/StreamMixin.js");
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
var EventListenerMixin = require('../common/EventListenerMixin.js');
var AppSettingsMixin = require('../common/AppSettingsMixin.js');
module.exports = Mentions = React.createClass({
mixins: [StreamMixin,AppSettingsMixin,SetIntervalMixin,SafeStateChangeMixin],
getInitialState: function() {
return {
username: (this.props.params.username ? this.props.params.username : this.props.activeAccount),
data: [],
postIdentifiers: {},
loading: true
};
},
updateMentions: function(outdatedLimit) {
thisComponent=this;
if (outdatedLimit===undefined) {outdatedLimit=this.state.appSettings.pollInterval/2;}
Twister.getUser(this.state.username).doMentions(function(mentions){
for(var i in mentions){
thisComponent.addPost(mentions[i]);
}
thisComponent.setStateSafe({loading: false});
},{outdatedLimit: outdatedLimit});
},
componentDidMount: function() {
this.updateMentions(this.state.appSettings.pollInterval*2);
this.setInterval(this.updateMentions, this.state.appSettings.pollInterval*1000);
},
render: function() {
return (
<Postboard data={this.state.data} loading={this.state.loading}/>
);
}
});