mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
refactor: remove broken anon mode feature
- delete the anon mode hook/store and stop wiring publish flows through alternate signers - strip the settings UI, avatar warning, reply indicators, and FAQ text that referenced the toggle - drop the anon mode translation keys via scripts/update-translations.js
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { useLocation, useParams } from 'react-router-dom';
|
||||
import { Trans, useTranslation } from 'react-i18next';
|
||||
import { setAccount, useAccount } from '@plebbit/plebbit-react-hooks';
|
||||
import useSubplebbitsStore from '@plebbit/plebbit-react-hooks/dist/stores/subplebbits';
|
||||
import useSubplebbitsPagesStore from '@plebbit/plebbit-react-hooks/dist/stores/subplebbits-pages';
|
||||
import Plebbit from '@plebbit/plebbit-js';
|
||||
import { formatMarkdown } from '../../lib/utils/post-utils';
|
||||
import { getFormattedTimeAgo } from '../../lib/utils/time-utils';
|
||||
@@ -15,7 +14,6 @@ import useIsMobile from '../../hooks/use-is-mobile';
|
||||
import styles from './reply-modal.module.css';
|
||||
import { LinkTypePreviewer } from '../post-form';
|
||||
import _ from 'lodash';
|
||||
import useAnonMode from '../../hooks/use-anon-mode';
|
||||
import FileUploader from '../../plugins/file-uploader';
|
||||
import { Capacitor } from '@capacitor/core';
|
||||
import { useSpring, animated } from '@react-spring/web';
|
||||
@@ -46,34 +44,6 @@ const ReplyModal = ({ closeModal, showReplyModal, parentCid, postCid, scrollY, s
|
||||
const urlRef = useRef<HTMLInputElement>(null);
|
||||
const { selectedText } = useSelectedTextStore();
|
||||
|
||||
const { anonMode, getNewSigner, getExistingSigner } = useAnonMode(postCid);
|
||||
const comment = useSubplebbitsPagesStore((state) => state.comments[postCid]);
|
||||
const address = comment?.author?.address;
|
||||
|
||||
const getAnonAddressForReply = useCallback(async () => {
|
||||
const existingSigner = await getExistingSigner(address);
|
||||
if (existingSigner) {
|
||||
setPublishReplyOptions({
|
||||
signer: existingSigner,
|
||||
author: {
|
||||
address: existingSigner.address,
|
||||
displayName: displayName || undefined,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
const newSigner = await getNewSigner();
|
||||
if (newSigner) {
|
||||
setPublishReplyOptions({
|
||||
signer: newSigner,
|
||||
author: {
|
||||
address: newSigner.address,
|
||||
displayName: displayName || undefined,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}, [address, getExistingSigner, getNewSigner, setPublishReplyOptions, displayName]);
|
||||
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [lengthError, setLengthError] = useState<string | null>(null);
|
||||
|
||||
@@ -115,28 +85,6 @@ const ReplyModal = ({ closeModal, showReplyModal, parentCid, postCid, scrollY, s
|
||||
publishReply();
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (anonMode) {
|
||||
setPublishReplyOptions({
|
||||
signer: undefined,
|
||||
author: {
|
||||
address: undefined,
|
||||
displayName: displayName || undefined,
|
||||
},
|
||||
});
|
||||
getAnonAddressForReply();
|
||||
} else {
|
||||
setPublishReplyOptions({
|
||||
signer: undefined,
|
||||
author: {
|
||||
...account?.author,
|
||||
displayName: displayName || account?.author?.displayName,
|
||||
},
|
||||
});
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [anonMode]);
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof replyIndex === 'number') {
|
||||
resetPublishReplyOptions();
|
||||
|
||||
Reference in New Issue
Block a user