mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
33 lines
673 B
React
33 lines
673 B
React
import React from "react";
|
|
import { useAccountComment } from "@plebbit/plebbit-react-hooks";
|
|
import useStateString from "../hooks/useStateString";
|
|
|
|
const StateLabel = ({ commentIndex, className }) => {
|
|
const comment = useAccountComment({commentIndex: commentIndex});
|
|
const stateString = useStateString(comment);
|
|
|
|
if (comment.updatedAt !== undefined) {
|
|
return null;
|
|
}
|
|
|
|
if (comment.state === "failed") {
|
|
return null;
|
|
}
|
|
|
|
if (!stateString) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<span className="ttl">
|
|
<br />
|
|
(
|
|
<span className={className}>
|
|
{stateString}
|
|
</span>
|
|
)
|
|
</span>
|
|
);
|
|
};
|
|
|
|
export default StateLabel; |