2023-06-01 17:25:21 +02:00
|
|
|
import React from "react";
|
2023-06-08 12:06:43 +02:00
|
|
|
import { useAccountComment } from "@plebbit/plebbit-react-hooks";
|
2023-06-01 17:24:44 +02:00
|
|
|
import useStateString from "../hooks/useStateString";
|
2023-06-08 12:06:43 +02:00
|
|
|
import useGeneralStore from "../hooks/stores/useGeneralStore";
|
2023-06-01 10:43:17 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
const StateLabel = ({ commentCid, className }) => {
|
2023-06-08 12:06:43 +02:00
|
|
|
const { pendingCommentIndex } = useGeneralStore(state => state);
|
|
|
|
|
|
|
|
|
|
const comment = useAccountComment({commentIndex: pendingCommentIndex});
|
2023-06-01 17:24:44 +02:00
|
|
|
const stateString = useStateString(comment);
|
2023-06-01 10:43:17 +02:00
|
|
|
|
|
|
|
|
return (
|
2023-06-08 12:06:43 +02:00
|
|
|
!commentCid && stateString !== "Succeeded" ? (
|
|
|
|
|
<span className="ttl">
|
|
|
|
|
<br />
|
|
|
|
|
(
|
|
|
|
|
<span className={className}>
|
|
|
|
|
{stateString}
|
|
|
|
|
</span>
|
|
|
|
|
)
|
|
|
|
|
</span>
|
|
|
|
|
) : null
|
|
|
|
|
);
|
2023-06-01 10:43:17 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default StateLabel;
|