From 99424d37be9f76e7b0502b674f2ecbb0b125e74b Mon Sep 17 00:00:00 2001 From: tapframe Date: Sun, 31 Aug 2025 14:12:38 +0530 Subject: [PATCH] some ui changes --- src/components/metadata/HeroSection.tsx | 117 +++++++++++++++++++++--- 1 file changed, 102 insertions(+), 15 deletions(-) diff --git a/src/components/metadata/HeroSection.tsx b/src/components/metadata/HeroSection.tsx index 6d62d164..d2c29c6a 100644 --- a/src/components/metadata/HeroSection.tsx +++ b/src/components/metadata/HeroSection.tsx @@ -7,6 +7,7 @@ import { TouchableOpacity, Platform, InteractionManager, + StatusBar, } from 'react-native'; import { MaterialIcons } from '@expo/vector-icons'; import { LinearGradient } from 'expo-linear-gradient'; @@ -702,6 +703,7 @@ const HeroSection: React.FC = memo(({ const [isTrailerPlaying, setIsTrailerPlaying] = useState(false); const [trailerReady, setTrailerReady] = useState(false); const [trailerPreloaded, setTrailerPreloaded] = useState(false); + const [isTrailerFullscreen, setIsTrailerFullscreen] = useState(false); const imageOpacity = useSharedValue(1); const imageLoadOpacity = useSharedValue(0); const shimmerOpacity = useSharedValue(0.3); @@ -745,6 +747,13 @@ const HeroSection: React.FC = memo(({ trailerOpacity.value = withTiming(0, { duration: 300 }); thumbnailOpacity.value = withTiming(1, { duration: 300 }); }, [trailerOpacity, thumbnailOpacity]); + + // Handle trailer fullscreen toggle + const handleTrailerFullscreenToggle = useCallback(() => { + setIsTrailerFullscreen(true); + // Hide status bar when entering fullscreen + StatusBar.setHidden(true, 'slide'); + }, []); // Memoized image source const imageSource = useMemo(() => @@ -951,6 +960,9 @@ const HeroSection: React.FC = memo(({ imageLoadOpacity.value = 0; shimmerOpacity.value = 0.3; interactionComplete.current = false; + + // Restore status bar when component unmounts + StatusBar.setHidden(false, 'slide'); }; }, []); @@ -968,6 +980,38 @@ const HeroSection: React.FC = memo(({ } }); + // Don't render hero content when trailer is in fullscreen + if (isTrailerFullscreen) { + return ( + + {/* Back button for fullscreen mode */} + { + setIsTrailerFullscreen(false); + // Restore status bar when exiting fullscreen + StatusBar.setHidden(false, 'slide'); + }} + activeOpacity={0.7} + > + + + + {trailerUrl && ( + + )} + + ); + } + return ( {/* Optimized Background */} @@ -1048,21 +1092,32 @@ const HeroSection: React.FC = memo(({ zIndex: 10, opacity: trailerOpacity }}> - setTrailerMuted(!trailerMuted)} - activeOpacity={0.7} - style={{ - padding: 8, - backgroundColor: 'rgba(0, 0, 0, 0.5)', - borderRadius: 20, - }} - > - - + + setTrailerMuted(!trailerMuted)} + activeOpacity={0.7} + style={styles.trailerControlButton} + > + + + + {/* Fullscreen button */} + + + + )} @@ -1173,6 +1228,20 @@ const styles = StyleSheet.create({ backgroundColor: '#000', overflow: 'hidden', }, + fullscreenTrailerContainer: { + position: 'absolute', + top: 0, + left: 0, + right: 0, + bottom: 0, + zIndex: 9999, + backgroundColor: '#000', + }, + fullscreenTrailerPlayer: { + flex: 1, + width: '100%', + height: '100%', + }, absoluteFill: { position: 'absolute', top: 0, @@ -1194,6 +1263,15 @@ const styles = StyleSheet.create({ textShadowOffset: { width: 0, height: 2 }, textShadowRadius: 3, }, + fullscreenBackButton: { + position: 'absolute', + top: Platform.OS === 'android' ? 40 : 50, + left: isTablet ? 32 : 16, + zIndex: 10, + padding: 8, + backgroundColor: 'rgba(0, 0, 0, 0.5)', + borderRadius: 20, + }, heroGradient: { flex: 1, @@ -1708,6 +1786,15 @@ const styles = StyleSheet.create({ opacity: 0.8, marginBottom: 1, }, + trailerControlsContainer: { + flexDirection: 'row', + gap: 10, + }, + trailerControlButton: { + padding: 8, + backgroundColor: 'rgba(0, 0, 0, 0.5)', + borderRadius: 20, + }, }); export default HeroSection; \ No newline at end of file