@@ -46,8 +46,8 @@ import { fetchGlobalHolidayStatus } from './utils/fetch/data';
4646export default function App ( ) {
4747 const { settings } = useSettings ( ) ;
4848 const { user } = useAuth ( ) ;
49- const [ testerGateEnabled , setTesterGateEnabled ] = useState ( true ) ;
50- const [ globalHolidayEnabled , setGlobalHolidayEnabled ] = useState ( true ) ;
49+ const [ testerGateEnabled , setTesterGateEnabled ] = useState ( false ) ;
50+ const [ globalHolidayEnabled , setGlobalHolidayEnabled ] = useState ( false ) ;
5151 const [ showUpdateModal , setShowUpdateModal ] = useState ( false ) ;
5252 const [ activeModal , setActiveModal ] = useState < UpdateModal | null > ( null ) ;
5353
@@ -58,7 +58,7 @@ export default function App() {
5858 setGlobalHolidayEnabled ( status . enabled ) ;
5959 } catch ( error ) {
6060 console . error ( 'Error fetching global holiday status:' , error ) ;
61- setGlobalHolidayEnabled ( true ) ;
61+ setGlobalHolidayEnabled ( false ) ;
6262 }
6363 } ;
6464
@@ -93,6 +93,29 @@ export default function App() {
9393 }
9494 } , [ user ] ) ;
9595
96+ useEffect ( ( ) => {
97+ const checkGateStatus = async ( ) => {
98+ try {
99+ const settings = await getTesterSettings ( ) ;
100+
101+ if ( settings && typeof settings . tester_gate_enabled === 'boolean' ) {
102+ setTesterGateEnabled ( settings . tester_gate_enabled ) ;
103+ } else {
104+ console . error (
105+ 'Failed to fetch tester settings or invalid response:' ,
106+ settings
107+ ) ;
108+ setTesterGateEnabled ( true ) ;
109+ }
110+ } catch ( error ) {
111+ console . error ( 'Error fetching tester settings:' , error ) ;
112+ setTesterGateEnabled ( true ) ;
113+ }
114+ } ;
115+
116+ checkGateStatus ( ) ;
117+ } , [ ] ) ;
118+
96119 const handleCloseModal = ( ) => {
97120 setShowUpdateModal ( false ) ;
98121
@@ -111,30 +134,9 @@ export default function App() {
111134 }
112135 } ;
113136
114- const checkGateStatus = async ( ) => {
115- try {
116- const settings = await getTesterSettings ( ) ;
117-
118- if ( settings && typeof settings . tester_gate_enabled === 'boolean' ) {
119- setTesterGateEnabled ( settings . tester_gate_enabled ) ;
120- } else {
121- console . error (
122- 'Failed to fetch tester settings or invalid response:' ,
123- settings
124- ) ;
125- setTesterGateEnabled ( true ) ;
126- }
127- } catch ( error ) {
128- console . error ( 'Error fetching tester settings:' , error ) ;
129- setTesterGateEnabled ( true ) ;
130- }
131- } ;
132-
133- checkGateStatus ( ) ;
134-
135137 return (
136138 < Router >
137- { globalHolidayEnabled && settings ?. holidayTheme . enabled && (
139+ { globalHolidayEnabled && settings ?. holidayTheme ? .enabled && (
138140 < >
139141 { settings . holidayTheme . snowEffect && < SnowEffect /> }
140142 { settings . holidayTheme . animations && < HolidayAnimations /> }
@@ -164,28 +166,49 @@ export default function App() {
164166 ) : (
165167 < Routes >
166168 < Route
167- path = "/*"
168- element = {
169- < ProtectedRoute >
170- < Routes >
171- < Route index element = { < Home globalHolidayEnabled = { globalHolidayEnabled } /> } />
172- < Route path = "pfatc" element = { < PFATCFlights /> } />
173- < Route path = "create" element = { < Create /> } />
174- < Route path = "sessions" element = { < Sessions /> } />
175- < Route path = "view/:sessionId" element = { < Flights globalHolidayEnabled = { globalHolidayEnabled } /> } />
176- < Route path = "settings" element = { < Settings /> } />
177- < Route path = "*" element = { < NotFound /> } />
178- </ Routes >
179- </ ProtectedRoute >
180- }
169+ path = "/"
170+ element = { < Home globalHolidayEnabled = { globalHolidayEnabled } /> }
181171 />
182-
172+ < Route path = "/pfatc" element = { < PFATCFlights /> } />
183173 < Route path = "/login" element = { < Login /> } />
184174 < Route path = "/login/vatsim/callback" element = { < VatsimCallback /> } />
185175 < Route path = "/submit/:sessionId" element = { < Submit /> } />
186176 < Route path = "acars/:sessionId/:flightId" element = { < ACARS /> } />
187177 < Route path = "/user/:username" element = { < PilotProfile /> } />
188178
179+ < Route
180+ path = "/create"
181+ element = {
182+ < ProtectedRoute >
183+ < Create />
184+ </ ProtectedRoute >
185+ }
186+ />
187+ < Route
188+ path = "/sessions"
189+ element = {
190+ < ProtectedRoute >
191+ < Sessions />
192+ </ ProtectedRoute >
193+ }
194+ />
195+ < Route
196+ path = "/view/:sessionId"
197+ element = {
198+ < ProtectedRoute >
199+ < Flights globalHolidayEnabled = { globalHolidayEnabled } />
200+ </ ProtectedRoute >
201+ }
202+ />
203+ < Route
204+ path = "/settings"
205+ element = {
206+ < ProtectedRoute >
207+ < Settings />
208+ </ ProtectedRoute >
209+ }
210+ />
211+
189212 < Route
190213 path = "/admin/*"
191214 element = {
0 commit comments