From 80fdbb8004c90385f9feaecd934105091320aeb5 Mon Sep 17 00:00:00 2001 From: cryptoseneca Date: Mon, 25 Mar 2024 13:27:45 -0400 Subject: [PATCH] remove hidden proposals from prop modal --- .../src/components/RoundContent/index.tsx | 34 +++++++------------ .../src/pages/Round/index.tsx | 16 +++++++-- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/packages/prop-house-webapp/src/components/RoundContent/index.tsx b/packages/prop-house-webapp/src/components/RoundContent/index.tsx index 1160c6dd5..ce0f71bf5 100644 --- a/packages/prop-house-webapp/src/components/RoundContent/index.tsx +++ b/packages/prop-house-webapp/src/components/RoundContent/index.tsx @@ -7,7 +7,6 @@ import { House, Proposal, Round, RoundType, Timed } from '@prophouse/sdk-react'; import TimedRoundProposalCard from '../TimedRoundProposalCard'; import TimedRoundModules from '../TimedRoundModules'; import InfRoundModules from '../InfRoundModules'; -import { useHiddenPropIds } from '../../hooks/useHiddenPropIds'; import { useContentModeration } from '../../hooks/useContentModeration'; const RoundContent: React.FC<{ @@ -18,7 +17,7 @@ const RoundContent: React.FC<{ const { round, proposals, house } = props; const [showVoteConfirmationModal, setShowVoteConfirmationModal] = useState(false); - const { hiddenPropIds, refresh } = useHiddenPropIds(round.address); + // eslint-disable-next-line const { isMod, hideProp, hideRound } = useContentModeration(house); @@ -46,26 +45,17 @@ const RoundContent: React.FC<{ ) : ( <> - {hiddenPropIds === undefined ? ( - <> - ) : ( - proposals && - proposals - .filter(p => !hiddenPropIds.includes(p.id)) - .map((prop, index) => ( - - { - await hideProp(round.address, propId); - setTimeout(() => refresh(), 1000); - }} - /> - - )) - )} + {proposals && + proposals.map((prop, index) => ( + + await hideProp(round.address, propId)} + /> + + ))} )} diff --git a/packages/prop-house-webapp/src/pages/Round/index.tsx b/packages/prop-house-webapp/src/pages/Round/index.tsx index 8b6243843..64feaaa0d 100644 --- a/packages/prop-house-webapp/src/pages/Round/index.tsx +++ b/packages/prop-house-webapp/src/pages/Round/index.tsx @@ -13,6 +13,7 @@ import RoundContent from '../../components/RoundContent'; import { setVoteAllotments } from '../../state/slices/voting'; import { removeHtmlFromString } from '../../utils/removeHtmlFromString'; import { RoundOrHouseContentLoadingCard } from '../../components/LoadingCards'; +import { useHiddenPropIds } from '../../hooks/useHiddenPropIds'; const Round: React.FC<{}> = () => { const propHouse = usePropHouse(); @@ -26,6 +27,9 @@ const Round: React.FC<{}> = () => { const [loadedProposals, setLoadedProposals] = useState(false); const [loadingProposalsFailed, setLoadingProposalsFailed] = useState(false); + // eslint-disable-next-line + const { hiddenPropIds, refresh } = useHiddenPropIds(round!.address); + // fetch proposals useEffect(() => { if (proposals || loadedProposals || !round) return; @@ -54,7 +58,9 @@ const Round: React.FC<{}> = () => { return ( <> - {isModalActive && proposals && } + {isModalActive && hiddenPropIds !== undefined && proposals && ( + !hiddenPropIds.includes(p.id))} /> + )} {round && ( = () => { ) : (
- {proposals && } + {hiddenPropIds !== undefined && proposals && ( + !hiddenPropIds.includes(p.id))} + /> + )}
)}