Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/app/(app)/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Tabs } from 'expo-router';
import { Ionicons } from '@expo/vector-icons';
import theme, { Box } from '@/theme/theme';
import theme from '@/theme/theme';
import { useBreakpoint } from '@/hooks/useBreakpoint';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { ResponsiveLayout } from '@/components/layout/ResponsiveLayout';
Expand Down Expand Up @@ -28,9 +28,9 @@ export default function TabsLayout() {
backgroundColor: theme.colors.cardBackground,
borderTopColor: theme.colors.cardBorder,
borderTopWidth: 1,
paddingBottom: compactTabs ? 2 : bottom,
paddingTop: compactTabs ? 4 : 10,
height: compactTabs ? 46 : 65 + bottom,
paddingBottom: compactTabs ? 0 : bottom,
paddingTop: compactTabs ? 4 : theme.sizes.tabBarPaddingTop,
height: compactTabs ? 46 : theme.sizes.tabBarHeight + bottom,
}
: {
display: 'none', // Hide tabs on tablet/TV
Expand Down
5 changes: 4 additions & 1 deletion src/components/layout/ResponsiveLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { useBreakpoint } from '@/hooks/useBreakpoint';
import { TVSidebar } from './TVSidebar';
import { useTVBackButton } from '@/hooks/useTVBackButton';
import { Platform, TVFocusGuideView, useWindowDimensions } from 'react-native';
import { useTheme } from '@shopify/restyle';
import type { Theme } from '@/theme/theme';

interface ResponsiveLayoutProps {
children: ReactNode;
Expand All @@ -12,6 +14,7 @@ interface ResponsiveLayoutProps {

export const ResponsiveLayout: FC<ResponsiveLayoutProps> = ({ children, maxWidth }) => {
const breakpoint = useBreakpoint();
const theme = useTheme<Theme>();
const { width, height } = useWindowDimensions();
const isLandscape = width > height;

Expand All @@ -27,7 +30,7 @@ export const ResponsiveLayout: FC<ResponsiveLayoutProps> = ({ children, maxWidth
: breakpoint === 'tv'
? width * 0.5
: breakpoint === 'tablet' && isLandscape
? Math.min(width * 0.75, 1000)
? Math.min(width * 0.75, theme.sizes.tabletLandscapeMaxWidth)
: undefined;

// Handle TV back button to focus sidebar
Expand Down
2 changes: 1 addition & 1 deletion src/components/media/DetailsShell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const DetailsShell = memo(
<ScrollView>
<Box flexDirection="row" padding="l" gap="l" position="relative">
{/* Left column: poster */}
<Box width={isMobile ? 140 : 180}>
<Box width={isMobile ? theme.sizes.landscapePosterWidthMobile : theme.sizes.landscapePosterWidthTablet}>
<Box
borderRadius="l"
overflow="hidden"
Expand Down
3 changes: 1 addition & 2 deletions src/components/media/HeroSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
HERO_CONTENT_SLIDE_DURATION_MS,
HERO_CONTENT_SLIDE_DELAY_MS,
HERO_DOT_ANIMATION_MS,
HERO_HEIGHT,
} from '@/constants/ui';
import { Button } from '@/components/basic/Button';

Expand All @@ -34,7 +33,7 @@ export const HeroSection = memo(({ hasTVPreferredFocus = false }: HeroSectionPro
const isLandscape = width > height;

// In landscape, scale hero height to avoid consuming the entire viewport
const heroHeight = isLandscape ? Math.min(HERO_HEIGHT, height * 0.7) : HERO_HEIGHT;
const heroHeight = isLandscape ? Math.min(theme.sizes.heroHeight, height * 0.7) : theme.sizes.heroHeight;

const [activeIndex, setActiveIndex] = useState(0);
const autoScrollRef = useRef<ReturnType<typeof setInterval> | null>(null);
Expand Down
22 changes: 0 additions & 22 deletions src/hooks/useBreakpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,6 @@ export interface ResponsiveLayoutResult {
width: number;
height: number;

/** Number of grid columns appropriate for current breakpoint and orientation */
columns: number;

/** Maximum content width for current breakpoint */
containerMaxWidth: number | undefined;

/** Horizontal content padding for current breakpoint */
contentPadding: number;

Expand Down Expand Up @@ -137,20 +131,6 @@ export function useResponsiveLayout(): ResponsiveLayoutResult {
const isPlatformTV = Platform.isTV;
const isLandscape = width > height;

// Grid columns based on breakpoint + orientation
const columns = useMemo(() => {
if (isTV) return isLandscape ? 5 : 4;
if (isTablet) return isLandscape ? 5 : 3;
return isLandscape ? 3 : 2;
}, [isTV, isTablet, isLandscape]);

// Max content width
const containerMaxWidth = useMemo(() => {
if (isTV) return Math.min(width * 0.7, 1200);
if (isTablet) return isLandscape ? Math.min(width * 0.9, 1100) : Math.min(width * 0.85, 900);
return undefined; // Full width on mobile
}, [isTV, isTablet, isLandscape, width]);

// Content padding
const contentPadding = useMemo(() => {
if (isTV) return theme.spacing.xl;
Expand Down Expand Up @@ -191,8 +171,6 @@ export function useResponsiveLayout(): ResponsiveLayoutResult {
isLandscape,
width,
height,
columns,
containerMaxWidth,
contentPadding,
isPlatformTV,
splitLayout,
Expand Down
6 changes: 6 additions & 0 deletions src/theme/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ const theme = createTheme({
loadingIndicatorLogoSizeSmall: 35,
loadingIndicatorLogoSizeLarge: 65,
progressBarHeight: 6,
tabBarHeight: 65,
tabBarPaddingTop: 10,
heroHeight: 500,
tabletLandscapeMaxWidth: 1000,
landscapePosterWidthMobile: 140,
landscapePosterWidthTablet: 180,
},
// Focus styling for TV
focus: {
Expand Down