);
diff --git a/app/(landing)/hackathons/[slug]/components/tabs/contents/winners/TopWinnerCard.tsx b/app/(landing)/hackathons/[slug]/components/tabs/contents/winners/TopWinnerCard.tsx
index d1b5cea7..4d051904 100644
--- a/app/(landing)/hackathons/[slug]/components/tabs/contents/winners/TopWinnerCard.tsx
+++ b/app/(landing)/hackathons/[slug]/components/tabs/contents/winners/TopWinnerCard.tsx
@@ -4,6 +4,7 @@ import { Trophy } from 'lucide-react';
import Image from 'next/image';
import { SubmissionCardProps } from '@/types/hackathon';
import BasicAvatar from '@/components/avatars/BasicAvatar';
+import { BoundlessButton } from '@/components/buttons/BoundlessButton';
interface TopWinnerCardProps {
winner: HackathonWinner;
@@ -12,6 +13,7 @@ interface TopWinnerCardProps {
export const TopWinnerCard = ({ winner, submission }: TopWinnerCardProps) => {
const bannerUrl = winner?.logo || '/images/default-project-banner.png'; // Fallback to logo or default
+ const projectUrl = `/projects/${winner.submissionId}?type=submission`;
return (
@@ -63,36 +65,29 @@ export const TopWinnerCard = ({ winner, submission }: TopWinnerCardProps) => {
'No description provided for this project.'}
-
-
- {winner.participants.map((participant, idx) => (
-
- //
- //
- //
- // {participant.username.slice(0, 2).toUpperCase()}
- //
- //
- ))}
+
+
+
+ {winner.participants.map((participant, idx) => (
+
+ ))}
+
- {/*
-
- {winner.teamName ? 'Team members' : 'Participant'}
-
-
- {winner.teamName
- ? winner.teamName
- : winner.participants[0]?.username}
-
-
*/}
+
+
+
+ View Project
+
+
diff --git a/hooks/use-hackathon-rewards.ts b/hooks/use-hackathon-rewards.ts
index 0e9164cc..06231076 100644
--- a/hooks/use-hackathon-rewards.ts
+++ b/hooks/use-hackathon-rewards.ts
@@ -1,14 +1,10 @@
import React, { useState, useEffect, useRef, useCallback } from 'react';
import pLimit from 'p-limit';
-import { useGetEscrowFromIndexerByContractIds } from '@trustless-work/escrow/hooks';
-import type {
- GetEscrowFromIndexerByContractIdsParams,
- MultiReleaseEscrow,
-} from '@trustless-work/escrow';
// Import Hackathon types
import {
getJudgingSubmissions,
getHackathon,
+ getHackathonEscrow,
type Hackathon,
type HackathonEscrowData,
} from '@/lib/api/hackathons';
@@ -24,37 +20,6 @@ import { PrizeTier } from '@/components/organization/hackathons/new/tabs/schemas
import { toast } from 'sonner';
import { reportError } from '@/lib/error-reporting';
-const mapEscrowToHackathonEscrowData = (
- escrowData: MultiReleaseEscrow
-): HackathonEscrowData => {
- const isFunded = (escrowData.balance || 0) > 0;
- const canUpdate = isFunded;
-
- return {
- contractId: escrowData.contractId || '',
- escrowAddress: escrowData.contractId || '',
- balance: escrowData.balance || 0,
- milestones:
- escrowData.milestones?.map(milestone => ({
- description: milestone.description || '',
- amount: milestone.amount || 0,
- receiver: milestone.receiver || '',
- status: milestone.status || 'pending',
- evidence: milestone.evidence || '',
- flags: milestone.flags
- ? {
- approved: milestone.flags.approved || false,
- disputed: milestone.flags.disputed || false,
- released: milestone.flags.released || false,
- resolved: milestone.flags.resolved || false,
- }
- : undefined,
- })) || [],
- isFunded,
- canUpdate,
- };
-};
-
const getOrdinalSuffix = (i: number) => {
const j = i % 10,
k = i % 100;
@@ -117,8 +82,6 @@ export const useHackathonRewards = (
organizationId: string,
hackathonId: string
): UseHackathonRewardsReturn => {
- const { getEscrowByContractIds } = useGetEscrowFromIndexerByContractIds();
-
const [submissions, setSubmissions] = useState
([]);
const [escrow, setEscrow] = useState(null);
const [prizeTiers, setPrizeTiers] = useState([]);
@@ -146,29 +109,10 @@ export const useHackathonRewards = (
setIsLoadingEscrow(true);
try {
- const params: GetEscrowFromIndexerByContractIdsParams = {
- contractIds: [contractIdToFetch],
- };
-
- const response = await getEscrowByContractIds(params);
-
- let escrows: MultiReleaseEscrow[] = [];
-
- if (Array.isArray(response)) {
- escrows = response as MultiReleaseEscrow[];
- } else if (
- response &&
- typeof response === 'object' &&
- 'escrows' in response
- ) {
- escrows =
- (response as { escrows: MultiReleaseEscrow[] }).escrows || [];
- }
+ const response = await getHackathonEscrow(organizationId, hackathonId);
- if (escrows.length > 0) {
- const escrowData = escrows[0] as MultiReleaseEscrow;
- const mappedEscrow = mapEscrowToHackathonEscrowData(escrowData);
- setEscrow(mappedEscrow);
+ if (response.success && response.data) {
+ setEscrow(response.data);
} else {
setEscrow(null);
}
@@ -180,7 +124,7 @@ export const useHackathonRewards = (
isFetchingEscrowRef.current = false;
}
},
- [getEscrowByContractIds]
+ [organizationId, hackathonId]
);
const refreshEscrow = useCallback(async () => {
diff --git a/lib/api/hackathons.ts b/lib/api/hackathons.ts
index 52b95d3b..ad1f4197 100644
--- a/lib/api/hackathons.ts
+++ b/lib/api/hackathons.ts
@@ -1611,7 +1611,7 @@ export const getHackathonEscrow = async (
hackathonId: string
): Promise => {
const res = await api.get(
- `/organizations/${organizationId}/hackathons/${hackathonId}/escrow`
+ `/organizations/${organizationId}/hackathons/${hackathonId}/rewards/escrow`
);
return res.data;
};
diff --git a/lib/api/hackathons/rewards.ts b/lib/api/hackathons/rewards.ts
index fda5a064..16f3d35c 100644
--- a/lib/api/hackathons/rewards.ts
+++ b/lib/api/hackathons/rewards.ts
@@ -181,7 +181,7 @@ export const getHackathonEscrow = async (
hackathonId: string
): Promise => {
const res = await api.get(
- `/organizations/${organizationId}/hackathons/${hackathonId}/escrow`
+ `/organizations/${organizationId}/hackathons/${hackathonId}/rewards/escrow`
);
return res.data;
};