diff --git a/app/allocation/[category]/page.tsx b/app/allocation/[category]/page.tsx index 217abb8..c324a4e 100644 --- a/app/allocation/[category]/page.tsx +++ b/app/allocation/[category]/page.tsx @@ -172,7 +172,7 @@ 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; diff --git a/app/allocation/components/BudgetAllocation.tsx b/app/allocation/components/BudgetAllocation.tsx index 4629e20..44fd730 100644 --- a/app/allocation/components/BudgetAllocation.tsx +++ b/app/allocation/components/BudgetAllocation.tsx @@ -48,15 +48,13 @@ const BudgetAllocation: React.FC = ({ const renderProgressState = useMemo(() => { switch (progress) { - case CollectionProgressStatusEnum.Finished: - return ; case CollectionProgressStatusEnum.Attested: return ( ); case CollectionProgressStatusEnum.Delegated: @@ -67,6 +65,7 @@ const BudgetAllocation: React.FC = ({ username={username} /> ); + case CollectionProgressStatusEnum.Finished: case CollectionProgressStatusEnum.Pending: default: return ( diff --git a/app/allocation/components/ProgressCards/PendingCategory.tsx b/app/allocation/components/ProgressCards/PendingCategory.tsx index 5ad7a05..7f07cdb 100644 --- a/app/allocation/components/ProgressCards/PendingCategory.tsx +++ b/app/allocation/components/ProgressCards/PendingCategory.tsx @@ -63,7 +63,7 @@ const PendingCategory = ({

)} - {progress === 'WIP' + {(progress === 'WIP' || progress === 'Finished') && !(isBadgeholder && bhCategory !== categorySlug) && (

Voting

diff --git a/app/allocation/page.tsx b/app/allocation/page.tsx index 96f9367..a7cb669 100644 --- a/app/allocation/page.tsx +++ b/app/allocation/page.tsx @@ -133,6 +133,11 @@ const AllocationPage = () => { = useState>(); const [targetDelegate, setTargetDelegate] = useState(); + const [rankingProgress, setRankingProgress] + = useState( + CollectionProgressStatusEnum.Pending + ); + const { mutateAsync: updateCategoriesRanking } = useUpdateCategoriesRanking({ budget: totalValue, allocationPercentages: @@ -304,6 +309,12 @@ const AllocationPage = () => { ); }; + useEffect(() => { + if (categoryRankings) { + setRankingProgress(categoryRankings.progress); + } + }, [categoryRankings]); + useEffect(() => { if (delegations) { const budgetDelegateFromYou = delegations?.fromYou?.budget; @@ -315,10 +326,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) { diff --git a/app/comparison/card/GithubBox.tsx b/app/comparison/card/GithubBox.tsx index 14f6ee0..7cf2d3c 100644 --- a/app/comparison/card/GithubBox.tsx +++ b/app/comparison/card/GithubBox.tsx @@ -55,13 +55,13 @@ const GithubBox: FC = ({ repo }) => { {isExpanded ? (
- Hide metrics + {'metrics' in repo && repo.metrics && Hide metrics }
) : (
- View metrics + {'metrics' in repo && repo.metrics && View metrics }
)} diff --git a/app/comparison/card/ProjectCard.tsx b/app/comparison/card/ProjectCard.tsx index dca3b03..d6b5d0d 100644 --- a/app/comparison/card/ProjectCard.tsx +++ b/app/comparison/card/ProjectCard.tsx @@ -161,9 +161,9 @@ export const ProjectCard: React.FC = ({ 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); } }; @@ -241,7 +241,7 @@ export const ProjectCard: React.FC = ({ coi || coiLoading ? 'brightness-50' : '' }`} > -
+
{/* Cover Image and Profile Avatar */}
@@ -424,7 +424,7 @@ export const ProjectCard: React.FC = ({ /> {project.testimonials?.length && ( { export const getProjectsRankingByCategoryId = async ( cid: number | undefined ): Promise => { - if (!cid) return { ranking: [], hasRanking: false, isFinished: false, progress: 'Pending', attestationLink: '', budget: 0, name: '', share: 0, id: 0 }; + if (!cid) return { ranking: [], hasRanking: false, isFinished: false, progress: CollectionProgressStatusEnum.Pending, attestationLink: '', budget: 0, name: '', share: 0, id: 0 }; return ( await axiosInstance.get(`flow/ranking?cid=${cid}