Skip to content

Commit f67cc19

Browse files
committed
Bug fixes and cleanups
1 parent b47c048 commit f67cc19

File tree

1 file changed

+0
-58
lines changed

1 file changed

+0
-58
lines changed

website/src/components/LessonAudioPlayer.tsx

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -22,88 +22,34 @@ export default function LessonAudioPlayer(): React.ReactElement | null {
2222
const [playbackRate, setPlaybackRate] = useState(1);
2323
const [isLoading, setIsLoading] = useState(true);
2424

25-
// Debug: log component mount
26-
console.log('[AudioPlayer] Component mounted with metadata:', {
27-
source: metadata.source,
28-
id: metadata.id,
29-
title: metadata.title,
30-
});
31-
3225
// Load manifest and find audio for current page
3326
useEffect(() => {
3427
async function loadAudio() {
35-
console.log('[AudioPlayer BROWSER] useEffect triggered');
36-
console.log('[AudioPlayer BROWSER] Metadata source:', metadata.source);
37-
3828
try {
3929
const manifestUrl = '/AI-Coding-Course/audio/manifest.json';
40-
console.log(
41-
'[AudioPlayer BROWSER] Fetching manifest from:',
42-
manifestUrl
43-
);
44-
4530
const response = await fetch(manifestUrl);
46-
console.log(
47-
'[AudioPlayer BROWSER] Fetch response status:',
48-
response.status
49-
);
50-
console.log('[AudioPlayer BROWSER] Fetch response ok:', response.ok);
5131

5232
if (!response.ok) {
53-
console.log(
54-
'[AudioPlayer BROWSER] Failed to fetch manifest:',
55-
response.status
56-
);
5733
setIsLoading(false);
5834
return;
5935
}
6036

6137
const manifest: AudioManifest = await response.json();
62-
console.log('[AudioPlayer BROWSER] Manifest loaded successfully');
63-
console.log(
64-
'[AudioPlayer BROWSER] Manifest keys:',
65-
Object.keys(manifest)
66-
);
6738

6839
// Get source file path from metadata
6940
const sourcePath = metadata.source.replace(/@site\/docs\//, '');
70-
console.log(
71-
'[AudioPlayer BROWSER] Transformed source path:',
72-
sourcePath
73-
);
74-
console.log(
75-
'[AudioPlayer BROWSER] Looking for key in manifest:',
76-
sourcePath
77-
);
7841

7942
// Look for matching audio in manifest
8043
const audioEntry = manifest[sourcePath];
81-
console.log(
82-
'[AudioPlayer BROWSER] Manifest lookup result:',
83-
audioEntry
84-
);
8544

8645
if (audioEntry) {
87-
console.log('[AudioPlayer BROWSER] Found audio entry:', audioEntry);
8846
// Prepend base URL for Docusaurus
8947
const fullAudioUrl = `/AI-Coding-Course${audioEntry.audioUrl}`;
90-
console.log('[AudioPlayer BROWSER] Setting audio URL:', fullAudioUrl);
9148
setAudioUrl(fullAudioUrl);
92-
} else {
93-
console.log('[AudioPlayer BROWSER] No audio found for:', sourcePath);
94-
console.log(
95-
'[AudioPlayer BROWSER] Exact match required. Available keys:',
96-
Object.keys(manifest)
97-
);
9849
}
9950

10051
setIsLoading(false);
101-
console.log(
102-
'[AudioPlayer BROWSER] Finished loading, isLoading set to false'
103-
);
10452
} catch (error) {
105-
console.error('[AudioPlayer BROWSER] Error during load:', error);
106-
console.error('[AudioPlayer BROWSER] Error stack:', error.stack);
10753
setIsLoading(false);
10854
}
10955
}
@@ -169,18 +115,14 @@ export default function LessonAudioPlayer(): React.ReactElement | null {
169115

170116
// Don't render if still loading
171117
if (isLoading) {
172-
console.log('[AudioPlayer BROWSER] Not rendering - still loading');
173118
return null;
174119
}
175120

176121
// Don't render if no audio found
177122
if (!audioUrl) {
178-
console.log('[AudioPlayer BROWSER] Not rendering - no audio URL found');
179123
return null;
180124
}
181125

182-
console.log('[AudioPlayer BROWSER] Rendering player with URL:', audioUrl);
183-
184126
return (
185127
<div className={styles.audioPlayer}>
186128
<audio ref={audioRef} src={audioUrl} preload="metadata" />

0 commit comments

Comments
 (0)