fix replymodal in anon mode

This commit is contained in:
plebeius.eth
2023-06-17 21:18:09 +02:00
parent 869d653ce3
commit fd84cbc55e
5 changed files with 2 additions and 27 deletions
-13
View File
@@ -4,13 +4,11 @@ import { StyledModal } from '../styled/modals/ReplyModal.styled';
import useGeneralStore from '../../hooks/stores/useGeneralStore'; import useGeneralStore from '../../hooks/stores/useGeneralStore';
import Modal from 'react-modal'; import Modal from 'react-modal';
import Draggable from 'react-draggable'; import Draggable from 'react-draggable';
import useAnonMode from '../../hooks/useAnonMode';
import useError from '../../hooks/useError'; import useError from '../../hooks/useError';
const ReplyModal = ({ isOpen, closeModal }) => { const ReplyModal = ({ isOpen, closeModal }) => {
const { const {
anonymousMode,
captchaResponse, setCaptchaResponse, captchaResponse, setCaptchaResponse,
setChallengesArray, setChallengesArray,
setIsCaptchaOpen, setIsCaptchaOpen,
@@ -21,7 +19,6 @@ const ReplyModal = ({ isOpen, closeModal }) => {
selectedParentCid, selectedParentCid,
selectedShortCid, selectedShortCid,
selectedStyle, selectedStyle,
selectedThread,
} = useGeneralStore(state => state); } = useGeneralStore(state => state);
const account = useAccount(); const account = useAccount();
@@ -36,9 +33,6 @@ const ReplyModal = ({ isOpen, closeModal }) => {
const [triggerPublishComment, setTriggerPublishComment] = useState(false); const [triggerPublishComment, setTriggerPublishComment] = useState(false);
const [selectedText, setSelectedText] = useState(''); const [selectedText, setSelectedText] = useState('');
const [isMobile, setIsMobile] = useState(window.innerWidth <= 480); const [isMobile, setIsMobile] = useState(window.innerWidth <= 480);
const [executeAnonMode, setExecuteAnonMode] = useState(false);
useAnonMode(selectedThread, anonymousMode && executeAnonMode);
useEffect(() => { useEffect(() => {
@@ -165,13 +159,6 @@ const ReplyModal = ({ isOpen, closeModal }) => {
}; };
useEffect(() => {
if (anonymousMode) {
setExecuteAnonMode(true);
}
}, [anonymousMode, selectedThread]);
useEffect(() => { useEffect(() => {
if (publishCommentOptions && triggerPublishComment) { if (publishCommentOptions && triggerPublishComment) {
(async () => { (async () => {
@@ -206,7 +206,7 @@ export const StyledModal = styled(Modal)`
background-color: currentColor; background-color: currentColor;
position: absolute; position: absolute;
left: 18px; left: 18px;
top: 116px; top: 120px;
} }
.anon-tip::after { .anon-tip::after {
@@ -217,7 +217,7 @@ export const StyledModal = styled(Modal)`
background-color: currentColor; background-color: currentColor;
position: absolute; position: absolute;
left: 18px; left: 18px;
top: 105px; top: 108px;
} }
-4
View File
@@ -669,7 +669,6 @@ const All = () => {
if (e.button === 2) return; if (e.button === 2) return;
e.preventDefault(); e.preventDefault();
setIsReplyOpen(true); setIsReplyOpen(true);
setSelectedThread(thread.cid);
setSelectedShortCid(thread.shortCid); setSelectedShortCid(thread.shortCid);
setSelectedParentCid(thread.cid); setSelectedParentCid(thread.cid);
setSelectedAddress(thread.subplebbitAddress); setSelectedAddress(thread.subplebbitAddress);
@@ -949,7 +948,6 @@ const All = () => {
if (e.button === 2) return; if (e.button === 2) return;
e.preventDefault(); e.preventDefault();
setIsReplyOpen(true); setIsReplyOpen(true);
setSelectedThread(thread.cid);
setSelectedShortCid(reply.shortCid); setSelectedShortCid(reply.shortCid);
setSelectedParentCid(reply.cid); setSelectedParentCid(reply.cid);
setSelectedAddress(thread.subplebbitAddress); setSelectedAddress(thread.subplebbitAddress);
@@ -1383,7 +1381,6 @@ const All = () => {
if (e.button === 2) return; if (e.button === 2) return;
e.preventDefault(); e.preventDefault();
setIsReplyOpen(true); setIsReplyOpen(true);
setSelectedThread(thread.cid);
setSelectedShortCid(thread.shortCid); setSelectedShortCid(thread.shortCid);
setSelectedParentCid(thread.cid); setSelectedParentCid(thread.cid);
setSelectedAddress(thread.subplebbitAddress); setSelectedAddress(thread.subplebbitAddress);
@@ -1556,7 +1553,6 @@ const All = () => {
if (e.button === 2) return; if (e.button === 2) return;
e.preventDefault(); e.preventDefault();
setIsReplyOpen(true); setIsReplyOpen(true);
setSelectedThread(thread.cid);
setSelectedShortCid(reply.shortCid); setSelectedShortCid(reply.shortCid);
setSelectedParentCid(reply.cid); setSelectedParentCid(reply.cid);
setSelectedAddress(thread.subplebbitAddress); setSelectedAddress(thread.subplebbitAddress);
-4
View File
@@ -1115,7 +1115,6 @@ const Board = () => {
onClick={(e) => { onClick={(e) => {
if (e.button === 2) return; if (e.button === 2) return;
e.preventDefault(); e.preventDefault();
setSelectedThread(thread.cid);
setIsReplyOpen(true); setIsReplyOpen(true);
setSelectedShortCid(thread.shortCid); setSelectedShortCid(thread.shortCid);
setSelectedParentCid(thread.cid); setSelectedParentCid(thread.cid);
@@ -1393,7 +1392,6 @@ const Board = () => {
onClick={(e) => { onClick={(e) => {
if (e.button === 2) return; if (e.button === 2) return;
e.preventDefault(); e.preventDefault();
setSelectedThread(thread.cid);
setIsReplyOpen(true); setIsReplyOpen(true);
setSelectedShortCid(reply.shortCid); setSelectedShortCid(reply.shortCid);
setSelectedParentCid(reply.cid); setSelectedParentCid(reply.cid);
@@ -1798,7 +1796,6 @@ const Board = () => {
onClick={(e) => { onClick={(e) => {
if (e.button === 2) return; if (e.button === 2) return;
e.preventDefault(); e.preventDefault();
setSelectedThread(thread.cid);
setIsReplyOpen(true); setIsReplyOpen(true);
setSelectedShortCid(thread.shortCid); setSelectedShortCid(thread.shortCid);
setSelectedParentCid(thread.cid); setSelectedParentCid(thread.cid);
@@ -1949,7 +1946,6 @@ const Board = () => {
onClick={(e) => { onClick={(e) => {
if (e.button === 2) return; if (e.button === 2) return;
e.preventDefault(); e.preventDefault();
setSelectedThread(thread.cid);
setIsReplyOpen(true); setIsReplyOpen(true);
setSelectedShortCid(reply.shortCid); setSelectedShortCid(reply.shortCid);
setSelectedParentCid(reply.cid); setSelectedParentCid(reply.cid);
-4
View File
@@ -679,7 +679,6 @@ const Subscriptions = () => {
if (e.button === 2) return; if (e.button === 2) return;
e.preventDefault(); e.preventDefault();
setIsReplyOpen(true); setIsReplyOpen(true);
setSelectedThread(thread.cid);
setSelectedShortCid(thread.shortCid); setSelectedShortCid(thread.shortCid);
setSelectedParentCid(thread.cid); setSelectedParentCid(thread.cid);
setSelectedAddress(thread.subplebbitAddress); setSelectedAddress(thread.subplebbitAddress);
@@ -959,7 +958,6 @@ const Subscriptions = () => {
if (e.button === 2) return; if (e.button === 2) return;
e.preventDefault(); e.preventDefault();
setIsReplyOpen(true); setIsReplyOpen(true);
setSelectedThread(thread.cid);
setSelectedShortCid(reply.shortCid); setSelectedShortCid(reply.shortCid);
setSelectedParentCid(reply.cid); setSelectedParentCid(reply.cid);
setSelectedAddress(thread.subplebbitAddress); setSelectedAddress(thread.subplebbitAddress);
@@ -1393,7 +1391,6 @@ const Subscriptions = () => {
if (e.button === 2) return; if (e.button === 2) return;
e.preventDefault(); e.preventDefault();
setIsReplyOpen(true); setIsReplyOpen(true);
setSelectedThread(thread.cid);
setSelectedShortCid(thread.shortCid); setSelectedShortCid(thread.shortCid);
setSelectedParentCid(thread.cid); setSelectedParentCid(thread.cid);
setSelectedAddress(thread.subplebbitAddress); setSelectedAddress(thread.subplebbitAddress);
@@ -1566,7 +1563,6 @@ const Subscriptions = () => {
if (e.button === 2) return; if (e.button === 2) return;
e.preventDefault(); e.preventDefault();
setIsReplyOpen(true); setIsReplyOpen(true);
setSelectedThread(thread.cid);
setSelectedShortCid(reply.shortCid); setSelectedShortCid(reply.shortCid);
setSelectedParentCid(reply.cid); setSelectedParentCid(reply.cid);
setSelectedAddress(thread.subplebbitAddress); setSelectedAddress(thread.subplebbitAddress);