diff --git a/lib/boards-api.js b/lib/boards-api.js index bfc8e30..ca1b074 100644 --- a/lib/boards-api.js +++ b/lib/boards-api.js @@ -130,6 +130,10 @@ BoardsAPI.prototype.createProfile = function (profile, done) { ], done) } +BoardsAPI.prototype.createBoard = function (board, done) { + +} + BoardsAPI.prototype.backupCache = function () { if (window && window.localStorage !== undefined) { // Use localStorage to store the IPNS cache diff --git a/webapp/pages/board-editor.jsx b/webapp/pages/board-editor.jsx new file mode 100644 index 0000000..876dd10 --- /dev/null +++ b/webapp/pages/board-editor.jsx @@ -0,0 +1,130 @@ +var React = require('react') +var GetIPFS = require('getipfs.jsx') +var Icon = require('icon.jsx') +var Link = require('react-router').Link + +module.exports = function (boardsAPI) { + return React.createClass({ + getInitialState () { + return { } + }, + componentDidMount () { + boardsAPI.use(boards => { + boards.init() + boards.getEventEmitter().on('init', err => { + if (!err && this.isMounted()) { + this.init(boards) + } + }) + if (this.isMounted() && boards.isInit) { + this.init(boards) + } + }) + }, + init (boards) { + if (this.state.init) return + this.setState({ api: boards, init: true }) + this.getBoardSettings(boards) + }, + getBoardSettings (boards) { + if (!this.props.params.board) return + boards.getBoardSettings(boards.getMyID(), this.props.params.board) + }, + handleChange (event) { + var obj = {} + obj[event.target.id] = event.target.value + this.setState(obj) + }, + skip () { + this.setState({ loading: false, updating: false, error: false }) + }, + refresh () { + this.setState({ loading: true }) + boardsAPI.use(b => this.getBoardSettings(b)) + }, + save () { + var boards = this.state.api + var board = { + id: this.state.shortname, + fullname: this.state.name, + description: this.state.description + } + this.setState({ updating: true }) + boards.createBoard(board, (err) => { + console.log('CREATE:', err) + }) + }, + additionalButtons () { + if (this.state.api && this.props.params.board) { + var url = '/@' + this.state.api.getMyID() + '/' + this.props.params.board + return + + View + + } else { + return + } + }, + render () { + if (this.state.api) { + if (this.state.error) { + return
{this.state.error}
+ +Pressing the Skip button will not abort the publish operation.
+ +This App uses IPFS to store your Boards. When you are offline, + other users or servers that viewed your content will serve it to + others.
+Warning: due to a bug in go-ipfs, it may take up to a minute + for your changes to be visibile. Your Boards will appear unchanged during + this time.
+