Browse Source

fix handleApi ; drop unused vars

Joystream Stats 3 years ago
parent
commit
62147f8515

+ 4 - 1
src/App.tsx

@@ -85,7 +85,10 @@ class App extends React.Component<IProps, IState> {
 
 
     let { status } = this.state;
     let { status } = this.state;
     let blockHash = await api.rpc.chain.getBlockHash(1);
     let blockHash = await api.rpc.chain.getBlockHash(1);
-    status.startTime = (await api.query.timestamp.now.at(blockHash)).toNumber();
+    if (blockHash)
+      status.startTime = (
+        await api.query.timestamp.now.at(blockHash)
+      ).toNumber();
     this.save("status", status);
     this.save("status", status);
   }
   }
 
 

+ 17 - 20
src/components/Curation/index.jsx

@@ -4,7 +4,7 @@ import { ChevronLeft, ChevronRight } from "react-feather";
 import Buttons from "./Buttons";
 import Buttons from "./Buttons";
 import ToggleCurated from "./ToggleCurated";
 import ToggleCurated from "./ToggleCurated";
 import Curated from "./Curated";
 import Curated from "./Curated";
-import Loading from "../Loading";
+//import Loading from "../Loading";
 import moment from "moment";
 import moment from "moment";
 import axios from "axios";
 import axios from "axios";
 
 
@@ -34,7 +34,6 @@ class Curation extends React.Component<> {
   }
   }
 
 
   async fetchPending(offset: number = 0) {
   async fetchPending(offset: number = 0) {
-    const { page } = this.state;
     console.log(`Fetching videos`);
     console.log(`Fetching videos`);
     const videos = await fetchPending(offset);
     const videos = await fetchPending(offset);
     if (!videos) return;
     if (!videos) return;
@@ -79,20 +78,18 @@ class Curation extends React.Component<> {
       handleChange,
       handleChange,
       addVideoVote,
       addVideoVote,
       selectVideo,
       selectVideo,
-      videos = [],
       curations = [],
       curations = [],
       search,
       search,
-      providers,
     } = this.props;
     } = this.props;
     const {
     const {
       loading,
       loading,
       pending,
       pending,
       page,
       page,
-      hideWithoutThumb,
+      //hideWithoutThumb,
       ipfsLocations,
       ipfsLocations,
     } = this.state;
     } = this.state;
 
 
-    const showCurated = this.props.showCurated ? "" : "un";
+    //const showCurated = this.props.showCurated ? "" : "un";
     const noThumb = pending.filter((v) => !v.thumbnailPhotoDataObject);
     const noThumb = pending.filter((v) => !v.thumbnailPhotoDataObject);
 
 
     return (
     return (
@@ -149,26 +146,26 @@ class Curation extends React.Component<> {
               createdAt,
               createdAt,
               updatedAt,
               updatedAt,
               channelId,
               channelId,
-              categoryId,
+              //categoryId,
               title,
               title,
               description,
               description,
               duration,
               duration,
-              thumbnailPhotoDataObjectId,
-              thumbnailPhotoUrls,
-              thumbnailPhotoAvailability,
+              //thumbnailPhotoDataObjectId,
+              //thumbnailPhotoUrls,
+              //thumbnailPhotoAvailability,
               languageId,
               languageId,
-              hasMarketing,
-              publishedBeforeJoystream,
-              isPublic,
-              isCensored,
-              isExplicit,
+              //hasMarketing,
+              //publishedBeforeJoystream,
+              //isPublic,
+              //isCensored,
+              //isExplicit,
               licenseId,
               licenseId,
-              mediaDataObjectId,
-              mediaUrls,
-              mediaAvailability,
-              mediaMetadataId,
+              //mediaDataObjectId,
+              //mediaUrls,
+              //mediaAvailability,
+              //mediaMetadataId,
               createdInBlock,
               createdInBlock,
-              isFeatured,
+              //isFeatured,
             } = v.videomediaDataObject[0];
             } = v.videomediaDataObject[0];
 
 
             return (
             return (

+ 1 - 2
src/components/Storage/Provider.tsx

@@ -4,11 +4,10 @@ import Asset from "./Asset";
 const Provider = (props: {
 const Provider = (props: {
   setAssetStatus: (id: string, provider: string, status: string) => void;
   setAssetStatus: (id: string, provider: string, status: string) => void;
   loading: any[];
   loading: any[];
-  startedAt: string | boolean;
   test: string[];
   test: string[];
   url: string;
   url: string;
 }) => {
 }) => {
-  const { setAssetStatus, loading, test, url, startedAt } = props;
+  const { setAssetStatus, loading, test, url } = props;
 
 
   return (
   return (
     <div key={url} className="m-2 d-flex flex-row">
     <div key={url} className="m-2 d-flex flex-row">

+ 1 - 1
src/components/Storage/Ranking.tsx

@@ -21,7 +21,7 @@ const calculateSpeed = (provider: Asset[]) => {
   let duration: number = 0;
   let duration: number = 0;
   let assets: string[] = [];
   let assets: string[] = [];
   let url: string;
   let url: string;
-  provider.map(({ speed, provider, asset }: Asset) => {
+  provider.forEach(({ speed, provider, asset }: Asset) => {
     const { total, size } = speed;
     const { total, size } = speed;
     transferred += size / 1000000;
     transferred += size / 1000000;
     duration += total;
     duration += total;