Joystream Stats 2 yıl önce
ebeveyn
işleme
a711703f81

+ 2 - 2
src/components/Distribution/Bucket.tsx

@@ -11,7 +11,7 @@ const BucketRow = (props: { isDP: boolean; bucket: Bucket }) => {
   const { id, distributing, acceptingNewBags, bags, operatorMetadata } = bucket;
   const op = useMemo(
     () => (isDP ? bucket.operators[0] : { metadata: operatorMetadata }),
-    [isDP]
+    [isDP, bucket.operators, operatorMetadata]
   );
   const [show, setShow] = useState(false);
   const [hasQN, setQN] = useState();
@@ -20,7 +20,7 @@ const BucketRow = (props: { isDP: boolean; bucket: Bucket }) => {
   const [families, setFams] = useState([]);
   useEffect(
     () => qnUrl || testQN(op, setQN, setInfo, setUrl, setFams),
-    [op, !qnUrl]
+    [op, qnUrl]
   );
   let qnTitle = `Not set.`;
   if (qnInfo.length) {

+ 1 - 1
src/components/Proposals/Detail.tsx

@@ -1,8 +1,8 @@
 import React from "react";
 import { OverlayTrigger, Tooltip } from "react-bootstrap";
 import { TableFromObject } from "..";
+import { mJoy } from "../../lib/util";
 
-const mJoy = (mJoy: number) => (mJoy / 1000000).toFixed(2);
 const Detail = (props: { mJoy: number; detail?: any; type: string }) => {
   const { amount, detail, type } = props;
   if (type === "text") return <span>Text</span>;

+ 11 - 4
src/components/Transactions/index.tsx

@@ -3,7 +3,7 @@ import { Form, Table } from "react-bootstrap";
 import axios from "axios";
 
 import { alternativeBackendApis } from "../../config";
-
+import { mJoy } from "../../lib/util";
 import { Transaction } from "../../types";
 
 interface IProps {}
@@ -44,9 +44,7 @@ class Transactions extends React.Component<IProps, IState> {
   }
 
   accountTxFilterChanged(address: string) {
-    if (this.state.address !== address) {
-      this.setState({ ...this.state, address: address });
-    }
+    if (this.state.address !== address) this.setState({ address: address });
   }
 
   render() {
@@ -96,9 +94,18 @@ class Transactions extends React.Component<IProps, IState> {
                     <td onClick={() => this.accountTxFilterChanged(tx.from)}>
                       {getHandle(tx.from)}
                     </td>
+                    <td onClick={() => this.accountTxFilterChanged(tx.from)}>
+                      {mJoy(tx.fromBalance)}
+                    </td>
                     <td onClick={() => this.accountTxFilterChanged(tx.to)}>
                       {getHandle(tx.to)}
                     </td>
+                    <td onClick={() => this.accountTxFilterChanged(tx.to)}>
+                      {getHandle(tx.to)}
+                    </td>
+                    <td onClick={() => this.accountTxFilterChanged(tx.to)}>
+                      {mJoy(tx.toBalance)}
+                    </td>
                   </tr>
                 ))}
               </tbody>

+ 0 - 1
src/lib/queries.ts

@@ -1,6 +1,5 @@
 import { apiLocation } from "../config";
 import { Tokenomics } from "../types";
-//import { getAssets, getStorageProviders } from "./storage";
 import axios from "axios";
 
 export const queryJstats = (route: string) => {

+ 2 - 43
src/lib/util.ts

@@ -1,48 +1,7 @@
-import { Options, Proposals, IApplicant, IVote } from "../types";
+import { IApplicant, IVote } from "../types";
 import moment from "moment";
 
-export const parseArgs = (args: string[]): Options => {
-  const inArgs = (term: string): boolean => {
-    return args.find((a) => a.search(term) > -1) ? true : false;
-  };
-
-  const options: Options = {
-    verbose: inArgs("--verbose") ? 2 : inArgs("--quiet") ? 0 : 1,
-    channel: inArgs("--channel"),
-    council: inArgs("--council"),
-    forum: inArgs("--forum"),
-    proposals: inArgs("--proposals"),
-  };
-
-  if (options.verbose > 1) console.debug("args", args, "\noptions", options);
-  return options;
-};
-
-export const printStatus = (
-  opts: Options,
-  data: {
-    block: number;
-    cats: number[];
-    chain: string;
-    posts: number[];
-    proposals: Proposals;
-    threads: number[];
-  }
-): void => {
-  if (opts.verbose < 1) return;
-
-  const { block, chain, proposals, cats, posts, threads } = data;
-  const date = formatTime();
-  let message = `[${date}] Chain:${chain} Block:${block} `;
-
-  if (opts.forum)
-    message += `Post:${posts[1]} Cat:${cats[1]} Thread:${threads[1]} `;
-
-  if (opts.proposals)
-    message += `Proposals:${proposals.current} (Active:${proposals.active.length} Pending:${proposals.executing.length}) `;
-
-  console.log(message);
-};
+export const mJoy = (mJoy: number) => (mJoy / 1000000).toFixed(2);
 
 // time
 export const formatDate = (time?: number) => {