Browse Source

hashtag browsing

master
Julian Steinwachs 9 years ago
parent
commit
a6781503d7
  1. 703
      build/app-bundle.js
  2. 7
      build/bootstrap.min.js
  3. 10
      build/jquery.min.js
  4. 9867
      build/twister-lib.js
  5. 5
      css/bootstrap-theme.min.css
  6. 5
      css/bootstrap.min.css
  7. 13
      index.html
  8. 2
      jsx/App.js
  9. 2
      jsx/common/PostContent.js
  10. 2
      jsx/other/Conversation.js
  11. 80
      jsx/other/Hashtag.js
  12. 8
      package.json
  13. 0
      twister-lib.js

703
build/app-bundle.js

File diff suppressed because it is too large Load Diff

7
build/bootstrap.min.js vendored

File diff suppressed because one or more lines are too long

10
build/jquery.min.js vendored

File diff suppressed because one or more lines are too long

9867
build/twister-lib.js

File diff suppressed because it is too large Load Diff

5
css/bootstrap-theme.min.css vendored

File diff suppressed because one or more lines are too long

5
css/bootstrap.min.css vendored

File diff suppressed because one or more lines are too long

13
index.html

@ -6,16 +6,9 @@ @@ -6,16 +6,9 @@
<script src="build/jquery.json-2.4.js"></script>
<script src="build/jquery.jsonrpcclient.js"></script>
<script src="build/twister-lib.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script src="build/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap-theme.min.css">
<link rel="stylesheet" type="text/css" href="css/paper-theme.css">
<link rel="stylesheet" type="text/css" href="css/main.css">

2
jsx/App.js

@ -36,6 +36,7 @@ var Timeline = require('./profile/Timeline.js'); @@ -36,6 +36,7 @@ var Timeline = require('./profile/Timeline.js');
var Followings = require('./profile/Followings.js');
var Mentions = require('./profile/Mentions.js');
var Conversation = require('./other/Conversation.js');
var Hashtag = require('./other/Hashtag.js');
var Settings = require('./other/Settings.js');
var AppSettingsMixin = require('./common/AppSettingsMixin.js');
@ -181,6 +182,7 @@ var routes = ( @@ -181,6 +182,7 @@ var routes = (
<DefaultRoute name="profile-timeline-default" handler={Timeline} />
</Route>
<Route name="conversation" path="/conversation/:username/:postid" handler={Conversation}/>
<Route name="hashtag" path="/hashtag/:hashtag" handler={Hashtag}/>
<Route name="settings" path="/settings" handler={Settings}/>
<DefaultRoute name="home" handler={Home} />
</Route>

2
jsx/common/PostContent.js

@ -162,7 +162,7 @@ module.exports = Post = React.createClass({ @@ -162,7 +162,7 @@ module.exports = Post = React.createClass({
)
case "hashtag":
return (
<span key={index} className="text-muted">{item.raw}</span>
<a key={index} className="text-muted" href={"#/hashtag/"+item.raw.substr(1)}>{item.raw}</a>
)
case "url":
return (

2
jsx/other/Conversation.js

@ -15,7 +15,7 @@ var ReactBootstrap = require('react-bootstrap') @@ -15,7 +15,7 @@ var ReactBootstrap = require('react-bootstrap')
, Glyphicon = ReactBootstrap.Glyphicon
, Button = ReactBootstrap.Button
module.exports = Timeline = React.createClass({
module.exports = Conversation = React.createClass({
mixins:[
AppSettingsMixin,

80
jsx/other/Hashtag.js

@ -0,0 +1,80 @@ @@ -0,0 +1,80 @@
var React = require('react');
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');
var ReactBootstrap = require('react-bootstrap')
, NavItem = ReactBootstrap.NavItem
, Nav = ReactBootstrap.Nav
, ListGroup = ReactBootstrap.ListGroup
, ListGroupItem = ReactBootstrap.ListGroupItem
, Panel = ReactBootstrap.Panel
, Glyphicon = ReactBootstrap.Glyphicon
, Button = ReactBootstrap.Button
module.exports = Hashtag = React.createClass({
mixins:[
AppSettingsMixin,
StreamMixin,
SetIntervalMixin,
SafeStateChangeMixin,
EventListenerMixin('newpostbyuser')
],
contextTypes: {
router: React.PropTypes.func
},
getInitialState: function() {
return {
hashtag: this.context.router.getCurrentParams().hashtag,
data: [],
postIdentifiers: {},
loading: true
};
},
updatePosts: function(outdatedLimit) {
//console.log(this.state.username+":post"+this.state.postid)
if (!outdatedLimit) {outdatedLimit=this.state.appSettings.pollInterval/2;}
var thisComponent = this;
Twister.doHashtagPosts(this.state.hashtag,function(posts){
thisComponent.setStateSafe({loading: false});
for (var i in posts) {
thisComponent.addPost(posts[i]);
//console.log(posts[i].getContent())
}
},{outdatedLimit: outdatedLimit, logfunc: function(log){console.log(log)}});
},
componentDidMount: function() {
this.updatePosts(2*this.state.appSettings.pollInterval);
this.setInterval(this.updatePosts, this.state.appSettings.pollInterval*1000);
},
onnewpostbyuser: function (event) {
//alert("got event")
this.updatePosts(-1);
},
render: function() {
return (
<Postboard header={
<ListGroupItem>
Hashtag
</ListGroupItem>
} data={this.state.data} loading={this.state.loading}/>
);
}
});

8
package.json

@ -10,10 +10,14 @@ @@ -10,10 +10,14 @@
"react-router": "^0.13.2",
"react-router-bootstrap": "^0.13.0"
},
"devDependencies": {},
"devDependencies": {
"react-tools": "*",
"browserify": "*"
},
"scripts": {
"test": "jsx jsx build-buffer && node test/PosContentTest.js",
"build": "jsx jsx build-buffer && browserify build-buffer/App.js -o build/app-bundle.js"
"build": "jsx jsx build-buffer && browserify build-buffer/App.js -o build/app-bundle.js",
"pull-lib-and-build": "cd ../twister-lib-js && npm run bundle && cd ../twister-react && cp ../twister-lib-js/twister-lib.js build && jsx jsx build-buffer && browserify build-buffer/App.js -o build/app-bundle.js"
},
"repository": {
"type": "git",

0
twister-lib.js

Loading…
Cancel
Save