From 90233cd2993340292d1a7e4f4f5b13d447fac046 Mon Sep 17 00:00:00 2001 From: tapframe Date: Sun, 26 Oct 2025 14:10:16 +0530 Subject: [PATCH] repositioned hero action button layout --- src/components/metadata/HeroSection.tsx | 331 ++++++++---------------- 1 file changed, 105 insertions(+), 226 deletions(-) diff --git a/src/components/metadata/HeroSection.tsx b/src/components/metadata/HeroSection.tsx index dd7995874..26a5de8b1 100644 --- a/src/components/metadata/HeroSection.tsx +++ b/src/components/metadata/HeroSection.tsx @@ -120,7 +120,6 @@ const ActionButtons = memo(({ watchProgress, groupedEpisodes, metadata, - aiChatEnabled, settings, // Trakt integration props isAuthenticated, @@ -141,7 +140,6 @@ const ActionButtons = memo(({ watchProgress: any; groupedEpisodes?: { [seasonNumber: number]: any[] }; metadata: any; - aiChatEnabled?: boolean; settings: any; // Trakt integration props isAuthenticated?: boolean; @@ -335,27 +333,22 @@ const ActionButtons = memo(({ return isWatched ? 'Play' : playButtonText; }, [isWatched, playButtonText, type, watchProgress, groupedEpisodes]); - // Determine if we should show buttons in a single row (Play, Save, and optionally one other button) - const hasAiChat = aiChatEnabled; + // Count additional buttons (excluding Play and Save) - AI Chat no longer counted const hasTraktCollection = isAuthenticated; const hasRatings = type === 'series'; - // Count additional buttons (excluding Play and Save) - const additionalButtonCount = (hasAiChat ? 1 : 0) + (hasTraktCollection ? 1 : 0) + (hasRatings ? 1 : 0); - - // Show single row when there are 0 additional buttons (2 total: Play + Save) or 1 additional button (3 total) - const shouldShowSingleRow = additionalButtonCount <= 1; + // Count additional buttons (AI Chat removed - now in top right corner) + const additionalButtonCount = (hasTraktCollection ? 1 : 0) + (hasRatings ? 1 : 0); return ( - {shouldShowSingleRow ? ( - /* Single Row Layout - Play, Save, and optionally one other button (2-3 total) */ - + {/* Single Row Layout - Play, Save, and optionally Collection/Ratings */} + - {/* Third Button - AI Chat, Trakt Collection, or Ratings (only if available) */} - {hasAiChat && additionalButtonCount === 1 && ( - { - // Extract episode info if it's a series - let episodeData = null; - if (type === 'series' && watchProgress?.episodeId) { - const parts = watchProgress.episodeId.split(':'); - if (parts.length >= 3) { - episodeData = { - seasonNumber: parseInt(parts[1], 10), - episodeNumber: parseInt(parts[2], 10) - }; - } - } - - navigation.navigate('AIChat', { - contentId: id, - contentType: type, - episodeId: episodeData ? watchProgress.episodeId : undefined, - seasonNumber: episodeData?.seasonNumber, - episodeNumber: episodeData?.episodeNumber, - title: metadata?.name || metadata?.title || 'Unknown' - }); - }} - activeOpacity={0.85} - > - {Platform.OS === 'ios' ? ( - GlassViewComp && liquidGlassAvailable ? ( - - ) : ( - - ) - ) : ( - - )} - - - )} - - {hasTraktCollection && !hasAiChat && additionalButtonCount === 1 && ( + {/* Trakt Collection Button */} + {hasTraktCollection && ( )} - {hasRatings && !hasAiChat && !hasTraktCollection && additionalButtonCount === 1 && ( + {/* Ratings Button (for series) */} + {hasRatings && ( )} - - ) : ( - <> - {/* Play Button Row - Only Play button */} - - - { - if (isWatched) { - return type === 'movie' ? 'replay' : 'play-arrow'; - } - return playButtonText === 'Resume' ? 'play-circle-outline' : 'play-arrow'; - })()} - size={isTablet ? 28 : 24} - color={isWatched && type === 'movie' ? "#fff" : "#000"} - /> - {finalPlayButtonText} - - - - {/* Secondary Action Row - All other buttons */} - - {/* Save Button */} - - {Platform.OS === 'ios' ? ( - GlassViewComp && liquidGlassAvailable ? ( - - ) : ( - - ) - ) : ( - - )} - - - {inLibrary ? 'Saved' : 'Save'} - - - - {/* AI Chat Button */} - {aiChatEnabled && ( - { - // Extract episode info if it's a series - let episodeData = null; - if (type === 'series' && watchProgress?.episodeId) { - const parts = watchProgress.episodeId.split(':'); - if (parts.length >= 3) { - episodeData = { - seasonNumber: parseInt(parts[1], 10), - episodeNumber: parseInt(parts[2], 10) - }; - } - } - - navigation.navigate('AIChat', { - contentId: id, - contentType: type, - episodeId: episodeData ? watchProgress.episodeId : undefined, - seasonNumber: episodeData?.seasonNumber, - episodeNumber: episodeData?.episodeNumber, - title: metadata?.name || metadata?.title || 'Unknown' - }); - }} - activeOpacity={0.85} - > - {Platform.OS === 'ios' ? ( - GlassViewComp && liquidGlassAvailable ? ( - - ) : ( - - ) - ) : ( - - )} - - - )} - - {/* Trakt Collection Button */} - {isAuthenticated && ( - - {Platform.OS === 'ios' ? ( - GlassViewComp && liquidGlassAvailable ? ( - - ) : ( - - ) - ) : ( - - )} - - - )} - - {/* Ratings Button (for series) */} - {type === 'series' && ( - - {Platform.OS === 'ios' ? ( - GlassViewComp && liquidGlassAvailable ? ( - - ) : ( - - ) - ) : ( - - )} - - - )} - - )} ); }); @@ -1892,6 +1682,95 @@ const HeroSection: React.FC = memo(({ color="white" /> + + {/* AI Chat button */} + {settings?.aiChatEnabled && ( + { + // Extract episode info if it's a series + let episodeData = null; + if (type === 'series' && watchProgress && watchProgress.episodeId) { + const parts = watchProgress.episodeId.split(':'); + if (parts.length >= 3) { + episodeData = { + seasonNumber: parseInt(parts[1], 10), + episodeNumber: parseInt(parts[2], 10) + }; + } + } + + navigation.navigate('AIChat', { + contentId: id, + contentType: type, + episodeId: episodeData && watchProgress ? watchProgress.episodeId : undefined, + seasonNumber: episodeData?.seasonNumber, + episodeNumber: episodeData?.episodeNumber, + title: metadata?.name || metadata?.title || 'Unknown' + }); + }} + activeOpacity={0.7} + onPressIn={(e) => e.stopPropagation()} + onPressOut={(e) => e.stopPropagation()} + style={{ + padding: 8, + backgroundColor: 'rgba(0, 0, 0, 0.5)', + borderRadius: 20, + }} + > + + + )} + + )} + + {/* AI Chat button (when trailers are disabled) */} + {settings?.aiChatEnabled && !(settings?.showTrailers && trailerReady && trailerUrl) && ( + = 768 ? 32 : 16, + zIndex: 1000, + }}> + { + // Extract episode info if it's a series + let episodeData = null; + if (type === 'series' && watchProgress && watchProgress.episodeId) { + const parts = watchProgress.episodeId.split(':'); + if (parts.length >= 3) { + episodeData = { + seasonNumber: parseInt(parts[1], 10), + episodeNumber: parseInt(parts[2], 10) + }; + } + } + + navigation.navigate('AIChat', { + contentId: id, + contentType: type, + episodeId: episodeData && watchProgress ? watchProgress.episodeId : undefined, + seasonNumber: episodeData?.seasonNumber, + episodeNumber: episodeData?.episodeNumber, + title: metadata?.name || metadata?.title || 'Unknown' + }); + }} + activeOpacity={0.7} + style={{ + padding: 8, + backgroundColor: 'rgba(0, 0, 0, 0.5)', + borderRadius: 20, + }} + > + + )} @@ -1992,7 +1871,6 @@ const HeroSection: React.FC = memo(({ watchProgress={watchProgress} groupedEpisodes={groupedEpisodes} metadata={metadata} - aiChatEnabled={settings?.aiChatEnabled} settings={settings} // Trakt integration props isAuthenticated={isAuthenticated} @@ -2179,11 +2057,9 @@ const styles = StyleSheet.create({ }, singleRowPlayButtonFullWidth: { flex: 1, - marginHorizontal: 2, }, singleRowSaveButtonFullWidth: { flex: 1, - marginHorizontal: 2, }, primaryActionRow: { flexDirection: 'row', @@ -2192,6 +2068,10 @@ const styles = StyleSheet.create({ justifyContent: 'center', width: '100%', }, + primaryActionButton: { + flex: 1, + maxWidth: '48%', + }, playButtonRow: { flexDirection: 'row', alignItems: 'center', @@ -2213,7 +2093,6 @@ const styles = StyleSheet.create({ paddingVertical: 11, paddingHorizontal: 16, borderRadius: 26, - flex: 1, }, playButton: { backgroundColor: '#fff',