fix state labels to reflect precise state

This commit is contained in:
plebeius.eth
2023-06-22 21:59:17 +02:00
parent 24ebb6bd7e
commit fbdeffe68c
2 changed files with 9 additions and 26 deletions
+8 -19
View File
@@ -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 ? (
<span>{comment.cid.slice(2, 14)}</span>
) : (
(comment.state === "failed"
// || (stateString === undefined && !isLoading)
) ? (
<span style={{color: 'red', fontWeight: '700'}}>
Failed
</span>
) : (
comment.state === "pending" ? (
<span style={{color: 'red', fontWeight: '700'}}>
Pending
</span>
) : (
comment.state === "failed" ? (
<span style={{color: 'red', fontWeight: '700'}}>
Failed
</span>
) : null
)
)
);
+1 -7
View File
@@ -21,13 +21,7 @@ const StateLabel = ({ commentIndex, className }) => {
null
) : (
stateString === undefined && !isLoading && comment.cid === undefined ? (
<span className="ttl">
<br />
(
<span className={className}>
</span>
)
</span>
null
) : (
<span className="ttl">
<br />