From 011f480fc1945dffaf911e084388dff5b7b462d2 Mon Sep 17 00:00:00 2001 From: tapframe Date: Tue, 25 Nov 2025 01:57:50 +0530 Subject: [PATCH] simplified thisweeeksection cards --- src/components/home/ThisWeekSection.tsx | 284 ++++++++++++------------ 1 file changed, 137 insertions(+), 147 deletions(-) diff --git a/src/components/home/ThisWeekSection.tsx b/src/components/home/ThisWeekSection.tsx index f9a53a6..3146f07 100644 --- a/src/components/home/ThisWeekSection.tsx +++ b/src/components/home/ThisWeekSection.tsx @@ -60,7 +60,7 @@ export const ThisWeekSection = React.memo(() => { // Enhanced responsive sizing for tablets and TV screens const deviceWidth = Dimensions.get('window').width; const deviceHeight = Dimensions.get('window').height; - + // Determine device type based on width const getDeviceType = useCallback(() => { if (deviceWidth >= BREAKPOINTS.tv) return 'tv'; @@ -68,13 +68,13 @@ export const ThisWeekSection = React.memo(() => { if (deviceWidth >= BREAKPOINTS.tablet) return 'tablet'; return 'phone'; }, [deviceWidth]); - + const deviceType = getDeviceType(); const isTablet = deviceType === 'tablet'; const isLargeTablet = deviceType === 'largeTablet'; const isTV = deviceType === 'tv'; const isLargeScreen = isTablet || isLargeTablet || isTV; - + // Enhanced responsive sizing const computedItemWidth = useMemo(() => { switch (deviceType) { @@ -88,7 +88,7 @@ export const ThisWeekSection = React.memo(() => { return ITEM_WIDTH; // phone } }, [deviceType, deviceWidth]); - + const computedItemHeight = useMemo(() => { switch (deviceType) { case 'tv': @@ -101,7 +101,7 @@ export const ThisWeekSection = React.memo(() => { return ITEM_HEIGHT; // phone } }, [deviceType]); - + // Enhanced spacing and padding const horizontalPadding = useMemo(() => { switch (deviceType) { @@ -115,7 +115,7 @@ export const ThisWeekSection = React.memo(() => { return 16; // phone } }, [deviceType]); - + const itemSpacing = useMemo(() => { switch (deviceType) { case 'tv': @@ -136,13 +136,13 @@ export const ThisWeekSection = React.memo(() => { // Limit episodes to prevent memory issues and add release status const episodes = memoryManager.limitArraySize(thisWeekSection.data, 20); // Limit to 20 for home screen - + return episodes.map(episode => ({ ...episode, isReleased: episode.releaseDate ? isBefore(parseISO(episode.releaseDate), new Date()) : false, })); }, [calendarData]); - + const handleEpisodePress = (episode: ThisWeekEpisode) => { // For upcoming episodes, go to the metadata screen if (!episode.isReleased) { @@ -154,7 +154,7 @@ export const ThisWeekSection = React.memo(() => { }); return; } - + // For released episodes, go to the streams screen const episodeId = `${episode.seriesId}:${episode.season}:${episode.episode}`; navigation.navigate('Streams', { @@ -163,136 +163,114 @@ export const ThisWeekSection = React.memo(() => { episodeId }); }; - + const handleViewAll = () => { navigation.navigate('Calendar' as any); }; - + if (thisWeekEpisodes.length === 0) { return null; } - + const renderEpisodeItem = ({ item, index }: { item: ThisWeekEpisode, index: number }) => { // Handle episodes without release dates gracefully const releaseDate = item.releaseDate ? parseISO(item.releaseDate) : null; - const formattedDate = releaseDate ? format(releaseDate, 'E, MMM d') : 'TBA'; + const formattedDate = releaseDate ? format(releaseDate, 'MMM d') : 'TBA'; const isReleased = item.isReleased; - + // Use episode still image if available, fallback to series poster - const imageUrl = item.still_path ? - tmdbService.getImageUrl(item.still_path) : - (item.season_poster_path ? - tmdbService.getImageUrl(item.season_poster_path) : + const imageUrl = item.still_path ? + tmdbService.getImageUrl(item.still_path) : + (item.season_poster_path ? + tmdbService.getImageUrl(item.season_poster_path) : item.poster); - + return ( handleEpisodePress(item)} - activeOpacity={0.8} + activeOpacity={0.7} > - - - {/* Enhanced gradient overlay */} - + + - {/* Content area */} + + + + {isReleased ? 'New' : formattedDate} + + + + {item.seriesName} - - - {item.title} - - - {item.overview && ( + + - {item.overview} - - )} - - - - S{item.season}:E{item.episode} • - - - - {formattedDate} + S{item.season} E{item.episode} + + + + {item.title} - - + + ); }; - + return ( { > - This Week + This Week { } ]}> View All - - + item.id} @@ -345,10 +323,10 @@ export const ThisWeekSection = React.memo(() => { horizontal showsHorizontalScrollIndicator={false} contentContainerStyle={[ - styles.listContent, - { - paddingLeft: horizontalPadding, - paddingRight: horizontalPadding + styles.listContent, + { + paddingLeft: horizontalPadding, + paddingRight: horizontalPadding } ]} snapToInterval={computedItemWidth + itemSpacing} @@ -371,7 +349,7 @@ export const ThisWeekSection = React.memo(() => { const styles = StyleSheet.create({ container: { - marginVertical: 20, + marginVertical: 24, }, header: { flexDirection: 'row', @@ -400,14 +378,15 @@ const styles = StyleSheet.create({ viewAllButton: { flexDirection: 'row', alignItems: 'center', - paddingVertical: 8, - paddingHorizontal: 10, + paddingVertical: 6, + paddingHorizontal: 12, borderRadius: 20, - backgroundColor: 'rgba(255,255,255,0.1)', - marginRight: -10, + backgroundColor: 'rgba(255,255,255,0.08)', + borderWidth: 1, + borderColor: 'rgba(255,255,255,0.05)', }, viewAllText: { - fontSize: 14, + fontSize: 13, fontWeight: '600', marginRight: 4, }, @@ -432,10 +411,11 @@ const styles = StyleSheet.create({ height: '100%', borderRadius: 16, overflow: 'hidden', - shadowOffset: { width: 0, height: 8 }, + shadowColor: "#000", + shadowOffset: { width: 0, height: 4 }, shadowOpacity: 0.3, - shadowRadius: 12, - elevation: 12, + shadowRadius: 8, + elevation: 8, }, imageContainer: { width: '100%', @@ -453,44 +433,54 @@ const styles = StyleSheet.create({ right: 0, top: 0, bottom: 0, - justifyContent: 'flex-end', + justifyContent: 'space-between', padding: 12, borderRadius: 16, }, + cardHeader: { + flexDirection: 'row', + justifyContent: 'flex-end', + width: '100%', + }, + statusBadge: { + paddingHorizontal: 8, + paddingVertical: 4, + borderRadius: 8, + overflow: 'hidden', + }, + statusText: { + color: '#fff', + fontSize: 10, + fontWeight: '700', + textTransform: 'uppercase', + }, contentArea: { width: '100%', }, seriesName: { fontSize: 16, - fontWeight: '700', - marginBottom: 6, - }, - episodeTitle: { - fontSize: 14, - fontWeight: '600', + fontWeight: '800', marginBottom: 4, - lineHeight: 18, + textShadowColor: 'rgba(0, 0, 0, 0.75)', + textShadowOffset: { width: 0, height: 1 }, + textShadowRadius: 3, }, - overview: { - fontSize: 12, - lineHeight: 16, - marginBottom: 6, - opacity: 0.9, - }, - dateContainer: { + metaContainer: { flexDirection: 'row', alignItems: 'center', - marginTop: 4, }, - episodeInfo: { + seasonBadge: { fontSize: 12, - fontWeight: '600', - marginRight: 4, + fontWeight: '700', }, - releaseDate: { - fontSize: 13, - fontWeight: '600', - marginLeft: 6, - letterSpacing: 0.3, + dotSeparator: { + marginHorizontal: 6, + fontSize: 12, + color: 'rgba(255,255,255,0.5)', + }, + episodeTitle: { + fontSize: 12, + fontWeight: '500', + flex: 1, }, }); \ No newline at end of file