From 4a7d6a9c0c80e7c397ec395da9901fb9bf2e1e99 Mon Sep 17 00:00:00 2001 From: Meriem-BM Date: Tue, 29 Oct 2024 11:51:10 +0100 Subject: [PATCH 1/5] fix: remove DnD column from ranking table --- app/allocation/[category]/components/RankingRow.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/allocation/[category]/components/RankingRow.tsx b/app/allocation/[category]/components/RankingRow.tsx index 710a95f..a43b520 100644 --- a/app/allocation/[category]/components/RankingRow.tsx +++ b/app/allocation/[category]/components/RankingRow.tsx @@ -63,11 +63,11 @@ const RankingRow: FC = ({ {project.project.description}

- + {/*
- + */}
Date: Tue, 29 Oct 2024 15:30:22 +0100 Subject: [PATCH 2/5] fix: show delegations modal once for every category each user --- app/comparison/card/Header-RF6.tsx | 39 +++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/app/comparison/card/Header-RF6.tsx b/app/comparison/card/Header-RF6.tsx index 366b466..236a094 100644 --- a/app/comparison/card/Header-RF6.tsx +++ b/app/comparison/card/Header-RF6.tsx @@ -1,5 +1,5 @@ import React, { FC, useState, useEffect, useMemo } from 'react'; -import { useDisconnect } from 'wagmi'; +import { useDisconnect, useAccount } from 'wagmi'; import { usePathname } from 'next/navigation'; import { ConnectButton } from '@/app/utils/wallet/Connect'; import { PwLogo } from '@/public/assets/icon-components/PairwiseLogo'; @@ -15,6 +15,7 @@ import { useGetPublicBadges } from '@/app/utils/getBadges'; import DelegationsModal from './modals/DelegationsModal'; import { useGetDelegationStatus } from '@/app/utils/getConnectionStatus'; import StorageLabel from '@/app/lib/localStorage'; + interface HeaderProps { progress?: number category?: string @@ -36,6 +37,8 @@ const HeaderRF6: FC = ({ const { signOut, loginAddress } = useAuth(); const { data: badges } = useGetPublicBadges(); const { data: delegates } = useGetDelegationStatus(); + const { address, chainId } = useAccount(); + const [isBadgesModalOpen, setIsBadgesModalOpen] = useState(false); const [isDelegateModalOpen, setIsDelegateModalOpen] = useState(false); @@ -97,9 +100,17 @@ const HeaderRF6: FC = ({ }; useEffect(() => { - const isAlreadyShown - = localStorage.getItem(StorageLabel.PRE_VOTING_DELEGATION_POPUP) === 'true'; + if (!category || !chainId || !delegates) return + + const currentUserKey = `${chainId}_${address}`; + + const storedData = JSON.parse( + localStorage.getItem(StorageLabel.PRE_VOTING_DELEGATION_POPUP) || '{}' + ); + const categories = storedData[currentUserKey] || {}; + const isAlreadyShown = categories[category]; + if ( path.includes('comparison') && delegates?.toYou?.uniqueDelegators @@ -110,7 +121,27 @@ const HeaderRF6: FC = ({ }, [path]); const markAsShown = () => { - localStorage.setItem(StorageLabel.PRE_VOTING_DELEGATION_POPUP, 'true'); + if (!category || !chainId || !delegates) return + + const currentUserKey = `${chainId}_${address}`; + + const storedData = JSON.parse( + localStorage.getItem(StorageLabel.PRE_VOTING_DELEGATION_POPUP) || '{}' + ); + + const categories = storedData[currentUserKey] || {}; + + localStorage.setItem( + StorageLabel.PRE_VOTING_DELEGATION_POPUP, + JSON.stringify({ + ...storedData, + [currentUserKey]: { + ...categories, + [category]: true, + }, + }) + ); + setIsDelegateModalOpen(false); }; From 93bf5b61506f86ad027b4203102981d724092047 Mon Sep 17 00:00:00 2001 From: Meriem-BM Date: Tue, 29 Oct 2024 16:48:37 +0100 Subject: [PATCH 3/5] fix: handle redundent email --- app/allocation/components/EOA/ConnectEOAModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/allocation/components/EOA/ConnectEOAModal.tsx b/app/allocation/components/EOA/ConnectEOAModal.tsx index f9122a2..ae4411f 100644 --- a/app/allocation/components/EOA/ConnectEOAModal.tsx +++ b/app/allocation/components/EOA/ConnectEOAModal.tsx @@ -45,7 +45,7 @@ const ConnectEOAModal: FC = ({ email, setStep }) => { setStep(Step.SUCCESS); } catch (err) { - setError('An error occurred while connecting to your wallet'); + setError('This email is already connected to another wallet'); setLoading(false); } }; From 38eeb483fea35fd1d6b9352bcc70b76a9202bda2 Mon Sep 17 00:00:00 2001 From: Meriem-BM Date: Tue, 29 Oct 2024 17:00:30 +0100 Subject: [PATCH 4/5] fix: change each category's budget when changing budget on bar --- app/allocation/page.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/allocation/page.tsx b/app/allocation/page.tsx index bdcb320..cfb325d 100644 --- a/app/allocation/page.tsx +++ b/app/allocation/page.tsx @@ -190,6 +190,12 @@ const AllocationPage = () => { const handleSliderChange = (_event: Event, newValue: number | number[]) => { if (typeof newValue === 'number') { setTotalValue(newValue * 1_000_000); + setCategoriesRanking( + categoriesRanking?.map(el => ({ + ...el, + budget: el.budget * (newValue / (totalValue / 1_000_000)), + })) + ); } }; From e3b618d65f16e4a5a691f739c2bd0d02f31ce6b1 Mon Sep 17 00:00:00 2001 From: Meriem-BM Date: Tue, 29 Oct 2024 17:04:22 +0100 Subject: [PATCH 5/5] chore: linting errors --- app/allocation/[category]/components/RankingRow.tsx | 1 - app/comparison/card/Header-RF6.tsx | 11 +++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/allocation/[category]/components/RankingRow.tsx b/app/allocation/[category]/components/RankingRow.tsx index a43b520..99e8b52 100644 --- a/app/allocation/[category]/components/RankingRow.tsx +++ b/app/allocation/[category]/components/RankingRow.tsx @@ -3,7 +3,6 @@ import Image from 'next/image'; import { NumericFormat } from 'react-number-format'; import { IProjectRanking } from '@/app/comparison/utils/types'; import { Checkbox } from '@/app/utils/Checkbox'; -import { ExpandVertical } from '@/public/assets/icon-components/ExpandVertical'; import { LockIcon } from '@/public/assets/icon-components/Lock'; import { UnlockIcon } from '@/public/assets/icon-components/Unlock'; import styles from '@/app/styles/Project.module.css'; diff --git a/app/comparison/card/Header-RF6.tsx b/app/comparison/card/Header-RF6.tsx index 236a094..831e1cb 100644 --- a/app/comparison/card/Header-RF6.tsx +++ b/app/comparison/card/Header-RF6.tsx @@ -39,7 +39,6 @@ const HeaderRF6: FC = ({ const { data: delegates } = useGetDelegationStatus(); const { address, chainId } = useAccount(); - const [isBadgesModalOpen, setIsBadgesModalOpen] = useState(false); const [isDelegateModalOpen, setIsDelegateModalOpen] = useState(false); const [isBarFixed, setIsBarFixed] = useState(false); @@ -100,7 +99,7 @@ const HeaderRF6: FC = ({ }; useEffect(() => { - if (!category || !chainId || !delegates) return + if (!category || !chainId || !delegates) return; const currentUserKey = `${chainId}_${address}`; @@ -110,7 +109,7 @@ const HeaderRF6: FC = ({ const categories = storedData[currentUserKey] || {}; const isAlreadyShown = categories[category]; - + if ( path.includes('comparison') && delegates?.toYou?.uniqueDelegators @@ -121,14 +120,14 @@ const HeaderRF6: FC = ({ }, [path]); const markAsShown = () => { - if (!category || !chainId || !delegates) return + if (!category || !chainId || !delegates) return; const currentUserKey = `${chainId}_${address}`; const storedData = JSON.parse( localStorage.getItem(StorageLabel.PRE_VOTING_DELEGATION_POPUP) || '{}' ); - + const categories = storedData[currentUserKey] || {}; localStorage.setItem( @@ -141,7 +140,7 @@ const HeaderRF6: FC = ({ }, }) ); - + setIsDelegateModalOpen(false); };