From b414609a655902d77cca732cc909adc84c89b976 Mon Sep 17 00:00:00 2001 From: Ezerous Date: Fri, 12 Feb 2021 14:52:59 +0200 Subject: [PATCH] Minor UI fixes/ refactoring --- .../public/locales/en/translation.json | 5 +++-- .../components/ClearDatabasesModal/index.jsx | 8 +++---- .../src/components/TopicList/styles.css | 4 +--- .../MainLayout/MainLayoutIPFSStats/styles.css | 13 ----------- .../index.jsx | 22 +++++++++---------- .../MainLayoutIPFSStatus/styles.css | 18 +++++++++++++++ .../MainLayout/MainLayoutMenu/index.jsx | 2 +- .../MainLayout/MainLayoutMenu/styles.css | 3 ++- .../src/layouts/MainLayout/index.jsx | 4 ++-- .../src/redux/sagas/peerDbReplicationSaga.js | 4 +--- 10 files changed, 43 insertions(+), 40 deletions(-) delete mode 100644 packages/concordia-app/src/layouts/MainLayout/MainLayoutIPFSStats/styles.css rename packages/concordia-app/src/layouts/MainLayout/{MainLayoutIPFSStats => MainLayoutIPFSStatus}/index.jsx (79%) create mode 100644 packages/concordia-app/src/layouts/MainLayout/MainLayoutIPFSStatus/styles.css diff --git a/packages/concordia-app/public/locales/en/translation.json b/packages/concordia-app/public/locales/en/translation.json index d37376c..d4661ce 100644 --- a/packages/concordia-app/public/locales/en/translation.json +++ b/packages/concordia-app/public/locales/en/translation.json @@ -7,8 +7,9 @@ "clear.databases.modal.clearing.progress.message": "This might take a minute...", "clear.databases.modal.clearing.progress.title": "Clearing all Concordia databases", "clear.databases.modal.description.body.user": "Although this action is generally recoverable some of your topics and posts may be permanently lost.", - "clear.databases.modal.description.pre": "You are about to clear the Concordia databases stored locally in your browser.", - "clear.databases.modal.form.username.label.guest": "Please type concordia to confirm.", + "clear.databases.modal.description.pre.guest": "You are about to clear the Concordia databases stored locally in your browser.", + "clear.databases.modal.description.pre.user": "Be careful, {{username}}! You are about to clear the Concordia databases stored locally in your browser.", + "clear.databases.modal.form.username.label.guest": "Please type Concordia to confirm.", "clear.databases.modal.form.username.label.user": "Please type your username to confirm.", "clear.databases.modal.title": "Clear all Concordia databases. Are you sure?", "custom.loading.tab.pane.default.generic.message": "Magic in the background", diff --git a/packages/concordia-app/src/components/ClearDatabasesModal/index.jsx b/packages/concordia-app/src/components/ClearDatabasesModal/index.jsx index db2aa72..922dc54 100644 --- a/packages/concordia-app/src/components/ClearDatabasesModal/index.jsx +++ b/packages/concordia-app/src/components/ClearDatabasesModal/index.jsx @@ -23,7 +23,7 @@ const ClearDatabasesModal = (props) => { useEffect(() => { if (user.hasSignedUp && confirmationInput === user.username) { setUserConfirmed(true); - } else if (!user.hasSignedUp && confirmationInput === 'concordia') { + } else if (!user.hasSignedUp && confirmationInput === 'Concordia') { setUserConfirmed(true); } else { setUserConfirmed(false); @@ -63,7 +63,7 @@ const ClearDatabasesModal = (props) => { return ( <>

- {t('clear.databases.modal.description.pre')} + {t('clear.databases.modal.description.pre.user', { username: user.username })}

{t('clear.databases.modal.description.body.user')} @@ -88,7 +88,7 @@ const ClearDatabasesModal = (props) => { return ( <>

- {t('clear.databases.modal.description.pre')} + {t('clear.databases.modal.description.pre.guest')}

@@ -105,7 +105,7 @@ const ClearDatabasesModal = (props) => { ); - }, [confirmationInput, isClearing, t, user.hasSignedUp]); + }, [confirmationInput, isClearing, t, user.hasSignedUp, user.username]); return useMemo(() => ( { +const MainLayoutIPFSStatus = () => { const ipfsId = useSelector((state) => state.ipfs.id); const peerIds = useSelector((state) => state.ipfs.peers); const bootstrapPeerIds = useSelector((state) => state.ipfs.bootstrapPeers); const peers = useMemo(() => peerIds .map((peerId) => ( - + {peerId} @@ -26,7 +26,7 @@ const MainLayoutIPFSStats = () => { const bootstrapPeers = useMemo(() => bootstrapPeerIds .map((bootstrapPeerId) => ( - + {bootstrapPeerId} @@ -39,17 +39,17 @@ const MainLayoutIPFSStats = () => { return (
- - IPFS Stats + + IPFS Status
- +
- Peer ID + Peer ID {ipfsId} @@ -57,7 +57,7 @@ const MainLayoutIPFSStats = () => { - Peers + Peers {peers.length === 0 ? ( @@ -67,7 +67,7 @@ const MainLayoutIPFSStats = () => { ) : null} {peers} - Bootstrap Peers + Bootstrap Peers {bootstrapPeers.length === 0 ? ( @@ -82,4 +82,4 @@ const MainLayoutIPFSStats = () => { ); }; -export default MainLayoutIPFSStats; +export default MainLayoutIPFSStatus; diff --git a/packages/concordia-app/src/layouts/MainLayout/MainLayoutIPFSStatus/styles.css b/packages/concordia-app/src/layouts/MainLayout/MainLayoutIPFSStatus/styles.css new file mode 100644 index 0000000..abfeccd --- /dev/null +++ b/packages/concordia-app/src/layouts/MainLayout/MainLayoutIPFSStatus/styles.css @@ -0,0 +1,18 @@ +.status-table { + border: 1px solid var(--secondary-color) !important; +} + +.status-key { + background-color: var(--secondary-color); + color: white; + font-weight: 700; +} + +.status-value { + font-size: 0.95rem; + cursor: pointer; +} + +.status-value:hover { + color: grey; +} diff --git a/packages/concordia-app/src/layouts/MainLayout/MainLayoutMenu/index.jsx b/packages/concordia-app/src/layouts/MainLayout/MainLayoutMenu/index.jsx index 012fad6..1f0c0f7 100644 --- a/packages/concordia-app/src/layouts/MainLayout/MainLayoutMenu/index.jsx +++ b/packages/concordia-app/src/layouts/MainLayout/MainLayoutMenu/index.jsx @@ -31,7 +31,7 @@ const MainLayoutMenu = () => { return ( {() => ( - + { @@ -17,7 +17,7 @@ const MainLayout = (props) => { {children} - + diff --git a/packages/concordia-app/src/redux/sagas/peerDbReplicationSaga.js b/packages/concordia-app/src/redux/sagas/peerDbReplicationSaga.js index 969195d..251a283 100644 --- a/packages/concordia-app/src/redux/sagas/peerDbReplicationSaga.js +++ b/packages/concordia-app/src/redux/sagas/peerDbReplicationSaga.js @@ -104,9 +104,7 @@ function* updateReduxState({ database }) { function* peerDbReplicationSaga() { yield takeEvery(FETCH_USER_DATABASE, fetchUserDb); - yield takeEvery(ORBIT_DB_REPLICATED, updateReduxState); - yield takeEvery(ORBIT_DB_READY, updateReduxState); - yield takeEvery(ORBIT_DB_WRITE, updateReduxState); + yield takeEvery([ORBIT_DB_READY, ORBIT_DB_REPLICATED, ORBIT_DB_WRITE], updateReduxState); } export default peerDbReplicationSaga;