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

Staging into Main #110

Merged
merged 25 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
13d8169
Merge branch 'staging' of github.com:GeneralMagicio/pairwise-rf6 into…
Meriem-BM Oct 31, 2024
420dfc4
fix: bulk lock issue
Meriem-BM Oct 31, 2024
068187a
fix: budget category view issue
Meriem-BM Oct 31, 2024
85d2523
fix: testimonial link broken & header flashing
Meriem-BM Oct 31, 2024
ffa76af
fix: show only if repo has metrics
Meriem-BM Oct 31, 2024
717c1fb
fix: show status for non attested projects
Meriem-BM Oct 31, 2024
acfdc37
chore: linting errors
Meriem-BM Oct 31, 2024
066b70f
Merge pull request #97 from GeneralMagicio/fix/feedback_issues
Meriem-BM Oct 31, 2024
ca7f767
Fix typo
mmahdigh Oct 31, 2024
d9f2b7c
redirect url change
HrithikSampson Oct 31, 2024
644bbe3
Merge pull request #99 from GeneralMagicio/redirect-url-change
HrithikSampson Oct 31, 2024
608b9c8
Add header logo link
mmahdigh Nov 1, 2024
f3ed32d
Merge pull request #105 from GeneralMagicio/main
mmahdigh Nov 2, 2024
4a8e777
Stack to Governance name change
HrithikSampson Nov 2, 2024
8183730
feat: add case when badgeholder attested associated category
Meriem-BM Nov 2, 2024
842caf4
feat: add case when badgeholder attested associated category
Meriem-BM Nov 2, 2024
58207f2
Merge branch 'staging' of github.com:GeneralMagicio/pairwise-rf6 into…
Meriem-BM Nov 2, 2024
3ea1134
fix: add isBHCategoryAtessted for budget category
Meriem-BM Nov 2, 2024
1ec128a
Merge pull request #106 from GeneralMagicio/redirect-url-change
mmahdigh Nov 2, 2024
4d97b24
add endpoints to get farcaster delegations
RamRamez Nov 3, 2024
2f5abc1
Merge pull request #108 from GeneralMagicio/add-endpoints-to-get-farc…
mmahdigh Nov 4, 2024
f8a928e
fix: add responsiveness to projects table
Meriem-BM Nov 4, 2024
c024f06
Merge pull request #107 from GeneralMagicio/fix/feedback_issues
mmahdigh Nov 4, 2024
4020015
fix: row lenght issue
Meriem-BM Nov 5, 2024
edf56cd
Merge pull request #116 from GeneralMagicio/fix/feedback_issues
mmahdigh Nov 5, 2024
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
12 changes: 6 additions & 6 deletions app/allocation/[category]/components/RankingRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ const RankingRow: FC<IRankingRowProps> = ({
locked && 'bg-gray-100'
}`}
>
<td className="pb-8 pl-4 pt-4">
<td className="pb-8 pl-1 pt-4 lg:pl-4">
<Checkbox
checked={selected}
onChange={() => onSelect(project.projectId)}
/>
</td>
<td className="pb-8 pl-4 pt-4">
<td className="pb-8 pl-1 pt-4 lg:pl-4">
<Image
src={project.project.image || '/assets/images/placeholder.png'}
alt={project.project.name}
Expand All @@ -54,20 +54,20 @@ const RankingRow: FC<IRankingRowProps> = ({
unoptimized
/>
</td>
<td className="w-[50%] pb-8 pl-4 pt-4">
<td className="2xl:w-[50%] xl:w-[35%] w-[30%] pb-8 pl-1 pt-4 lg:pl-4">
<p className={`font-medium text-gray-700 ${styles.oneLineClamp}`}>
{project.project.name}
</p>
<p className={`text-sm text-gray-400 ${styles.oneLineClamp}`}>
{project.project.description}
</p>
</td>
{/* <td className="pb-8 pl-4 pt-4">
{/* <td className="pb-8 lg:pl-4 pl-1 pt-4">
<div className="flex items-center gap-2">
<ExpandVertical />
</div>
</td> */}
<td className="pb-8 pl-4 pt-4">
<td className="pb-8 pl-1 pt-4 lg:pl-4">
<div
className={`flex items-center justify-center rounded-md border border-gray-200 px-4 py-2 ${
locked && 'bg-gray-100'
Expand All @@ -76,7 +76,7 @@ const RankingRow: FC<IRankingRowProps> = ({
<p className="text-gray-700">{index + 1}</p>
</div>
</td>
<td className="relative pb-8 pl-4 pt-4">
<td className="relative pb-8 pl-1 pt-4 lg:pl-4">
<NumericFormat
suffix="%"
decimalScale={2}
Expand Down
43 changes: 24 additions & 19 deletions app/allocation/[category]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ const RankingPage = () => {
const lockSelection = () => {
if (!projects) return;

if (checkedItems.length > projects?.length - 2) {
if (
checkedItems.length > projects?.length - 2
|| lockedItems.length >= projects?.length - 2
) {
setTotalShareError('At least two projects must be unlocked');
window.scrollTo(0, document.body.scrollHeight);
return;
Expand Down Expand Up @@ -367,7 +370,7 @@ const RankingPage = () => {
</div>
</div>
{/* <SearchBar search={search} setSearch={setSearch} /> */}
<div className="flex items-center justify-between rounded-lg bg-gray-100 px-8 py-3">
<div className="flex items-center justify-between rounded-lg bg-gray-100 px-4 py-3 lg:px-8">
<div className="flex items-center gap-4">
<div className="flex items-center justify-center gap-2">
<Checkbox
Expand Down Expand Up @@ -428,23 +431,25 @@ const RankingPage = () => {
)
: projects?.length
? (
<table className="w-full">
<tbody className="flex flex-col gap-6">
{projects.map((project, index) => (
<RankingRow
key={project.projectId}
index={index}
budget={allocationBudget * project.share}
project={project}
selected={checkedItems.includes(project.projectId)}
locked={lockedItems.includes(project.projectId)}
onLock={handleLocck}
onSelect={selectItem}
onVote={handleVote}
/>
))}
</tbody>
</table>
<div className="w-full overflow-x-auto">
<table className="w-full min-w-full">
<tbody className="flex flex-col gap-6">
{projects.map((project, index) => (
<RankingRow
key={project.projectId}
index={index}
budget={allocationBudget * project.share}
project={project}
selected={checkedItems.includes(project.projectId)}
locked={lockedItems.includes(project.projectId)}
onLock={handleLocck}
onSelect={selectItem}
onVote={handleVote}
/>
))}
</tbody>
</table>
</div>
)
: (
<p className="text-center text-gray-400">No projects found</p>
Expand Down
8 changes: 5 additions & 3 deletions app/allocation/components/BudgetAllocation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ interface IBudgetAllocationProps extends BudgetCategory {
username?: string
isBadgeholder: boolean
bhCategory: string
isBHCategoryAtessted: boolean
attestationLink: string | null
categorySlug: string
onDelegate: () => void
Expand All @@ -39,6 +40,7 @@ const BudgetAllocation: React.FC<IBudgetAllocationProps> = ({
progress = CollectionProgressStatusEnum.Pending,
username,
isBadgeholder,
isBHCategoryAtessted,
bhCategory,
categorySlug,
onScore,
Expand All @@ -48,15 +50,13 @@ const BudgetAllocation: React.FC<IBudgetAllocationProps> = ({

const renderProgressState = useMemo(() => {
switch (progress) {
case CollectionProgressStatusEnum.Finished:
return <VotedCategory id={id} isAutoConnecting={isAutoConnecting} />;
case CollectionProgressStatusEnum.Attested:
return (
<VotedCategory
budgetEditHandle={onScore}
id={id}
isAutoConnecting={isAutoConnecting}
attestationLink={attestationLink}
attestationLink={attestationLink || ''}
/>
);
case CollectionProgressStatusEnum.Delegated:
Expand All @@ -67,6 +67,7 @@ const BudgetAllocation: React.FC<IBudgetAllocationProps> = ({
username={username}
/>
);
case CollectionProgressStatusEnum.Finished:
case CollectionProgressStatusEnum.Pending:
default:
return (
Expand All @@ -79,6 +80,7 @@ const BudgetAllocation: React.FC<IBudgetAllocationProps> = ({
isBadgeholder={isBadgeholder}
bhCategory={bhCategory}
categorySlug={categorySlug}
isBHCategoryAtessted={isBHCategoryAtessted}
/>
);
}
Expand Down
3 changes: 3 additions & 0 deletions app/allocation/components/CategoryAllocation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ interface CategoryAllocationProps extends TCategory {
username?: string
isBadgeholder: boolean
bhCategory: string
isBHCategoryAtessted: boolean
categorySlug: string
onDelegate: () => void
onScore: () => void
Expand All @@ -60,6 +61,7 @@ const CategoryAllocation: FC<CategoryAllocationProps> = ({
isBadgeholder,
bhCategory,
categorySlug,
isBHCategoryAtessted,
onDelegate,
onScore,
onLockClick,
Expand Down Expand Up @@ -123,6 +125,7 @@ const CategoryAllocation: FC<CategoryAllocationProps> = ({
isBadgeholder={isBadgeholder}
bhCategory={bhCategory}
categorySlug={categorySlug}
isBHCategoryAtessted={isBHCategoryAtessted}
/>
);
}
Expand Down
2 changes: 1 addition & 1 deletion app/allocation/components/EOA/EmailLoginModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ const EmailLoginModal = ({ closeModal, selectedCategoryId }: TEmailLoginModalPro
className="flex items-center gap-1 font-medium text-primary"
onClick={() =>
window.open(
'https://pairwise.vote/blog/2021/09/15/why-we-need-anonymous-voting/',
'https://paragraph.xyz/@pairwise/empowering-superchain-with-pseudonymous',
'_blank'
)}
>
Expand Down
12 changes: 7 additions & 5 deletions app/allocation/components/ProgressCards/PendingCategory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type TPendingCategoryProps = {
isBadgeholder: boolean
bhCategory: string
categorySlug: string
isBHCategoryAtessted: boolean
};

const PendingCategory = ({
Expand All @@ -20,21 +21,22 @@ const PendingCategory = ({
isBadgeholder,
bhCategory,
categorySlug,
isBHCategoryAtessted,
}: TPendingCategoryProps) => {
return (
<div className="flex w-full flex-col items-center justify-center gap-2">
<div className="flex w-full items-center justify-between">
<button
onClick={onScore}
className={`whitespace-nowrap rounded-md py-3 text-sm font-medium ${
isAutoConnecting || (isBadgeholder && bhCategory !== categorySlug)
? 'border bg-gray-300 text-gray-500'
isAutoConnecting || (isBadgeholder && bhCategory !== categorySlug && !isBHCategoryAtessted)
? 'border bg-gray-300 text-gray-600'
: 'bg-primary text-white'
} ${
isBadgeholder && bhCategory === categorySlug ? 'w-full' : 'w-[48%]'
}`}
disabled={
isAutoConnecting || (isBadgeholder && bhCategory !== categorySlug)
isAutoConnecting || (isBadgeholder && bhCategory !== categorySlug && !isBHCategoryAtessted)
}
>
Vote
Expand Down Expand Up @@ -63,8 +65,8 @@ const PendingCategory = ({
</p>
</div>
)}
{progress === 'WIP'
&& !(isBadgeholder && bhCategory !== categorySlug) && (
{(progress === 'WIP' || progress === 'Finished')
&& !(isBadgeholder && bhCategory !== categorySlug && !isBHCategoryAtessted) && (
<div className="flex w-full justify-center gap-2 rounded-xl border border-[#FFA15A] bg-[#FFF7ED] py-1">
<p className="text-xs font-medium text-[#FFA15A]">Voting</p>
</div>
Expand Down
29 changes: 27 additions & 2 deletions app/allocation/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ const AllocationPage = () => {
= useState<Pick<ICategory, 'id' | 'name'>>();
const [targetDelegate, setTargetDelegate] = useState<TargetDelegate>();

const [rankingProgress, setRankingProgress]
= useState<CollectionProgressStatusEnum>(
CollectionProgressStatusEnum.Pending
);

const { mutateAsync: updateCategoriesRanking } = useUpdateCategoriesRanking({
budget: totalValue,
allocationPercentages:
Expand Down Expand Up @@ -304,6 +309,20 @@ const AllocationPage = () => {
);
};

const isBHCategoryAtessted = () => {
const bhCategoryProgress = categories?.find(
el => el.id === categorySlugIdMap.get(category)
)?.progress;

return bhCategoryProgress === CollectionProgressStatusEnum.Attested;
};

useEffect(() => {
if (categoryRankings) {
setRankingProgress(categoryRankings.progress);
}
}, [categoryRankings]);

useEffect(() => {
if (delegations) {
const budgetDelegateFromYou = delegations?.fromYou?.budget;
Expand All @@ -315,10 +334,14 @@ const AllocationPage = () => {
}, [delegations]);

useEffect(() => {
if (categoryRankings && categoryRankings.progress === 'Attested' && dbudgetProgress === CollectionProgressStatusEnum.Pending) {
if (
rankingProgress === CollectionProgressStatusEnum.Attested
&& dbudgetProgress === CollectionProgressStatusEnum.Pending
) {
setDbudgetProgress(CollectionProgressStatusEnum.Attested);
}
}, [categoryRankings, dbudgetProgress]);
else setDbudgetProgress(CollectionProgressStatusEnum.Pending);
}, [rankingProgress]);

useEffect(() => {
if (categoryRankings) {
Expand Down Expand Up @@ -533,6 +556,7 @@ const AllocationPage = () => {
loading={delegationsLoading}
isBadgeholder={isBadgeholder}
bhCategory={category}
isBHCategoryAtessted={isBHCategoryAtessted()}
categorySlug={category}
onDelegate={() => {
setCategoryToDelegate(budgetCategory);
Expand All @@ -558,6 +582,7 @@ const AllocationPage = () => {
loading={delegationsLoading}
isBadgeholder={isBadgeholder}
bhCategory={category}
isBHCategoryAtessted={isBHCategoryAtessted()}
categorySlug={categoryIdSlugMap.get(cat.id)!}
onDelegate={() => {
setCategoryToDelegate(cat);
Expand Down
4 changes: 2 additions & 2 deletions app/comparison/card/GithubBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ const GithubBox: FC<Props> = ({ repo }) => {
{isExpanded
? (
<div className="flex items-center gap-2">
<span> Hide metrics </span>
{'metrics' in repo && repo.metrics && <span> Hide metrics </span>}
<ArrowUpIcon />
</div>
)
: (
<div className="flex items-center gap-2">
<span> View metrics </span>
{'metrics' in repo && repo.metrics && <span> View metrics </span>}
<ArrowDownIcon />
</div>
)}
Expand Down
5 changes: 3 additions & 2 deletions app/comparison/card/Header-RF6.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { FC, useState, useEffect, useMemo } from 'react';
import { useDisconnect, useAccount } from 'wagmi';
import { usePathname } from 'next/navigation';
import { usePathname, useRouter } from 'next/navigation';
import { ConnectButton } from '@/app/utils/wallet/Connect';
import { PwLogo } from '@/public/assets/icon-components/PairwiseLogo';
import { ThinExternalLinkIcon } from '@/public/assets/icon-components/ThinExternalLink';
Expand Down Expand Up @@ -33,6 +33,7 @@ const HeaderRF6: FC<HeaderProps> = ({
isFirstSelection = false,
}) => {
const path = usePathname();
const router = useRouter();
const { disconnectAsync } = useDisconnect();
const { signOut, loginAddress } = useAuth();
const { data: badges } = useGetPublicBadges();
Expand Down Expand Up @@ -168,7 +169,7 @@ const HeaderRF6: FC<HeaderProps> = ({
<div className="relative z-40 w-full border-b bg-white">
<div className="flex items-center justify-between px-6 py-4 md:px-12 lg:px-4">
{!isFirstSelection && (
<div className="flex items-center">
<div onClick={() => router.push('/allocation')} className="flex cursor-pointer items-center">
<PwLogo />
</div>
)}
Expand Down
8 changes: 4 additions & 4 deletions app/comparison/card/ProjectCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ export const ProjectCard: React.FC<Props> = ({

const handleScroll = () => {
if (parentRef.current && titleRef.current) {
const rect = titleRef.current.getBoundingClientRect();
const rect = titleRef.current.getBoundingClientRect()?.top;
const offset = parentRef.current.getBoundingClientRect()?.top;
setIsSticky(rect.top <= offset && rect.top >= -offset);
setIsSticky(rect <= offset && rect >= -offset);
}
};

Expand Down Expand Up @@ -241,7 +241,7 @@ export const ProjectCard: React.FC<Props> = ({
coi || coiLoading ? 'brightness-50' : ''
}`}
>
<div ref={parentRef} className="h-[78vh] gap-10 overflow-y-auto p-2">
<div ref={parentRef} className="h-[78vh] gap-10 overflow-y-auto">
<div className="mr-4">
{/* Cover Image and Profile Avatar */}
<div className="relative h-40">
Expand Down Expand Up @@ -424,7 +424,7 @@ export const ProjectCard: React.FC<Props> = ({
/>
{project.testimonials?.length && (
<SimpleInfoBox
title={`https://www.metricsgarden.xyz/projects/${project.projectId}/contributions/${project.projectId}`}
title={`https://www.metricsgarden.xyz/projects/${project.projectId}/?tab=insights`}
description=""
type="link"
showIcon={false}
Expand Down
10 changes: 5 additions & 5 deletions app/comparison/card/modals/GoodRatingModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ const StarRating: FC<IStarRatingProps> = ({ color, numRated }) => (
);

const ratingOptions = [
{ color: '#FF1D1D', numRated: 1, label: 'No impact on the OP stack' },
{ color: '#FF8C22', numRated: 2, label: 'Low impact on the OP stack' },
{ color: '#F8CE00', numRated: 3, label: 'Medium impact on the OP stack' },
{ color: '#46C34C', numRated: 4, label: 'High impact on the OP stack' },
{ color: '#479F78', numRated: 5, label: 'Very High impact on the OP stack' },
{ color: '#FF1D1D', numRated: 1, label: 'No impact on the OP Governance' },
{ color: '#FF8C22', numRated: 2, label: 'Low impact on the OP Governance' },
{ color: '#F8CE00', numRated: 3, label: 'Medium impact on the OP Governance' },
{ color: '#46C34C', numRated: 4, label: 'High impact on the OP Governance' },
{ color: '#479F78', numRated: 5, label: 'Very High impact on the OP Governance' },
];

const GoodRatingModal: FC<IGoodRatingModalProps> = ({ confirm }) => (
Expand Down
Loading