Browse Source

feat: add loader to poll view

develop
Ezerous 4 years ago
parent
commit
24a3a8f2c9
  1. 20
      packages/concordia-app/src/components/PollView/index.jsx
  2. 2
      packages/concordia-pinner/package.json
  3. 54
      yarn.lock

20
packages/concordia-app/src/components/PollView/index.jsx

@ -2,7 +2,7 @@ import React, { useEffect, useMemo, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { VOTING_CONTRACT } from 'concordia-shared/src/constants/contracts/ContractNames';
import {
Container, Header, Icon, Tab,
Container, Header, Icon, Loader, Tab,
} from 'semantic-ui-react';
import { useTranslation } from 'react-i18next';
import PropTypes from 'prop-types';
@ -33,7 +33,7 @@ const PollView = (props) => {
const [pollOptions, setPollOptions] = useState([]);
const [voteCounts, setVoteCounts] = useState([]);
const [voters, setVoters] = useState([]);
const [pollHashValid, setPollHashValid] = useState(false);
const [pollHashValid, setPollHashValid] = useState(true);
const [pollQuestion, setPollQuestion] = useState('');
const [chainDataLoading, setChainDataLoading] = useState(true);
const [orbitDataLoading, setOrbitDataLoading] = useState(true);
@ -162,14 +162,18 @@ const PollView = (props) => {
return (
<Container id="topic-poll-container" textAlign="left">
{!chainDataLoading && !orbitDataLoading && pollHashValid
{pollHashValid
? (
<>
<Header as="h3">
<Icon name="chart pie" size="large" />
{pollQuestion}
</Header>
<Tab panes={panes} />
{!chainDataLoading && !orbitDataLoading ? (
<>
<Header as="h3">
<Icon name="chart pie" size="large" />
{pollQuestion}
</Header>
<Tab panes={panes} />
</>
) : <Loader active inline="centered" />}
</>
)
: <PollDataInvalid />}

2
packages/concordia-pinner/package.json

@ -22,7 +22,7 @@
"libp2p": "~0.30.0",
"libp2p-bootstrap": "~0.12.2",
"libp2p-gossipsub": "~0.8.0",
"libp2p-kad-dht": "~0.20.1",
"libp2p-kad-dht": "~0.21.0",
"libp2p-mdns": "~0.15.0",
"libp2p-mplex": "~0.10.0",
"libp2p-noise": "~2.0.1",

54
yarn.lock

@ -8732,7 +8732,7 @@ interface-datastore@^2.0.0:
it-drain "^1.0.1"
nanoid "^3.0.2"
interface-datastore@^3.0.1, interface-datastore@^3.0.3:
interface-datastore@^3.0.1, interface-datastore@^3.0.3, interface-datastore@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/interface-datastore/-/interface-datastore-3.0.4.tgz#7c02d393fb0372bc86c03de1095e15ae70912771"
integrity sha512-WEO09j/VRF866je3UXfk64GTWi0ag5mH+jbTbOYX7rkhcNnvAvYvvtysOu2vzUXaM1nBmtI9SjMpp4dqXOE+LA==
@ -11529,7 +11529,7 @@ libp2p-interfaces@^0.8.0, libp2p-interfaces@^0.8.1, libp2p-interfaces@^0.8.2, li
streaming-iterables "^5.0.4"
uint8arrays "^2.0.5"
libp2p-kad-dht@^0.20.1, libp2p-kad-dht@~0.20.1:
libp2p-kad-dht@^0.20.1:
version "0.20.6"
resolved "https://registry.yarnpkg.com/libp2p-kad-dht/-/libp2p-kad-dht-0.20.6.tgz#18bcc903f614d3397f523a2ab8d122ef5ba3d5e0"
integrity sha512-hRClzJP+NK3zBU0/pYkoDUhZcviqmPu4czFaftcl3cCGasjxSaWNEZNKsf65QwoINZD9jFrYkQuXW9/gWQwuOA==
@ -11564,6 +11564,40 @@ libp2p-kad-dht@^0.20.1, libp2p-kad-dht@~0.20.1:
varint "^5.0.0"
xor-distance "^2.0.0"
libp2p-kad-dht@~0.21.0:
version "0.21.0"
resolved "https://registry.yarnpkg.com/libp2p-kad-dht/-/libp2p-kad-dht-0.21.0.tgz#3415381b62a158a0ec50c6c1ffb14c04c118c3c0"
integrity sha512-xluAQlVnsdpswE8lLtma+BTOkbvUsS0E9AbpwMioS+X6vY+SlLNgPnRPA8jvnyEC8YDA7U14ndHzFULPCPJcMw==
dependencies:
abort-controller "^3.0.0"
cids "^1.1.5"
debug "^4.3.1"
err-code "^3.0.0"
hashlru "^2.3.0"
heap "~0.2.6"
interface-datastore "^3.0.4"
it-first "^1.0.4"
it-length-prefixed "^3.1.0"
it-pipe "^1.1.0"
k-bucket "^5.0.0"
libp2p-crypto "^0.19.0"
libp2p-interfaces "^0.8.2"
libp2p-record "^0.10.0"
multiaddr "^8.1.2"
multihashing-async "^2.1.0"
p-filter "^2.1.0"
p-map "^4.0.0"
p-queue "^6.6.2"
p-timeout "^4.1.0"
p-times "^3.0.0"
peer-id "^0.14.2"
promise-to-callback "^1.0.0"
protons "^2.0.0"
streaming-iterables "^5.0.4"
uint8arrays "^2.0.5"
varint "^6.0.0"
xor-distance "^2.0.0"
libp2p-mdns@^0.15.0, libp2p-mdns@~0.15.0:
version "0.15.0"
resolved "https://registry.yarnpkg.com/libp2p-mdns/-/libp2p-mdns-0.15.0.tgz#c4e71e162ef2ea817d9d745376a1acac1271fe51"
@ -11605,6 +11639,17 @@ libp2p-noise@^2.0.1, libp2p-noise@~2.0.1:
protobufjs "^6.10.1"
uint8arrays "^2.0.5"
libp2p-record@^0.10.0:
version "0.10.0"
resolved "https://registry.yarnpkg.com/libp2p-record/-/libp2p-record-0.10.0.tgz#176519fea533d79485fd82d7f47b2b4094f86877"
integrity sha512-IxnEaLSdKNAtLLEUw5chI7osRoI1YmCEIw5yHOItYC2Px1+S8N1izxN2tRKqRJoXoz7CkDWREnUClPa4jyaJwA==
dependencies:
err-code "^3.0.0"
multihashes "^3.0.1"
multihashing-async "^2.1.0"
protons "^2.0.0"
uint8arrays "^2.0.5"
libp2p-record@^0.9.0:
version "0.9.0"
resolved "https://registry.yarnpkg.com/libp2p-record/-/libp2p-record-0.9.0.tgz#6c8775b77660ec5b5ce143fac20bd9e67e66e0fe"
@ -12722,7 +12767,7 @@ multihashes@~3.0.1:
uint8arrays "^1.0.0"
varint "^5.0.0"
multihashing-async@^2.0.0, multihashing-async@^2.0.1, multihashing-async@^2.1.2:
multihashing-async@^2.0.0, multihashing-async@^2.0.1, multihashing-async@^2.1.0, multihashing-async@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/multihashing-async/-/multihashing-async-2.1.2.tgz#9ed68f183bde70e0416b166bbc59a0c0623a0ede"
integrity sha512-FTPNnWWxwIK5dXXmTFhySSF8Fkdqf7vzqpV09+RWsmfUhrsL/b3Arg3+bRrBnXTtjxm3JRGI3wSAtQHL0QCxhQ==
@ -16665,9 +16710,6 @@ snake-case@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/snake-case/-/snake-case-3.0.4.tgz#4f2bbd568e9935abdfd593f34c691dadb49c452c"
integrity sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==
dependencies:
dot-case "^3.0.4"
tslib "^2.0.3"
snapdragon-node@^2.0.1:
version "2.1.1"

Loading…
Cancel
Save