diff --git a/src/components/modals/SettingsModal.jsx b/src/components/modals/SettingsModal.jsx index f1590627..62bca6f0 100755 --- a/src/components/modals/SettingsModal.jsx +++ b/src/components/modals/SettingsModal.jsx @@ -1,10 +1,8 @@ import React, { useState, useEffect, useRef } from "react"; import { Link, useLocation, useNavigate } from "react-router-dom"; -import { confirmAlert } from "react-confirm-alert"; import Modal from "react-modal"; import { deleteCaches, exportAccount, importAccount, setAccount, setActiveAccount, useAccount, useAccounts } from "@plebbit/plebbit-react-hooks"; import { StyledModal } from "../styled/modals/SettingsModal.styled"; -import { AuthorDeleteAlert } from '../styled/views/Thread.styled'; import useError from "../../hooks/useError"; import useSuccess from "../../hooks/useSuccess"; import useAnonModeStore from '../../hooks/stores/useAnonModeStore'; @@ -196,38 +194,6 @@ const SettingsModal = ({ isOpen, closeModal }) => { } }; - - const handleAnonymousMode = () => { - confirmAlert({ - customUI: ({ onClose }) => { - return ( - - - - { !anonymousMode ? - "Enabling anonymous mode will turn off all account-based features, such as subscribing to boards." : - "Disabling anonymous mode will turn on all account-based features, such as subscribing to boards." - } - - - Cancel - { - setAnonymousMode(!anonymousMode); - onClose(); - }} - > - { !anonymousMode ? "Enable" : "Disable" } - - - - - ) - } - }) - }; - - return ( { ] - + toggleExpanded(1)} @@ -270,6 +236,22 @@ const SettingsModal = ({ isOpen, closeModal }) => { + + + {setAnonymousMode(!anonymousMode)}} + /> + Anon mode + + + + Automatically uses a different account (u/address) per thread. + Account Data @@ -402,21 +384,6 @@ const SettingsModal = ({ isOpen, closeModal }) => { */} - - - - - Disable anonymous mode - - - { setSelectedTitle, } = useGeneralStore(state => state); - const { anonymousMode } = useAnonModeStore(); const account = useAccount(); const navigate = useNavigate(); @@ -452,12 +450,8 @@ const All = () => { [ All - {anonymousMode ? null : - <> - / - Subscriptions - > - } + / + Subscriptions ] [ {defaultSubplebbits.map((subplebbit, index) => ( @@ -491,7 +485,7 @@ const All = () => { All - {anonymousMode ? null : Subscriptions} + Subscriptions {defaultSubplebbits.map(subplebbit => ( {subplebbit.title ? subplebbit.title : subplebbit.address} @@ -674,7 +668,8 @@ const All = () => { onClick={(e) => { if (e.button === 2) return; e.preventDefault(); - setIsReplyOpen(true); + setIsReplyOpen(true); + setSelectedThread(thread.cid); setSelectedShortCid(thread.shortCid); setSelectedParentCid(thread.cid); setSelectedAddress(thread.subplebbitAddress); @@ -953,7 +948,8 @@ const All = () => { onClick={(e) => { if (e.button === 2) return; e.preventDefault(); - setIsReplyOpen(true); + setIsReplyOpen(true); + setSelectedThread(thread.cid); setSelectedShortCid(reply.shortCid); setSelectedParentCid(reply.cid); setSelectedAddress(thread.subplebbitAddress); @@ -1386,7 +1382,8 @@ const All = () => { onClick={(e) => { if (e.button === 2) return; e.preventDefault(); - setIsReplyOpen(true); + setIsReplyOpen(true); + setSelectedThread(thread.cid); setSelectedShortCid(thread.shortCid); setSelectedParentCid(thread.cid); setSelectedAddress(thread.subplebbitAddress); @@ -1558,7 +1555,8 @@ const All = () => { onClick={(e) => { if (e.button === 2) return; e.preventDefault(); - setIsReplyOpen(true); + setIsReplyOpen(true); + setSelectedThread(thread.cid); setSelectedShortCid(reply.shortCid); setSelectedParentCid(reply.cid); setSelectedAddress(thread.subplebbitAddress); @@ -1851,12 +1849,8 @@ const All = () => { [ All - {anonymousMode ? null : - <> - / - Subscriptions - > - } + / + Subscriptions ] [ {defaultSubplebbits.map((subplebbit, index) => ( diff --git a/src/components/views/AllCatalog.jsx b/src/components/views/AllCatalog.jsx index bb15e305..ec08f7f5 100755 --- a/src/components/views/AllCatalog.jsx +++ b/src/components/views/AllCatalog.jsx @@ -21,7 +21,6 @@ import handleStyleChange from '../../utils/handleStyleChange'; import useError from '../../hooks/useError'; import useFeedStateString from '../../hooks/useFeedStateString'; import useSuccess from '../../hooks/useSuccess'; -import useAnonModeStore from '../../hooks/stores/useAnonModeStore'; import useGeneralStore from '../../hooks/stores/useGeneralStore'; import packageJson from '../../../package.json' const {version} = packageJson @@ -46,7 +45,6 @@ const AllCatalog = () => { setSelectedTitle, } = useGeneralStore(state => state); - const { anonymousMode } = useAnonModeStore(); const threadMenuRefs = useRef({}); const postMenuRef = useRef(null); @@ -340,12 +338,8 @@ const AllCatalog = () => { [ All - {anonymousMode ? null : - <> - / - Subscriptions - > - } + / + Subscriptions ] [ {defaultSubplebbits.map((subplebbit, index) => ( @@ -382,7 +376,7 @@ const AllCatalog = () => { All - {anonymousMode ? null : Subscriptions} + Subscriptions {defaultSubplebbits.map(subplebbit => ( {subplebbit.title ? subplebbit.title : subplebbit.address} @@ -669,12 +663,8 @@ const AllCatalog = () => { [ All - {anonymousMode ? null : - <> - / - Subscriptions - > - } + / + Subscriptions ] [ {defaultSubplebbits.map((subplebbit, index) => ( diff --git a/src/components/views/Board.jsx b/src/components/views/Board.jsx index 292f9c4b..32841ce4 100755 --- a/src/components/views/Board.jsx +++ b/src/components/views/Board.jsx @@ -32,12 +32,10 @@ import handleQuoteClick from '../../utils/handleQuoteClick'; import handleQuoteHover from '../../utils/handleQuoteHover'; import handleStyleChange from '../../utils/handleStyleChange'; import removeHighlight from '../../utils/removeHighlight'; -import useAnonMode from '../../hooks/useAnonMode'; import useClickForm from '../../hooks/useClickForm'; import useError from '../../hooks/useError'; import useStateString from '../../hooks/useStateString'; import useSuccess from '../../hooks/useSuccess'; -import useAnonModeStore from '../../hooks/stores/useAnonModeStore'; import useGeneralStore from '../../hooks/stores/useGeneralStore'; import packageJson from '../../../package.json' const {version} = packageJson @@ -62,13 +60,12 @@ const Board = () => { setSelectedParentCid, setSelectedShortCid, selectedStyle, - selectedThread, setSelectedThread, + setSelectedThread, selectedTitle, setSelectedTitle, showPostForm, showPostFormLink, } = useGeneralStore(state => state); - const { anonymousMode } = useAnonModeStore(); const account = useAccount(); const navigate = useNavigate(); @@ -112,9 +109,6 @@ const Board = () => { const [outOfViewCid, setOutOfViewCid] = useState(null); const [outOfViewPosition, setOutOfViewPosition] = useState({top: 0, left: 0}); const [postOnHoverHeight, setPostOnHoverHeight] = useState(0); - const [executeAnonMode, setExecuteAnonMode] = useState(false); - - useAnonMode(selectedThread, anonymousMode && executeAnonMode); useEffect(() => { @@ -360,13 +354,6 @@ const Board = () => { }; - useEffect(() => { - if (anonymousMode) { - setExecuteAnonMode(true); - } - }, [anonymousMode, selectedThread]); - - useEffect(() => { if (publishCommentOptions && triggerPublishComment) { (async () => { @@ -578,12 +565,8 @@ const Board = () => { [ All - {anonymousMode ? null : - <> / - Subscriptions - > - } + Subscriptions ] [ {defaultSubplebbits.map((subplebbit, index) => ( @@ -617,7 +600,7 @@ const Board = () => { All - {anonymousMode ? null : Subscriptions} + Subscriptions {defaultSubplebbits.map(subplebbit => ( {subplebbit.title ? subplebbit.title : subplebbit.address} @@ -727,24 +710,20 @@ const Board = () => { {feed.length > 0 ? ( <> - {anonymousMode ? null : ( - <> - - [ - - handleSubscribe()}> - {subscribed ? "Unsubscribe" : "Subscribe"} - - - ] - - - handleSubscribe()}> + + [ + + handleSubscribe()}> {subscribed ? "Unsubscribe" : "Subscribe"} - - > - )} + + ] + + + handleSubscribe()}> + {subscribed ? "Unsubscribe" : "Subscribe"} + + > ) : ( @@ -1136,6 +1115,7 @@ const Board = () => { onClick={(e) => { if (e.button === 2) return; e.preventDefault(); + setSelectedThread(thread.cid); setIsReplyOpen(true); setSelectedShortCid(thread.shortCid); setSelectedParentCid(thread.cid); @@ -1413,7 +1393,8 @@ const Board = () => { onClick={(e) => { if (e.button === 2) return; e.preventDefault(); - setIsReplyOpen(true); + setSelectedThread(thread.cid); + setIsReplyOpen(true); setSelectedShortCid(reply.shortCid); setSelectedParentCid(reply.cid); }} title="Reply to this post">{reply.shortCid} @@ -1817,7 +1798,8 @@ const Board = () => { onClick={(e) => { if (e.button === 2) return; e.preventDefault(); - setIsReplyOpen(true); + setSelectedThread(thread.cid); + setIsReplyOpen(true); setSelectedShortCid(thread.shortCid); setSelectedParentCid(thread.cid); }} title="Reply to this post">{thread.shortCid} @@ -1967,7 +1949,8 @@ const Board = () => { onClick={(e) => { if (e.button === 2) return; e.preventDefault(); - setIsReplyOpen(true); + setSelectedThread(thread.cid); + setIsReplyOpen(true); setSelectedShortCid(reply.shortCid); setSelectedParentCid(reply.cid); }} title="Reply to this post">{reply.shortCid} @@ -2259,12 +2242,8 @@ const Board = () => { [ All - {anonymousMode ? null : - <> - / - Subscriptions - > - } + / + Subscriptions ] {defaultSubplebbits.map((subplebbit, index) => ( diff --git a/src/components/views/Catalog.jsx b/src/components/views/Catalog.jsx index 7fded738..51bac62c 100755 --- a/src/components/views/Catalog.jsx +++ b/src/components/views/Catalog.jsx @@ -18,12 +18,10 @@ import OfflineIndicator from '../OfflineIndicator'; import SettingsModal from '../modals/SettingsModal'; import getCommentMediaInfo from '../../utils/getCommentMediaInfo'; import handleStyleChange from '../../utils/handleStyleChange'; -import useAnonMode from '../../hooks/useAnonMode'; import useClickForm from '../../hooks/useClickForm'; import useError from '../../hooks/useError'; import useStateString from '../../hooks/useStateString'; import useSuccess from '../../hooks/useSuccess'; -import useAnonModeStore from '../../hooks/stores/useAnonModeStore'; import useGeneralStore from '../../hooks/stores/useGeneralStore'; import packageJson from '../../../package.json' const {version} = packageJson @@ -46,13 +44,12 @@ const Catalog = () => { setResolveCaptchaPromise, selectedAddress, setSelectedAddress, selectedStyle, - selectedThread, setSelectedThread, + setSelectedThread, selectedTitle, setSelectedTitle, showPostForm, showPostFormLink, } = useGeneralStore(state => state); - const { anonymousMode } = useAnonModeStore(); const nameRef = useRef(); const subjectRef = useRef(); @@ -80,9 +77,6 @@ const Catalog = () => { const [commentCid, setCommentCid] = useState(null); const [menuPosition, setMenuPosition] = useState({top: 0, left: 0}); const [openMenuCid, setOpenMenuCid] = useState(null); - const [executeAnonMode, setExecuteAnonMode] = useState(false); - - useAnonMode(selectedThread, anonymousMode && executeAnonMode); const { feed, hasMore, loadMore } = useFeed({subplebbitAddresses: [`${selectedAddress}`], sortType: 'active'}); const { subplebbitAddress } = useParams(); @@ -281,13 +275,6 @@ const Catalog = () => { }; - useEffect(() => { - if (anonymousMode) { - setExecuteAnonMode(true); - } - }, [anonymousMode, selectedThread]); - - useEffect(() => { if (publishCommentOptions && triggerPublishComment) { (async () => { @@ -475,12 +462,8 @@ const Catalog = () => { [ All - {anonymousMode ? null : - <> - / - Subscriptions - > - } + / + Subscriptions ] [ {defaultSubplebbits.map((subplebbit, index) => ( @@ -517,7 +500,7 @@ const Catalog = () => { All - {anonymousMode ? null : Subscriptions} + Subscriptions {defaultSubplebbits.map(subplebbit => ( {subplebbit.title ? subplebbit.title : subplebbit.address} @@ -629,24 +612,20 @@ const Catalog = () => { {feed.length > 0 ? ( <> - {anonymousMode ? null : ( - <> - - [ - - handleSubscribe()}> - {subscribed ? "Unsubscribe" : "Subscribe"} - - - ] - - - handleSubscribe()}> + + [ + + handleSubscribe()}> {subscribed ? "Unsubscribe" : "Subscribe"} - - > - )} + + ] + + + handleSubscribe()}> + {subscribed ? "Unsubscribe" : "Subscribe"} + + > ) : ( @@ -1064,12 +1043,8 @@ const Catalog = () => { [ All - {anonymousMode ? null : - <> - / - Subscriptions - > - } + / + Subscriptions ] {defaultSubplebbits.map((subplebbit, index) => ( diff --git a/src/components/views/Home.jsx b/src/components/views/Home.jsx index dd301cc5..ebd24ad3 100644 --- a/src/components/views/Home.jsx +++ b/src/components/views/Home.jsx @@ -5,7 +5,6 @@ import { Link, useNavigate } from 'react-router-dom'; import { Container, Header, Logo, Page, Search, About, AboutTitle, AboutContent, Boards, BoardsTitle, BoardsContent, Footer } from '../styled/views/Home.styled'; import BoardAvatar from '../BoardAvatar'; import OfflineIndicator from '../OfflineIndicator'; -import useAnonModeStore from '../../hooks/stores/useAnonModeStore'; import useGeneralStore from '../../hooks/stores/useGeneralStore'; import packageJson from '../../../package.json' import { Tooltip } from 'react-tooltip'; @@ -22,8 +21,6 @@ const Home = () => { selectedStyle, setSelectedStyle, setSelectedTitle } = useGeneralStore(state => state); - - const { anonymousMode } = useAnonModeStore(); const account = useAccount(); const navigate = useNavigate(); @@ -105,7 +102,7 @@ const Home = () => { - {account?.subscriptions?.length > 0 && !anonymousMode ? ( + {account?.subscriptions?.length > 0 ? ( Subscriptions diff --git a/src/components/views/Subscriptions.jsx b/src/components/views/Subscriptions.jsx index 67d8d88a..7c4a2139 100755 --- a/src/components/views/Subscriptions.jsx +++ b/src/components/views/Subscriptions.jsx @@ -678,7 +678,8 @@ const Subscriptions = () => { onClick={(e) => { if (e.button === 2) return; e.preventDefault(); - setIsReplyOpen(true); + setIsReplyOpen(true); + setSelectedThread(thread.cid); setSelectedShortCid(thread.shortCid); setSelectedParentCid(thread.cid); setSelectedAddress(thread.subplebbitAddress); @@ -957,7 +958,8 @@ const Subscriptions = () => { onClick={(e) => { if (e.button === 2) return; e.preventDefault(); - setIsReplyOpen(true); + setIsReplyOpen(true); + setSelectedThread(thread.cid); setSelectedShortCid(reply.shortCid); setSelectedParentCid(reply.cid); setSelectedAddress(thread.subplebbitAddress); @@ -1390,7 +1392,8 @@ const Subscriptions = () => { onClick={(e) => { if (e.button === 2) return; e.preventDefault(); - setIsReplyOpen(true); + setIsReplyOpen(true); + setSelectedThread(thread.cid); setSelectedShortCid(thread.shortCid); setSelectedParentCid(thread.cid); setSelectedAddress(thread.subplebbitAddress); @@ -1562,7 +1565,8 @@ const Subscriptions = () => { onClick={(e) => { if (e.button === 2) return; e.preventDefault(); - setIsReplyOpen(true); + setIsReplyOpen(true); + setSelectedThread(thread.cid); setSelectedShortCid(reply.shortCid); setSelectedParentCid(reply.cid); setSelectedAddress(thread.subplebbitAddress); diff --git a/src/components/views/Thread.jsx b/src/components/views/Thread.jsx index fd6a873a..65e20740 100755 --- a/src/components/views/Thread.jsx +++ b/src/components/views/Thread.jsx @@ -532,12 +532,8 @@ const Thread = () => { [ All - {anonymousMode ? null : - <> - / - Subscriptions - > - } + / + Subscriptions ] [ {defaultSubplebbits.map((subplebbit, index) => ( @@ -574,7 +570,7 @@ const Thread = () => { All - {anonymousMode ? null : Subscriptions} + Subscriptions {defaultSubplebbits.map(subplebbit => ( {subplebbit.title ? subplebbit.title : subplebbit.address} @@ -1833,12 +1829,8 @@ const Thread = () => { [ All - {anonymousMode ? null : - <> - / - Subscriptions - > - } + / + Subscriptions ] {defaultSubplebbits.map((subplebbit, index) => (
- { !anonymousMode ? - "Enabling anonymous mode will turn off all account-based features, such as subscribing to boards." : - "Disabling anonymous mode will turn on all account-based features, such as subscribing to boards." - } -