From 4d99491133c8ecc2363f6e6222d27b8eaf5a88a1 Mon Sep 17 00:00:00 2001 From: "plebeius.eth" Date: Thu, 8 Jun 2023 12:06:43 +0200 Subject: [PATCH] Update StateLabel.jsx --- src/components/StateLabel.jsx | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/components/StateLabel.jsx b/src/components/StateLabel.jsx index 079e28a0..86a73fb9 100644 --- a/src/components/StateLabel.jsx +++ b/src/components/StateLabel.jsx @@ -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 : ( - - <> -
- ( - - {stateString} - - ) - -
- ) - ) - ) + !commentCid && stateString !== "Succeeded" ? ( + +
+ ( + + {stateString} + + ) +
+ ) : null + ); }; export default StateLabel; \ No newline at end of file