From fbdeffe68c566ed6d4861fdc7c018e178b64596d Mon Sep 17 00:00:00 2001 From: "plebeius.eth" Date: Thu, 22 Jun 2023 21:59:17 +0200 Subject: [PATCH] fix state labels to reflect precise state --- src/components/PendingLabel.jsx | 27 ++++++++------------------- src/components/StateLabel.jsx | 8 +------- 2 files changed, 9 insertions(+), 26 deletions(-) diff --git a/src/components/PendingLabel.jsx b/src/components/PendingLabel.jsx index d8862ddd..d070e579 100644 --- a/src/components/PendingLabel.jsx +++ b/src/components/PendingLabel.jsx @@ -1,19 +1,8 @@ -import React -// , { useState, useEffect } - from "react"; +import React from "react"; import { useAccountComment } from "@plebbit/plebbit-react-hooks"; -// import useStateString from "../hooks/useStateString"; const PendingLabel = ({ commentIndex }) => { const comment = useAccountComment({commentIndex: commentIndex}); - // const stateString = useStateString(comment); - - // const [isLoading, setIsLoading] = useState(true); - - // useEffect(() => { - // const timer = setTimeout(() => setIsLoading(false), 2000); - // return () => clearTimeout(timer); - // }, []); if (commentIndex === undefined) return null; @@ -21,16 +10,16 @@ const PendingLabel = ({ commentIndex }) => { comment.cid ? ( {comment.cid.slice(2, 14)} ) : ( - (comment.state === "failed" - // || (stateString === undefined && !isLoading) - ) ? ( - - Failed - - ) : ( + comment.state === "pending" ? ( Pending + ) : ( + comment.state === "failed" ? ( + + Failed + + ) : null ) ) ); diff --git a/src/components/StateLabel.jsx b/src/components/StateLabel.jsx index c6398285..7fabc934 100644 --- a/src/components/StateLabel.jsx +++ b/src/components/StateLabel.jsx @@ -21,13 +21,7 @@ const StateLabel = ({ commentIndex, className }) => { null ) : ( stateString === undefined && !isLoading && comment.cid === undefined ? ( - -
- ( - - - ) -
+ null ) : (