mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
add setPendingCommentIndex
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
REACT_APP_PLEBBIT_REACT_HOOKS_MOCK_CONTENT=1
|
||||
REACT_APP_PLEBBIT_REACT_HOOKS_MOCK_CONTENT_LOADING_TIME=1000
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
"@babel/core": "^7.21.3",
|
||||
"@babel/plugin-syntax-flow": "^7.18.6",
|
||||
"@babel/plugin-transform-react-jsx": "^7.21.0",
|
||||
"@plebbit/plebbit-react-hooks": "https://github.com/plebbit/plebbit-react-hooks.git#604eab550a9c480cee42bf414581c624ec316f27",
|
||||
"@plebbit/plebbit-react-hooks": "https://github.com/plebbit/plebbit-react-hooks.git#97b538693972e26f7c0f0f13ec6afab03b0e2e57",
|
||||
"@testing-library/dom": "^9.0.1",
|
||||
"@testing-library/jest-dom": "^5.14.1",
|
||||
"@testing-library/react": "^14.0.0",
|
||||
|
||||
@@ -39,7 +39,6 @@ const CaptchaModal = () => {
|
||||
|
||||
const handleKeyDown = (event) => {
|
||||
if (event.key === "Enter") {
|
||||
event.preventDefault();
|
||||
submitCaptcha();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import React, { useRef, useState, useEffect } from 'react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { usePublishComment } from '@plebbit/plebbit-react-hooks';
|
||||
import { StyledModal } from './styled/ReplyModal.styled';
|
||||
import useGeneralStore from '../hooks/stores/useGeneralStore';
|
||||
@@ -13,6 +14,7 @@ const ReplyModal = ({ isOpen, closeModal }) => {
|
||||
setChallengesArray,
|
||||
setIsCaptchaOpen,
|
||||
setPendingComment,
|
||||
setPendingCommentIndex,
|
||||
setResolveCaptchaPromise,
|
||||
selectedAddress,
|
||||
selectedParentCid,
|
||||
@@ -29,6 +31,7 @@ const ReplyModal = ({ isOpen, closeModal }) => {
|
||||
const [errorMessage, setErrorMessage] = useState(null);
|
||||
useError(errorMessage, [errorMessage]);
|
||||
|
||||
const location = useLocation();
|
||||
|
||||
const onChallengeVerification = (challengeVerification) => {
|
||||
if (challengeVerification.challengeSuccess === true) {
|
||||
@@ -74,7 +77,13 @@ const ReplyModal = ({ isOpen, closeModal }) => {
|
||||
});
|
||||
|
||||
|
||||
const { publishComment } = usePublishComment(publishCommentOptions);
|
||||
const { publishComment, index } = usePublishComment(publishCommentOptions);
|
||||
|
||||
useEffect(() => {
|
||||
if (index !== undefined) {
|
||||
setPendingCommentIndex(index);
|
||||
}
|
||||
}, [index, location]);
|
||||
|
||||
|
||||
const resetFields = () => {
|
||||
|
||||
@@ -32,6 +32,7 @@ const Board = () => {
|
||||
setIsCaptchaOpen,
|
||||
isSettingsOpen, setIsSettingsOpen,
|
||||
setPendingComment,
|
||||
setPendingCommentIndex,
|
||||
setResolveCaptchaPromise,
|
||||
selectedAddress, setSelectedAddress,
|
||||
setSelectedParentCid,
|
||||
@@ -145,6 +146,7 @@ const Board = () => {
|
||||
|
||||
useEffect(() => {
|
||||
if (index !== undefined) {
|
||||
setPendingCommentIndex(index);
|
||||
navigate(`/profile/c/${index}`);
|
||||
}
|
||||
}, [index]);
|
||||
|
||||
@@ -25,6 +25,7 @@ const Catalog = () => {
|
||||
setIsCaptchaOpen,
|
||||
isSettingsOpen, setIsSettingsOpen,
|
||||
setPendingComment,
|
||||
setPendingCommentIndex,
|
||||
setResolveCaptchaPromise,
|
||||
selectedAddress, setSelectedAddress,
|
||||
selectedStyle,
|
||||
@@ -127,6 +128,7 @@ const Catalog = () => {
|
||||
|
||||
useEffect(() => {
|
||||
if (index !== undefined) {
|
||||
setPendingCommentIndex(index);
|
||||
navigate(`/profile/c/${index}`);
|
||||
}
|
||||
}, [index]);
|
||||
|
||||
@@ -33,6 +33,7 @@ const Thread = () => {
|
||||
isSettingsOpen, setIsSettingsOpen,
|
||||
setResolveCaptchaPromise,
|
||||
pendingComment, setPendingComment,
|
||||
setPendingCommentIndex,
|
||||
selectedAddress, setSelectedAddress,
|
||||
setSelectedParentCid,
|
||||
setSelectedShortCid,
|
||||
@@ -137,7 +138,7 @@ const Thread = () => {
|
||||
|
||||
useEffect(() => {
|
||||
if (index !== undefined) {
|
||||
window.scrollTo(0, document.body.scrollHeight);
|
||||
setPendingCommentIndex(index);
|
||||
}
|
||||
}, [index]);
|
||||
|
||||
@@ -151,6 +152,10 @@ const Thread = () => {
|
||||
|
||||
const handleSubmit = async (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
setTimeout(() => {
|
||||
window.scrollTo(0, document.body.scrollHeight);
|
||||
}, 100)
|
||||
|
||||
setPublishCommentOptions((prevPublishCommentOptions) => ({
|
||||
...prevPublishCommentOptions,
|
||||
|
||||
@@ -29,6 +29,9 @@ const useGeneralStore = create((set) => ({
|
||||
pendingComment: '',
|
||||
setPendingComment: (comment) => set({ pendingComment: comment }),
|
||||
|
||||
pendingCommentIndex: null,
|
||||
setPendingCommentIndex: (index) => set({ pendingCommentIndex: index }),
|
||||
|
||||
publishedComment: '',
|
||||
setPublishedComment: (comment) => set({ publishedComment: comment }),
|
||||
|
||||
|
||||
@@ -2487,6 +2487,21 @@
|
||||
uuid "8.3.2"
|
||||
zustand "4.0.0"
|
||||
|
||||
"@plebbit/plebbit-react-hooks@https://github.com/plebbit/plebbit-react-hooks.git#97b538693972e26f7c0f0f13ec6afab03b0e2e57":
|
||||
version "0.0.1"
|
||||
resolved "https://github.com/plebbit/plebbit-react-hooks.git#97b538693972e26f7c0f0f13ec6afab03b0e2e57"
|
||||
dependencies:
|
||||
"@plebbit/plebbit-js" "https://github.com/plebbit/plebbit-js.git#b3272c08bd3861322b7a5eef48992e1b73640098"
|
||||
"@plebbit/plebbit-logger" "https://github.com/plebbit/plebbit-logger.git"
|
||||
assert "2.0.0"
|
||||
ethers "5.6.9"
|
||||
localforage "1.10.0"
|
||||
lodash.isequal "4.5.0"
|
||||
memoizee "0.4.15"
|
||||
quick-lru "5.1.1"
|
||||
uuid "8.3.2"
|
||||
zustand "4.0.0"
|
||||
|
||||
"@pmmmwh/react-refresh-webpack-plugin@^0.5.3":
|
||||
version "0.5.10"
|
||||
resolved "https://registry.yarnpkg.com/@pmmmwh/react-refresh-webpack-plugin/-/react-refresh-webpack-plugin-0.5.10.tgz#2eba163b8e7dbabb4ce3609ab5e32ab63dda3ef8"
|
||||
|
||||
Reference in New Issue
Block a user