diff --git a/src/components/player/modals/SubtitleModals.tsx b/src/components/player/modals/SubtitleModals.tsx index e7f3bef..14e8bad 100644 --- a/src/components/player/modals/SubtitleModals.tsx +++ b/src/components/player/modals/SubtitleModals.tsx @@ -128,6 +128,12 @@ export const SubtitleModals: React.FC = ({ }; }, [showSubtitleLanguageModal]); + React.useEffect(() => { + if (showSubtitleLanguageModal && !isLoadingSubtitleList && availableSubtitles.length === 0) { + fetchAvailableSubtitles(); + } + }, [showSubtitleLanguageModal]); + const modalStyle = useAnimatedStyle(() => ({ opacity: modalOpacity.value, })); @@ -372,6 +378,48 @@ export const SubtitleModals: React.FC = ({ Subtitle Source + fetchAvailableSubtitles()} + > + + + + Search Online Subtitles + + + + + + + + + = ({ - {availableSubtitles.map((sub) => ( - - { - loadWyzieSubtitle(sub); - handleLanguageClose(); - }} - activeOpacity={0.85} - > - - - { + const isCustomSelected = useCustomSubtitles && customSubtitles.length > 0; + const isThisSubSelected = isCustomSelected; // Since we only load one custom sub at a time + + return ( + + { + loadWyzieSubtitle(sub); + handleLanguageClose(); + }} + activeOpacity={0.85} + disabled={isLoadingSubtitles} + > + + + + + {sub.display} + + + {isThisSubSelected && ( + + + + LOADED + + + )} + + + + {isThisSubSelected && ( + + )} + + + + - {sub.display} - - - + {isLoadingSubtitles ? ( + + ) : ( + + )} - - - - - ))} + + + ); + })} )} + + {/* No Subtitles Option */} + + { + selectTextTrack(-1); + handleLanguageClose(); + }} + activeOpacity={0.85} + > + + + + + No Subtitles + + + {selectedTextTrack === -1 && !useCustomSubtitles && ( + + + + ACTIVE + + + )} + + + + + + + + + + + + +