@@ -9,20 +9,29 @@ import {
99 Check ,
1010} from 'lucide-react' ;
1111import { useHackathons } from '@/hooks/use-hackathons' ;
12- import { useEffect } from 'react' ;
12+ import { useEffect , useState } from 'react' ;
1313import { useHackathonAnalytics } from '@/hooks/use-hackathon-analytics' ;
1414import { Alert , AlertDescription , AlertTitle } from '@/components/ui/alert' ;
1515import { HackathonStatistics } from '@/components/organization/hackathons/details/HackathonStatistics' ;
1616import { HackathonCharts } from '@/components/organization/hackathons/details/HackathonCharts' ;
1717import { HackathonTimeline } from '@/components/organization/hackathons/details/HackathonTimeline' ;
1818import { AuthGuard } from '@/components/auth' ;
1919import Loading from '@/components/Loading' ;
20+ import HackathonPublishedModal from '@/components/organization/hackathons/new/tabs/components/review/HackathonPublishedModal' ;
21+ import type { PublishResponseData } from '@/hooks/use-hackathon-publish' ;
22+
23+ const STORAGE_KEY = 'boundless_hackathon_published' ;
2024
2125export default function HackathonPage ( ) {
2226 const params = useParams ( ) ;
2327 const organizationId = params . id as string ;
2428 const hackathonId = params . hackathonId as string ;
2529
30+ const [ publishedModalData , setPublishedModalData ] = useState < {
31+ publishResponse : PublishResponseData ;
32+ organizationId : string ;
33+ } | null > ( null ) ;
34+
2635 const { currentHackathon, currentLoading, currentError, fetchHackathon } =
2736 useHackathons ( {
2837 organizationId,
@@ -41,6 +50,37 @@ export default function HackathonPage() {
4150 }
4251 } , [ organizationId , hackathonId , fetchHackathon ] ) ;
4352
53+ useEffect ( ( ) => {
54+ try {
55+ const raw = sessionStorage . getItem ( STORAGE_KEY ) ;
56+ if ( ! raw ) return ;
57+ const payload = JSON . parse ( raw ) as {
58+ organizationId : string ;
59+ id : string ;
60+ slug : string ;
61+ publishedAt : string ;
62+ message : string ;
63+ escrowAddress : string ;
64+ transactionHash : string | null ;
65+ } ;
66+ if ( payload . id !== hackathonId ) return ;
67+ sessionStorage . removeItem ( STORAGE_KEY ) ;
68+ setPublishedModalData ( {
69+ publishResponse : {
70+ id : payload . id ,
71+ slug : payload . slug ,
72+ publishedAt : payload . publishedAt ,
73+ message : payload . message ,
74+ escrowAddress : payload . escrowAddress ,
75+ transactionHash : payload . transactionHash ,
76+ } ,
77+ organizationId : payload . organizationId ,
78+ } ) ;
79+ } catch {
80+ // ignore
81+ }
82+ } , [ hackathonId ] ) ;
83+
4484 if ( currentLoading ) {
4585 return (
4686 < div className = 'flex min-h-screen items-center justify-center bg-black' >
@@ -95,6 +135,15 @@ export default function HackathonPage() {
95135 return (
96136 < AuthGuard redirectTo = '/auth?mode=signin' fallback = { < Loading /> } >
97137 < div className = 'min-h-screen bg-black' >
138+ < HackathonPublishedModal
139+ open = { ! ! publishedModalData }
140+ onOpenChange = { open => {
141+ if ( ! open ) setPublishedModalData ( null ) ;
142+ } }
143+ publishResponse = { publishedModalData ?. publishResponse ?? null }
144+ organizationId = { publishedModalData ?. organizationId }
145+ />
146+
98147 { /* Hero Section with Hackathon Name */ }
99148 < div className = 'border-b border-gray-900 p-4' >
100149 < div className = 'mx-auto max-w-7xl' >
0 commit comments