@@ -5,9 +5,14 @@ import type React from 'react';
55import OrganizationHeader from '@/components/organization/OrganizationHeader' ;
66import OrganizationSidebar from '@/components/organization/OrganizationSidebar' ;
77import { usePathname } from 'next/navigation' ;
8- import { OrganizationProvider } from '@/lib/providers' ;
8+ import {
9+ OrganizationProvider ,
10+ NavigationLoadingProvider ,
11+ useNavigationLoading ,
12+ } from '@/lib/providers' ;
913import NewHackathonSidebar from '@/components/organization/hackathons/new/NewHackathonSidebar' ;
1014import HackathonSidebar from '@/components/organization/hackathons/details/HackathonSidebar' ;
15+ import HackathonNavigationLoader from '@/components/organization/hackathons/details/HackathonNavigationLoader' ;
1116export default function OrganizationsLayout ( {
1217 children,
1318} : {
@@ -39,26 +44,59 @@ export default function OrganizationsLayout({
3944
4045 return (
4146 < OrganizationProvider initialOrgId = { initialOrgId || undefined } >
42- < div className = 'bg-background-main-bg relative min-h-screen text-white' >
43- < OrganizationHeader />
44- { showOrganizationSidebar ? (
45- < div className = 'relative border-t border-t-zinc-800' >
46- { showOrganizationSidebar &&
47- ! showNewHackathonSidebar &&
48- ! showNewGrantSidebar &&
49- ! showHackathonSidebar && < OrganizationSidebar /> }
50- { showNewHackathonSidebar && < NewHackathonSidebar /> }
51- { showHackathonSidebar && (
52- < HackathonSidebar organizationId = { initialOrgId || undefined } />
53- ) }
54- { /* {showNewGrantSidebar && <NewGrantSidebar />} */ }
55-
56- < main className = 'md:ml-[350px]' > { children } </ main >
57- </ div >
58- ) : (
59- < main > { children } </ main >
60- ) }
61- </ div >
47+ < NavigationLoadingProvider >
48+ < OrganizationsLayoutContent
49+ showOrganizationSidebar = { showOrganizationSidebar }
50+ showNewHackathonSidebar = { showNewHackathonSidebar }
51+ showNewGrantSidebar = { showNewGrantSidebar }
52+ showHackathonSidebar = { showHackathonSidebar }
53+ initialOrgId = { initialOrgId }
54+ >
55+ { children }
56+ </ OrganizationsLayoutContent >
57+ </ NavigationLoadingProvider >
6258 </ OrganizationProvider >
6359 ) ;
6460}
61+
62+ function OrganizationsLayoutContent ( {
63+ children,
64+ showOrganizationSidebar,
65+ showNewHackathonSidebar,
66+ showNewGrantSidebar,
67+ showHackathonSidebar,
68+ initialOrgId,
69+ } : {
70+ children : React . ReactNode ;
71+ showOrganizationSidebar : boolean ;
72+ showNewHackathonSidebar : boolean ;
73+ showNewGrantSidebar : boolean ;
74+ showHackathonSidebar : boolean ;
75+ initialOrgId : string | null ;
76+ } ) {
77+ const { isNavigating } = useNavigationLoading ( ) ;
78+
79+ return (
80+ < div className = 'bg-background-main-bg relative min-h-screen text-white' >
81+ { isNavigating && < HackathonNavigationLoader /> }
82+ < OrganizationHeader />
83+ { showOrganizationSidebar ? (
84+ < div className = 'relative border-t border-t-zinc-800' >
85+ { showOrganizationSidebar &&
86+ ! showNewHackathonSidebar &&
87+ ! showNewGrantSidebar &&
88+ ! showHackathonSidebar && < OrganizationSidebar /> }
89+ { showNewHackathonSidebar && < NewHackathonSidebar /> }
90+ { showHackathonSidebar && (
91+ < HackathonSidebar organizationId = { initialOrgId || undefined } />
92+ ) }
93+ { /* {showNewGrantSidebar && <NewGrantSidebar />} */ }
94+
95+ < main className = 'md:ml-[350px]' > { children } </ main >
96+ </ div >
97+ ) : (
98+ < main > { children } </ main >
99+ ) }
100+ </ div >
101+ ) ;
102+ }
0 commit comments