refactor settingsmodal to render it globally

This commit is contained in:
Tom (plebeius.eth)
2025-03-05 12:06:27 +01:00
parent 37e325c3d2
commit b686ca3dd0
5 changed files with 9 additions and 21 deletions
+2 -12
View File
@@ -1,9 +1,7 @@
import { useEffect } from 'react';
import { useLocation, useNavigate, useParams } from 'react-router-dom';
import { useNavigate, useParams } from 'react-router-dom';
import { useAccountComment, useAccountComments } from '@plebbit/plebbit-react-hooks';
import { isSettingsView } from '../../lib/utils/view-utils';
import { Post } from '../post';
import SettingsModal from '../../components/settings-modal';
const PendingPost = () => {
const { accountComments } = useAccountComments();
@@ -11,9 +9,6 @@ const PendingPost = () => {
const commentIndex = accountCommentIndex ? parseInt(accountCommentIndex) : undefined;
const post = useAccountComment({ commentIndex });
const navigate = useNavigate();
const location = useLocation();
const params = useParams();
const isInSettingsView = isSettingsView(location.pathname, params);
useEffect(() => window.scrollTo(0, 0), []);
@@ -36,12 +31,7 @@ const PendingPost = () => {
}
}, [post, navigate]);
return (
<>
{isInSettingsView && <SettingsModal />}
<Post post={post} />
</>
);
return <Post post={post} />;
};
export default PendingPost;