Joystream Stats 3 年 前
コミット
c3278c44e1

+ 4 - 2
src/App.tsx

@@ -185,7 +185,9 @@ class App extends React.Component<IProps, IState> {
 
   updateActiveProposals() {
     const active = this.state.proposals.filter((p) => p.result === "Pending");
-    console.log(`Updating ${active.length} active proposals`);
+    if (!active.length) return;
+    const s = active.length > 1 ? `s` : ``;
+    console.log(`Updating ${active.length} active proposal${s}`);
     active.forEach(async (a) => {
       const { data } = await axios.get(`${apiLocation}/proposals/${a.id}`);
       if (!data || data.error) return console.error(`failed to fetch from API`);
@@ -201,7 +203,7 @@ class App extends React.Component<IProps, IState> {
     this.fetchEraRewardPoints(api, era);
 
     const { status, validators } = this.state;
-    if (era > status.era || validators.length) {
+    if (era > status.era || !validators.length) {
       console.debug(`Updating validators`);
       this.fetchLastReward(api, status.era);
       const validators = await this.fetchValidators(api);

+ 0 - 1
src/components/Dashboard/ElectionStatus.tsx

@@ -25,7 +25,6 @@ const Stage = (props: {
   }
 
   let stageString = Object.keys(stage)[0];
-  console.log(`e`, stageString);
   const left = timeLeft(stage[stageString] - block);
   if (stageString === "announcing")
     return (

+ 2 - 6
src/components/Dashboard/Footer.tsx

@@ -6,12 +6,8 @@ import { domain } from "../../config";
 const donationUrl = `${domain}/#/members/joystreamstats`;
 const ideasUrl = `${domain}/#/forum/threads/257`;
 
-const Footer = (props: {
-  show: boolean;
-  toggleHide: () => void;
-  link: string;
-}) => {
-  const { show, link } = props;
+const Footer = (props: { show: boolean; toggleHide: () => void }) => {
+  const { show } = props;
   if (!show)
     return (
       <Info className="footer-hidden" onClick={() => props.toggleHide()} />

+ 0 - 3
src/components/Dashboard/Proposals.tsx

@@ -49,9 +49,6 @@ const Proposals = (props: {
   const classes = useStyles();
   const pending = proposals.filter((p) => p && p.result === "Pending");
 
-  if (proposals.length && !pending.length)
-    return <div className="box">No active proposals.</div>;
-
   return (
     <Grid
       style={{

+ 0 - 2
src/components/FAQ/index.tsx

@@ -9,8 +9,6 @@ import {
   Typography,
 } from "@material-ui/core";
 import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
-import { useEffect } from "react";
-import { useState } from "react";
 import { FAQItem } from "../../types";
 
 const useStyles = makeStyles((theme: Theme) =>

+ 1 - 9
src/components/Proposals/Proposal.tsx

@@ -45,15 +45,7 @@ const Proposal = (props: {
         Proposal {proposals.length}
       </Link>
     );
-  const {
-    author,
-    description,
-    title,
-    message,
-    result,
-    stage,
-    votes,
-  } = proposal;
+  const { author, description, title, result, stage, votes } = proposal;
   return (
     <div>
       <div className="text-center p-1 m-1">