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 { 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;
|
||||
Reference in New Issue
Block a user