Skip to content
Open
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
6 changes: 3 additions & 3 deletions app/allocation/[category]/components/RankingRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ const RankingRow: FC<IRankingRowProps> = ({
<div className="relative">
<div className={`flex gap-2 rounded-md border border-op-neutral-300 px-6 py-1 ${locked ? 'bg-gray-200' : 'bg-white'}`}>
<button
onClick={() => onVote(project.projectId, project.share - 0.01)}
onClick={() => onVote(project.projectId, Math.max(project.share - 0.01, 0))}
className={`font-bold ${
coi ? 'text-dark-500/[.2]' : 'text-gray-600'
}`}
disabled={locked || coi || project.share === 0}
disabled={locked || coi || project.share <= 0}
>
-
</button>
Expand All @@ -125,7 +125,7 @@ const RankingRow: FC<IRankingRowProps> = ({
allowNegative={false}
/>
<button
onClick={() => onVote(project.projectId, project.share + 0.01)}
onClick={() => onVote(project.projectId, Math.min(project.share + 0.01, 1))}
className={`font-bold ${
coi ? 'text-dark-500/[.2]' : 'text-gray-600'
}`}
Expand Down
22 changes: 16 additions & 6 deletions app/allocation/[category]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ import {
useCategoryRankings,
} from '@/app/comparison/utils/data-fetching/ranking';
import { CheckIcon } from '@/public/assets/icon-components/Check';
import { IProjectRanking } from '@/app/comparison/utils/types';
import {
IProjectRanking,
CollectionProgressStatusEnum,
} from '@/app/comparison/utils/types';
import { ArrowLeft2Icon } from '@/public/assets/icon-components/ArrowLeft2';
import { ArrowRightIcon } from '@/public/assets/icon-components/ArrowRight';
import { Info2Icon } from '@/public/assets/icon-components/Info2';
Expand Down Expand Up @@ -119,7 +122,10 @@ const RankingPage = () => {
percentage: share * 100,
});

const sum = newRanking.reduce((acc, curr) => (acc += curr.percentage), 0);
const sum = newRanking.reduce(
(acc, curr) => (acc += curr.percentage),
0
);

const newProjects = projects.map(project => ({
...project,
Expand All @@ -130,9 +136,7 @@ const RankingPage = () => {

setProjects(newProjects);

setNonCoIProjects(
newProjects.filter(project => !project.coi)
);
setNonCoIProjects(newProjects.filter(project => !project.coi));

if (sum < 99.9) {
const deficit = 100 - sum;
Expand Down Expand Up @@ -366,7 +370,13 @@ const RankingPage = () => {
useEffect(() => {
if (ranking) setProjects(ranking?.ranking);

setNonCoIProjects(ranking?.ranking?.filter(project => !project.coi) || []);
setNonCoIProjects(
ranking?.ranking?.filter(project => !project.coi) || []
);

if (categoryRankings?.progress === CollectionProgressStatusEnum.Attested) {
setAttestationLink(categoryRankings?.attestationLink);
}

if (!categoryRankings?.budget) return;

Expand Down
6 changes: 3 additions & 3 deletions public/assets/icon-components/COI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export const COI: FC<{ isActive: boolean }> = ({ isActive }) => {
<path
d="M8 6.00015V8.66682M8 11.3335H8.00667M7.07688 2.59464L1.59362 12.0657C1.28948 12.591 1.13742 12.8537 1.15989 13.0693C1.1795 13.2573 1.27801 13.4282 1.43091 13.5394C1.60622 13.6668 1.90973 13.6668 2.51674 13.6668H13.4833C14.0903 13.6668 14.3938 13.6668 14.5691 13.5394C14.722 13.4282 14.8205 13.2573 14.8401 13.0693C14.8626 12.8537 14.7105 12.591 14.4064 12.0657L8.92312 2.59463C8.62007 2.07119 8.46855 1.80947 8.27087 1.72157C8.09843 1.64489 7.90157 1.64489 7.72913 1.72157C7.53145 1.80947 7.37992 2.07119 7.07688 2.59464Z"
stroke="#FF0420"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
)
Expand Down