From ec017b32a8f5788d5b1b5b02e4df1d716944ba99 Mon Sep 17 00:00:00 2001 From: Enrico Fasoli Date: Wed, 7 Feb 2018 21:08:53 +0100 Subject: [PATCH] UI work --- src/components/Board.js | 77 ++++++++++++++++++++++++++++++++----- src/components/Post.js | 13 ++++++- src/containers/WithBoard.js | 5 ++- src/utils/ipfs.js | 10 +++-- 4 files changed, 90 insertions(+), 15 deletions(-) diff --git a/src/components/Board.js b/src/components/Board.js index 58e0550..328f938 100644 --- a/src/components/Board.js +++ b/src/components/Board.js @@ -1,15 +1,74 @@ import React from 'react' import Post from './Post' -import { Segment, Button } from 'semantic-ui-react' +import { Divider, Icon, Grid, Segment, Header, List, Button, Card } from 'semantic-ui-react' import { Link } from 'react-router-dom' import { shortenAddress } from '../utils/orbitdb'; -export default function Board({ address, posts }) { - return
- {address} - - -
    {Object.keys(posts || {}).map(i => )}
-
-
+export default function Board({ address, posts, metadata }) { + const { email, website, title } = metadata || {} + const url = window.location.href + return + +
+ {title || 'Unnamed Board'} + Board +
+ + + + + + Board Address + + {address} + + + + + + + Users + ? + + + + + + Posts + {Object.values(posts || {}).length} + + + + + + Replication Status + Idle + + + + + + Website + {website ? {website} : 'N/A'} + + + + + + Mail + {email ? {email} : 'N/A'} + + + +
+ + +
+
+ + + {Object.keys(posts || {}).map(i => )} + + +
} \ No newline at end of file diff --git a/src/components/Post.js b/src/components/Post.js index 24371a4..66f0661 100644 --- a/src/components/Post.js +++ b/src/components/Post.js @@ -1,5 +1,16 @@ import React from 'react' +import { Card, Icon } from 'semantic-ui-react' export default function Post({ title, multihash}) { - return
  • {title}: {multihash}
  • + return + + {title} + + + View + + + Comments not supported yet + + } \ No newline at end of file diff --git a/src/containers/WithBoard.js b/src/containers/WithBoard.js index 36a73a7..d18cb3d 100644 --- a/src/containers/WithBoard.js +++ b/src/containers/WithBoard.js @@ -1,4 +1,5 @@ import React, { Component } from 'react' +import { Loader, Dimmer } from 'semantic-ui-react' import { connect } from 'react-redux' import { openBoard } from '../actions/board' import { getBoardAddress } from '../utils/orbitdb' @@ -40,7 +41,9 @@ export default function WithBoard(WrappedComponent) { if (board) { return } else { - return
    Opening this board...
    + return + Opening this board + } } } diff --git a/src/utils/ipfs.js b/src/utils/ipfs.js index 0505cf2..95779f3 100644 --- a/src/utils/ipfs.js +++ b/src/utils/ipfs.js @@ -1,6 +1,8 @@ -import multihashes from 'multihashes' - export async function ipfsPut(content) { - const dagNode = await window.ipfs.object.put(Buffer.from(content)) - return multihashes.toB58String(dagNode.multihash) + const obj = { + content: Buffer.from(content), + path: '/' + } + const response = await window.ipfs.files.add(obj) + return response[0].hash } \ No newline at end of file