Browse Source

Tiny improvements

develop
Ezerous 6 years ago
parent
commit
b6677e5a9c
  1. 15
      app/src/components/LoadingContainer.js
  2. 12
      app/src/components/NewPost.js
  3. 2
      app/src/helpers/EpochTimeConverter.js
  4. 2
      app/src/redux/sagas/drizzleUtilsSaga.js
  5. 1
      app/src/redux/sagas/orbitSaga.js

15
app/src/components/LoadingContainer.js

@ -29,13 +29,11 @@ class LoadingContainer extends Component {
if (this.props.web3.status === 'initialized' && Object.keys(this.props.accounts).length === 0) { if (this.props.web3.status === 'initialized' && Object.keys(this.props.accounts).length === 0) {
return( return(
<main className="loading-screen"> <main className="loading-screen">
<div>
<div> <div>
<img src={ethereum_logo} alt="ethereum_logo" className="loading-img"/> <img src={ethereum_logo} alt="ethereum_logo" className="loading-img"/>
<p><strong>We can't find any Ethereum accounts!</strong></p> <p><strong>We can't find any Ethereum accounts!</strong></p>
<p>Please make sure that MetaMask is unlocked.</p> <p>Please make sure that MetaMask is unlocked.</p>
</div> </div>
</div>
</main> </main>
) )
} }
@ -43,7 +41,6 @@ class LoadingContainer extends Component {
if (!this.props.contractInitialized) { if (!this.props.contractInitialized) {
return( return(
<main className="loading-screen"> <main className="loading-screen">
<div>
<div> <div>
<img src={ethereum_logo} alt="ethereum_logo" className="loading-img"/> <img src={ethereum_logo} alt="ethereum_logo" className="loading-img"/>
<p><strong>Initializing contracts...</strong></p> <p><strong>Initializing contracts...</strong></p>
@ -51,7 +48,6 @@ class LoadingContainer extends Component {
and you are connected to the correct one. and you are connected to the correct one.
</p> </p>
</div> </div>
</div>
</main> </main>
) )
} }
@ -59,25 +55,24 @@ class LoadingContainer extends Component {
if (!this.props.ipfsInitialized) { if (!this.props.ipfsInitialized) {
return( return(
<main className="loading-screen"> <main className="loading-screen">
<div>
<div> <div>
<img src={ipfs_logo} alt="ipfs_logo" className="loading-img"/> <img src={ipfs_logo} alt="ipfs_logo" className="loading-img"/>
<p><strong>Initializing IPFS...</strong></p> <p><strong>Initializing IPFS...</strong></p>
</div> </div>
</div>
</main> </main>
) )
} }
if (!this.props.orbitReady) { if (!this.props.orbitReady) {
const message = process.env.NODE_ENV ==='development' ?
"If needed, please sign the transaction in MetaMask to create the databases." :
"Please sign the transaction in MetaMask to create the databases.";
return( return(
<main className="loading-screen"> <main className="loading-screen">
<div>
<div> <div>
<img src={orbitdb_logo} alt="orbitdb_logo" className="loading-img"/> <img src={orbitdb_logo} alt="orbitdb_logo" className="loading-img"/>
<p><strong>Preparing OrbitDB...</strong></p> <p><strong>Preparing OrbitDB...</strong></p>
<p>Please sign the transaction in MetaMask to create the databases.</p> <p>{message}</p>
</div>
</div> </div>
</main> </main>
) )
@ -88,12 +83,10 @@ class LoadingContainer extends Component {
return( return(
<main className="loading-screen"> <main className="loading-screen">
<div>
<div> <div>
<img src={logo} alt="app_logo" className="loading-img"/> <img src={logo} alt="app_logo" className="loading-img"/>
<p><strong>Loading dapp...</strong></p> <p><strong>Loading dapp...</strong></p>
</div> </div>
</div>
</main> </main>
) )
} }

12
app/src/components/NewPost.js

@ -92,8 +92,7 @@ class NewPost extends Component {
<div className="post" ref={this.newPostOuterRef}> <div className="post" ref={this.newPostOuterRef}>
<Divider horizontal> <Divider horizontal>
<span className="grey-text"> <span className="grey-text">
# #{postIndex}
{postIndex}
</span> </span>
</Divider> </Divider>
<Grid> <Grid>
@ -111,18 +110,13 @@ class NewPost extends Component {
<div className="stretch-space-between"> <div className="stretch-space-between">
<span><strong>{username}</strong></span> <span><strong>{username}</strong></span>
<span className="grey-text"> <span className="grey-text">
{previewEnabled {previewEnabled && <TimeAgo date={previewDate} />}
&& <TimeAgo date={previewDate} />
}
</span> </span>
</div> </div>
<div className="stretch-space-between"> <div className="stretch-space-between">
<span> <span>
<strong> <strong>
{previewEnabled {previewEnabled && (`Subject: ${postSubjectInput}`)}
&& (`Subject: ${
postSubjectInput}`)
}
</strong> </strong>
</span> </span>
</div> </div>

2
app/src/helpers/EpochTimeConverter.js

@ -5,7 +5,7 @@ const epochTimeConverter = (timestamp) => {
timestampDate.getMonth() + 1}/${ timestampDate.getMonth() + 1}/${
timestampDate.getFullYear()}, ${ timestampDate.getFullYear()}, ${
timestampDate.getHours()}:${ timestampDate.getHours()}:${
timestampDate.getMinutes()}:${ ("0"+timestampDate.getMinutes()).slice(-2)}:${
timestampDate.getSeconds()}`); timestampDate.getSeconds()}`);
}; };

2
app/src/redux/sagas/drizzleUtilsSaga.js

@ -20,7 +20,6 @@ function* init() {
const host = "http://127.0.0.1:8545"; //Ganache development blockchain const host = "http://127.0.0.1:8545"; //Ganache development blockchain
const fallbackProvider = new Web3.providers.HttpProvider(host); const fallbackProvider = new Web3.providers.HttpProvider(host);
web3 = yield call(getWeb3, { fallbackProvider }); web3 = yield call(getWeb3, { fallbackProvider });
forumContract = yield call(getContractInstance, { web3, artifact: Forum }); forumContract = yield call(getContractInstance, { web3, artifact: Forum });
initFlag = true; initFlag = true;
yield put({ yield put({
@ -40,7 +39,6 @@ function* init() {
// If the method below proves to be problematic/ineffective (i.e. getting current account // If the method below proves to be problematic/ineffective (i.e. getting current account
// from state), consider getting it from @drizzle-utils/get-accounts instead // from state), consider getting it from @drizzle-utils/get-accounts instead
// with (yield call(getAccounts, {web3}))[0];
function* getCurrentAccount() { function* getCurrentAccount() {
return (yield select(accounts))[0]; return (yield select(accounts))[0];
} }

1
app/src/redux/sagas/orbitSaga.js

@ -100,6 +100,7 @@ function* orbitSaga() {
]); ]);
yield takeLatest(ACCOUNT_CHANGED, getOrbitDBInfo); yield takeLatest(ACCOUNT_CHANGED, getOrbitDBInfo);
yield takeEvery(ADD_PEER_DATABASE, addPeerDatabase); yield takeEvery(ADD_PEER_DATABASE, addPeerDatabase);
if(process.env.NODE_ENV==='development')
yield takeEvery(ACCOUNTS_FETCHED, updatePeersState); yield takeEvery(ACCOUNTS_FETCHED, updatePeersState);
} }

Loading…
Cancel
Save