From 5d3cceb478bca9eda259ac2d4f51a1b7371360fa Mon Sep 17 00:00:00 2001 From: apostolof Date: Sun, 28 Mar 2021 18:10:01 +0300 Subject: [PATCH] feat: add invalid poll data view --- .../PollView/PollDataInvalid/index.jsx | 16 ++++++++++ .../src/components/PollView/index.jsx | 29 ++++++++++++------- 2 files changed, 34 insertions(+), 11 deletions(-) create mode 100644 packages/concordia-app/src/components/PollView/PollDataInvalid/index.jsx diff --git a/packages/concordia-app/src/components/PollView/PollDataInvalid/index.jsx b/packages/concordia-app/src/components/PollView/PollDataInvalid/index.jsx new file mode 100644 index 0000000..c699e45 --- /dev/null +++ b/packages/concordia-app/src/components/PollView/PollDataInvalid/index.jsx @@ -0,0 +1,16 @@ +import React from 'react'; +import { Container, Header, Icon } from 'semantic-ui-react'; + +const PollDataInvalid = () => ( + +
+ + + This topic has a poll but the data are untrusted! + The poll data downloaded from the poster have been tampered with. + +
+
+); + +export default PollDataInvalid; diff --git a/packages/concordia-app/src/components/PollView/index.jsx b/packages/concordia-app/src/components/PollView/index.jsx index 2014cf7..bb2ab0d 100644 --- a/packages/concordia-app/src/components/PollView/index.jsx +++ b/packages/concordia-app/src/components/PollView/index.jsx @@ -15,6 +15,7 @@ import PollVote from './PollVote'; import { FETCH_USER_DATABASE } from '../../redux/actions/peerDbReplicationActions'; import { generatePollHash, generateHash } from '../../utils/hashUtils'; import { POLL_OPTIONS, POLL_QUESTION } from '../../constants/orbit/PollsDatabaseKeys'; +import PollDataInvalid from './PollDataInvalid'; const { contracts: { [VOTING_CONTRACT]: { methods: { getPoll: { cacheCall: getPollChainData } } } } } = drizzle; const { orbit } = breeze; @@ -144,17 +145,23 @@ const PollView = (props) => { return ( -
- - - - {loading - ? - : pollQuestion} - - -
- + {!loading && pollHashValid + ? ( + <> +
+ + + + {loading + ? + : pollQuestion} + + +
+ + + ) + : }
); };