mirror of
https://github.com/fazo96/ipfs-boards
synced 2025-02-04 16:34:19 +01:00
added routing and some css
This commit is contained in:
parent
412978f120
commit
46c2eb4309
@ -65,7 +65,7 @@ BoardsAPI.prototype.resolveIPNS = function(n,done){
|
|||||||
done(null,cached)
|
done(null,cached)
|
||||||
}
|
}
|
||||||
this.ipfs.name.resolve(n,(err,r) => {
|
this.ipfs.name.resolve(n,(err,r) => {
|
||||||
console.log('Resolved',n,'to',r)
|
if(!err) console.log('Resolved',n,'to',r.Path)
|
||||||
if(err){
|
if(err){
|
||||||
done(err)
|
done(err)
|
||||||
} else if(!cached){
|
} else if(!cached){
|
||||||
|
@ -33,11 +33,14 @@
|
|||||||
"gulp-connect": "^2.2.0",
|
"gulp-connect": "^2.2.0",
|
||||||
"gulp-minify-css": "^1.2.1",
|
"gulp-minify-css": "^1.2.1",
|
||||||
"gulp-uglify": "^1.5.1",
|
"gulp-uglify": "^1.5.1",
|
||||||
|
"history": "^1.13.1",
|
||||||
"ipfs-api": "^2.6.2",
|
"ipfs-api": "^2.6.2",
|
||||||
"moment": "^2.10.6",
|
"moment": "^2.10.6",
|
||||||
"react": "^0.14.2",
|
"react": "^0.14.2",
|
||||||
"react-dom": "^0.14.2",
|
"react-dom": "^0.14.2",
|
||||||
|
"react-router": "^1.0.0",
|
||||||
"vinyl-buffer": "^1.0.0",
|
"vinyl-buffer": "^1.0.0",
|
||||||
"vinyl-source-stream": "^1.1.0"
|
"vinyl-source-stream": "^1.1.0",
|
||||||
|
"wolfy87-eventemitter": "^4.3.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
var React = require('react')
|
var React = require('react')
|
||||||
var ReactDOM = require('react-dom')
|
var ReactDOM = require('react-dom')
|
||||||
|
var Router = require('react-router').Router
|
||||||
|
var Route = require('react-router').Route
|
||||||
|
var IndexRoute = require('react-router').IndexRoute
|
||||||
|
var Link = require('react-router').Link
|
||||||
|
|
||||||
var ipfs = require('ipfs-api')('localhost',5001)
|
var ipfs = require('ipfs-api')('localhost',5001)
|
||||||
var BoardsAPI = require('../lib/boards-api.js')
|
var BoardsAPI = require('../lib/boards-api.js')
|
||||||
|
|
||||||
@ -20,7 +25,11 @@ var App = React.createClass({
|
|||||||
var Homepage = React.createClass({
|
var Homepage = React.createClass({
|
||||||
render: function(){
|
render: function(){
|
||||||
return (
|
return (
|
||||||
|
<div>
|
||||||
<h3>Hello</h3>
|
<h3>Hello</h3>
|
||||||
|
<p>Not much is implemented...</p>
|
||||||
|
<p>You can try <Link to="@QmXnfA41SXMX3tqFD4kjED7ehyvgTsuAho86TkEoTbZdpw">Opening a Profile</Link> though :)</p>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -30,7 +39,7 @@ var Navbar = React.createClass({
|
|||||||
return (
|
return (
|
||||||
<div className="navbar">
|
<div className="navbar">
|
||||||
<div className="container">
|
<div className="container">
|
||||||
<h4>Boards</h4>
|
<h4><Link to="/">Boards</Link></h4>
|
||||||
</div>
|
</div>
|
||||||
</div>)
|
</div>)
|
||||||
}
|
}
|
||||||
@ -41,7 +50,7 @@ var Profile = React.createClass({
|
|||||||
return { name: '...' }
|
return { name: '...' }
|
||||||
},
|
},
|
||||||
componentDidMount: function(){
|
componentDidMount: function(){
|
||||||
boards.getProfile(this.props.id, (err,res) => {
|
boards.getProfile(this.props.params.userid, (err,res) => {
|
||||||
if(err){
|
if(err){
|
||||||
console.log(err)
|
console.log(err)
|
||||||
this.setState({
|
this.setState({
|
||||||
@ -58,11 +67,27 @@ var Profile = React.createClass({
|
|||||||
return (<div className="profile">
|
return (<div className="profile">
|
||||||
<h1>{this.state.name}</h1>
|
<h1>{this.state.name}</h1>
|
||||||
<p>{this.state.error}</p>
|
<p>{this.state.error}</p>
|
||||||
<h5 className="light">@{this.props.id}</h5>
|
<h5 className="light">@{this.props.params.userid}</h5>
|
||||||
</div>)
|
</div>)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
var Board = React.createClass({
|
||||||
|
getInitialState: function(){
|
||||||
|
return { posts: [] }
|
||||||
|
},
|
||||||
|
render: function(){
|
||||||
|
return (
|
||||||
|
<div></div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<App><Profile id="QmXnfA41SXMX3tqFD4kjED7ehyvgTsuAho86TkEoTbZdpw"/></App>, document.getElementById('root')
|
<Router>
|
||||||
|
<Route path="/" component={App}>
|
||||||
|
<IndexRoute component={Homepage} />
|
||||||
|
<Route path="/@:userid" component={Profile} />
|
||||||
|
</Route>
|
||||||
|
</Router>, document.getElementById('root')
|
||||||
)
|
)
|
||||||
|
@ -20,6 +20,11 @@
|
|||||||
height: 4.5em
|
height: 4.5em
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.navbar a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
.navbar .container {
|
.navbar .container {
|
||||||
padding-top: 1em
|
padding-top: 1em
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user