mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
Update StateLabel.jsx
This commit is contained in:
@@ -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;
|
||||||
Reference in New Issue
Block a user