mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
update anon mode
This commit is contained in:
@@ -1,10 +1,8 @@
|
|||||||
import React, { useState, useEffect, useRef } from "react";
|
import React, { useState, useEffect, useRef } from "react";
|
||||||
import { Link, useLocation, useNavigate } from "react-router-dom";
|
import { Link, useLocation, useNavigate } from "react-router-dom";
|
||||||
import { confirmAlert } from "react-confirm-alert";
|
|
||||||
import Modal from "react-modal";
|
import Modal from "react-modal";
|
||||||
import { deleteCaches, exportAccount, importAccount, setAccount, setActiveAccount, useAccount, useAccounts } from "@plebbit/plebbit-react-hooks";
|
import { deleteCaches, exportAccount, importAccount, setAccount, setActiveAccount, useAccount, useAccounts } from "@plebbit/plebbit-react-hooks";
|
||||||
import { StyledModal } from "../styled/modals/SettingsModal.styled";
|
import { StyledModal } from "../styled/modals/SettingsModal.styled";
|
||||||
import { AuthorDeleteAlert } from '../styled/views/Thread.styled';
|
|
||||||
import useError from "../../hooks/useError";
|
import useError from "../../hooks/useError";
|
||||||
import useSuccess from "../../hooks/useSuccess";
|
import useSuccess from "../../hooks/useSuccess";
|
||||||
import useAnonModeStore from '../../hooks/stores/useAnonModeStore';
|
import useAnonModeStore from '../../hooks/stores/useAnonModeStore';
|
||||||
@@ -197,38 +195,6 @@ const SettingsModal = ({ isOpen, closeModal }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const handleAnonymousMode = () => {
|
|
||||||
confirmAlert({
|
|
||||||
customUI: ({ onClose }) => {
|
|
||||||
return (
|
|
||||||
<AuthorDeleteAlert selectedStyle={selectedStyle}>
|
|
||||||
<div className='author-delete-alert'>
|
|
||||||
<p>
|
|
||||||
{ !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."
|
|
||||||
}
|
|
||||||
</p>
|
|
||||||
<div className="author-delete-buttons">
|
|
||||||
<button onClick={onClose}>Cancel</button>
|
|
||||||
<button
|
|
||||||
onClick={() => {
|
|
||||||
setAnonymousMode(!anonymousMode);
|
|
||||||
onClose();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{ !anonymousMode ? "Enable" : "Disable" }
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</AuthorDeleteAlert>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledModal
|
<StyledModal
|
||||||
isOpen={isOpen}
|
isOpen={isOpen}
|
||||||
@@ -256,7 +222,7 @@ const SettingsModal = ({ isOpen, closeModal }) => {
|
|||||||
</button>
|
</button>
|
||||||
]
|
]
|
||||||
</div>
|
</div>
|
||||||
<ul style={{display: anonymousMode ? "none" : "block"}}>
|
<ul>
|
||||||
<li className="settings-cat-lbl">
|
<li className="settings-cat-lbl">
|
||||||
<span className={`${expanded.includes(1) ? 'minus' : 'plus'}`}
|
<span className={`${expanded.includes(1) ? 'minus' : 'plus'}`}
|
||||||
onClick={() => toggleExpanded(1)}
|
onClick={() => toggleExpanded(1)}
|
||||||
@@ -270,6 +236,22 @@ const SettingsModal = ({ isOpen, closeModal }) => {
|
|||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<ul className="settings-cat" style={{ display: expanded.includes(1) ? 'block' : 'none' }}>
|
<ul className="settings-cat" style={{ display: expanded.includes(1) ? 'block' : 'none' }}>
|
||||||
|
<li className="anon-off">
|
||||||
|
<label title={ !anonymousMode ?
|
||||||
|
"Enable anon mode" :
|
||||||
|
"Disable anon mode"
|
||||||
|
}>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
checked={anonymousMode}
|
||||||
|
onChange={() => {setAnonymousMode(!anonymousMode)}}
|
||||||
|
/>
|
||||||
|
Anon mode
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
<li className="settings-tip anon-tip">
|
||||||
|
Automatically uses a different account (u/address) per thread.
|
||||||
|
</li>
|
||||||
<li className="settings-option disc">
|
<li className="settings-option disc">
|
||||||
Account Data
|
Account Data
|
||||||
</li>
|
</li>
|
||||||
@@ -402,21 +384,6 @@ const SettingsModal = ({ isOpen, closeModal }) => {
|
|||||||
</ul>
|
</ul>
|
||||||
</ul> */}
|
</ul> */}
|
||||||
</ul>
|
</ul>
|
||||||
<ul>
|
|
||||||
<li className="anon-off">
|
|
||||||
<label title={ !anonymousMode ?
|
|
||||||
"Enable anonymous mode (turns off all account-based features)" :
|
|
||||||
"Disable anonymous mode (turns on all account-based features)"
|
|
||||||
}>
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
checked={!anonymousMode}
|
|
||||||
onChange={handleAnonymousMode}
|
|
||||||
/>
|
|
||||||
Disable anonymous mode
|
|
||||||
</label>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<div>
|
<div>
|
||||||
<button
|
<button
|
||||||
className="cache-button"
|
className="cache-button"
|
||||||
|
|||||||
@@ -191,8 +191,33 @@ export const StyledModal = styled(Modal)`
|
|||||||
}
|
}
|
||||||
|
|
||||||
.anon-off {
|
.anon-off {
|
||||||
padding-left: 3px;
|
margin: 10px 0 5px -2px
|
||||||
padding-top: 15px;
|
}
|
||||||
|
|
||||||
|
.anon-tip {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.anon-tip::before {
|
||||||
|
content: '';
|
||||||
|
display: block;
|
||||||
|
width: 10px;
|
||||||
|
height: 1px;
|
||||||
|
background-color: currentColor;
|
||||||
|
position: absolute;
|
||||||
|
left: 18px;
|
||||||
|
top: 116px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.anon-tip::after {
|
||||||
|
content: '';
|
||||||
|
display: block;
|
||||||
|
width: 1px;
|
||||||
|
height: 12px;
|
||||||
|
background-color: currentColor;
|
||||||
|
position: absolute;
|
||||||
|
left: 18px;
|
||||||
|
top: 105px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ import removeHighlight from '../../utils/removeHighlight';
|
|||||||
import useError from '../../hooks/useError';
|
import useError from '../../hooks/useError';
|
||||||
import useFeedStateString from '../../hooks/useFeedStateString';
|
import useFeedStateString from '../../hooks/useFeedStateString';
|
||||||
import useSuccess from '../../hooks/useSuccess';
|
import useSuccess from '../../hooks/useSuccess';
|
||||||
import useAnonModeStore from '../../hooks/stores/useAnonModeStore';
|
|
||||||
import useGeneralStore from '../../hooks/stores/useGeneralStore';
|
import useGeneralStore from '../../hooks/stores/useGeneralStore';
|
||||||
import packageJson from '../../../package.json'
|
import packageJson from '../../../package.json'
|
||||||
const {version} = packageJson
|
const {version} = packageJson
|
||||||
@@ -63,7 +62,6 @@ const All = () => {
|
|||||||
setSelectedTitle,
|
setSelectedTitle,
|
||||||
} = useGeneralStore(state => state);
|
} = useGeneralStore(state => state);
|
||||||
|
|
||||||
const { anonymousMode } = useAnonModeStore();
|
|
||||||
|
|
||||||
const account = useAccount();
|
const account = useAccount();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -452,12 +450,8 @@ const All = () => {
|
|||||||
<span className="boardList">
|
<span className="boardList">
|
||||||
[
|
[
|
||||||
<Link to={`/p/all`}>All</Link>
|
<Link to={`/p/all`}>All</Link>
|
||||||
{anonymousMode ? null :
|
|
||||||
<>
|
|
||||||
/
|
/
|
||||||
<Link to={`/p/subscriptions`}>Subscriptions</Link>
|
<Link to={`/p/subscriptions`}>Subscriptions</Link>
|
||||||
</>
|
|
||||||
}
|
|
||||||
] [
|
] [
|
||||||
{defaultSubplebbits.map((subplebbit, index) => (
|
{defaultSubplebbits.map((subplebbit, index) => (
|
||||||
<span className="boardList" key={`span-${subplebbit.address}`}>
|
<span className="boardList" key={`span-${subplebbit.address}`}>
|
||||||
@@ -491,7 +485,7 @@ const All = () => {
|
|||||||
|
|
||||||
<select id="board-select-mobile" value="all" onChange={handleSelectChange}>
|
<select id="board-select-mobile" value="all" onChange={handleSelectChange}>
|
||||||
<option value="all">All</option>
|
<option value="all">All</option>
|
||||||
{anonymousMode ? null : <option value="subscriptions">Subscriptions</option>}
|
<option value="subscriptions">Subscriptions</option>
|
||||||
{defaultSubplebbits.map(subplebbit => (
|
{defaultSubplebbits.map(subplebbit => (
|
||||||
<option key={`option-${subplebbit.address}`} value={subplebbit.address}
|
<option key={`option-${subplebbit.address}`} value={subplebbit.address}
|
||||||
>{subplebbit.title ? subplebbit.title : subplebbit.address}</option>
|
>{subplebbit.title ? subplebbit.title : subplebbit.address}</option>
|
||||||
@@ -675,6 +669,7 @@ 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);
|
||||||
@@ -954,6 +949,7 @@ 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);
|
||||||
@@ -1387,6 +1383,7 @@ 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);
|
||||||
@@ -1559,6 +1556,7 @@ 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);
|
||||||
@@ -1851,12 +1849,8 @@ const All = () => {
|
|||||||
<span className="boardList">
|
<span className="boardList">
|
||||||
[
|
[
|
||||||
<Link to={`/p/all`}>All</Link>
|
<Link to={`/p/all`}>All</Link>
|
||||||
{anonymousMode ? null :
|
|
||||||
<>
|
|
||||||
/
|
/
|
||||||
<Link to={`/p/subscriptions`}>Subscriptions</Link>
|
<Link to={`/p/subscriptions`}>Subscriptions</Link>
|
||||||
</>
|
|
||||||
}
|
|
||||||
] [
|
] [
|
||||||
</span>
|
</span>
|
||||||
{defaultSubplebbits.map((subplebbit, index) => (
|
{defaultSubplebbits.map((subplebbit, index) => (
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import handleStyleChange from '../../utils/handleStyleChange';
|
|||||||
import useError from '../../hooks/useError';
|
import useError from '../../hooks/useError';
|
||||||
import useFeedStateString from '../../hooks/useFeedStateString';
|
import useFeedStateString from '../../hooks/useFeedStateString';
|
||||||
import useSuccess from '../../hooks/useSuccess';
|
import useSuccess from '../../hooks/useSuccess';
|
||||||
import useAnonModeStore from '../../hooks/stores/useAnonModeStore';
|
|
||||||
import useGeneralStore from '../../hooks/stores/useGeneralStore';
|
import useGeneralStore from '../../hooks/stores/useGeneralStore';
|
||||||
import packageJson from '../../../package.json'
|
import packageJson from '../../../package.json'
|
||||||
const {version} = packageJson
|
const {version} = packageJson
|
||||||
@@ -46,7 +45,6 @@ const AllCatalog = () => {
|
|||||||
setSelectedTitle,
|
setSelectedTitle,
|
||||||
} = useGeneralStore(state => state);
|
} = useGeneralStore(state => state);
|
||||||
|
|
||||||
const { anonymousMode } = useAnonModeStore();
|
|
||||||
|
|
||||||
const threadMenuRefs = useRef({});
|
const threadMenuRefs = useRef({});
|
||||||
const postMenuRef = useRef(null);
|
const postMenuRef = useRef(null);
|
||||||
@@ -340,12 +338,8 @@ const AllCatalog = () => {
|
|||||||
<span className="boardList">
|
<span className="boardList">
|
||||||
[
|
[
|
||||||
<Link to={`/p/all`}>All</Link>
|
<Link to={`/p/all`}>All</Link>
|
||||||
{anonymousMode ? null :
|
|
||||||
<>
|
|
||||||
/
|
/
|
||||||
<Link to={`/p/subscriptions`}>Subscriptions</Link>
|
<Link to={`/p/subscriptions`}>Subscriptions</Link>
|
||||||
</>
|
|
||||||
}
|
|
||||||
] [
|
] [
|
||||||
{defaultSubplebbits.map((subplebbit, index) => (
|
{defaultSubplebbits.map((subplebbit, index) => (
|
||||||
<span className="boardList" key={`span-${subplebbit.address}`}>
|
<span className="boardList" key={`span-${subplebbit.address}`}>
|
||||||
@@ -382,7 +376,7 @@ const AllCatalog = () => {
|
|||||||
|
|
||||||
<select id="board-select-mobile" value="all" onChange={handleSelectChange}>
|
<select id="board-select-mobile" value="all" onChange={handleSelectChange}>
|
||||||
<option value="all">All</option>
|
<option value="all">All</option>
|
||||||
{anonymousMode ? null : <option value="subscriptions">Subscriptions</option>}
|
<option value="subscriptions">Subscriptions</option>
|
||||||
{defaultSubplebbits.map(subplebbit => (
|
{defaultSubplebbits.map(subplebbit => (
|
||||||
<option key={`option-${subplebbit.address}`} value={subplebbit.address}
|
<option key={`option-${subplebbit.address}`} value={subplebbit.address}
|
||||||
>{subplebbit.title ? subplebbit.title : subplebbit.address}</option>
|
>{subplebbit.title ? subplebbit.title : subplebbit.address}</option>
|
||||||
@@ -669,12 +663,8 @@ const AllCatalog = () => {
|
|||||||
<span className="boardList">
|
<span className="boardList">
|
||||||
[
|
[
|
||||||
<Link to={`/p/all`}>All</Link>
|
<Link to={`/p/all`}>All</Link>
|
||||||
{anonymousMode ? null :
|
|
||||||
<>
|
|
||||||
/
|
/
|
||||||
<Link to={`/p/subscriptions`}>Subscriptions</Link>
|
<Link to={`/p/subscriptions`}>Subscriptions</Link>
|
||||||
</>
|
|
||||||
}
|
|
||||||
] [
|
] [
|
||||||
{defaultSubplebbits.map((subplebbit, index) => (
|
{defaultSubplebbits.map((subplebbit, index) => (
|
||||||
<span className="boardList" key={`span-${subplebbit.address}`}>
|
<span className="boardList" key={`span-${subplebbit.address}`}>
|
||||||
|
|||||||
@@ -32,12 +32,10 @@ import handleQuoteClick from '../../utils/handleQuoteClick';
|
|||||||
import handleQuoteHover from '../../utils/handleQuoteHover';
|
import handleQuoteHover from '../../utils/handleQuoteHover';
|
||||||
import handleStyleChange from '../../utils/handleStyleChange';
|
import handleStyleChange from '../../utils/handleStyleChange';
|
||||||
import removeHighlight from '../../utils/removeHighlight';
|
import removeHighlight from '../../utils/removeHighlight';
|
||||||
import useAnonMode from '../../hooks/useAnonMode';
|
|
||||||
import useClickForm from '../../hooks/useClickForm';
|
import useClickForm from '../../hooks/useClickForm';
|
||||||
import useError from '../../hooks/useError';
|
import useError from '../../hooks/useError';
|
||||||
import useStateString from '../../hooks/useStateString';
|
import useStateString from '../../hooks/useStateString';
|
||||||
import useSuccess from '../../hooks/useSuccess';
|
import useSuccess from '../../hooks/useSuccess';
|
||||||
import useAnonModeStore from '../../hooks/stores/useAnonModeStore';
|
|
||||||
import useGeneralStore from '../../hooks/stores/useGeneralStore';
|
import useGeneralStore from '../../hooks/stores/useGeneralStore';
|
||||||
import packageJson from '../../../package.json'
|
import packageJson from '../../../package.json'
|
||||||
const {version} = packageJson
|
const {version} = packageJson
|
||||||
@@ -62,13 +60,12 @@ const Board = () => {
|
|||||||
setSelectedParentCid,
|
setSelectedParentCid,
|
||||||
setSelectedShortCid,
|
setSelectedShortCid,
|
||||||
selectedStyle,
|
selectedStyle,
|
||||||
selectedThread, setSelectedThread,
|
setSelectedThread,
|
||||||
selectedTitle, setSelectedTitle,
|
selectedTitle, setSelectedTitle,
|
||||||
showPostForm,
|
showPostForm,
|
||||||
showPostFormLink,
|
showPostFormLink,
|
||||||
} = useGeneralStore(state => state);
|
} = useGeneralStore(state => state);
|
||||||
|
|
||||||
const { anonymousMode } = useAnonModeStore();
|
|
||||||
|
|
||||||
const account = useAccount();
|
const account = useAccount();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -112,9 +109,6 @@ const Board = () => {
|
|||||||
const [outOfViewCid, setOutOfViewCid] = useState(null);
|
const [outOfViewCid, setOutOfViewCid] = useState(null);
|
||||||
const [outOfViewPosition, setOutOfViewPosition] = useState({top: 0, left: 0});
|
const [outOfViewPosition, setOutOfViewPosition] = useState({top: 0, left: 0});
|
||||||
const [postOnHoverHeight, setPostOnHoverHeight] = useState(0);
|
const [postOnHoverHeight, setPostOnHoverHeight] = useState(0);
|
||||||
const [executeAnonMode, setExecuteAnonMode] = useState(false);
|
|
||||||
|
|
||||||
useAnonMode(selectedThread, anonymousMode && executeAnonMode);
|
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -360,13 +354,6 @@ const Board = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (anonymousMode) {
|
|
||||||
setExecuteAnonMode(true);
|
|
||||||
}
|
|
||||||
}, [anonymousMode, selectedThread]);
|
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (publishCommentOptions && triggerPublishComment) {
|
if (publishCommentOptions && triggerPublishComment) {
|
||||||
(async () => {
|
(async () => {
|
||||||
@@ -578,12 +565,8 @@ const Board = () => {
|
|||||||
<span className="boardList">
|
<span className="boardList">
|
||||||
[
|
[
|
||||||
<Link to={`/p/all`}>All</Link>
|
<Link to={`/p/all`}>All</Link>
|
||||||
{anonymousMode ? null :
|
|
||||||
<>
|
|
||||||
/
|
/
|
||||||
<Link to={`/p/subscriptions`}>Subscriptions</Link>
|
<Link to={`/p/subscriptions`}>Subscriptions</Link>
|
||||||
</>
|
|
||||||
}
|
|
||||||
] [
|
] [
|
||||||
{defaultSubplebbits.map((subplebbit, index) => (
|
{defaultSubplebbits.map((subplebbit, index) => (
|
||||||
<span className="boardList" key={`span-${subplebbit.address}`}>
|
<span className="boardList" key={`span-${subplebbit.address}`}>
|
||||||
@@ -617,7 +600,7 @@ const Board = () => {
|
|||||||
|
|
||||||
<select id="board-select-mobile" value={selectedAddress} onChange={handleSelectChange}>
|
<select id="board-select-mobile" value={selectedAddress} onChange={handleSelectChange}>
|
||||||
<option value="all">All</option>
|
<option value="all">All</option>
|
||||||
{anonymousMode ? null : <option value="subscriptions">Subscriptions</option>}
|
<option value="subscriptions">Subscriptions</option>
|
||||||
{defaultSubplebbits.map(subplebbit => (
|
{defaultSubplebbits.map(subplebbit => (
|
||||||
<option key={`option-${subplebbit.address}`} value={subplebbit.address}
|
<option key={`option-${subplebbit.address}`} value={subplebbit.address}
|
||||||
>{subplebbit.title ? subplebbit.title : subplebbit.address}</option>
|
>{subplebbit.title ? subplebbit.title : subplebbit.address}</option>
|
||||||
@@ -726,8 +709,6 @@ const Board = () => {
|
|||||||
]
|
]
|
||||||
</div>
|
</div>
|
||||||
{feed.length > 0 ? (
|
{feed.length > 0 ? (
|
||||||
<>
|
|
||||||
{anonymousMode ? null : (
|
|
||||||
<>
|
<>
|
||||||
<span className="subscribe-button-desktop">
|
<span className="subscribe-button-desktop">
|
||||||
[
|
[
|
||||||
@@ -744,8 +725,6 @@ const Board = () => {
|
|||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</>
|
</>
|
||||||
)}
|
|
||||||
</>
|
|
||||||
) : (
|
) : (
|
||||||
<div id="stats" style={{float: "right", marginTop: "5px"}}>
|
<div id="stats" style={{float: "right", marginTop: "5px"}}>
|
||||||
<span className={stateString ? "ellipsis" : ""}>{stateString}</span>
|
<span className={stateString ? "ellipsis" : ""}>{stateString}</span>
|
||||||
@@ -1136,6 +1115,7 @@ 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);
|
||||||
@@ -1413,6 +1393,7 @@ 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);
|
||||||
@@ -1817,6 +1798,7 @@ 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);
|
||||||
@@ -1967,6 +1949,7 @@ 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);
|
||||||
@@ -2259,12 +2242,8 @@ const Board = () => {
|
|||||||
<span className="boardList">
|
<span className="boardList">
|
||||||
[
|
[
|
||||||
<Link to={`/p/all`}>All</Link>
|
<Link to={`/p/all`}>All</Link>
|
||||||
{anonymousMode ? null :
|
|
||||||
<>
|
|
||||||
/
|
/
|
||||||
<Link to={`/p/subscriptions`}>Subscriptions</Link>
|
<Link to={`/p/subscriptions`}>Subscriptions</Link>
|
||||||
</>
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
</span>
|
</span>
|
||||||
{defaultSubplebbits.map((subplebbit, index) => (
|
{defaultSubplebbits.map((subplebbit, index) => (
|
||||||
|
|||||||
@@ -18,12 +18,10 @@ import OfflineIndicator from '../OfflineIndicator';
|
|||||||
import SettingsModal from '../modals/SettingsModal';
|
import SettingsModal from '../modals/SettingsModal';
|
||||||
import getCommentMediaInfo from '../../utils/getCommentMediaInfo';
|
import getCommentMediaInfo from '../../utils/getCommentMediaInfo';
|
||||||
import handleStyleChange from '../../utils/handleStyleChange';
|
import handleStyleChange from '../../utils/handleStyleChange';
|
||||||
import useAnonMode from '../../hooks/useAnonMode';
|
|
||||||
import useClickForm from '../../hooks/useClickForm';
|
import useClickForm from '../../hooks/useClickForm';
|
||||||
import useError from '../../hooks/useError';
|
import useError from '../../hooks/useError';
|
||||||
import useStateString from '../../hooks/useStateString';
|
import useStateString from '../../hooks/useStateString';
|
||||||
import useSuccess from '../../hooks/useSuccess';
|
import useSuccess from '../../hooks/useSuccess';
|
||||||
import useAnonModeStore from '../../hooks/stores/useAnonModeStore';
|
|
||||||
import useGeneralStore from '../../hooks/stores/useGeneralStore';
|
import useGeneralStore from '../../hooks/stores/useGeneralStore';
|
||||||
import packageJson from '../../../package.json'
|
import packageJson from '../../../package.json'
|
||||||
const {version} = packageJson
|
const {version} = packageJson
|
||||||
@@ -46,13 +44,12 @@ const Catalog = () => {
|
|||||||
setResolveCaptchaPromise,
|
setResolveCaptchaPromise,
|
||||||
selectedAddress, setSelectedAddress,
|
selectedAddress, setSelectedAddress,
|
||||||
selectedStyle,
|
selectedStyle,
|
||||||
selectedThread, setSelectedThread,
|
setSelectedThread,
|
||||||
selectedTitle, setSelectedTitle,
|
selectedTitle, setSelectedTitle,
|
||||||
showPostForm,
|
showPostForm,
|
||||||
showPostFormLink,
|
showPostFormLink,
|
||||||
} = useGeneralStore(state => state);
|
} = useGeneralStore(state => state);
|
||||||
|
|
||||||
const { anonymousMode } = useAnonModeStore();
|
|
||||||
|
|
||||||
const nameRef = useRef();
|
const nameRef = useRef();
|
||||||
const subjectRef = useRef();
|
const subjectRef = useRef();
|
||||||
@@ -80,9 +77,6 @@ const Catalog = () => {
|
|||||||
const [commentCid, setCommentCid] = useState(null);
|
const [commentCid, setCommentCid] = useState(null);
|
||||||
const [menuPosition, setMenuPosition] = useState({top: 0, left: 0});
|
const [menuPosition, setMenuPosition] = useState({top: 0, left: 0});
|
||||||
const [openMenuCid, setOpenMenuCid] = useState(null);
|
const [openMenuCid, setOpenMenuCid] = useState(null);
|
||||||
const [executeAnonMode, setExecuteAnonMode] = useState(false);
|
|
||||||
|
|
||||||
useAnonMode(selectedThread, anonymousMode && executeAnonMode);
|
|
||||||
|
|
||||||
const { feed, hasMore, loadMore } = useFeed({subplebbitAddresses: [`${selectedAddress}`], sortType: 'active'});
|
const { feed, hasMore, loadMore } = useFeed({subplebbitAddresses: [`${selectedAddress}`], sortType: 'active'});
|
||||||
const { subplebbitAddress } = useParams();
|
const { subplebbitAddress } = useParams();
|
||||||
@@ -281,13 +275,6 @@ const Catalog = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (anonymousMode) {
|
|
||||||
setExecuteAnonMode(true);
|
|
||||||
}
|
|
||||||
}, [anonymousMode, selectedThread]);
|
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (publishCommentOptions && triggerPublishComment) {
|
if (publishCommentOptions && triggerPublishComment) {
|
||||||
(async () => {
|
(async () => {
|
||||||
@@ -475,12 +462,8 @@ const Catalog = () => {
|
|||||||
<span className="boardList">
|
<span className="boardList">
|
||||||
[
|
[
|
||||||
<Link to={`/p/all`}>All</Link>
|
<Link to={`/p/all`}>All</Link>
|
||||||
{anonymousMode ? null :
|
|
||||||
<>
|
|
||||||
/
|
/
|
||||||
<Link to={`/p/subscriptions`}>Subscriptions</Link>
|
<Link to={`/p/subscriptions`}>Subscriptions</Link>
|
||||||
</>
|
|
||||||
}
|
|
||||||
] [
|
] [
|
||||||
{defaultSubplebbits.map((subplebbit, index) => (
|
{defaultSubplebbits.map((subplebbit, index) => (
|
||||||
<span className="boardList" key={`span-${subplebbit.address}`}>
|
<span className="boardList" key={`span-${subplebbit.address}`}>
|
||||||
@@ -517,7 +500,7 @@ const Catalog = () => {
|
|||||||
|
|
||||||
<select id="board-select-mobile" value={selectedAddress} onChange={handleSelectChange}>
|
<select id="board-select-mobile" value={selectedAddress} onChange={handleSelectChange}>
|
||||||
<option value="all">All</option>
|
<option value="all">All</option>
|
||||||
{anonymousMode ? null : <option value="subscriptions">Subscriptions</option>}
|
<option value="subscriptions">Subscriptions</option>
|
||||||
{defaultSubplebbits.map(subplebbit => (
|
{defaultSubplebbits.map(subplebbit => (
|
||||||
<option key={`option-${subplebbit.address}`} value={subplebbit.address}
|
<option key={`option-${subplebbit.address}`} value={subplebbit.address}
|
||||||
>{subplebbit.title ? subplebbit.title : subplebbit.address}</option>
|
>{subplebbit.title ? subplebbit.title : subplebbit.address}</option>
|
||||||
@@ -628,8 +611,6 @@ const Catalog = () => {
|
|||||||
]
|
]
|
||||||
</div>
|
</div>
|
||||||
{feed.length > 0 ? (
|
{feed.length > 0 ? (
|
||||||
<>
|
|
||||||
{anonymousMode ? null : (
|
|
||||||
<>
|
<>
|
||||||
<span className="subscribe-button-desktop">
|
<span className="subscribe-button-desktop">
|
||||||
[
|
[
|
||||||
@@ -646,8 +627,6 @@ const Catalog = () => {
|
|||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</>
|
</>
|
||||||
)}
|
|
||||||
</>
|
|
||||||
) : (
|
) : (
|
||||||
<div id="stats" style={{float: "right", marginTop: "5px"}}>
|
<div id="stats" style={{float: "right", marginTop: "5px"}}>
|
||||||
<span className={stateString ? "ellipsis" : ""}>{stateString}</span>
|
<span className={stateString ? "ellipsis" : ""}>{stateString}</span>
|
||||||
@@ -1064,12 +1043,8 @@ const Catalog = () => {
|
|||||||
<span className="boardList">
|
<span className="boardList">
|
||||||
[
|
[
|
||||||
<Link to={`/p/all`}>All</Link>
|
<Link to={`/p/all`}>All</Link>
|
||||||
{anonymousMode ? null :
|
|
||||||
<>
|
|
||||||
/
|
/
|
||||||
<Link to={`/p/subscriptions`}>Subscriptions</Link>
|
<Link to={`/p/subscriptions`}>Subscriptions</Link>
|
||||||
</>
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
</span>
|
</span>
|
||||||
{defaultSubplebbits.map((subplebbit, index) => (
|
{defaultSubplebbits.map((subplebbit, index) => (
|
||||||
|
|||||||
@@ -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 { Container, Header, Logo, Page, Search, About, AboutTitle, AboutContent, Boards, BoardsTitle, BoardsContent, Footer } from '../styled/views/Home.styled';
|
||||||
import BoardAvatar from '../BoardAvatar';
|
import BoardAvatar from '../BoardAvatar';
|
||||||
import OfflineIndicator from '../OfflineIndicator';
|
import OfflineIndicator from '../OfflineIndicator';
|
||||||
import useAnonModeStore from '../../hooks/stores/useAnonModeStore';
|
|
||||||
import useGeneralStore from '../../hooks/stores/useGeneralStore';
|
import useGeneralStore from '../../hooks/stores/useGeneralStore';
|
||||||
import packageJson from '../../../package.json'
|
import packageJson from '../../../package.json'
|
||||||
import { Tooltip } from 'react-tooltip';
|
import { Tooltip } from 'react-tooltip';
|
||||||
@@ -23,8 +22,6 @@ const Home = () => {
|
|||||||
setSelectedTitle
|
setSelectedTitle
|
||||||
} = useGeneralStore(state => state);
|
} = useGeneralStore(state => state);
|
||||||
|
|
||||||
const { anonymousMode } = useAnonModeStore();
|
|
||||||
|
|
||||||
const account = useAccount();
|
const account = useAccount();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
@@ -105,7 +102,7 @@ const Home = () => {
|
|||||||
</div>
|
</div>
|
||||||
</AboutContent>
|
</AboutContent>
|
||||||
</About>
|
</About>
|
||||||
{account?.subscriptions?.length > 0 && !anonymousMode ? (
|
{account?.subscriptions?.length > 0 ? (
|
||||||
<Boards>
|
<Boards>
|
||||||
<BoardsTitle>
|
<BoardsTitle>
|
||||||
<h2>Subscriptions</h2>
|
<h2>Subscriptions</h2>
|
||||||
|
|||||||
@@ -679,6 +679,7 @@ 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);
|
||||||
@@ -958,6 +959,7 @@ 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);
|
||||||
@@ -1391,6 +1393,7 @@ 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);
|
||||||
@@ -1563,6 +1566,7 @@ 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);
|
||||||
|
|||||||
@@ -532,12 +532,8 @@ const Thread = () => {
|
|||||||
<span className="boardList">
|
<span className="boardList">
|
||||||
[
|
[
|
||||||
<Link to={`/p/all`}>All</Link>
|
<Link to={`/p/all`}>All</Link>
|
||||||
{anonymousMode ? null :
|
|
||||||
<>
|
|
||||||
/
|
/
|
||||||
<Link to={`/p/subscriptions`}>Subscriptions</Link>
|
<Link to={`/p/subscriptions`}>Subscriptions</Link>
|
||||||
</>
|
|
||||||
}
|
|
||||||
] [
|
] [
|
||||||
{defaultSubplebbits.map((subplebbit, index) => (
|
{defaultSubplebbits.map((subplebbit, index) => (
|
||||||
<span className="boardList" key={`span-${subplebbit.address}`}>
|
<span className="boardList" key={`span-${subplebbit.address}`}>
|
||||||
@@ -574,7 +570,7 @@ const Thread = () => {
|
|||||||
|
|
||||||
<select id="board-select-mobile" value={selectedAddress} onChange={handleSelectChange}>
|
<select id="board-select-mobile" value={selectedAddress} onChange={handleSelectChange}>
|
||||||
<option value="all">All</option>
|
<option value="all">All</option>
|
||||||
{anonymousMode ? null : <option value="subscriptions">Subscriptions</option>}
|
<option value="subscriptions">Subscriptions</option>
|
||||||
{defaultSubplebbits.map(subplebbit => (
|
{defaultSubplebbits.map(subplebbit => (
|
||||||
<option key={`option-${subplebbit.address}`} value={subplebbit.address}
|
<option key={`option-${subplebbit.address}`} value={subplebbit.address}
|
||||||
>{subplebbit.title ? subplebbit.title : subplebbit.address}</option>
|
>{subplebbit.title ? subplebbit.title : subplebbit.address}</option>
|
||||||
@@ -1833,12 +1829,8 @@ const Thread = () => {
|
|||||||
<span className="boardList">
|
<span className="boardList">
|
||||||
[
|
[
|
||||||
<Link to={`/p/all`}>All</Link>
|
<Link to={`/p/all`}>All</Link>
|
||||||
{anonymousMode ? null :
|
|
||||||
<>
|
|
||||||
/
|
/
|
||||||
<Link to={`/p/subscriptions`}>Subscriptions</Link>
|
<Link to={`/p/subscriptions`}>Subscriptions</Link>
|
||||||
</>
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
</span>
|
</span>
|
||||||
{defaultSubplebbits.map((subplebbit, index) => (
|
{defaultSubplebbits.map((subplebbit, index) => (
|
||||||
|
|||||||
Reference in New Issue
Block a user