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) {
return(
<main className="loading-screen">
<div>
<div>
<img src={ethereum_logo} alt="ethereum_logo" className="loading-img"/>
<p><strong>We can't find any Ethereum accounts!</strong></p>
<p>Please make sure that MetaMask is unlocked.</p>
</div>
</div>
</main>
)
}
@ -43,7 +41,6 @@ class LoadingContainer extends Component {
if (!this.props.contractInitialized) {
return(
<main className="loading-screen">
<div>
<div>
<img src={ethereum_logo} alt="ethereum_logo" className="loading-img"/>
<p><strong>Initializing contracts...</strong></p>
@ -51,7 +48,6 @@ class LoadingContainer extends Component {
and you are connected to the correct one.
</p>
</div>
</div>
</main>
)
}
@ -59,25 +55,24 @@ class LoadingContainer extends Component {
if (!this.props.ipfsInitialized) {
return(
<main className="loading-screen">
<div>
<div>
<img src={ipfs_logo} alt="ipfs_logo" className="loading-img"/>
<p><strong>Initializing IPFS...</strong></p>
</div>
</div>
</main>
)
}
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(
<main className="loading-screen">
<div>
<div>
<img src={orbitdb_logo} alt="orbitdb_logo" className="loading-img"/>
<p><strong>Preparing OrbitDB...</strong></p>
<p>Please sign the transaction in MetaMask to create the databases.</p>
</div>
<p>{message}</p>
</div>
</main>
)
@ -88,12 +83,10 @@ class LoadingContainer extends Component {
return(
<main className="loading-screen">
<div>
<div>
<img src={logo} alt="app_logo" className="loading-img"/>
<p><strong>Loading dapp...</strong></p>
</div>
</div>
</main>
)
}

12
app/src/components/NewPost.js

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

2
app/src/helpers/EpochTimeConverter.js

@ -5,7 +5,7 @@ const epochTimeConverter = (timestamp) => {
timestampDate.getMonth() + 1}/${
timestampDate.getFullYear()}, ${
timestampDate.getHours()}:${
timestampDate.getMinutes()}:${
("0"+timestampDate.getMinutes()).slice(-2)}:${
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 fallbackProvider = new Web3.providers.HttpProvider(host);
web3 = yield call(getWeb3, { fallbackProvider });
forumContract = yield call(getContractInstance, { web3, artifact: Forum });
initFlag = true;
yield put({
@ -40,7 +39,6 @@ function* init() {
// 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
// with (yield call(getAccounts, {web3}))[0];
function* getCurrentAccount() {
return (yield select(accounts))[0];
}

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

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

Loading…
Cancel
Save