Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: QA reported issues #77

Merged
merged 5 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions app/allocation/[category]/components/RankingRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -63,11 +62,11 @@ const RankingRow: FC<IRankingRowProps> = ({
{project.project.description}
</p>
</td>
<td className="pb-8 pl-4 pt-4">
{/* <td className="pb-8 pl-4 pt-4">
<div className="flex items-center gap-2">
<ExpandVertical />
</div>
</td>
</td> */}
<td className="pb-8 pl-4 pt-4">
<div
className={`flex items-center justify-center rounded-md border border-gray-200 px-4 py-2 ${
Expand Down
2 changes: 1 addition & 1 deletion app/allocation/components/EOA/ConnectEOAModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const ConnectEOAModal: FC<TConnectEOAModalProps> = ({ 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);
}
};
Expand Down
6 changes: 6 additions & 0 deletions app/allocation/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
}))
);
}
};

Expand Down
38 changes: 34 additions & 4 deletions app/comparison/card/Header-RF6.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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
Expand All @@ -36,6 +37,7 @@ const HeaderRF6: FC<HeaderProps> = ({
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);
Expand Down Expand Up @@ -97,8 +99,16 @@ const HeaderRF6: FC<HeaderProps> = ({
};

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')
Expand All @@ -110,7 +120,27 @@ const HeaderRF6: FC<HeaderProps> = ({
}, [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);
};

Expand Down