mirror of
https://github.com/twisterarmy/twister-react.git
synced 2025-02-05 03:24:29 +00:00
hashtag browsing
This commit is contained in:
parent
30c7b918e1
commit
a6781503d7
File diff suppressed because it is too large
Load Diff
7
build/bootstrap.min.js
vendored
Normal file
7
build/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
10
build/jquery.min.js
vendored
10
build/jquery.min.js
vendored
File diff suppressed because one or more lines are too long
9785
build/twister-lib.js
9785
build/twister-lib.js
File diff suppressed because it is too large
Load Diff
5
css/bootstrap-theme.min.css
vendored
Normal file
5
css/bootstrap-theme.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
5
css/bootstrap.min.css
vendored
Normal file
5
css/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
13
index.html
13
index.html
@ -6,16 +6,9 @@
|
|||||||
<script src="build/jquery.json-2.4.js"></script>
|
<script src="build/jquery.json-2.4.js"></script>
|
||||||
<script src="build/jquery.jsonrpcclient.js"></script>
|
<script src="build/jquery.jsonrpcclient.js"></script>
|
||||||
<script src="build/twister-lib.js"></script>
|
<script src="build/twister-lib.js"></script>
|
||||||
|
<script src="build/bootstrap.min.js"></script>
|
||||||
<!-- Latest compiled and minified CSS -->
|
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
|
||||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
|
<link rel="stylesheet" type="text/css" href="css/bootstrap-theme.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>
|
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="css/paper-theme.css">
|
<link rel="stylesheet" type="text/css" href="css/paper-theme.css">
|
||||||
<link rel="stylesheet" type="text/css" href="css/main.css">
|
<link rel="stylesheet" type="text/css" href="css/main.css">
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ var Timeline = require('./profile/Timeline.js');
|
|||||||
var Followings = require('./profile/Followings.js');
|
var Followings = require('./profile/Followings.js');
|
||||||
var Mentions = require('./profile/Mentions.js');
|
var Mentions = require('./profile/Mentions.js');
|
||||||
var Conversation = require('./other/Conversation.js');
|
var Conversation = require('./other/Conversation.js');
|
||||||
|
var Hashtag = require('./other/Hashtag.js');
|
||||||
var Settings = require('./other/Settings.js');
|
var Settings = require('./other/Settings.js');
|
||||||
var AppSettingsMixin = require('./common/AppSettingsMixin.js');
|
var AppSettingsMixin = require('./common/AppSettingsMixin.js');
|
||||||
|
|
||||||
@ -181,6 +182,7 @@ var routes = (
|
|||||||
<DefaultRoute name="profile-timeline-default" handler={Timeline} />
|
<DefaultRoute name="profile-timeline-default" handler={Timeline} />
|
||||||
</Route>
|
</Route>
|
||||||
<Route name="conversation" path="/conversation/:username/:postid" handler={Conversation}/>
|
<Route name="conversation" path="/conversation/:username/:postid" handler={Conversation}/>
|
||||||
|
<Route name="hashtag" path="/hashtag/:hashtag" handler={Hashtag}/>
|
||||||
<Route name="settings" path="/settings" handler={Settings}/>
|
<Route name="settings" path="/settings" handler={Settings}/>
|
||||||
<DefaultRoute name="home" handler={Home} />
|
<DefaultRoute name="home" handler={Home} />
|
||||||
</Route>
|
</Route>
|
||||||
|
@ -162,7 +162,7 @@ module.exports = Post = React.createClass({
|
|||||||
)
|
)
|
||||||
case "hashtag":
|
case "hashtag":
|
||||||
return (
|
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":
|
case "url":
|
||||||
return (
|
return (
|
||||||
|
@ -15,7 +15,7 @@ var ReactBootstrap = require('react-bootstrap')
|
|||||||
, Glyphicon = ReactBootstrap.Glyphicon
|
, Glyphicon = ReactBootstrap.Glyphicon
|
||||||
, Button = ReactBootstrap.Button
|
, Button = ReactBootstrap.Button
|
||||||
|
|
||||||
module.exports = Timeline = React.createClass({
|
module.exports = Conversation = React.createClass({
|
||||||
|
|
||||||
mixins:[
|
mixins:[
|
||||||
AppSettingsMixin,
|
AppSettingsMixin,
|
||||||
|
80
jsx/other/Hashtag.js
Normal file
80
jsx/other/Hashtag.js
Normal file
@ -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}/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
@ -10,10 +10,14 @@
|
|||||||
"react-router": "^0.13.2",
|
"react-router": "^0.13.2",
|
||||||
"react-router-bootstrap": "^0.13.0"
|
"react-router-bootstrap": "^0.13.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {},
|
"devDependencies": {
|
||||||
|
"react-tools": "*",
|
||||||
|
"browserify": "*"
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "jsx jsx build-buffer && node test/PosContentTest.js",
|
"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": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
0
twister-lib.js
Normal file
0
twister-lib.js
Normal file
Loading…
x
Reference in New Issue
Block a user