11import React , { useState , useEffect , useCallback , lazy , Suspense } from 'react' ;
22import useBaseUrl from '@docusaurus/useBaseUrl' ;
33import styles from './PresentationToggle.module.css' ;
4+ import type { PresentationData } from './RevealSlideshow' ;
45
56// Lazy load RevealSlideshow to avoid bundling Reveal.js for all users
67const RevealSlideshow = lazy ( ( ) => import ( './RevealSlideshow' ) ) ;
@@ -9,9 +10,13 @@ interface PresentationToggleProps {
910 lessonPath : string ;
1011}
1112
12- export default function PresentationToggle ( { lessonPath } : PresentationToggleProps ) {
13+ export default function PresentationToggle ( {
14+ lessonPath,
15+ } : PresentationToggleProps ) {
1316 const [ isOpen , setIsOpen ] = useState ( false ) ;
14- const [ presentation , setPresentation ] = useState < any > ( null ) ;
17+ const [ presentation , setPresentation ] = useState < PresentationData | null > (
18+ null
19+ ) ;
1520 const [ loading , setLoading ] = useState ( false ) ;
1621 const [ error , setError ] = useState < string | null > ( null ) ;
1722 const [ hasPresentation , setHasPresentation ] = useState ( false ) ;
@@ -27,7 +32,7 @@ export default function PresentationToggle({ lessonPath }: PresentationTogglePro
2732 // Check if this lesson has a presentation
2833 setHasPresentation ( ! ! manifest [ lessonPath ] ) ;
2934 }
30- } catch ( err ) {
35+ } catch {
3136 // Manifest doesn't exist yet, hide button
3237 setHasPresentation ( false ) ;
3338 }
@@ -42,7 +47,9 @@ export default function PresentationToggle({ lessonPath }: PresentationTogglePro
4247
4348 try {
4449 // Load manifest to get presentation URL
45- const manifestResponse = await fetch ( `${ baseUrl } presentations/manifest.json` ) ;
50+ const manifestResponse = await fetch (
51+ `${ baseUrl } presentations/manifest.json`
52+ ) ;
4653 if ( ! manifestResponse . ok ) {
4754 throw new Error ( 'Presentation manifest not found' ) ;
4855 }
@@ -55,7 +62,9 @@ export default function PresentationToggle({ lessonPath }: PresentationTogglePro
5562 }
5663
5764 // Load presentation data
58- const presentationResponse = await fetch ( `${ baseUrl . replace ( / \/ $ / , '' ) } ${ lessonData . presentationUrl } ` ) ;
65+ const presentationResponse = await fetch (
66+ `${ baseUrl . replace ( / \/ $ / , '' ) } ${ lessonData . presentationUrl } `
67+ ) ;
5968 if ( ! presentationResponse . ok ) {
6069 throw new Error ( 'Failed to load presentation' ) ;
6170 }
@@ -126,7 +135,11 @@ export default function PresentationToggle({ lessonPath }: PresentationTogglePro
126135 ) }
127136
128137 { isOpen && presentation && (
129- < Suspense fallback = { < div className = { styles . loadingOverlay } > Loading presentation...</ div > } >
138+ < Suspense
139+ fallback = {
140+ < div className = { styles . loadingOverlay } > Loading presentation...</ div >
141+ }
142+ >
130143 < RevealSlideshow
131144 presentation = { presentation }
132145 onClose = { ( ) => {
0 commit comments