Update StateLabel.jsx

This commit is contained in:
plebeius.eth
2023-06-08 12:06:43 +02:00
parent 81bc4ffb55
commit 4d99491133
+16 -17
View File
@@ -1,28 +1,27 @@
import React from "react"; import React from "react";
import { useComment } from "@plebbit/plebbit-react-hooks"; import { useAccountComment } from "@plebbit/plebbit-react-hooks";
import useStateString from "../hooks/useStateString"; import useStateString from "../hooks/useStateString";
import useGeneralStore from "../hooks/stores/useGeneralStore";
const StateLabel = ({ commentCid, className }) => { const StateLabel = ({ commentCid, className }) => {
const comment = useComment({commentCid}); const { pendingCommentIndex } = useGeneralStore(state => state);
const comment = useAccountComment({commentIndex: pendingCommentIndex});
const stateString = useStateString(comment); const stateString = useStateString(comment);
return ( return (
comment.state === "succeeded" ? null : ( !commentCid && stateString !== "Succeeded" ? (
comment.state === "initializing" ? null : ( <span className="ttl">
<span className="ttl"> <br />
<> (
<br /> <span className={className}>
( {stateString}
<span className={className}> </span>
{stateString} )
</span> </span>
) ) : null
</> );
</span>
)
)
)
}; };
export default StateLabel; export default StateLabel;