Преглед на файлове

fix handleApi ; drop unused vars

Joystream Stats преди 3 години
родител
ревизия
62147f8515
променени са 4 файла, в които са добавени 23 реда и са изтрити 24 реда
  1. 4 1
      src/App.tsx
  2. 17 20
      src/components/Curation/index.jsx
  3. 1 2
      src/components/Storage/Provider.tsx
  4. 1 1
      src/components/Storage/Ranking.tsx

+ 4 - 1
src/App.tsx

@@ -85,7 +85,10 @@ class App extends React.Component<IProps, IState> {
 
     let { status } = this.state;
     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);
   }
 

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

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

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

@@ -4,11 +4,10 @@ import Asset from "./Asset";
 const Provider = (props: {
   setAssetStatus: (id: string, provider: string, status: string) => void;
   loading: any[];
-  startedAt: string | boolean;
   test: string[];
   url: string;
 }) => {
-  const { setAssetStatus, loading, test, url, startedAt } = props;
+  const { setAssetStatus, loading, test, url } = props;
 
   return (
     <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 assets: string[] = [];
   let url: string;
-  provider.map(({ speed, provider, asset }: Asset) => {
+  provider.forEach(({ speed, provider, asset }: Asset) => {
     const { total, size } = speed;
     transferred += size / 1000000;
     duration += total;