{'>>'}
@@ -233,12 +240,16 @@ const ReplyDesktop = ({ reply, roles }: PostProps) => {
{getFormattedDate(timestamp)}
-
+ !cid && e.preventDefault()}>
c/
-
- {shortCid}
-
+ {!cid ? (
+ {state === 'failed' ? 'Failed' : 'Pending'}
+ ) : (
+
+ {shortCid}
+
+ )}
{pinned && (
@@ -308,6 +319,12 @@ const ReplyDesktop = ({ reply, roles }: PostProps) => {
>
)}
+ {!cid && (
+ <>
+
+ {loadingString}
+ >
+ )}
)}
diff --git a/src/hooks/use-reply.ts b/src/hooks/use-reply.ts
new file mode 100644
index 00000000..7d8d52f4
--- /dev/null
+++ b/src/hooks/use-reply.ts
@@ -0,0 +1,115 @@
+import { useMemo } from 'react';
+import { ChallengeVerification, Comment, PublishCommentOptions, usePublishComment } from '@plebbit/plebbit-react-hooks';
+import { create } from 'zustand';
+import useChallengesStore from './use-challenges';
+import { alertChallengeVerificationFailed } from '../lib/utils/challenge-utils';
+
+type SetReplyStoreData = {
+ subplebbitAddress: string;
+ parentCid: string;
+ content: string | undefined;
+ link: string | undefined;
+ spoiler: boolean;
+};
+
+type ReplyState = {
+ content: { [parentCid: string]: string | undefined };
+ link: { [parentCid: string]: string | undefined };
+ spoiler: { [parentCid: string]: boolean | undefined };
+ publishCommentOptions: PublishCommentOptions;
+ setReplyStore: (data: SetReplyStoreData) => void;
+ resetReplyStore: (parentCid: string) => void;
+};
+
+const { addChallenge } = useChallengesStore.getState();
+
+const useReplyStore = create