From fbd2cfc5bcd8c44eac375e820a3cf03b0ff78c10 Mon Sep 17 00:00:00 2001 From: electrone901 Date: Tue, 24 Oct 2023 12:50:57 -0400 Subject: [PATCH] Remove grid, list, and shuffle buttons from View Ballot pag --- .../nextjs/components/ballot/AllBallots.tsx | 30 +++---------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/packages/nextjs/components/ballot/AllBallots.tsx b/packages/nextjs/components/ballot/AllBallots.tsx index 48222ce..303f448 100644 --- a/packages/nextjs/components/ballot/AllBallots.tsx +++ b/packages/nextjs/components/ballot/AllBallots.tsx @@ -10,7 +10,6 @@ import useSWR from "swr"; import { useAccount } from "wagmi"; import * as solid from "@heroicons/react/20/solid"; import YourBallot from "~~/components/op/projects/YourBallot"; -import ProjectsPageHeader from "~~/components/projects/ProjectsPageHeader"; import Sidebar from "~~/components/shared/Sidebar"; import { useBallot } from "~~/context/BallotContext"; import { fetcher } from "~~/utils/fetcher"; @@ -28,11 +27,8 @@ const AllBallots = () => { const { state, dispatch } = useBallot(); const router = useRouter(); const [wallet, setWallet] = useState(false); - const { isLoading: isFetching } = useSWR(`/api/projects?pageQuery=1&limit=12`, fetcher); - const [selectedCategory, setSelectedCategory] = useState("all"); const [ballotProjects, setBallotProjects] = useState([]); - const [filteredBallotProjects, setFilteredBallotProjects] = useState([]); const [isLoading, setIsLoading] = useState(false); const [loadingMessage, setLoadingMessage] = useState(""); @@ -59,7 +55,9 @@ const AllBallots = () => { ); }; useEffect(() => { - setBallotProjects([...state.projects.map((project: any) => ({ ...project, isOpenModal: false }))]); + const _ballotProjects = [...state.projects.map((project: any) => ({ ...project, isOpenModal: false }))]; + setBallotProjects(_ballotProjects); + setFilteredBallotProjects(_ballotProjects); }, [state]); const handleOpenBallotModal = (id: string) => { setBallotProjects(prev => { @@ -81,18 +79,6 @@ const AllBallots = () => { setWallet(isDisconnected); }, [isDisconnected]); - useEffect(() => { - function filterProjects() { - const _filteredProjects = - selectedCategory === "all" - ? ballotProjects - : ballotProjects?.filter(project => project.category === selectedCategory); - setFilteredBallotProjects(_filteredProjects); - } - filterProjects(); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [selectedCategory, ballotProjects]); - if (isFetching) { return (
@@ -130,15 +116,7 @@ const AllBallots = () => {
{!wallet ? : }
-
- -
+

My ballot

{ballotProjects.length === 0 ? (

You have no projects in your ballot