Files
5chan/src/components/PendingLabel.jsx
T

28 lines
689 B
React
Raw Normal View History

2023-06-22 21:59:17 +02:00
import React from "react";
2023-06-15 14:17:33 +02:00
import { useAccountComment } from "@plebbit/plebbit-react-hooks";
const PendingLabel = ({ commentIndex }) => {
const comment = useAccountComment({commentIndex: commentIndex});
if (commentIndex === undefined) return null;
2023-06-15 15:50:13 +02:00
2023-06-15 14:17:33 +02:00
return (
2023-06-15 15:50:13 +02:00
comment.cid ? (
<span>{comment.cid.slice(2, 14)}</span>
) : (
2023-06-22 21:59:17 +02:00
comment.state === "pending" ? (
2023-06-15 14:17:33 +02:00
<span style={{color: 'red', fontWeight: '700'}}>
Pending
</span>
2023-06-22 21:59:17 +02:00
) : (
comment.state === "failed" ? (
<span style={{color: 'red', fontWeight: '700'}}>
Failed
</span>
) : null
2023-06-15 14:17:33 +02:00
)
2023-06-15 15:50:13 +02:00
)
2023-06-15 14:17:33 +02:00
);
};
export default PendingLabel;