App.tsx
import { StatusBar } from 'react-native';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { Block, BottomAppBar, IconButton, PlocksProvider, SafeArea, Icon, Text } from '@plocks/ui';
import { NightfallProvider, useNightfall, type Route, type Tab } from './store';
import { C, ProfileTile, useScreen } from './ui';
import { HomeScreen } from './screens/HomeScreen';
import { MyScreen, DownloadsScreen, NotificationsScreen } from './screens/MyScreen';
import { NewHotScreen } from './screens/NewHotScreen';
import { PlayerScreen } from './screens/PlayerScreen';
import { ProfilePicker } from './screens/ProfilePicker';
import { SearchScreen } from './screens/SearchScreen';
import { TitleScreen } from './screens/TitleScreen';
function Header() {
const app = useNightfall();
const { wide, gutter } = useScreen();
const profileColor = app.profile?.color ?? C.red;
if (wide) {
const links: { label: string; active: boolean; onPress: () => void }[] = [
{ label: 'Home', active: app.tab === 'home' && app.filter === 'all', onPress: () => app.setFilter('all') },
{ label: 'TV Shows', active: app.tab === 'home' && app.filter === 'series', onPress: () => app.setFilter('series') },
{ label: 'Movies', active: app.tab === 'home' && app.filter === 'movie', onPress: () => app.setFilter('movie') },
{ label: 'New & Hot', active: app.tab === 'new', onPress: () => app.setTab('new') },
{ label: 'My Nightfall', active: app.tab === 'my', onPress: () => app.setTab('my') },
];
return (
<Block direction="row" align="center" gap={28} px={gutter} h={68} bg={C.black}>
<Text c={C.red} fw="900" size={28} lts={1} onPress={() => app.setFilter('all')}>
NIGHTFALL
</Text>
<Block direction="row" gap={22} flex={1} align="center">
{links.map((link) => (
<Text key={link.label} c={link.active ? C.white : C.soft} fw={link.active ? 'bold' : 'normal'} size={14} onPress={link.onPress}>
{link.label}
</Text>
))}
</Block>
<IconButton icon="search" variant="ghost" iconColor={C.white} accessibilityLabel="Search" onPress={() => app.push({ name: 'search' })} />
<IconButton icon="bell" variant="ghost" iconColor={C.white} accessibilityLabel="Notifications" onPress={() => app.push({ name: 'notifications' })} />
<Block gap={0} onPress={() => app.setTab('my')} accessibilityRole="button" accessibilityLabel="My Nightfall">
<ProfileTile color={profileColor} size={32} />
</Block>
</Block>
);
}
const heading = app.tab === 'home' ? `For ${app.profile?.name ?? 'You'}` : app.tab === 'new' ? 'New & Hot' : 'My Nightfall';
return (
<Block direction="row" align="center" gap={4} px={gutter} h={56} bg={C.black}>
<Text c={C.white} fw="bold" size={22} flex={1} numberOfLines={1}>
{heading}
</Text>
<IconButton icon="download" variant="ghost" iconColor={C.white} accessibilityLabel="Downloads" onPress={() => app.push({ name: 'downloads' })} />
<IconButton icon="search" variant="ghost" iconColor={C.white} accessibilityLabel="Search" onPress={() => app.push({ name: 'search' })} />
</Block>
);
}
function RouteScreen({ route }: { route: Route }) {
switch (route.name) {
case 'title':
return <TitleScreen id={route.id} />;
case 'player':
return <PlayerScreen route={route} />;
case 'search':
return <SearchScreen />;
case 'downloads':
return <DownloadsScreen />;
case 'notifications':
return <NotificationsScreen />;
}
}
function Nightfall() {
const app = useNightfall();
const { wide } = useScreen();
if (!app.profile) return <ProfilePicker />;
return (
<Block flex={1} gap={0} position="relative">
{/* Tab screens stay mounted under pushed pages so Back returns to the same scroll position. */}
<Block flex={1} gap={0}>
<Header />
<Block flex={1} gap={0} w="100%" maw={wide ? 1400 : undefined} alignSelf="center">
{app.tab === 'home' && <HomeScreen />}
{app.tab === 'new' && <NewHotScreen />}
{app.tab === 'my' && <MyScreen />}
</Block>
{!wide && (
<BottomAppBar
accessibilityLabel="Main"
activeKey={app.tab}
onItemPress={(key) => app.setTab(key as Tab)}
bg="#121212F2"
withBorder={false}
indicator={false}
activeColor={C.white}
inactiveColor={C.muted}
items={[
{
key: 'home',
label: 'Home',
icon: ({ active, color }) => (active ? <Icon name="home" variant="filled" size={24} color={color} /> : <Icon name="home" size={24} color={color} />),
},
{
key: 'new',
label: 'New & Hot',
icon: ({ active, color }) => <Icon name="flame" variant={active ? 'filled' : 'outlined'} size={24} color={color} />,
},
{
key: 'my',
label: 'My Nightfall',
icon: () => <ProfileTile color={app.profile?.color ?? C.red} size={24} />,
},
]}
/>
)}
</Block>
{app.stack.map((route, index) => (
<Block key={`${index}:${JSON.stringify(route)}`} position="absolute" inset={0} zIndex={10 + index} bg={C.black} gap={0}>
<RouteScreen route={route} />
</Block>
))}
</Block>
);
}
export default function App() {
return (
<SafeAreaProvider>
<PlocksProvider theme={{ colorScheme: 'dark' }}>
<NightfallProvider>
<SafeArea gap={0} flex={1} bg={C.black}>
<StatusBar barStyle="light-content" />
<Nightfall />
</SafeArea>
</NightfallProvider>
</PlocksProvider>
</SafeAreaProvider>
);
}
data.ts
/** Fictional Nightfall catalog. Every title, person and episode here is invented demo content. */
export const ART = [
require('./assets/scene-forest.webp'),
require('./assets/scene-city.webp'),
require('./assets/scene-desert.webp'),
require('./assets/scene-lake.webp'),
require('./assets/scene-ocean.webp'),
];
export type Kind = 'movie' | 'series';
export interface Episode {
n: number;
title: string;
length: string;
synopsis: string;
}
export interface Title {
id: string;
title: string;
kind: Kind;
genres: string[];
/** Mood tags ("This title is…"). */
moods: string[];
year: string;
rating: string;
/** Movie runtime, or a season count label for series. */
length: string;
art: number;
/** Colour wash laid over the shared scene art so reused images read as different titles. */
tint: string;
match: number;
caption: string;
synopsis: string;
cast: string[];
creator: string;
original?: boolean;
label?: 'New Season' | 'Recently Added' | 'New Episodes';
/** Release note for unreleased titles, such as "Nov 6". */
coming?: { month: string; day: string; note: string };
seasons?: Episode[][];
}
const ep = (n: number, title: string, length: string, synopsis: string): Episode => ({ n, title, length, synopsis });
export const TITLES: Title[] = [
{
id: 'dust',
title: 'Dust & Static',
kind: 'series',
genres: ['Sci-Fi', 'Thriller'],
moods: ['Gritty', 'Suspenseful', 'Mind-Bending'],
year: '2026',
rating: 'TV-MA',
length: '2 Seasons',
art: 2,
tint: '#C2410C55',
match: 97,
caption: 'The signal came from nowhere. Then it started answering back.',
synopsis:
'At a remote desert observatory, a night-shift engineer picks up a broadcast that predicts tomorrow. Every warning she ignores comes true.',
cast: ['Maya Chen', 'Isaac Holt', 'Nadia Cole', 'Evan Price', 'Rosa Field'],
creator: 'Hanna Voss',
original: true,
label: 'New Season',
seasons: [
[
ep(1, 'Dead Air', '52m', 'A routine calibration catches a voice on a frequency nobody uses.'),
ep(2, 'Carrier Wave', '48m', 'Iris tests the broadcast with a prediction she can check by morning.'),
ep(3, 'Interference', '51m', 'A visitor from the agency asks too many questions about the dish.'),
ep(4, 'Feedback Loop', '55m', 'The signal names someone inside the observatory.'),
ep(5, 'Ground Station', '49m', 'A sandstorm cuts the power and the broadcast keeps going.'),
ep(6, 'Sign Off', '61m', 'Iris decides whether to answer the voice at last.'),
],
[
ep(1, 'Static Bloom', '54m', 'Six months later, the dish turns on by itself.'),
ep(2, 'Night Relay', '50m', 'A second station picks up the same voice across the border.'),
ep(3, 'Low Band', '47m', 'Old logbooks reveal the signal has called before.'),
ep(4, 'Open Channel', '58m', 'The team broadcasts a reply and waits.'),
],
],
},
{
id: 'evergreen',
title: 'Evergreen',
kind: 'movie',
genres: ['Adventure', 'Drama'],
moods: ['Heartfelt', 'Inspiring'],
year: '2026',
rating: 'PG-13',
length: '1h 48m',
art: 0,
tint: '#15803D33',
match: 98,
caption: 'Some paths lead you back to yourself.',
synopsis:
'A field researcher returns to the forest where everything began and finds an unexpected new trail that is not on any map.',
cast: ['Ava Morgan', 'Elliot Hayes', 'Mina Brooks', 'Leo Carter'],
creator: 'Ruth Okafor',
original: true,
},
{
id: 'tidekeepers',
title: 'The Tidekeepers',
kind: 'series',
genres: ['Fantasy', 'Drama'],
moods: ['Imaginative', 'Epic'],
year: '2025',
rating: 'TV-14',
length: '1 Season',
art: 4,
tint: '#1D4ED855',
match: 95,
caption: 'The sea keeps its promises. People do not.',
synopsis:
'On an island where the tide obeys an old pact, the last keeper must find an heir before the water forgets its place.',
cast: ['Kai Bennett', 'Lena Ortiz', 'Owen Blake', 'Dara Quinn'],
creator: 'Tomas Wilde',
original: true,
label: 'New Episodes',
seasons: [
[
ep(1, 'Low Water', '57m', 'The tide fails to turn for the first time in a hundred years.'),
ep(2, 'The Lighthouse Key', '53m', 'Mara inherits a key and a duty she never asked for.'),
ep(3, 'Salt Ledger', '49m', 'The pact turns out to have a second signature.'),
ep(4, 'Undertow', '55m', 'A storm brings a stranger who knows the old words.'),
ep(5, 'High Water', '62m', 'The island chooses its keeper.'),
],
],
},
{
id: 'afterdark',
title: 'After Dark',
kind: 'movie',
genres: ['Mystery', 'Thriller'],
moods: ['Dark', 'Suspenseful'],
year: '2026',
rating: 'R',
length: '2h 02m',
art: 1,
tint: '#7C3AED44',
match: 92,
caption: 'Every city keeps a secret.',
synopsis: 'One night, one city, and a clue hidden in plain sight. A cab driver has until dawn to prove what she saw.',
cast: ['Nora Vale', 'Julian Cross', 'Iris Chen', 'Marcus Reed'],
creator: 'Dev Anand Rao',
original: true,
},
{
id: 'stillwater',
title: 'Stillwater',
kind: 'series',
genres: ['Documentary', 'Nature'],
moods: ['Soothing', 'Visually Striking'],
year: '2026',
rating: 'TV-G',
length: '2 Seasons',
art: 3,
tint: '#0E749033',
match: 89,
caption: 'Beneath the surface.',
synopsis: 'An intimate look at the wild places where water shapes every life around it, filmed across four seasons.',
cast: ['Elena Park', 'Samir Shah'],
creator: 'Elena Park',
seasons: [
[
ep(1, 'Thaw', '44m', 'Spring melt wakes a mountain lake and everything that depends on it.'),
ep(2, 'Shallows', '42m', 'Life crowds into the warm edges of the water.'),
ep(3, 'Deep Cold', '46m', 'Under the ice, the lake keeps moving.'),
],
[
ep(1, 'Estuary', '45m', 'Where rivers meet the sea, two worlds trade places twice a day.'),
ep(2, 'Floodplain', '43m', 'A once-a-decade flood remakes a valley overnight.'),
],
],
},
{
id: 'nightshift',
title: 'Night Shift',
kind: 'series',
genres: ['Comedy'],
moods: ['Witty', 'Feel-Good'],
year: '2024',
rating: 'TV-14',
length: '2 Seasons',
art: 1,
tint: '#DB277744',
match: 94,
caption: 'The city never sleeps. Neither do they.',
synopsis: 'A mismatched team keeps a tiny late-night radio station on the air, one strange caller at a time.',
cast: ['Riley James', 'Theo Martin', 'Zoe Patel', 'Miles Grant'],
creator: 'Gabe Lindqvist',
original: true,
seasons: [
[
ep(1, 'Graveyard Slot', '28m', 'Dee takes over the 2 a.m. show nobody else wants.'),
ep(2, 'Caller Four', '26m', 'A regular caller claims to be the station’s founder.'),
ep(3, 'Dead Air Fund', '27m', 'The team throws a pledge drive with no budget.'),
ep(4, 'Static Love', '29m', 'Two listeners fall for each other live on air.'),
],
[
ep(1, 'Signal Boost', '30m', 'A viral clip brings the wrong kind of attention.'),
ep(2, 'Request Line', '27m', 'Theo plays a song he swore he never would.'),
ep(3, 'Sunrise', '31m', 'The last show before the station is sold.'),
],
],
},
{
id: 'goldenhour',
title: 'Golden Hour',
kind: 'movie',
genres: ['Drama'],
moods: ['Emotional', 'Heartfelt'],
year: '2025',
rating: 'PG-13',
length: '1h 39m',
art: 2,
tint: '#CA8A0444',
match: 90,
caption: 'The light changes everything.',
synopsis: 'Two old friends cross the desert to make good on a promise they made twenty years ago.',
cast: ['Sofia Reyes', 'Caleb Ward', 'Amara Bell', 'Jonah Wells'],
creator: 'Lucia Marchetti',
label: 'Recently Added',
},
{
id: 'hollowpines',
title: 'Hollow Pines',
kind: 'series',
genres: ['Horror', 'Mystery'],
moods: ['Eerie', 'Ominous'],
year: '2025',
rating: 'TV-MA',
length: '1 Season',
art: 0,
tint: '#11182799',
match: 86,
caption: 'Nobody hikes the north trail twice.',
synopsis: 'When a camp counsellor goes missing, a small mountain town learns the woods have been counting.',
cast: ['Piper Lane', 'Finn Walker', 'June Ellis', 'Arlo Stone'],
creator: 'Marcus Dahl',
original: true,
seasons: [
[
ep(1, 'Trailhead', '47m', 'The first night of camp ends with an empty bunk.'),
ep(2, 'Cairns', '45m', 'Someone is building stone markers around the town.'),
ep(3, 'Ranger Station', '50m', 'An old ranger finally talks about 1994.'),
ep(4, 'North Trail', '58m', 'The search party splits up. Not everyone comes back.'),
],
],
},
{
id: 'deepblue',
title: 'Deep Blue',
kind: 'movie',
genres: ['Adventure', 'Family'],
moods: ['Exciting', 'Feel-Good'],
year: '2025',
rating: 'PG',
length: '1h 31m',
art: 4,
tint: '#0369A133',
match: 91,
caption: 'The horizon is only the beginning.',
synopsis: 'A small crew sets sail toward a distant island and a much larger discovery beneath it.',
cast: ['Kai Bennett', 'Lena Ortiz', 'Owen Blake'],
creator: 'Imani Brooks',
},
{
id: 'mirage',
title: 'Mirage',
kind: 'movie',
genres: ['Sci-Fi', 'Thriller'],
moods: ['Mind-Bending', 'Suspenseful'],
year: '2026',
rating: 'PG-13',
length: '1h 56m',
art: 2,
tint: '#9333EA33',
match: 93,
caption: 'What you see is only the start.',
synopsis: 'A strange signal brings a research team to the edge of the desert, where the horizon refuses to stay put.',
cast: ['Maya Chen', 'Isaac Holt', 'Nadia Cole', 'Evan Price'],
creator: 'Hanna Voss',
original: true,
label: 'Recently Added',
},
{
id: 'lanterns',
title: 'Paper Lanterns',
kind: 'movie',
genres: ['Romance', 'Comedy'],
moods: ['Romantic', 'Charming'],
year: '2026',
rating: 'PG',
length: '1h 44m',
art: 3,
tint: '#F9731633',
match: 88,
caption: 'One lake. One summer. One very bad idea.',
synopsis: 'A wedding planner and a rival caterer get stranded at a lakeside festival they both swore to ruin.',
cast: ['Tessa Cole', 'Micah Ford', 'Zoe Patel', 'Riley James'],
creator: 'Noor Haddad',
},
{
id: 'wildwood',
title: 'Wildwood',
kind: 'movie',
genres: ['Family', 'Adventure'],
moods: ['Heartfelt', 'Feel-Good'],
year: '2025',
rating: 'PG',
length: '1h 27m',
art: 0,
tint: '#65A30D33',
match: 87,
caption: 'A summer to remember.',
synopsis: 'Four siblings discover their favourite campsite has one last surprise before it closes for good.',
cast: ['Piper Lane', 'Finn Walker', 'June Ellis', 'Arlo Stone'],
creator: 'Sam Ortega',
},
{
id: 'northern',
title: 'Northern Signal',
kind: 'series',
genres: ['Thriller', 'Drama'],
moods: ['Tense', 'Atmospheric'],
year: '2026',
rating: 'TV-MA',
length: '1 Season',
art: 3,
tint: '#0F766E55',
match: 96,
caption: 'Out here, the radio is the only witness.',
synopsis: 'A lighthouse radio operator hears a mayday from a ship that sank forty years ago.',
cast: ['Nora Vale', 'Owen Blake', 'Amara Bell'],
creator: 'Tomas Wilde',
original: true,
coming: { month: 'NOV', day: '06', note: 'Coming Friday' },
seasons: [[ep(1, 'Mayday', '54m', 'A call comes in on a channel that was closed decades ago.')]],
},
{
id: 'glasshouse',
title: 'Glasshouse',
kind: 'movie',
genres: ['Mystery', 'Drama'],
moods: ['Stylish', 'Twisty'],
year: '2026',
rating: 'R',
length: '2h 08m',
art: 1,
tint: '#BE123C44',
match: 90,
caption: 'Everyone can see in. Nobody can see out.',
synopsis: 'An architect’s celebrated glass house becomes the scene of a disappearance that every guest saw — differently.',
cast: ['Julian Cross', 'Iris Chen', 'Sofia Reyes'],
creator: 'Dev Anand Rao',
original: true,
coming: { month: 'NOV', day: '13', note: 'Coming Nov 13' },
},
{
id: 'saltwater',
title: 'Saltwater Saints',
kind: 'series',
genres: ['Comedy', 'Drama'],
moods: ['Warm', 'Quirky'],
year: '2026',
rating: 'TV-14',
length: '1 Season',
art: 4,
tint: '#0284C744',
match: 93,
caption: 'Every harbour town needs a patron saint. This one got three.',
synopsis: 'Three estranged sisters inherit a failing fishing boat and the family feud that comes with it.',
cast: ['Lena Ortiz', 'Tessa Cole', 'June Ellis'],
creator: 'Noor Haddad',
coming: { month: 'NOV', day: '20', note: 'Coming Nov 20' },
seasons: [[ep(1, 'Low Tide Blessing', '41m', 'The sisters meet at the dock for the first time in a decade.')]],
},
];
export const byId = (id: string) => TITLES.find((item) => item.id === id) ?? TITLES[0];
export const released = TITLES.filter((item) => !item.coming);
export const comingSoon = TITLES.filter((item) => item.coming);
export const TOP_SHOWS = ['dust', 'tidekeepers', 'nightshift', 'hollowpines', 'stillwater'];
export const TOP_MOVIES = ['evergreen', 'mirage', 'afterdark', 'goldenhour', 'lanterns', 'deepblue', 'wildwood'];
export const topRank = (title: Title) => {
const list = title.kind === 'series' ? TOP_SHOWS : TOP_MOVIES;
const index = list.indexOf(title.id);
return index < 0 ? null : index + 1;
};
export const GENRES = Array.from(new Set(released.flatMap((item) => item.genres))).sort();
export const TOP_SEARCHES = ['afterdark', 'dust', 'evergreen', 'hollowpines', 'lanterns', 'tidekeepers', 'mirage', 'nightshift'];
export function similarTo(title: Title) {
return released
.filter((item) => item.id !== title.id)
.map((item) => ({ item, score: item.genres.filter((genre) => title.genres.includes(genre)).length + (item.kind === title.kind ? 0.5 : 0) }))
.sort((a, b) => b.score - a.score)
.map(({ item }) => item);
}
export const trailersFor = (title: Title) => [
{ id: `${title.id}:trailer`, label: title.coming ? 'Official Teaser' : 'Official Trailer', length: '2:18' },
{ id: `${title.id}:look`, label: title.kind === 'series' ? 'Season 1 Recap' : 'First Look', length: '1:42' },
{ id: `${title.id}:bts`, label: 'Behind the Scenes', length: '4:05' },
];
export const PROFILES = [
{ id: 'avery', name: 'Avery', color: '#2F6FDB' },
{ id: 'jordan', name: 'Jordan', color: '#E5A00D' },
{ id: 'sam', name: 'Sam', color: '#2BAE66' },
{ id: 'kids', name: 'Kids', color: '#E5487D' },
];
export type Profile = (typeof PROFILES)[number];
export const NOTIFICATIONS = [
{ id: 'n1', titleId: 'tidekeepers', kicker: 'New Episodes', text: 'The Tidekeepers', date: 'Today' },
{ id: 'n2', titleId: 'northern', kicker: 'Coming Friday', text: 'Northern Signal — remind me?', date: 'Yesterday' },
{ id: 'n3', titleId: 'dust', kicker: 'New Season', text: 'Dust & Static Season 2 is here', date: 'Oct 24' },
{ id: 'n4', titleId: 'mirage', kicker: 'Recently Added', text: 'Mirage', date: 'Oct 19' },
];
export const CAST_COLORS = ['#663BA1', '#AF484E', '#2C777B', '#9A6B2C', '#3B5BA1'];
export const initials = (name: string) =>
name
.split(' ')
.map((part) => part[0])
.join('');
index.ts
import { registerRootComponent } from 'expo';
import App from './App';
registerRootComponent(App);
screens/HomeScreen.tsx
import { BackgroundImage, Block, Button, Chip, Gradient, Icon, Menu, MenuDropdown, MenuItem, Progress, ScrollArea, Text } from '@plocks/ui';
import { ART, GENRES, TOP_MOVIES, TOP_SHOWS, byId, released, type Title } from '../data';
import { useNightfall, type Filter } from '../store';
import { C, Dots, Mark, Poster, PosterGrid, Shelf, useScreen } from '../ui';
const FEATURED: Record<Filter, string> = { all: 'dust', series: 'tidekeepers', movie: 'evergreen' };
export function HomeScreen() {
const app = useNightfall();
const { wide, gutter, poster } = useScreen();
const pool = released.filter((item) => app.filter === 'all' || item.kind === app.filter);
const hero = byId(FEATURED[app.filter]);
const inList = app.myList.includes(hero.id);
const continuing = pool.filter((item) => {
const value = app.resume(item).value;
return value > 0 && value < 1;
});
const showTopMovies = app.filter === 'movie';
const top = (showTopMovies ? TOP_MOVIES : TOP_SHOWS).map(byId);
const kindLabel = app.filter === 'series' ? 'TV Shows' : app.filter === 'movie' ? 'Movies' : '';
const genreTitles = app.genre ? pool.filter((item) => item.genres.includes(app.genre!)) : [];
const shelf = (heading: string, titles: Title[]) =>
titles.length > 0 && (
<Shelf heading={heading}>
{titles.map((item) => (
<Poster key={item.id} title={item} w={poster} onPress={() => app.openTitle(item.id)} />
))}
</Shelf>
);
return (
<ScrollArea flex={1} contentProps={{ pb: 40 }}>
<Block direction="row" gap={8} px={gutter} py={10} align="center" wrap="wrap">
{app.filter !== 'all' && (
<Chip
variant="outline"
color={C.soft}
onPress={() => app.setFilter('all')}
accessibilityLabel="Clear filters"
labelProps={{ c: C.white }}
>
<Icon name="x" size={14} color={C.white} />
</Chip>
)}
{(app.filter === 'all' || app.filter === 'series') && (
<Chip
variant={app.filter === 'series' ? 'filled' : 'outline'}
color={app.filter === 'series' ? C.raised : C.soft}
labelProps={{ c: C.white, fw: '600' }}
onPress={() => app.setFilter('series')}
>
TV Shows
</Chip>
)}
{(app.filter === 'all' || app.filter === 'movie') && (
<Chip
variant={app.filter === 'movie' ? 'filled' : 'outline'}
color={app.filter === 'movie' ? C.raised : C.soft}
labelProps={{ c: C.white, fw: '600' }}
onPress={() => app.setFilter('movie')}
>
Movies
</Chip>
)}
<Menu position="bottom-start" mah={360}>
<Chip
variant={app.genre ? 'filled' : 'outline'}
color={app.genre ? C.raised : C.soft}
labelProps={{ c: C.white, fw: '600' }}
endSection={<Icon name="chevron-down" size={14} color={C.white} />}
>
{app.genre ?? (kindLabel ? 'All Categories' : 'Categories')}
</Chip>
<MenuDropdown>
<MenuItem onPress={() => app.setFilter(app.filter, null)}>{`All ${kindLabel || 'Categories'}`}</MenuItem>
{GENRES.map((item) => (
<MenuItem key={item} onPress={() => app.setFilter(app.filter, item)}>
{item}
</MenuItem>
))}
</MenuDropdown>
</Menu>
</Block>
{app.genre ? (
<Block px={gutter} gap={14} mt={10}>
<Text c={C.white} fw="bold" size={wide ? 28 : 22}>
{app.genre} {kindLabel}
</Text>
{genreTitles.length ? (
<PosterGrid titles={genreTitles} onPress={app.openTitle} />
) : (
<Text c={C.muted}>Nothing in {app.genre} yet. Try another category.</Text>
)}
</Block>
) : (
<>
<Block px={wide ? 0 : gutter} gap={0}>
<BackgroundImage source={ART[hero.art]} w="100%" h={wide ? 520 : 470} radius={wide ? 0 : 10} justify="flex-end">
<Gradient colors={[hero.tint, '#0000', '#000C', wide ? C.black : '#000E']} flex={1} justify="flex-end" align={wide ? 'flex-start' : 'center'} px={wide ? 48 : 18} pb={wide ? 60 : 18} gap={12}>
<Block direction="row" align="center" gap={6}>
<Mark size={18} />
<Text c={C.soft} fw="bold" size={11} lts={3}>
{hero.kind === 'series' ? 'SERIES' : 'FILM'}
</Text>
</Block>
<Text c={C.white} fw="900" size={wide ? 60 : 40} lh={wide ? 62 : 42} tt="uppercase" ta={wide ? 'left' : 'center'}>
{hero.title}
</Text>
{wide ? (
<Text c={C.white} size={17} lh={25} maw={520}>
{hero.synopsis}
</Text>
) : (
<Dots items={hero.moods.concat(hero.genres[0])} />
)}
<Block direction="row" gap={10} w={wide ? undefined : '100%'}>
<Button
title="Play"
startSection={<Icon name="play" variant="filled" size={20} color={C.black} />}
color={C.white}
textColor={C.black}
flex={wide ? undefined : 1}
onPress={() => app.play(hero.id)}
/>
<Button
title="My List"
startSection={inList ? <Icon name="check" size={20} color={C.white} /> : <Icon name="plus" size={20} color={C.white} />}
color="#6D6D6EB3"
textColor={C.white}
flex={wide ? undefined : 1}
onPress={() => app.toggleList(hero.id)}
/>
{wide && (
<Button
title="More Info"
startSection={<Icon name="info" size={20} color={C.white} />}
color="#6D6D6EB3"
textColor={C.white}
onPress={() => app.openTitle(hero.id)}
/>
)}
</Block>
</Gradient>
</BackgroundImage>
</Block>
{continuing.length > 0 && (
<Shelf heading={`Continue Watching for ${app.profile?.name ?? 'you'}`}>
{continuing.map((item) => (
<ContinueCard key={item.id} title={item} w={poster} />
))}
</Shelf>
)}
<Shelf heading={`Top 10 ${showTopMovies ? 'Movies' : 'TV Shows'} Today`}>
{top.map((item, index) => (
<Block
key={item.id}
direction="row"
align="flex-end"
gap={0}
onPress={() => app.openTitle(item.id)}
accessibilityRole="button"
accessibilityLabel={`Number ${index + 1}, ${item.title}`}
>
<Text c="transparent" stroke={{ c: "#8C8C8C", w: 2 }} fw="900" size={wide ? 150 : 104} lh={wide ? 140 : 96} lts={-8} mr={-10}>
{index + 1}
</Text>
<Poster title={item} w={poster} onPress={() => app.openTitle(item.id)} />
</Block>
))}
</Shelf>
{shelf('Trending Now', pool.slice().sort((a, b) => b.match - a.match))}
{shelf('My List', pool.filter((item) => app.myList.includes(item.id)))}
{shelf('New Releases', pool.filter((item) => item.label || item.year === '2026'))}
{shelf('Only on Nightfall', pool.filter((item) => item.original))}
{shelf('Edge-of-Your-Seat Thrillers', pool.filter((item) => item.genres.some((genre) => ['Thriller', 'Mystery', 'Horror'].includes(genre))))}
{shelf('Feel-Good Favourites', pool.filter((item) => item.moods.some((mood) => ['Feel-Good', 'Heartfelt', 'Witty', 'Charming'].includes(mood))))}
</>
)}
</ScrollArea>
);
}
function ContinueCard({ title, w }: { title: Title; w: number }) {
const app = useNightfall();
const resume = app.resume(title);
return (
<Block w={w} gap={0} radius={6} overflow="hidden" bg={C.panel}>
<Block gap={0} onPress={() => app.play(title.id)} accessibilityRole="button" accessibilityLabel={`Resume ${title.title}`}>
<Poster title={title} w={w} onPress={() => app.play(title.id)} />
</Block>
<Progress value={resume.value * 100} size={3} radius={0} color={C.red} trackColor="#4D4D4D" />
<Block direction="row" align="center" justify="space-between" px={8} py={6} gap={4}>
<Text c={C.soft} size={11} fw="600">
{resume.label || `${Math.round((1 - resume.value) * 100)}% left`}
</Text>
<Block gap={0} onPress={() => app.openTitle(title.id)} accessibilityRole="button" accessibilityLabel={`${title.title} details`}>
<Icon name="info" size={20} color={C.soft} />
</Block>
</Block>
</Block>
);
}
screens/MyScreen.tsx
import { Block, Button, Icon, IconButton, Menu, MenuDivider, MenuDropdown, MenuItem, Progress, ScrollArea, Text } from '@plocks/ui';
import { NOTIFICATIONS, PROFILES, TITLES, byId, trailersFor } from '../data';
import { useNightfall } from '../store';
import { C, Poster, ProfileTile, Shelf, Still, useScreen } from '../ui';
/** "My Nightfall": profile, notifications, downloads and personal shelves. */
export function MyScreen() {
const app = useNightfall();
const { wide, gutter, poster } = useScreen();
const profile = app.profile ?? PROFILES[0];
const liked = TITLES.filter((item) => app.ratings[item.id] === 'up' || app.ratings[item.id] === 'love');
const list = TITLES.filter((item) => app.myList.includes(item.id));
const downloads = Object.keys(app.downloads);
return (
<ScrollArea flex={1} contentProps={{ pb: 40 }}>
<Block gap={0} w="100%" maw={1100} alignSelf="center">
<Block align="center" gap={10} pt={20}>
<ProfileTile color={profile.color} size={wide ? 96 : 72} />
<Menu position="bottom">
<Block direction="row" align="center" gap={4} accessibilityRole="button" accessibilityLabel="Switch profile">
<Text c={C.white} fw="bold" size={22}>
{profile.name}
</Text>
<Icon name="chevron-down" size={18} color={C.white} />
</Block>
<MenuDropdown>
{PROFILES.filter((item) => item.id !== profile.id).map((item) => (
<MenuItem key={item.id} startSection={<ProfileTile color={item.color} size={22} />} onPress={() => app.selectProfile(item.id)}>
{item.name}
</MenuItem>
))}
<MenuDivider />
<MenuItem startSection={<Icon name="edit" size={16} color={C.soft} />} onPress={() => app.selectProfile(null)}>
Manage Profiles
</MenuItem>
</MenuDropdown>
</Menu>
</Block>
<Block px={gutter} mt={20} gap={4}>
<MenuRow
icon={
<Block bg={C.red} w={36} h={36} radius="full" align="center" justify="center" gap={0}>
<Icon name="bell" size={20} color={C.white} />
</Block>
}
label="Notifications"
detail={`${NOTIFICATIONS.length} new`}
onPress={() => app.push({ name: 'notifications' })}
/>
<MenuRow
icon={
<Block bg="#0071EB" w={36} h={36} radius="full" align="center" justify="center" gap={0}>
<Icon name="download" size={20} color={C.white} />
</Block>
}
label="Downloads"
detail={downloads.length ? `${downloads.length} title${downloads.length === 1 ? '' : 's'}` : 'None yet'}
onPress={() => app.push({ name: 'downloads' })}
/>
</Block>
{liked.length > 0 && (
<Shelf heading="TV Shows & Movies You Liked">
{liked.map((item) => (
<Poster key={item.id} title={item} w={poster} onPress={() => app.openTitle(item.id)} />
))}
</Shelf>
)}
<Shelf heading="My List">
{list.length ? (
list.map((item) => <Poster key={item.id} title={item} w={poster} onPress={() => app.openTitle(item.id)} />)
) : (
<Text c={C.muted}>Add shows and movies to keep track of what you want to watch.</Text>
)}
</Shelf>
{app.trailers.length > 0 && (
<Shelf heading="Trailers You've Watched">
{app.trailers.map(byId).map((item) => (
<Block
key={item.id}
w={wide ? 300 : 220}
gap={6}
onPress={() => app.playTrailer(item.id, trailersFor(item)[0].id)}
accessibilityRole="button"
accessibilityLabel={`Play ${item.title} trailer`}
>
<Still title={item} w="100%" play />
<Text c={C.soft} size={12} numberOfLines={1}>
{trailersFor(item)[0].label}: {item.title}
</Text>
</Block>
))}
</Shelf>
)}
</Block>
</ScrollArea>
);
}
function MenuRow({ icon, label, detail, onPress }: { icon: React.ReactNode; label: string; detail: string; onPress: () => void }) {
return (
<Block direction="row" align="center" gap={14} py={10} onPress={onPress} accessibilityRole="button" accessibilityLabel={label}>
{icon}
<Block flex={1} gap={0}>
<Text c={C.white} fw="bold" size={16}>
{label}
</Text>
<Text c={C.muted} size={12}>
{detail}
</Text>
</Block>
<Icon name="chevron-right" size={20} color={C.muted} />
</Block>
);
}
function PageHeader({ heading }: { heading: string }) {
const app = useNightfall();
const { gutter } = useScreen();
return (
<Block direction="row" align="center" gap={8} px={gutter} py={10}>
<IconButton icon="arrowLeft" variant="ghost" iconColor={C.white} accessibilityLabel="Back" onPress={app.back} />
<Text c={C.white} fw="bold" size={20}>
{heading}
</Text>
</Block>
);
}
export function DownloadsScreen() {
const app = useNightfall();
const { gutter, wide } = useScreen();
const ids = Object.keys(app.downloads);
return (
<Block flex={1} gap={0}>
<PageHeader heading="Downloads" />
<ScrollArea flex={1} contentProps={{ px: gutter, pb: 40, gap: 16 }}>
<Block gap={0} w="100%" maw={900} alignSelf="center">
<Block direction="row" align="center" gap={8} mb={16}>
<Icon name="circle-check" variant="filled" size={16} color="#0071EB" />
<Text c={C.soft} size={13}>
Smart Downloads · <Text c="#0071EB" size={13} fw="bold">ON</Text>
</Text>
</Block>
{ids.length === 0 ? (
<Block align="center" gap={14} py={40}>
<Block w={120} h={120} radius="full" bg={C.raised} align="center" justify="center" gap={0}>
<Icon name="download" size={56} color={C.muted} />
</Block>
<Text c={C.white} fw="bold" size={18} ta="center">
Movies and TV shows that you download appear here.
</Text>
<Button title="Find Something to Download" color={C.white} textColor={C.black} onPress={() => app.setTab('home')} />
</Block>
) : (
ids.map((id) => {
const title = byId(id);
const value = app.downloads[id];
return (
<Block key={id} direction="row" align="center" gap={12} mb={16}>
<Block gap={0} w={wide ? 180 : 130} onPress={() => app.play(id)} accessibilityRole="button" accessibilityLabel={`Play ${title.title}`}>
<Still title={title} w="100%" play={value === 1} />
</Block>
<Block flex={1} gap={4}>
<Text c={C.white} fw="bold" size={15} numberOfLines={1}>
{title.title}
</Text>
{value < 1 ? (
<>
<Text c={C.muted} size={12}>
Downloading… {Math.round(value * 100)}%
</Text>
<Progress value={value * 100} size={3} color="#0071EB" trackColor="#444" />
</>
) : (
<Text c={C.muted} size={12}>
{title.kind === 'series' ? '1 Episode' : title.length} | {title.kind === 'series' ? '312' : '1.1'} {title.kind === 'series' ? 'MB' : 'GB'}
</Text>
)}
</Block>
<IconButton
icon="trash"
variant="ghost"
iconColor={C.muted}
accessibilityLabel={`Delete ${title.title} download`}
onPress={() => app.removeDownload(id)}
/>
</Block>
);
})
)}
</Block>
</ScrollArea>
</Block>
);
}
export function NotificationsScreen() {
const app = useNightfall();
const { gutter, wide } = useScreen();
return (
<Block flex={1} gap={0}>
<PageHeader heading="Notifications" />
<ScrollArea flex={1} contentProps={{ px: gutter, pb: 40 }}>
<Block gap={18} w="100%" maw={900} alignSelf="center">
{NOTIFICATIONS.map((item) => {
const title = byId(item.titleId);
return (
<Block key={item.id} direction="row" align="center" gap={12} onPress={() => app.openTitle(title.id)} accessibilityRole="button" accessibilityLabel={item.text}>
<Block gap={0} w={wide ? 160 : 120}>
<Still title={title} w="100%" />
</Block>
<Block flex={1} gap={2}>
<Text c={C.white} fw="bold" size={14}>
{item.kicker}
</Text>
<Text c={C.soft} size={13}>
{item.text}
</Text>
<Text c={C.muted} size={11}>
{item.date}
</Text>
</Block>
</Block>
);
})}
</Block>
</ScrollArea>
</Block>
);
}
screens/NewHotScreen.tsx
import { useState } from 'react';
import { Block, Chip, Icon, ScrollArea, Text, useToast } from '@plocks/ui';
import { TOP_MOVIES, TOP_SHOWS, byId, comingSoon, released, type Title } from '../data';
import { useNightfall } from '../store';
import { Action, C, Dots, Mark, Still, useScreen } from '../ui';
type Section = 'coming' | 'everyone' | 'shows' | 'movies';
const SECTIONS: { key: Section; label: string }[] = [
{ key: 'coming', label: '🍿 Coming Soon' },
{ key: 'everyone', label: "🔥 Everyone's Watching" },
{ key: 'shows', label: '🔟 Top 10 TV Shows' },
{ key: 'movies', label: '🔟 Top 10 Movies' },
];
export function NewHotScreen() {
const { gutter } = useScreen();
const [section, setSection] = useState<Section>('coming');
const items =
section === 'coming'
? comingSoon
: section === 'everyone'
? released.filter((item) => item.label || item.match >= 93)
: (section === 'shows' ? TOP_SHOWS : TOP_MOVIES).map(byId);
return (
<Block flex={1} gap={0}>
<Block gap={0}>
<ScrollArea horizontal showsHorizontalScrollIndicator={false} contentProps={{ px: gutter, py: 10, gap: 8, direction: 'row' }}>
{SECTIONS.map((item) => (
<Chip
key={item.key}
variant="filled"
color={section === item.key ? C.white : C.raised}
labelProps={{ c: section === item.key ? C.black : C.white, fw: 'bold' }}
pressed={section === item.key}
onPress={() => setSection(item.key)}
>
{item.label}
</Chip>
))}
</ScrollArea>
</Block>
<ScrollArea flex={1} contentProps={{ px: gutter, pb: 40, pt: 8 }}>
<Block gap={0} w="100%" maw={760} alignSelf="center">
{items.map((item, index) => (
<Entry key={item.id} title={item} lead={section === 'coming' ? 'date' : section === 'everyone' ? 'none' : 'rank'} rank={index + 1} />
))}
</Block>
</ScrollArea>
</Block>
);
}
function Entry({ title, lead, rank }: { title: Title; lead: 'date' | 'rank' | 'none'; rank: number }) {
const app = useNightfall();
const toast = useToast();
const { wide } = useScreen();
const reminded = app.reminders.includes(title.id);
const inList = app.myList.includes(title.id);
const share = () => toast.show({ title: 'Link copied', message: `nightfall.example/title/${title.id}`, autoHide: 2500 });
return (
<Block direction="row" gap={wide ? 18 : 10} mb={wide ? 40 : 30}>
{lead !== 'none' && (
<Block w={wide ? 64 : 44} align="center" gap={0}>
{lead === 'date' ? (
<>
<Text c={C.muted} fw="bold" size={wide ? 14 : 12}>
{title.coming?.month}
</Text>
<Text c={C.white} fw="900" size={wide ? 38 : 30} lh={wide ? 40 : 32}>
{title.coming?.day}
</Text>
</>
) : (
<Text c={C.white} fw="900" size={wide ? 52 : 38} lh={wide ? 54 : 40}>
{rank}
</Text>
)}
</Block>
)}
<Block flex={1} gap={10}>
<Block gap={0} onPress={() => (title.coming ? app.playTrailer(title.id, `${title.id}:trailer`) : app.openTitle(title.id))} accessibilityRole="button" accessibilityLabel={title.coming ? `Play ${title.title} teaser` : title.title}>
<Still title={title} w="100%" play radius={8}>
<Block position="absolute" left={10} bottom={8} gap={0}>
<Text c={C.white} fw="900" size={wide ? 30 : 20} tt="uppercase">
{title.title}
</Text>
</Block>
</Still>
</Block>
<Block direction="row" align="center" justify="space-between" gap={8}>
<Block flex={1} gap={0}>
{title.coming && (
<Text c={C.white} fw="bold" size={13}>
{title.coming.note}
</Text>
)}
</Block>
{title.coming ? (
<>
<Action
icon={<Icon name={reminded ? 'bell-ringing' : 'bell'} size={22} color={C.white} />}
label={reminded ? 'Reminder Set' : 'Remind Me'}
onPress={() => app.toggleReminder(title.id)}
/>
<Action icon={<Icon name="info" size={22} color={C.white} />} label="Info" onPress={() => app.openTitle(title.id)} />
</>
) : (
<>
<Action icon={<Icon name="share" size={22} color={C.white} />} label="Share" onPress={share} />
<Action
icon={inList ? <Icon name="check" size={22} color={C.white} /> : <Icon name="plus" size={22} color={C.white} />}
label="My List"
onPress={() => app.toggleList(title.id)}
/>
<Action icon={<Icon name="play" variant="filled" size={22} color={C.white} />} label="Play" onPress={() => app.play(title.id)} />
</>
)}
</Block>
{title.original && (
<Block direction="row" align="center" gap={6}>
<Mark size={14} />
<Text c={C.soft} fw="bold" size={10} lts={3}>
{title.kind === 'series' ? 'SERIES' : 'FILM'}
</Text>
</Block>
)}
<Text c={C.white} fw="bold" size={wide ? 20 : 17}>
{title.title}
</Text>
<Text c={C.muted} size={13} lh={19}>
{title.synopsis}
</Text>
<Block gap={0} align="flex-start">
<Dots items={title.moods.concat(title.genres)} c={C.white} size={12} ta="left" />
</Block>
</Block>
</Block>
);
}
screens/PlayerScreen.tsx
import { useState } from 'react';
import { Asset } from 'expo-asset';
import { Block, Button, Icon, IconButton, Text } from '@plocks/ui';
import { Video, type VideoState } from '@plocks/media';
import { byId, trailersFor } from '../data';
import { progressKey, useNightfall, type Route } from '../store';
import { C, useScreen } from '../ui';
const SAMPLE_CLIP = Asset.fromModule(require('../assets/demo-clip.mp4')).uri;
/** Full-screen player. Every title plays the bundled sample clip; progress feeds Continue Watching. */
export function PlayerScreen({ route }: { route: Extract<Route, { name: 'player' }> }) {
const app = useNightfall();
const { gutter } = useScreen();
const [error, setError] = useState<string | null>(null);
const title = byId(route.id);
const { s, e, trailer } = route;
const episode = s && e ? title.seasons?.[s - 1]?.[e - 1] : undefined;
const nextEpisode = s && e ? (title.seasons?.[s - 1]?.[e] ? [s, e + 1] : title.seasons?.[s]?.[0] ? [s + 1, 1] : null) : null;
const trailerLabel = trailer ? trailersFor(title).find((item) => item.id === trailer)?.label : undefined;
const key = progressKey(title.id, s, e);
return (
<Block flex={1} bg="#000" gap={0}>
<Block direction="row" align="center" gap={10} px={gutter} py={10}>
<IconButton icon="arrowLeft" variant="ghost" iconColor={C.white} accessibilityLabel="Exit player" onPress={app.back} />
<Block flex={1} gap={0}>
<Text c={C.white} fw="bold" size={17} numberOfLines={1}>
{title.title}
</Text>
<Text c={C.muted} size={12} numberOfLines={1}>
{trailerLabel ?? (episode ? `S${s}:E${e} “${episode.title}”` : title.length)}
</Text>
</Block>
</Block>
<Block flex={1} w="100%" maw={1100} alignSelf="center" justify="center" gap={0}>
<Video
key={`${key}:${trailer ?? ''}`}
source={{ url: SAMPLE_CLIP }}
w="100%"
aspectRatio={16 / 9}
autoPlay
controls
accessibilityLabel={`Sample clip for ${title.title}`}
onTimeUpdate={(state: VideoState) => {
if (trailer || !state.duration) return;
app.setProgress(key, Math.min(1, state.currentTime / state.duration), title.id, s, e);
}}
onError={setError}
/>
<Block direction="row" align="center" justify="space-between" px={gutter} py={14} gap={10} wrap="wrap">
<Text c={C.muted} size={12}>
{error ? 'This clip could not play here.' : 'Every title plays the same bundled preview footage.'}
</Text>
{nextEpisode && !trailer && (
<Button
title="Next Episode"
startSection={<Icon name="player-skip-forward" variant="filled" size={18} color={C.black} />}
color={C.white}
textColor={C.black}
size="sm"
onPress={() => {
app.back();
app.play(title.id, nextEpisode[0], nextEpisode[1]);
}}
/>
)}
</Block>
</Block>
</Block>
);
}
screens/ProfilePicker.tsx
import { Block, Icon, Text } from '@plocks/ui';
import { PROFILES } from '../data';
import { useNightfall } from '../store';
import { C, ProfileTile, useScreen } from '../ui';
/** "Who's watching?" launch screen. */
export function ProfilePicker() {
const app = useNightfall();
const { wide } = useScreen();
const size = wide ? 140 : 104;
return (
<Block flex={1} align="center" justify="center" gap={wide ? 36 : 28} p={24}>
<Text c={C.red} fw="900" size={wide ? 36 : 28} lts={2}>
NIGHTFALL
</Text>
<Text c={C.white} size={wide ? 40 : 24}>
Who's watching?
</Text>
<Block direction="row" wrap="wrap" justify="center" gap={wide ? 28 : 20} maw={wide ? 900 : 300}>
{PROFILES.map((profile) => (
<Block
key={profile.id}
align="center"
gap={10}
onPress={() => app.selectProfile(profile.id)}
accessibilityRole="button"
accessibilityLabel={`Watch as ${profile.name}`}
>
<ProfileTile color={profile.color} size={size} />
<Text c={C.muted} size={wide ? 18 : 15}>
{profile.name}
</Text>
</Block>
))}
<Block align="center" gap={10}>
<Block w={size} h={size} radius={size / 10} borderWidth={2} borderColor="#3A3A3A" align="center" justify="center" gap={0}>
<Icon name="plus" size={size * 0.4} color={C.muted} />
</Block>
<Text c={C.muted} size={wide ? 18 : 15}>
Add Profile
</Text>
</Block>
</Block>
</Block>
);
}
screens/SearchScreen.tsx
import { useState } from 'react';
import { Block, Icon, IconButton, Input, ScrollArea, Text } from '@plocks/ui';
import { TOP_SEARCHES, byId, released, TITLES } from '../data';
import { useNightfall } from '../store';
import { C, PlayGlyph, PosterGrid, Still, useScreen } from '../ui';
export function SearchScreen() {
const app = useNightfall();
const { wide, gutter } = useScreen();
const [query, setQuery] = useState('');
const q = query.trim().toLowerCase();
const results = TITLES.filter((item) =>
[item.title, item.kind === 'series' ? 'tv show series' : 'movie film', ...item.genres, ...item.moods, ...item.cast, item.creator]
.join(' ')
.toLowerCase()
.includes(q),
);
const suggestions = released.filter((item) => !results.includes(item)).slice(0, wide ? 12 : 9);
return (
<Block flex={1} gap={0}>
<Block direction="row" align="center" gap={8} px={gutter} py={10}>
<IconButton icon="arrowLeft" variant="ghost" iconColor={C.white} accessibilityLabel="Back" onPress={app.back} />
<Input
variant="filled"
size="lg"
radius={6}
value={query}
onChangeText={setQuery}
placeholder="Search shows, movies, genres, people"
placeholderTextColor="#8C8C8C"
startSection={<Icon name="search" size={20} color={C.muted} />}
clearable
clearButtonLabel="Clear search"
autoFocus
mb={0}
flex={1}
inputColor={C.white}
inputFontSize={15}
accessibilityLabel="Search"
/>
</Block>
<ScrollArea flex={1} contentProps={{ px: gutter, pb: 40, gap: 12 }}>
{!q ? (
<>
<Text c={C.white} fw="bold" size={wide ? 22 : 18} mt={8}>
Top Searches
</Text>
<Block gap={wide ? 10 : 6} direction={wide ? 'row' : 'column'} wrap="wrap">
{TOP_SEARCHES.map(byId).map((item) => (
<Block
key={item.id}
direction="row"
align="center"
gap={12}
bg={C.panel}
radius={4}
overflow="hidden"
w={wide ? '49%' : '100%'}
onPress={() => app.openTitle(item.id)}
accessibilityRole="button"
accessibilityLabel={item.title}
>
<Still title={item} w={wide ? 168 : 136} radius={0} />
<Block flex={1} gap={2}>
<Text c={C.white} fw="600" size={15} numberOfLines={2}>
{item.title}
</Text>
<Text c={C.muted} size={12}>
{item.kind === 'series' ? 'TV Show' : 'Movie'} · {item.genres[0]}
</Text>
</Block>
<Block gap={0} pr={14} onPress={() => app.play(item.id)} accessibilityRole="button" accessibilityLabel={`Play ${item.title}`}>
<PlayGlyph size={34} />
</Block>
</Block>
))}
</Block>
</>
) : results.length ? (
<>
<Text c={C.white} fw="bold" size={wide ? 22 : 18} mt={8}>
Movies & TV
</Text>
<PosterGrid titles={results} onPress={app.openTitle} />
</>
) : (
<>
<Block align="center" gap={8} py={36}>
<Text c={C.white} fw="bold" size={20} ta="center">
Oh darn. We don't have that.
</Text>
<Text c={C.muted} size={14} ta="center" maw={360}>
Try searching for another movie, show, actor, director or genre.
</Text>
</Block>
<Text c={C.white} fw="bold" size={wide ? 22 : 18}>
You might like
</Text>
<PosterGrid titles={suggestions} onPress={app.openTitle} />
</>
)}
</ScrollArea>
</Block>
);
}
screens/TitleScreen.tsx
import { useState } from 'react';
import { Avatar, BackgroundImage, Block, Button, Gradient, Icon, IconButton, Menu, MenuDropdown, MenuItem, Progress, ScrollArea, Tabs, Text, useToast } from '@plocks/ui';
import { ART, CAST_COLORS, byId, initials, similarTo, topRank, trailersFor } from '../data';
import { progressKey, useNightfall, type Rating } from '../store';
import { Action, C, Mark, Meta, PlayGlyph, PosterGrid, Still, useScreen } from '../ui';
export function TitleScreen({ id }: { id: string }) {
const app = useNightfall();
const toast = useToast();
const { wide, gutter } = useScreen();
const title = byId(id);
const rank = topRank(title);
const series = title.kind === 'series';
const [section, setSection] = useState(series ? 'episodes' : 'more');
const [season, setSeason] = useState(app.lastEp[id]?.[0] ?? 1);
const [rating, setRating] = useState(false);
const resume = app.resume(title);
const inList = app.myList.includes(id);
const download = app.downloads[id];
const rated = app.ratings[id];
const episodes = title.seasons?.[season - 1] ?? [];
const thumb = { down: 'thumb-down', up: 'thumb-up', love: 'heart' };
const reminded = app.reminders.includes(id);
const share = () =>
toast.show({ title: 'Link copied', message: `nightfall.example/title/${title.id}`, autoHide: 2500 });
const rate = (value: Rating) => {
app.rate(id, value);
setRating(false);
};
return (
<ScrollArea flex={1} contentProps={{ pb: 48 }}>
<Block gap={0} w="100%" maw={1100} alignSelf="center">
<BackgroundImage source={ART[title.art]} w="100%" h={wide ? 460 : 250} justify="space-between">
<Gradient colors={[title.tint, '#0000', C.black]} flex={1} justify="space-between" p={gutter}>
<Block direction="row" justify="space-between" gap={0}>
<IconButton icon="arrowLeft" variant="filled" color="#000A" iconColor={C.white} accessibilityLabel="Back" onPress={app.back} />
</Block>
{!title.coming && (
<Block alignSelf="center" gap={0} onPress={() => app.play(id)} accessibilityRole="button" accessibilityLabel={`Play ${title.title}`}>
<PlayGlyph size={wide ? 68 : 52} />
</Block>
)}
<Block h={20} gap={0} />
</Gradient>
</BackgroundImage>
<Block px={gutter} gap={12} mt={wide ? -40 : 0}>
{title.original && (
<Block direction="row" align="center" gap={6}>
<Mark size={16} />
<Text c={C.soft} fw="bold" size={11} lts={3}>
{series ? 'SERIES' : 'FILM'}
</Text>
</Block>
)}
<Text c={C.white} fw="900" size={wide ? 44 : 28} lh={wide ? 48 : 32}>
{title.title}
</Text>
<Meta title={title} />
{rank && !title.coming && (
<Block direction="row" align="center" gap={8}>
<Block bg={C.red} px={4} py={1} radius={2} gap={0}>
<Text c={C.white} fw="900" size={10}>
TOP 10
</Text>
</Block>
<Text c={C.white} fw="bold" size={14}>
#{rank} in {series ? 'TV Shows' : 'Movies'} Today
</Text>
</Block>
)}
{title.coming ? (
<Block gap={8} maw={wide ? 420 : undefined}>
<Text c={C.white} fw="bold" size={14}>
{title.coming.note}
</Text>
<Button
title={reminded ? 'Reminder set' : 'Remind Me'}
startSection={<Icon name={reminded ? 'bell-ringing' : 'bell'} size={20} color={C.black} />}
color={C.white}
textColor={C.black}
fullWidth
onPress={() => app.toggleReminder(id)}
/>
</Block>
) : (
<Block gap={8} maw={wide ? 420 : undefined}>
<Button
title={resume.value > 0 && resume.value < 1 ? `Resume${resume.label ? ` ${resume.label}` : ''}` : series ? 'Play S1:E1' : 'Play'}
startSection={<Icon name="play" variant="filled" size={20} color={C.black} />}
color={C.white}
textColor={C.black}
fullWidth
onPress={() => app.play(id)}
/>
{resume.value > 0 && resume.value < 1 && <Progress value={resume.value * 100} size={3} color={C.red} trackColor="#555" />}
<Button
title={download === undefined ? 'Download' : download < 1 ? `Downloading ${Math.round(download * 100)}%` : 'Downloaded'}
startSection={
download === 1 ? <Icon name="circle-check" variant="filled" size={20} color={C.white} /> : <Icon name="download" size={20} color={C.white} />
}
color="#333333"
textColor={C.white}
fullWidth
onPress={() => (download === undefined ? app.download(id) : app.push({ name: 'downloads' }))}
/>
</Block>
)}
<Text c={C.white} size={wide ? 16 : 14} lh={wide ? 24 : 21} maw={720}>
{title.synopsis}
</Text>
<Text c={C.muted} size={12} lh={18}>
Cast: <Text c={C.soft} size={12}>{title.cast.join(', ')}</Text>
</Text>
<Text c={C.muted} size={12}>
{series ? 'Creator' : 'Director'}: <Text c={C.soft} size={12}>{title.creator}</Text>
</Text>
<Block direction="row" gap={wide ? 20 : 4} mt={4} align="flex-start">
<Action
icon={inList ? <Icon name="check" size={26} color={C.white} /> : <Icon name="plus" size={26} color={C.white} />}
label="My List"
accessibilityLabel={inList ? 'Remove from My List' : 'Add to My List'}
onPress={() => app.toggleList(id)}
/>
{!title.coming && (
<Action
icon={<Icon name={rated ? thumb[rated] : 'thumb-up'} variant={rated ? 'filled' : 'outlined'} size={26} color={C.white} />}
label={rated === 'love' ? 'Love this!' : rated === 'up' ? 'I like this' : rated === 'down' ? 'Not for me' : 'Rate'}
onPress={() => setRating((open) => !open)}
/>
)}
{title.coming && (
<Action
icon={<Icon name={reminded ? 'bell-ringing' : 'bell'} size={26} color={C.white} />}
label="Remind Me"
onPress={() => app.toggleReminder(id)}
/>
)}
<Action icon={<Icon name="share" size={26} color={C.white} />} label="Share" onPress={share} />
</Block>
{rating && (
<Block direction="row" gap={6} bg={C.raised} radius="full" p={6} alignSelf="flex-start">
{(['down', 'up', 'love'] as Rating[]).map((value) => {
return (
<Block
key={value}
gap={2}
align="center"
px={14}
py={6}
radius="full"
bg={rated === value ? '#FFFFFF22' : undefined}
onPress={() => rate(value)}
accessibilityRole="button"
accessibilityLabel={value === 'down' ? 'Not for me' : value === 'up' ? 'I like this' : 'Love this'}
>
<Icon name={thumb[value]} variant={rated === value ? 'filled' : 'outlined'} size={24} color={C.white} />
<Text c={C.soft} size={10}>
{value === 'down' ? 'Not for me' : value === 'up' ? 'I like this' : 'Love this!'}
</Text>
</Block>
);
})}
</Block>
)}
<Block gap={6} mt={4}>
<Text c={C.muted} size={12}>
Genres: <Text c={C.soft} size={12}>{title.genres.join(', ')}</Text>
</Text>
<Text c={C.muted} size={12}>
This {series ? 'show' : 'movie'} is: <Text c={C.soft} size={12}>{title.moods.join(', ')}</Text>
</Text>
</Block>
<Block gap={10} mt={8}>
<Text c={C.white} fw="bold" size={16}>
Cast
</Text>
<ScrollArea horizontal showsHorizontalScrollIndicator={false} contentProps={{ direction: 'row', gap: 14 }}>
{title.cast.map((actor, index) => (
<Block key={actor} w={76} align="center" gap={6}>
<Avatar
size={52}
fallback={initials(actor)}
bg={CAST_COLORS[index % CAST_COLORS.length]}
textColor={C.white}
showText={false}
accessibilityLabel={actor}
/>
<Text c={C.soft} size={11} ta="center" numberOfLines={2}>
{actor}
</Text>
</Block>
))}
</ScrollArea>
</Block>
<Block mt={10} gap={0} borderTopWidth={1} borderTopColor={C.line}>
<Tabs
navigationOnly
variant="line"
value={section}
onChange={setSection}
color={C.red}
activeTabTextColor={C.white}
labelProps={{ size: 14, fw: 'bold', c: C.muted }}
items={[
...(series ? [{ key: 'episodes', label: 'Episodes', content: null }] : []),
{ key: 'more', label: 'More Like This', content: null },
{ key: 'trailers', label: 'Trailers & More', content: null },
]}
/>
</Block>
{section === 'episodes' && series && (
<Block gap={14}>
{title.seasons && title.seasons.length > 1 ? (
<Menu position="bottom-start">
<Button
title={`Season ${season}`}
endSection={<Icon name="chevron-down" size={16} color={C.white} />}
color={C.raised}
textColor={C.white}
size="sm"
accessibilityLabel="Choose season"
/>
<MenuDropdown>
{title.seasons.map((_, index) => (
<MenuItem key={index} onPress={() => setSeason(index + 1)}>
{`Season ${index + 1}${index + 1 === season ? ' ✓' : ''}`}
</MenuItem>
))}
</MenuDropdown>
</Menu>
) : (
<Text c={C.soft} fw="bold" size={14}>
Season 1
</Text>
)}
{episodes.map((episode) => {
const watched = app.progress[progressKey(id, season, episode.n)] ?? 0;
return (
<Block key={episode.n} gap={8}>
<Block direction="row" align="center" gap={12}>
<Block
gap={0}
w={wide ? 200 : 128}
onPress={title.coming ? undefined : () => app.play(id, season, episode.n)}
accessibilityRole="button"
accessibilityLabel={`Play episode ${episode.n}, ${episode.title}`}
>
<Still title={title} w="100%" play={!title.coming} progress={watched} />
</Block>
<Block flex={1} gap={2}>
<Text c={C.white} fw="bold" size={14} numberOfLines={2}>
{episode.n}. {episode.title}
</Text>
<Text c={C.muted} size={12}>
{episode.length}
</Text>
</Block>
{!title.coming && (
<IconButton
icon={app.downloads[id] === 1 ? 'circle-check' : 'download'} iconVariant={app.downloads[id] === 1 ? 'filled' : 'outlined'}
variant="ghost"
iconColor={C.white}
accessibilityLabel={`Download episode ${episode.n}`}
onPress={() => app.download(id)}
/>
)}
</Block>
<Text c={C.muted} size={13} lh={19}>
{episode.synopsis}
</Text>
</Block>
);
})}
</Block>
)}
{section === 'more' && <PosterGrid titles={similarTo(title).slice(0, wide ? 12 : 9)} onPress={app.openTitle} />}
{section === 'trailers' && (
<Block gap={18} direction={wide ? 'row' : 'column'} wrap="wrap">
{trailersFor(title).map((trailer) => (
<Block
key={trailer.id}
gap={8}
w={wide ? 320 : '100%'}
onPress={() => app.playTrailer(id, trailer.id)}
accessibilityRole="button"
accessibilityLabel={`Play ${trailer.label}`}
>
<Still title={title} w="100%" play />
<Text c={C.white} fw="bold" size={14}>
{trailer.label}: {title.title}{' '}
<Text c={C.muted} size={12}>
{trailer.length}
</Text>
</Text>
</Block>
))}
</Block>
)}
</Block>
</Block>
</ScrollArea>
);
}
store.tsx
import { createContext, useContext, useEffect, useState, type ReactNode } from 'react';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { byId, PROFILES, type Profile, type Title } from './data';
export type Tab = 'home' | 'new' | 'my';
export type Filter = 'all' | 'series' | 'movie';
export type Rating = 'down' | 'up' | 'love';
export type Route =
| { name: 'title'; id: string }
| { name: 'player'; id: string; s?: number; e?: number; trailer?: string }
| { name: 'search' }
| { name: 'downloads' }
| { name: 'notifications' };
interface Saved {
myList: string[];
progress: Record<string, number>;
lastEp: Record<string, [number, number]>;
ratings: Record<string, Rating>;
reminders: string[];
downloads: Record<string, number>;
trailers: string[];
}
const STORAGE = 'plocks-nightfall-example:v2';
const INITIAL: Saved = {
myList: ['stillwater', 'afterdark', 'tidekeepers'],
progress: { wildwood: 0.42, 'nightshift:1:3': 0.19, 'dust:1:2': 0.63, 'nightshift:1:1': 1, 'nightshift:1:2': 1, 'dust:1:1': 1 },
lastEp: { nightshift: [1, 3], dust: [1, 2] },
ratings: { evergreen: 'love' },
reminders: ['northern'],
downloads: { goldenhour: 1 },
trailers: ['glasshouse'],
};
export const progressKey = (id: string, s?: number, e?: number) => (s && e ? `${id}:${s}:${e}` : id);
function useNightfallState() {
const [profile, setProfile] = useState<Profile | null>(null);
const [tab, setTab] = useState<Tab>('home');
const [filter, setFilter] = useState<Filter>('all');
const [genre, setGenre] = useState<string | null>(null);
const [stack, setStack] = useState<Route[]>([]);
const [saved, setSaved] = useState<Saved>(INITIAL);
const [ready, setReady] = useState(false);
useEffect(() => {
AsyncStorage.getItem(STORAGE)
.then((raw) => {
if (raw) setSaved({ ...INITIAL, ...(JSON.parse(raw) as Partial<Saved>) });
})
.catch(() => {})
.finally(() => setReady(true));
}, []);
useEffect(() => {
if (ready) AsyncStorage.setItem(STORAGE, JSON.stringify(saved)).catch(() => {});
}, [saved, ready]);
// Simulated downloads: anything below 1 creeps forward until it finishes.
const downloading = Object.values(saved.downloads).some((value) => value < 1);
useEffect(() => {
if (!downloading) return;
const timer = setInterval(() => {
setSaved((old) => ({
...old,
downloads: Object.fromEntries(
Object.entries(old.downloads).map(([id, value]) => [id, value < 1 ? Math.min(1, value + 0.08) : value]),
),
}));
}, 350);
return () => clearInterval(timer);
}, [downloading]);
const toggle = (list: string[], id: string) => (list.includes(id) ? list.filter((item) => item !== id) : [...list, id]);
const update = (patch: (old: Saved) => Partial<Saved>) => setSaved((old) => ({ ...old, ...patch(old) }));
return {
...saved,
profile,
tab,
filter,
genre,
stack,
route: stack[stack.length - 1] as Route | undefined,
selectProfile: (id: string | null) => {
setProfile(PROFILES.find((item) => item.id === id) ?? null);
setStack([]);
setTab('home');
},
setTab: (next: Tab) => {
setStack([]);
setTab(next);
},
setFilter: (next: Filter, nextGenre: string | null = null) => {
setStack([]);
setTab('home');
setFilter(next);
setGenre(nextGenre);
},
push: (next: Route) => setStack((old) => [...old, next]),
back: () => setStack((old) => old.slice(0, -1)),
openTitle: (id: string) => setStack((old) => [...old, { name: 'title', id }]),
play: (id: string, s?: number, e?: number) => {
const title = byId(id);
if (title.kind === 'series' && !s) [s, e] = saved.lastEp[id] ?? [1, 1];
setStack((old) => [...old, { name: 'player', id, s, e }]);
},
playTrailer: (id: string, trailer: string) => {
update((old) => ({ trailers: old.trailers.includes(id) ? old.trailers : [id, ...old.trailers] }));
setStack((old) => [...old, { name: 'player', id, trailer }]);
},
toggleList: (id: string) => update((old) => ({ myList: toggle(old.myList, id) })),
toggleReminder: (id: string) => update((old) => ({ reminders: toggle(old.reminders, id) })),
rate: (id: string, value: Rating) =>
update((old) => {
const ratings = { ...old.ratings };
if (ratings[id] === value) delete ratings[id];
else ratings[id] = value;
return { ratings };
}),
download: (id: string) => update((old) => ({ downloads: { ...old.downloads, [id]: old.downloads[id] ?? 0 } })),
removeDownload: (id: string) =>
update((old) => {
const downloads = { ...old.downloads };
delete downloads[id];
return { downloads };
}),
setProgress: (key: string, value: number, id?: string, s?: number, e?: number) =>
setSaved((old) => {
if (Math.abs((old.progress[key] ?? 0) - value) < 0.01 && value !== 1) return old;
const lastEp = id && s && e ? { ...old.lastEp, [id]: [s, e] as [number, number] } : old.lastEp;
return { ...old, lastEp, progress: { ...old.progress, [key]: value } };
}),
/** Progress for the title's resume point (last episode for series). */
resume: (title: Title) => {
if (title.kind === 'movie') return { value: saved.progress[title.id] ?? 0, label: '' };
const [s, e] = saved.lastEp[title.id] ?? [1, 1];
return { value: saved.progress[progressKey(title.id, s, e)] ?? 0, label: `S${s}:E${e}`, s, e };
},
};
}
export type Nightfall = ReturnType<typeof useNightfallState>;
const Context = createContext<Nightfall | null>(null);
export function NightfallProvider({ children }: { children: ReactNode }) {
return <Context.Provider value={useNightfallState()}>{children}</Context.Provider>;
}
export function useNightfall() {
const value = useContext(Context);
if (!value) throw new Error('useNightfall must be used inside NightfallProvider');
return value;
}
ui.tsx
import { useState, type ReactNode } from 'react';
import { useWindowDimensions } from 'react-native';
import { BackgroundImage, Block, Gradient, Icon, Progress, ScrollArea, Text } from '@plocks/ui';
import { ART, topRank, type Title } from './data';
export const C = {
black: '#0D0D0D',
panel: '#181818',
raised: '#262626',
white: '#FFFFFF',
muted: '#A3A3A3',
soft: '#D4D4D4',
red: '#E50914',
green: '#46D369',
line: '#2A2A2A',
};
/** Breakpoints used across screens. `wide` switches to the desktop layout with a top nav. */
export function useScreen() {
const { width } = useWindowDimensions();
const wide = width >= 900;
return { width, wide, gutter: wide ? 40 : 16, poster: wide ? 168 : 112 };
}
/** The red "N" mark used on originals and in the header. */
export function Mark({ size = 14 }: { size?: number }) {
return (
<Text c={C.red} fw="900" size={size} lh={size}>
N
</Text>
);
}
/** Poster: 2:3 art, originals mark, Top 10 flag and an optional ribbon. */
export function Poster({ title, w, onPress }: { title: Title; w: number; onPress: () => void }) {
const rank = topRank(title);
return (
<BackgroundImage
source={ART[title.art]}
w={w}
h={Math.round(w * 1.5)}
radius={6}
onPress={onPress}
accessibilityRole="button"
accessibilityLabel={title.title}
>
<Gradient colors={[title.tint, '#0000', '#000E']} flex={1} justify="space-between">
<Block direction="row" justify="space-between" align="flex-start" gap={0}>
<Block gap={0} p={7}>
{title.original && <Mark size={w > 140 ? 18 : 14} />}
</Block>
{rank !== null && rank <= 3 && !title.coming && <TopTenFlag />}
</Block>
<Block gap={6}>
<Text c={C.white} fw="900" size={w > 140 ? 18 : 14} lh={w > 140 ? 21 : 16} ta="center" px={6} numberOfLines={3} tt="uppercase">
{title.title}
</Text>
{title.label ? (
<Block bg={C.red} py={3} align="center" gap={0}>
<Text c={C.white} fw="bold" size={w > 140 ? 11 : 9}>
{title.label}
</Text>
</Block>
) : (
<Block h={4} gap={0} />
)}
</Block>
</Gradient>
</BackgroundImage>
);
}
export function TopTenFlag() {
return (
<Block bg={C.red} w={22} pt={2} pb={3} align="center" gap={0} borderTopRightRadius={6}>
<Text c={C.white} fw="bold" size={7} lh={8}>
TOP
</Text>
<Text c={C.white} fw="900" size={11} lh={12}>
10
</Text>
</Block>
);
}
/** A titled horizontal shelf. */
export function Shelf({ heading, children }: { heading: string; children: ReactNode }) {
const { wide, gutter } = useScreen();
return (
<Block gap={wide ? 12 : 9} mt={wide ? 30 : 22}>
<Text c={C.white} fw="bold" size={wide ? 21 : 17} px={gutter}>
{heading}
</Text>
<ScrollArea horizontal showsHorizontalScrollIndicator={false} contentProps={{ px: gutter, gap: wide ? 10 : 8, direction: 'row' }}>
{children}
</ScrollArea>
</Block>
);
}
/**
* Even poster grid. Measures its own width, then picks the column count that keeps
* posters near `min` wide, so gutters are identical and every poster shares one 2:3 size.
*/
export function PosterGrid({ titles, onPress, min, gap = 8 }: { titles: Title[]; onPress: (id: string) => void; min?: number; gap?: number }) {
const { poster } = useScreen();
const [width, setWidth] = useState(0);
const target = min ?? poster;
const columns = Math.max(3, Math.floor((width + gap) / (target + gap)));
const itemW = Math.floor((width - gap * (columns - 1)) / columns);
return (
<Block direction="row" wrap="wrap" gap={gap} w="100%" onLayout={(event) => setWidth(event.nativeEvent.layout.width)}>
{width > 0 && titles.map((item) => <Poster key={item.id} title={item} w={itemW} onPress={() => onPress(item.id)} />)}
</Block>
);
}
/** 16:9 still with the title tint and an optional centred play glyph. */
export function Still({
title,
w,
radius = 6,
play = false,
progress,
children,
}: {
title: Title;
w: number | string;
radius?: number;
play?: boolean;
progress?: number;
children?: ReactNode;
}) {
return (
<BackgroundImage source={ART[title.art]} w={w} aspectRatio={16 / 9} radius={radius}>
<Gradient colors={[title.tint, '#0003']} flex={1} justify="center" align="center">
{play && <PlayGlyph />}
{children}
</Gradient>
{progress !== undefined && progress > 0 && (
<Block position="absolute" left={0} right={0} bottom={0} gap={0}>
<Progress value={progress * 100} size={3} radius={0} color={C.red} trackColor="#FFFFFF44" />
</Block>
)}
</BackgroundImage>
);
}
export function PlayGlyph({ size = 38 }: { size?: number }) {
return (
<Block w={size} h={size} radius="full" borderWidth={1.5} borderColor={C.white} bg="#0008" align="center" justify="center" gap={0}>
<Icon name="play" variant="filled" size={size * 0.45} color={C.white} />
</Block>
);
}
/** Icon-over-label action (My List, Rate, Share, Remind Me). */
export function Action({ icon, label, onPress, accessibilityLabel }: { icon: ReactNode; label: string; onPress: () => void; accessibilityLabel?: string }) {
return (
<Block gap={5} align="center" miw={64} py={4} onPress={onPress} accessibilityRole="button" accessibilityLabel={accessibilityLabel ?? label}>
{icon}
<Text c={C.muted} size={11}>
{label}
</Text>
</Block>
);
}
/** Bold meta line: match %, year, rating box, length, HD. */
export function Meta({ title, size = 13 }: { title: Title; size?: number }) {
return (
<Block direction="row" align="center" gap={8} wrap="wrap">
{!title.coming && (
<Text c={C.green} fw="bold" size={size}>
{title.match}% Match
</Text>
)}
<Text c={C.soft} size={size}>
{title.year}
</Text>
<Block bg="#4D4D4D" px={5} radius={2} gap={0}>
<Text c={C.white} size={size - 2} fw="600">
{title.rating}
</Text>
</Block>
<Text c={C.soft} size={size}>
{title.length}
</Text>
<Block borderWidth={1} borderColor="#8C8C8C" px={4} radius={3} gap={0}>
<Text c={C.soft} size={size - 3} fw="bold">
HD
</Text>
</Block>
</Block>
);
}
/** Square profile avatar. */
export function ProfileTile({ color, size }: { color: string; size: number }) {
return (
<Block w={size} h={size} radius={size / 10} bg={color} align="center" justify="center" gap={size * 0.06}>
<Block direction="row" gap={size * 0.22}>
<Block w={size * 0.09} h={size * 0.14} radius="full" bg="#FFFFFFE6" gap={0} />
<Block w={size * 0.09} h={size * 0.14} radius="full" bg="#FFFFFFE6" gap={0} />
</Block>
<Block w={size * 0.42} h={size * 0.16} borderBottomWidth={size * 0.06} borderLeftWidth={size * 0.06} borderRightWidth={size * 0.06} borderColor="#FFFFFFE6" gap={0} borderBottomLeftRadius={size * 0.21} borderBottomRightRadius={size * 0.21} mt={size * 0.04} />
</Block>
);
}
/** Dot-separated genres / moods line. */
export function Dots({ items, c = C.soft, size = 13, ta = 'center' }: { items: string[]; c?: string; size?: number; ta?: 'left' | 'center' }) {
return (
<Text c={c} size={size} ta={ta}>
{items.join(' · ')}
</Text>
);
}