From e714637da256f47d9b9c4f75a8c4e0c772d2d13e Mon Sep 17 00:00:00 2001 From: tapframe Date: Tue, 8 Jul 2025 14:57:07 +0530 Subject: [PATCH] Enhance UI consistency in AudioTrackModal, SourcesModal, and SubtitleModals by updating border radii, padding, and background colors for improved aesthetics and user experience. --- .../player/modals/AudioTrackModal.tsx | 10 ++-- src/components/player/modals/SourcesModal.tsx | 12 +++-- .../player/modals/SubtitleModals.tsx | 47 ++++++++++++------- 3 files changed, 42 insertions(+), 27 deletions(-) diff --git a/src/components/player/modals/AudioTrackModal.tsx b/src/components/player/modals/AudioTrackModal.tsx index cfc50d6c..4a382813 100644 --- a/src/components/player/modals/AudioTrackModal.tsx +++ b/src/components/player/modals/AudioTrackModal.tsx @@ -73,6 +73,8 @@ export const AudioTrackModal: React.FC = ({ shadowOffset: { width: -5, height: 0 }, shadowOpacity: 0.3, shadowRadius: 10, + borderTopLeftRadius: 20, + borderBottomLeftRadius: 20, }} > {/* Header */} @@ -81,10 +83,10 @@ export const AudioTrackModal: React.FC = ({ alignItems: 'center', justifyContent: 'space-between', paddingHorizontal: 20, - paddingTop: 50, + paddingTop: 60, paddingBottom: 20, borderBottomWidth: 1, - borderBottomColor: 'rgba(255, 255, 255, 0.1)', + borderBottomColor: 'rgba(255, 255, 255, 0.08)', }}> = ({ key={track.id} style={{ backgroundColor: isSelected ? 'rgba(34, 197, 94, 0.15)' : 'rgba(255, 255, 255, 0.05)', - borderRadius: 12, + borderRadius: 16, padding: 16, borderWidth: 1, borderColor: isSelected ? 'rgba(34, 197, 94, 0.3)' : 'rgba(255, 255, 255, 0.1)', @@ -176,7 +178,7 @@ export const AudioTrackModal: React.FC = ({ {vlcAudioTracks.length === 0 && ( diff --git a/src/components/player/modals/SourcesModal.tsx b/src/components/player/modals/SourcesModal.tsx index f8aa33a0..ada3bf39 100644 --- a/src/components/player/modals/SourcesModal.tsx +++ b/src/components/player/modals/SourcesModal.tsx @@ -136,6 +136,8 @@ export const SourcesModal: React.FC = ({ shadowOffset: { width: -5, height: 0 }, shadowOpacity: 0.3, shadowRadius: 10, + borderTopLeftRadius: 20, + borderBottomLeftRadius: 20, }} > {/* Header */} @@ -144,10 +146,10 @@ export const SourcesModal: React.FC = ({ alignItems: 'center', justifyContent: 'space-between', paddingHorizontal: 20, - paddingTop: 50, + paddingTop: 60, paddingBottom: 20, borderBottomWidth: 1, - borderBottomColor: 'rgba(255, 255, 255, 0.1)', + borderBottomColor: 'rgba(255, 255, 255, 0.08)', }}> = ({ {isChangingSource && ( = ({ key={`${providerId}-${index}`} style={{ backgroundColor: isSelected ? 'rgba(59, 130, 246, 0.15)' : 'rgba(255, 255, 255, 0.05)', - borderRadius: 12, + borderRadius: 16, padding: 16, borderWidth: 1, borderColor: isSelected ? 'rgba(59, 130, 246, 0.3)' : 'rgba(255, 255, 255, 0.1)', @@ -303,7 +305,7 @@ export const SourcesModal: React.FC = ({ ) : ( diff --git a/src/components/player/modals/SubtitleModals.tsx b/src/components/player/modals/SubtitleModals.tsx index ff3f0e8b..c0bb047a 100644 --- a/src/components/player/modals/SubtitleModals.tsx +++ b/src/components/player/modals/SubtitleModals.tsx @@ -6,10 +6,6 @@ import Animated, { FadeOut, SlideInRight, SlideOutRight, - useAnimatedStyle, - useSharedValue, - withTiming, - runOnJS, } from 'react-native-reanimated'; import { styles } from '../utils/playerStyles'; import { WyzieSubtitle, SubtitleCue } from '../utils/playerTypes'; @@ -57,18 +53,29 @@ export const SubtitleModals: React.FC = ({ increaseSubtitleSize, decreaseSubtitleSize, }) => { + // Track which specific online subtitle is currently loaded + const [selectedOnlineSubtitleId, setSelectedOnlineSubtitleId] = React.useState(null); + React.useEffect(() => { if (showSubtitleModal && !isLoadingSubtitleList && availableSubtitles.length === 0) { fetchAvailableSubtitles(); } }, [showSubtitleModal]); + // Reset selected online subtitle when switching to built-in tracks + React.useEffect(() => { + if (!useCustomSubtitles) { + setSelectedOnlineSubtitleId(null); + } + }, [useCustomSubtitles]); + const handleClose = () => { setShowSubtitleModal(false); }; - const handleLanguageClose = () => { - setShowSubtitleLanguageModal(false); + const handleLoadWyzieSubtitle = (subtitle: WyzieSubtitle) => { + setSelectedOnlineSubtitleId(subtitle.id); + loadWyzieSubtitle(subtitle); }; // Main subtitle menu @@ -115,6 +122,8 @@ export const SubtitleModals: React.FC = ({ shadowOffset: { width: -5, height: 0 }, shadowOpacity: 0.3, shadowRadius: 10, + borderTopLeftRadius: 20, + borderBottomLeftRadius: 20, }} > {/* Header */} @@ -123,10 +132,10 @@ export const SubtitleModals: React.FC = ({ alignItems: 'center', justifyContent: 'space-between', paddingHorizontal: 20, - paddingTop: 50, + paddingTop: 60, paddingBottom: 20, borderBottomWidth: 1, - borderBottomColor: 'rgba(255, 255, 255, 0.1)', + borderBottomColor: 'rgba(255, 255, 255, 0.08)', }}> = ({ alignItems: 'center', justifyContent: 'space-between', backgroundColor: 'rgba(255, 255, 255, 0.05)', - borderRadius: 12, + borderRadius: 16, padding: 16, }}> = ({ {vlcTextTracks.map((track) => { - const isSelected = selectedTextTrack === track.id; + const isSelected = selectedTextTrack === track.id && !useCustomSubtitles; return ( { selectTextTrack(track.id); + setSelectedOnlineSubtitleId(null); }} activeOpacity={0.7} > @@ -287,7 +297,7 @@ export const SubtitleModals: React.FC = ({ = ({ {availableSubtitles.length > 0 ? ( {availableSubtitles.map((sub) => { - const isSelected = useCustomSubtitles && customSubtitles.length > 0; + const isSelected = useCustomSubtitles && selectedOnlineSubtitleId === sub.id; return ( { - loadWyzieSubtitle(sub); + handleLoadWyzieSubtitle(sub); }} activeOpacity={0.7} disabled={isLoadingSubtitles} @@ -365,7 +375,7 @@ export const SubtitleModals: React.FC = ({ = ({ ) : ( @@ -422,7 +432,7 @@ export const SubtitleModals: React.FC = ({ backgroundColor: selectedTextTrack === -1 && !useCustomSubtitles ? 'rgba(239, 68, 68, 0.15)' : 'rgba(255, 255, 255, 0.05)', - borderRadius: 12, + borderRadius: 16, padding: 16, borderWidth: 1, borderColor: selectedTextTrack === -1 && !useCustomSubtitles @@ -431,6 +441,7 @@ export const SubtitleModals: React.FC = ({ }} onPress={() => { selectTextTrack(-1); + setSelectedOnlineSubtitleId(null); }} activeOpacity={0.7} >