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 { useComment } from "@plebbit/plebbit-react-hooks";
import { useAccountComment } from "@plebbit/plebbit-react-hooks";
import useStateString from "../hooks/useStateString";
import useGeneralStore from "../hooks/stores/useGeneralStore";
const StateLabel = ({ commentCid, className }) => {
const comment = useComment({commentCid});
const { pendingCommentIndex } = useGeneralStore(state => state);
const comment = useAccountComment({commentIndex: pendingCommentIndex});
const stateString = useStateString(comment);
return (
comment.state === "succeeded" ? null : (
comment.state === "initializing" ? null : (
<span className="ttl">
<>
<br />
(
<span className={className}>
{stateString}
</span>
)
</>
</span>
)
)
)
!commentCid && stateString !== "Succeeded" ? (
<span className="ttl">
<br />
(
<span className={className}>
{stateString}
</span>
)
</span>
) : null
);
};
export default StateLabel;