Table reservation

Book a table at a restaurant with motion throughout: chairs spring in and slide round a drawn table as the party grows, an accent pill glides along a 14-day strip whose availability dots follow the party size, and changing the date restaggers the lunch and dinner slots while large parties see fewer times. The chosen slot springs its accent in, the sticky summary cross-fades with every choice, and Reserve stretches into a "Holding your table" sweep before a ticket with a perforated stub rises, with a flip-to-Added calendar button and Modify keeping every choice.

restaurantbookingreservationdate pickertime slotsstepperticketanimationreanimated
Paste into Claude Code Cursor Codex Lovable RapidNative
Live preview · follows the site themeOpen full screen

Details

File
components/patterns/table-reservation.tsx
Lines
1516
Stack
React Native, StyleSheet
Packages
expo-linear-gradient, expo-status-bar, lucide-react-native, react-native-reanimated, react-native-safe-area-context, react-native-svg, react-native-worklets
Platforms
iOS, Android, Web

Using gluestack-ui?

Optional. The screen is plain React Native; these components can stand in for its primitives.

components/patterns/table-reservation.tsx
1import { useEffect, useLayoutEffect, useRef, useState, type ComponentRef, type ReactNode } from 'react';
2import { Image, Platform, Pressable, ScrollView, StyleSheet, Text, TextInput, View, useColorScheme, useWindowDimensions, type LayoutChangeEvent, type StyleProp, type TextStyle, type ViewStyle } from 'react-native';
3import Animated, {
4 cancelAnimation,
5 Easing,
6 FadeIn,
7 FadeInDown,
8 interpolate,
9 interpolateColor,
10 runOnJS,
11 useAnimatedReaction,
12 useAnimatedScrollHandler,
13 useAnimatedStyle,
14 useSharedValue,
15 withDelay,
16 withRepeat,
17 withSequence,
18 withSpring,
19 withTiming,
20 type SharedValue,
21} from 'react-native-reanimated';
22import { LinearGradient } from 'expo-linear-gradient';
23import { StatusBar } from 'expo-status-bar';
24import { useSafeAreaInsets } from 'react-native-safe-area-context';
25import {
26 ArrowRight,
27 Bell,
28 BellRing,
29 Briefcase,
30 Cake,
31 CalendarCheck,
32 CalendarPlus,
33 Check,
34 ChevronLeft,
35 Heart,
36 MapPin,
37 Minus,
38 Moon,
39 PencilLine,
40 Phone,
41 Plus,
42 Share,
43 ShieldCheck,
44 Sofa,
45 Star,
46 Sun,
47 Trees,
48 Wine,
49 type LucideIcon,
50} from 'lucide-react-native';
51
52// ─── Brand ──────────────────────────────────────────────────────────────────
53// The screen's accent and name. Every accent colour below derives from these, so changing them rebrands the screen.
54
55const ACCENT = '#862E2E';
56const ACCENT_DARK = '#DE8282'; // the accent as text and icons on dark backgrounds
57const ON_ACCENT = '#FFFFFF'; // text and icons on an accent fill
58const APP_NAME = 'Tablenote';
59
60/** `hex` at `alpha` opacity, as rgba(). */
61function tint(hex: string, alpha: number) {
62 const n = parseInt(hex.slice(1), 16);
63 return `rgba(${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255}, ${alpha})`;
64}
65
66/** `hex` mixed toward black (amount > 0) or white (amount < 0); amount from -1 to 1. */
67function shade(hex: string, amount: number) {
68 const n = parseInt(hex.slice(1), 16);
69 const target = amount < 0 ? 255 : 0;
70 const p = Math.abs(amount);
71 const c = (v: number) => Math.round(v + (target - v) * p).toString(16).padStart(2, '0');
72 return `#${c((n >> 16) & 255)}${c((n >> 8) & 255)}${c(n & 255)}`.toUpperCase();
73}
74
75/** `hex` with its hue turned by `deg` degrees and its HSL lightness and saturation moved by `light` / `sat` (-1 to 1).
76 * For accent-related colours of a different hue (an amber-to-coral gradient from one accent). */
77function spin(hex: string, deg: number, light = 0, sat = 0) {
78 const n = parseInt(hex.slice(1), 16);
79 const r = ((n >> 16) & 255) / 255;
80 const g = ((n >> 8) & 255) / 255;
81 const b = (n & 255) / 255;
82 const max = Math.max(r, g, b);
83 const min = Math.min(r, g, b);
84 const d = max - min;
85 const s = Math.min(1, Math.max(0, (d === 0 ? 0 : d / (1 - Math.abs(max + min - 1))) + sat));
86 const l = Math.min(1, Math.max(0, (max + min) / 2 + light));
87 const h0 = d === 0 ? 0 : max === r ? ((g - b) / d + 6) % 6 : max === g ? (b - r) / d + 2 : (r - g) / d + 4;
88 const h = (((h0 * 60 + deg) % 360) + 360) % 360;
89 const a = s * Math.min(l, 1 - l);
90 const f = (m: number) => {
91 const k = (m + h / 30) % 12;
92 return Math.round(255 * (l - a * Math.max(-1, Math.min(k - 3, 9 - k, 1)))).toString(16).padStart(2, '0');
93 };
94 return `#${f(0)}${f(8)}${f(4)}`.toUpperCase();
95}
96
97// ─── Sample data ────────────────────────────────────────────────────────────
98
99const photo = (id: string, w: number) => `https://images.unsplash.com/photo-${id}?w=${w}&q=80&fit=crop`;
100
101const RESTAURANT = {
102 name: 'Osteria Lirica',
103 cuisine: 'Modern Italian · Wine bar',
104 price: '$$$',
105 rating: 4.8,
106 reviews: '2.1k',
107 area: 'Hayes Valley',
108 distance: '0.8 mi',
109 street: '418 Linden Row',
110 bookedLastHour: 12,
111 cancelBy: '2 PM',
112 room: photo('1552566626-52f8b828add9', 1000),
113 dish: photo('1414235077428-338989a2e8c0', 240),
114};
115
116const MIN_PARTY = 1;
117const MAX_PARTY = 10;
118const CALL_FROM = 9; // parties this size or larger are confirmed by phone
119const BAR_MAX = 4; // the counter seats up to four together
120const REQUEST_MAX = 140;
121
122type SeatingId = 'indoor' | 'terrace' | 'bar';
123type OccasionId = 'birthday' | 'anniversary' | 'business';
124type Sitting = { id: string; label: string; hours: string; icon: LucideIcon; times: number[] };
125
126const at = (hour: number, minute = 0) => hour * 60 + minute;
127
128const SITTINGS: Sitting[] = [
129 { id: 'lunch', label: 'Lunch', hours: '12 to 2:30 PM', icon: Sun, times: [at(12), at(12, 30), at(13), at(13, 30)] },
130 { id: 'dinner', label: 'Dinner', hours: '6 to 10:30 PM', icon: Moon, times: [at(18), at(18, 30), at(19), at(19, 30), at(20), at(20, 30), at(21), at(21, 30)] },
131];
132
133const SEATING: { id: SeatingId; label: string; icon: LucideIcon; note: string }[] = [
134 { id: 'indoor', label: 'Indoor', icon: Sofa, note: 'Main room, by the wood-fired hearth' },
135 { id: 'terrace', label: 'Terrace', icon: Trees, note: 'Covered and heated, blankets on request' },
136 { id: 'bar', label: 'Bar counter', icon: Wine, note: 'Facing the pasta station, up to 4 guests' },
137];
138
139const OCCASIONS: { id: OccasionId; label: string; icon: LucideIcon; perk: string }[] = [
140 { id: 'birthday', label: 'Birthday', icon: Cake, perk: "We'll bring a candle out with dessert" },
141 { id: 'anniversary', label: 'Anniversary', icon: Heart, perk: 'A glass of sparkling wine to start, on us' },
142 { id: 'business', label: 'Business', icon: Briefcase, perk: "We'll seat you somewhere quieter" },
143];
144
145// A fixed first day (Tuesday 1 December 2026), so the screen looks the same every time. Start from today in your app.
146const FIRST_DAY = new Date(2026, 11, 1);
147const CLOSED_ON = 1; // closed on Mondays
148const WEEKDAYS = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
149const MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
150
151// The screen opens on Friday at 8 PM for four on the terrace, ready to reserve.
152const START = { party: 4, day: 3, minute: at(20), seating: 'terrace' as SeatingId };
153
154// ─── Availability ───────────────────────────────────────────────────────────
155// Stand-in for your availability API: tables left per slot, worked out from the day and time so it never changes
156// between renders. Busier on weekend evenings and around 8 PM, and big tables run out first.
157
158type Tables = { two: number; four: number; six: number; large: number };
159type Day = { index: number; date: number; weekday: string; long: string; month: string; closed: boolean; tables: Tables[][] };
160
161/** A well-mixed 0 to 1 number from an integer. */
162function hash(n: number) {
163 let x = n | 0;
164 x = Math.imul(x ^ (x >>> 16), 0x45d9f3b);
165 x = Math.imul(x ^ (x >>> 16), 0x45d9f3b);
166 x = x ^ (x >>> 16);
167 return (x >>> 0) / 4294967296;
168}
169
170// How full each weekday runs, Sunday first, as [lunch, dinner]; and the extra rush per slot.
171const BUSY = [[0.7, 0.4], [0, 0], [0.15, 0.3], [0.25, 0.4], [0.3, 0.5], [0.4, 0.65], [0.85, 1.05]];
172const RUSH = [[0, 0.15, 0.15, 0], [0, 0, 0.1, 0.3, 0.25, 0.3, 0.1, 0]];
173
174function tablesAt(day: number, weekday: number, sitting: number, slot: number): Tables {
175 const p = BUSY[weekday][sitting] + RUSH[sitting][slot];
176 const r = (k: number) => hash(1019 + day * 977 + sitting * 131 + slot * 29 + k * 7);
177 return {
178 two: Math.max(0, Math.floor(5.4 - p * 5 + r(1) * 2.4)),
179 four: Math.max(0, Math.floor(5 - p * 5 + r(2) * 2.6)),
180 six: Math.max(0, Math.floor(2 - p * 2.4 + r(3) * 1.6)),
181 large: r(4) > 0.5 + p * 0.4 ? 1 : 0,
182 };
183}
184
185/** Tables that seat `party`: a pair fits any table, ten only the long one. */
186const tablesFor = (t: Tables, party: number) => (party <= 2 ? t.two : 0) + (party <= 4 ? t.four : 0) + (party <= 6 ? t.six : 0) + t.large;
187
188const DAYS: Day[] = Array.from({ length: 14 }, (_, index) => {
189 const d = new Date(FIRST_DAY.getFullYear(), FIRST_DAY.getMonth(), FIRST_DAY.getDate() + index);
190 const w = d.getDay();
191 return {
192 index,
193 date: d.getDate(),
194 weekday: WEEKDAYS[w].slice(0, 3),
195 long: WEEKDAYS[w],
196 month: MONTHS[d.getMonth()],
197 closed: w === CLOSED_ON,
198 tables: SITTINGS.map((s, si) => s.times.map((_, j) => tablesAt(index, w, si, j))),
199 };
200});
201
202function leftAt(day: Day, minute: number, party: number) {
203 if (day.closed) return 0;
204 for (let si = 0; si < SITTINGS.length; si++) {
205 const j = SITTINGS[si].times.indexOf(minute);
206 if (j >= 0) return tablesFor(day.tables[si][j], party);
207 }
208 return 0;
209}
210
211const openTimes = (day: Day, party: number) => (day.closed ? 0 : day.tables.flat().filter((t) => tablesFor(t, party) > 0).length);
212
213const CODE_CHARS = 'ACDEFHJKLMNPRTVWXY3479';
214function confirmationCode(day: number, minute: number, party: number) {
215 let out = '';
216 for (let i = 0; i < 4; i++) out += CODE_CHARS[Math.floor(hash(day * 7919 + minute * 31 + party * 401 + i * 97) * CODE_CHARS.length)];
217 return `LRC-${out}`;
218}
219
220// ─── Formatting ─────────────────────────────────────────────────────────────
221
222const clock = (m: number) => `${((Math.floor(m / 60) + 11) % 12) + 1}:${String(m % 60).padStart(2, '0')} ${m < 720 ? 'AM' : 'PM'}`;
223const shortDate = (d: Day) => `${d.weekday} ${d.date} ${d.month.slice(0, 3)}`;
224const guests = (n: number) => `${n} ${n === 1 ? 'guest' : 'guests'}`;
225const seatingLabel = (id: SeatingId) => SEATING.find((s) => s.id === id)?.label ?? '';
226
227// ─── Palette ────────────────────────────────────────────────────────────────
228
229const ACCENT_FILL_DARK = spin(ACCENT, 0, 0.08); // a touch lighter, so selected fills still glow on a dark page
230const ON_ACCENT_SOFT = tint(ON_ACCENT, 0.78);
231const ON_ACCENT_SHEEN = tint(ON_ACCENT, 0.16);
232const ACCENT_DEEP = shade(ACCENT, 0.35);
233const STAR = '#F4B740';
234const HERO_PLACEHOLDER = '#3B2421'; // matched to the dining-room photo
235const COLUMN = 520;
236const SIDE = 20;
237const HERO_BODY = 166;
238const SHEET_LIP = 22;
239const TOP_ROW = 52;
240const BAR_BODY = 76;
241const BTN_W = 148;
242const HOLD_MS = 1700;
243const GLIDE = { damping: 18, stiffness: 210, mass: 0.7 };
244const POP = { damping: 11, stiffness: 260, mass: 0.6 };
245const PRESS = { damping: 16, stiffness: 320, mass: 0.6 };
246const NO_OUTLINE = Platform.OS === 'web' ? ({ outlineStyle: 'none' } as object) : null;
247const SERIF = Platform.select({ ios: 'Georgia', android: 'serif', default: 'Georgia, "Times New Roman", serif' });
248const MONO = Platform.select({ ios: 'Menlo', android: 'monospace', default: 'ui-monospace, Menlo, Consolas, monospace' });
249
250function usePalette() {
251 const dark = useColorScheme() === 'dark';
252 return {
253 dark,
254 bg: dark ? '#0F0B0B' : '#FBF8F6',
255 card: dark ? '#1B1515' : '#FFFFFF',
256 fg: dark ? '#F6EFEE' : '#1F1515',
257 muted: dark ? '#A89896' : '#7A6A68',
258 faint: dark ? '#5F5250' : '#BDB0AE',
259 line: dark ? '#2C2323' : '#EEE5E2',
260 track: dark ? '#231C1C' : '#F3ECEA',
261 booked: dark ? '#151010' : '#F5F0EE',
262 skeleton: dark ? '#221B1B' : '#EFE6E3',
263 shine: dark ? '#332929' : '#E3D7D4',
264 chair: dark ? '#4D403F' : '#D9CBC8',
265 thumb: dark ? '#3A2F2F' : '#FFFFFF',
266 table: dark ? '#2A2121' : '#FFFFFF',
267 stub: dark ? '#231A1A' : '#F8F1EF',
268 accentText: dark ? ACCENT_DARK : ACCENT,
269 accentFill: dark ? ACCENT_FILL_DARK : ACCENT,
270 accentSoft: dark ? tint(ACCENT_DARK, 0.14) : tint(ACCENT, 0.08),
271 accentLine: dark ? tint(ACCENT_DARK, 0.5) : tint(ACCENT, 0.4),
272 good: dark ? '#4CC38A' : '#2E9D6A',
273 few: dark ? '#F0B44C' : '#D9921E',
274 clear: 'rgba(0, 0, 0, 0)',
275 };
276}
277type Palette = ReturnType<typeof usePalette>;
278
279// ─── Small pieces ───────────────────────────────────────────────────────────
280
281/** A photo that pulses over a tinted placeholder, then fades in once it has loaded. */
282function Photo({ uri, alt, style, placeholder }: { uri: string; alt: string; style?: StyleProp<ViewStyle>; placeholder?: string }) {
283 const c = usePalette();
284 const shown = useSharedValue(0);
285 const pulse = useSharedValue(0.4);
286 useEffect(() => {
287 pulse.value = withRepeat(withSequence(withTiming(1, { duration: 700 }), withTiming(0.4, { duration: 700 })), -1);
288 return () => cancelAnimation(pulse);
289 }, [pulse]);
290 const image = useAnimatedStyle(() => ({ opacity: shown.value }));
291 const glow = useAnimatedStyle(() => ({ opacity: (1 - shown.value) * pulse.value * 0.6 }));
292 return (
293 <View style={[styles.photo, { backgroundColor: placeholder ?? c.skeleton }, style]}>
294 <Animated.View style={[StyleSheet.absoluteFill, { backgroundColor: c.shine }, glow]} />
295 <Animated.View style={[StyleSheet.absoluteFill, image]}>
296 <Image
297 source={{ uri }}
298 alt={alt}
299 resizeMode="cover"
300 style={styles.photoImage}
301 onLoad={() => {
302 cancelAnimation(pulse);
303 shown.value = withTiming(1, { duration: 360 });
304 }}
305 />
306 </Animated.View>
307 </View>
308 );
309}
310
311/** Text that cross-fades (and slides by `dir`) to its new value instead of jumping. */
312function CrossFade({ text, style, dir = 0, lines = 1, label }: { text: string; style: StyleProp<TextStyle>; dir?: number; lines?: number; label?: string }) {
313 const [pair, setPair] = useState({ cur: text, prev: '', n: 0, dir });
314 if (pair.cur !== text) setPair({ cur: text, prev: pair.cur, n: pair.n + 1, dir });
315 const t = useSharedValue(1);
316 useLayoutEffect(() => {
317 if (pair.n === 0) return;
318 const n = pair.n;
319 t.value = 0;
320 t.value = withTiming(1, { duration: 280, easing: Easing.out(Easing.cubic) });
321 // Drop the old text once it has faded.
322 const id = setTimeout(() => setPair((p) => (p.n === n ? { ...p, prev: '' } : p)), 320);
323 return () => clearTimeout(id);
324 }, [pair.n, t]);
325 const shift = pair.dir * 9;
326 const enter = useAnimatedStyle(() => ({ opacity: t.value, transform: [{ translateY: (1 - t.value) * shift }] }));
327 const leave = useAnimatedStyle(() => ({ opacity: 1 - t.value, transform: [{ translateY: -t.value * shift }] }));
328 return (
329 <View aria-label={label}>
330 <Animated.Text numberOfLines={lines} style={[style, enter]}>
331 {pair.cur}
332 </Animated.Text>
333 {pair.prev !== '' && (
334 <Animated.Text aria-hidden numberOfLines={lines} style={[style, styles.fadeLeaving, leave]}>
335 {pair.prev}
336 </Animated.Text>
337 )}
338 </View>
339 );
340}
341
342function RoundButton({ label, onPress, children }: { label: string; onPress?: () => void; children: ReactNode }) {
343 const c = usePalette();
344 const scale = useSharedValue(1);
345 const style = useAnimatedStyle(() => ({ transform: [{ scale: scale.value }] }));
346 return (
347 <Pressable
348 role="button"
349 aria-label={label}
350 onPress={onPress}
351 hitSlop={6}
352 onPressIn={() => (scale.value = withSpring(0.88, PRESS))}
353 onPressOut={() => (scale.value = withSpring(1, PRESS))}
354 >
355 <Animated.View style={[styles.round, { backgroundColor: c.card }, c.dark ? styles.roundDark : styles.roundLight, style]}>{children}</Animated.View>
356 </Pressable>
357 );
358}
359
360function SectionHead({ title, aside }: { title: string; aside?: string }) {
361 const c = usePalette();
362 return (
363 <View style={styles.sectionHead}>
364 <Text role="heading" aria-level={2} style={[styles.sectionTitle, { color: c.fg }]}>
365 {title}
366 </Text>
367 {aside ? <Text style={[styles.sectionAside, { color: c.muted }]}>{aside}</Text> : null}
368 </View>
369 );
370}
371
372function Spinner({ color }: { color: string }) {
373 const r = useSharedValue(0);
374 useEffect(() => {
375 r.value = withRepeat(withTiming(360, { duration: 800, easing: Easing.linear }), -1);
376 return () => cancelAnimation(r);
377 }, [r]);
378 const style = useAnimatedStyle(() => ({ transform: [{ rotate: `${r.value}deg` }] }));
379 return <Animated.View style={[styles.spinner, { borderColor: tint(color, 0.3), borderTopColor: color }, style]} />;
380}
381
382// ─── Restaurant header ──────────────────────────────────────────────────────
383
384function Hero({ height, scrollY }: { height: number; scrollY: SharedValue<number> }) {
385 // The photo drifts at half speed as the page scrolls and stretches when pulled down.
386 const parallax = useAnimatedStyle(() => ({
387 transform: [
388 { translateY: scrollY.value < 0 ? scrollY.value / 2 : scrollY.value * 0.45 },
389 { scale: scrollY.value < 0 ? 1 - scrollY.value / height : 1 },
390 ],
391 }));
392 const copy = useAnimatedStyle(() => ({
393 opacity: interpolate(scrollY.value, [0, height * 0.42], [1, 0], 'clamp'),
394 transform: [{ translateY: interpolate(scrollY.value, [0, height], [0, height * 0.2], 'clamp') }],
395 }));
396 return (
397 <View style={[styles.hero, { height }]}>
398 <Animated.View style={[StyleSheet.absoluteFill, parallax]}>
399 <Photo uri={RESTAURANT.room} alt={`The dining room at ${RESTAURANT.name}`} style={StyleSheet.absoluteFill} placeholder={HERO_PLACEHOLDER} />
400 </Animated.View>
401 <LinearGradient colors={['rgba(10, 4, 4, 0.55)', 'rgba(10, 4, 4, 0)']} style={styles.heroTopShade} />
402 <LinearGradient colors={['rgba(14, 6, 6, 0)', 'rgba(14, 6, 6, 0.55)', 'rgba(14, 6, 6, 0.88)']} locations={[0, 0.45, 1]} style={styles.heroBottomShade} />
403 <Animated.View style={[styles.heroCopy, copy]}>
404 <Animated.Text entering={FadeInDown.delay(80).duration(420)} style={styles.heroKicker}>
405 {RESTAURANT.cuisine}
406 </Animated.Text>
407 <Animated.Text entering={FadeInDown.delay(140).duration(460)} role="heading" aria-level={1} style={styles.heroName}>
408 {RESTAURANT.name}
409 </Animated.Text>
410 <Animated.View entering={FadeInDown.delay(200).duration(460)} style={styles.heroMeta}>
411 <View style={styles.heroRating} aria-label={`Rated ${RESTAURANT.rating} from ${RESTAURANT.reviews} reviews`}>
412 <Star size={13} color={STAR} fill={STAR} />
413 <Text style={styles.heroMetaStrong}>{RESTAURANT.rating}</Text>
414 <Text style={styles.heroMetaText}>({RESTAURANT.reviews})</Text>
415 </View>
416 <Text style={styles.heroMetaDot}>·</Text>
417 <Text style={styles.heroMetaStrong}>{RESTAURANT.price}</Text>
418 <Text style={styles.heroMetaDot}>·</Text>
419 <MapPin size={13} color={ON_ACCENT_SOFT} strokeWidth={2.2} />
420 <Text numberOfLines={1} style={styles.heroMetaText}>
421 {RESTAURANT.area} · {RESTAURANT.distance}
422 </Text>
423 </Animated.View>
424 </Animated.View>
425 </View>
426 );
427}
428
429/** "Popular tonight": a live dot that keeps sending out a soft ring. */
430function LiveLine() {
431 const c = usePalette();
432 const pulse = useSharedValue(0);
433 useEffect(() => {
434 pulse.value = withRepeat(withTiming(1, { duration: 1800, easing: Easing.out(Easing.quad) }), -1, false);
435 return () => cancelAnimation(pulse);
436 }, [pulse]);
437 const ring = useAnimatedStyle(() => ({ opacity: 0.5 * (1 - pulse.value), transform: [{ scale: 1 + pulse.value * 1.8 }] }));
438 return (
439 <Animated.View entering={FadeIn.delay(260).duration(420)} style={styles.live}>
440 <View style={styles.liveDotWrap}>
441 <Animated.View style={[styles.liveDot, { backgroundColor: c.accentText }, ring]} />
442 <View style={[styles.liveDot, { backgroundColor: c.accentText }]} />
443 </View>
444 <Text numberOfLines={1} style={[styles.liveText, { color: c.muted }]}>
445 <Text style={[styles.liveStrong, { color: c.fg }]}>Popular tonight</Text> · {RESTAURANT.bookedLastHour} booked in the last hour
446 </Text>
447 </Animated.View>
448 );
449}
450
451// ─── Party size: chairs spring in around the table ──────────────────────────
452
453const VIZ = 72;
454const CHAIR_W = 15;
455const CHAIR_H = 9;
456
457function Chair({ index, party, radius, c }: { index: number; party: number; radius: SharedValue<number>; c: Palette }) {
458 const visible = index < party;
459 const target = -90 + (360 / party) * index;
460 const angle = useSharedValue(target);
461 const shown = useSharedValue(0);
462 const booted = useRef(false);
463 useEffect(() => {
464 if (!booted.current) {
465 booted.current = true;
466 angle.value = target;
467 if (visible) shown.value = withDelay(320 + index * 70, withSpring(1, POP));
468 return;
469 }
470 if (visible) {
471 // A new chair appears in its place; the others slide round the table to make room.
472 if (shown.value < 0.05) angle.value = target;
473 else angle.value = withSpring(target, GLIDE);
474 shown.value = withSpring(1, POP);
475 } else {
476 shown.value = withTiming(0, { duration: 180 });
477 }
478 }, [visible, target, index, angle, shown]);
479 const style = useAnimatedStyle(() => {
480 const a = (angle.value * Math.PI) / 180;
481 return {
482 opacity: Math.min(1, shown.value * 1.6),
483 transform: [
484 { translateX: Math.cos(a) * radius.value },
485 { translateY: Math.sin(a) * radius.value },
486 { rotate: `${angle.value + 90}deg` },
487 { scale: Math.max(0, shown.value) },
488 ],
489 };
490 });
491 return <Animated.View style={[styles.chair, { backgroundColor: index === 0 ? c.accentText : c.chair }, style]} />;
492}
493
494function TableViz({ party }: { party: number }) {
495 const c = usePalette();
496 const size = (p: number) => 11 + p * 0.9;
497 const tableR = useSharedValue(size(party));
498 const radius = useSharedValue(size(party) + 10);
499 useEffect(() => {
500 tableR.value = withSpring(size(party), GLIDE);
501 radius.value = withSpring(size(party) + 10, GLIDE);
502 }, [party, tableR, radius]);
503 const table = useAnimatedStyle(() => ({
504 width: tableR.value * 2,
505 height: tableR.value * 2,
506 borderRadius: tableR.value,
507 marginLeft: -tableR.value,
508 marginTop: -tableR.value,
509 }));
510 return (
511 <View aria-hidden style={[styles.viz, { backgroundColor: c.track }]}>
512 {Array.from({ length: MAX_PARTY }, (_, i) => (
513 <Chair key={i} index={i} party={party} radius={radius} c={c} />
514 ))}
515 <Animated.View style={[styles.table, { backgroundColor: c.table, borderColor: c.line }, table]}>
516 <View style={[styles.candleGlow, { backgroundColor: c.accentSoft }]} />
517 <View style={[styles.candle, { backgroundColor: c.accentText }]} />
518 </Animated.View>
519 </View>
520 );
521}
522
523function StepButton({ icon: Icon, label, disabled, onPress }: { icon: LucideIcon; label: string; disabled: boolean; onPress: () => void }) {
524 const c = usePalette();
525 const scale = useSharedValue(1);
526 const style = useAnimatedStyle(() => ({ transform: [{ scale: scale.value }] }));
527 return (
528 <Pressable
529 role="button"
530 aria-label={label}
531 aria-disabled={disabled}
532 disabled={disabled}
533 onPress={onPress}
534 hitSlop={4}
535 onPressIn={() => (scale.value = withSpring(0.86, PRESS))}
536 onPressOut={() => (scale.value = withSpring(1, PRESS))}
537 >
538 <Animated.View style={[styles.stepButton, { backgroundColor: c.thumb, opacity: disabled ? 0.35 : 1 }, c.dark ? styles.stepDark : styles.stepLight, style]}>
539 <Icon size={18} color={c.fg} strokeWidth={2.4} />
540 </Animated.View>
541 </Pressable>
542 );
543}
544
545function PartyCard({ party, day, onChange }: { party: number; day: Day; onChange: (next: number) => void }) {
546 const c = usePalette();
547 const last = useRef(party);
548 const dir = party >= last.current ? 1 : -1;
549 useEffect(() => {
550 last.current = party;
551 }, [party]);
552 const open = openTimes(day, party);
553 const call = party >= CALL_FROM;
554 const caption = call ? `For ${CALL_FROM}+ we'll call you to confirm` : open ? `${open} ${open === 1 ? 'time' : 'times'} open on ${day.weekday}` : `Fully booked on ${day.weekday}`;
555 return (
556 <View style={[styles.party, { backgroundColor: c.card, borderColor: c.line }]}>
557 <TableViz party={party} />
558 <View style={styles.partyText}>
559 <Text style={[styles.partyLabel, { color: c.muted }]}>Party size</Text>
560 <CrossFade text={guests(party)} dir={dir} style={[styles.partyValue, { color: c.fg }]} label={`Party size: ${guests(party)}`} />
561 <View style={styles.partyCaption}>
562 {call && (
563 <Animated.View entering={FadeIn.duration(200)} style={styles.partyPhone}>
564 <Phone size={12} color={c.accentText} strokeWidth={2.4} />
565 </Animated.View>
566 )}
567 <View style={styles.fill}>
568 <CrossFade text={caption} lines={2} style={[styles.partyCaptionText, { color: call ? c.accentText : c.muted }]} />
569 </View>
570 </View>
571 </View>
572 <View style={[styles.stepper, { backgroundColor: c.track }]}>
573 <StepButton icon={Minus} label="Remove a guest" disabled={party <= MIN_PARTY} onPress={() => onChange(party - 1)} />
574 <StepButton icon={Plus} label="Add a guest" disabled={party >= MAX_PARTY} onPress={() => onChange(party + 1)} />
575 </View>
576 </View>
577 );
578}
579
580// ─── Date strip: one pill glides to the chosen day ──────────────────────────
581
582const DAY_W = 50;
583const DAY_H = 62;
584const DAY_GAP = 7;
585
586function DayChip({ day, party, pos, selected, onPress }: { day: Day; party: number; pos: SharedValue<number>; selected: boolean; onPress: () => void }) {
587 const c = usePalette();
588 const open = openTimes(day, party);
589 const dot = day.closed ? c.clear : open === 0 ? c.clear : open <= 5 ? c.few : c.good;
590 const ring = day.closed ? c.clear : open === 0 ? c.faint : dot;
591 const i = day.index;
592 // Labels turn to the on-accent colour as the pill passes under them.
593 const weekday = useAnimatedStyle(() => ({ color: interpolateColor(Math.max(0, 1 - Math.abs(pos.value - i)), [0, 1], [c.muted, ON_ACCENT_SOFT]) }));
594 const date = useAnimatedStyle(() => ({ color: interpolateColor(Math.max(0, 1 - Math.abs(pos.value - i)), [0, 1], [c.fg, ON_ACCENT]) }));
595 const mark = useAnimatedStyle(() => {
596 const on = Math.max(0, 1 - Math.abs(pos.value - i));
597 return {
598 backgroundColor: interpolateColor(on, [0, 1], [dot, open === 0 ? c.clear : ON_ACCENT]),
599 borderColor: interpolateColor(on, [0, 1], [ring, ON_ACCENT]),
600 };
601 });
602 const status = day.closed ? 'closed' : open === 0 ? 'fully booked' : open <= 5 ? 'filling up' : 'good availability';
603 return (
604 <Pressable
605 role="tab"
606 aria-selected={selected}
607 aria-disabled={day.closed}
608 aria-label={`${day.long} ${day.date} ${day.month}, ${status}`}
609 disabled={day.closed}
610 onPress={onPress}
611 style={[styles.dayChip, { opacity: day.closed ? 0.42 : 1 }]}
612 >
613 <Animated.Text style={[styles.dayWeekday, weekday]}>{i === 0 ? 'Today' : day.weekday}</Animated.Text>
614 <Animated.Text style={[styles.dayDate, { textDecorationLine: day.closed ? 'line-through' : 'none' }, styles.tabular, date]}>{day.date}</Animated.Text>
615 <Animated.View style={[styles.dayDot, mark]} />
616 </Pressable>
617 );
618}
619
620function DateStrip({ selected, party, width, onSelect }: { selected: number; party: number; width: number; onSelect: (index: number) => void }) {
621 const c = usePalette();
622 const strip = useRef<ComponentRef<typeof ScrollView>>(null);
623 const pos = useSharedValue(selected);
624 const booted = useRef(false);
625 useEffect(() => {
626 pos.value = withSpring(selected, GLIDE);
627 // Keep the chosen day near the middle of the strip (the first draw starts at today).
628 if (booted.current) strip.current?.scrollTo({ x: Math.max(0, SIDE + selected * (DAY_W + DAY_GAP) - (width - DAY_W) / 2), animated: true });
629 booted.current = true;
630 }, [selected, pos, width]);
631 const pill = useAnimatedStyle(() => ({ transform: [{ translateX: pos.value * (DAY_W + DAY_GAP) }] }));
632 return (
633 <ScrollView ref={strip} horizontal showsHorizontalScrollIndicator={false} contentContainerStyle={styles.stripContent} style={styles.strip}>
634 <View role="tablist" aria-label="Date" style={styles.days}>
635 {DAYS.map((d) => (
636 <View key={d.index} style={[styles.dayFrame, { left: d.index * (DAY_W + DAY_GAP), backgroundColor: d.closed ? c.clear : c.card, borderColor: c.line }]} />
637 ))}
638 <Animated.View style={[styles.dayPill, { backgroundColor: c.accentFill }, c.dark ? styles.dayPillDark : styles.dayPillLight, pill]} />
639 {DAYS.map((d) => (
640 <DayChip key={d.index} day={d} party={party} pos={pos} selected={d.index === selected} onPress={() => onSelect(d.index)} />
641 ))}
642 </View>
643 </ScrollView>
644 );
645}
646
647// ─── Times: sittings with slots that stagger in ─────────────────────────────
648
649const enterDelay = (order: number) => 40 + order * 30;
650
651function SlotPill({ minute, left, selected, width, order, onPress }: { minute: number; left: number; selected: boolean; width: number; order: number; onPress: () => void }) {
652 const c = usePalette();
653 const full = left === 0;
654 const few = !full && left <= 2;
655 const on = useSharedValue(0);
656 const scale = useSharedValue(1);
657 const booted = useRef(false);
658 useEffect(() => {
659 // The accent springs in: after the stagger on first draw, at once when tapped.
660 on.value = selected ? withDelay(booted.current ? 0 : enterDelay(order) + 220, withSpring(1, POP)) : withTiming(0, { duration: 150 });
661 booted.current = true;
662 }, [selected, on, order]);
663 // A small nod when the party size changes what this time can seat.
664 const kind = full ? 'full' : few ? `few${left}` : 'open';
665 const lastKind = useRef(kind);
666 useEffect(() => {
667 if (lastKind.current === kind) return;
668 lastKind.current = kind;
669 scale.value = withSequence(withTiming(0.9, { duration: 90 }), withSpring(1, POP));
670 }, [kind, scale]);
671 const box = useAnimatedStyle(() => ({ transform: [{ scale: scale.value }] }));
672 const fill = useAnimatedStyle(() => ({ opacity: Math.min(1, on.value * 1.6), transform: [{ scale: 0.5 + on.value * 0.5 }] }));
673 const label = useAnimatedStyle(() => ({ color: interpolateColor(Math.max(0, Math.min(1, on.value)), [0, 1], [c.fg, ON_ACCENT]) }));
674 const time = clock(minute);
675 return (
676 <Animated.View entering={FadeInDown.delay(enterDelay(order)).duration(300)}>
677 <Pressable
678 role="radio"
679 aria-checked={selected}
680 aria-disabled={full}
681 aria-label={full ? `${time}, fully booked` : few ? `${time}, ${left} ${left === 1 ? 'table' : 'tables'} left` : time}
682 disabled={full}
683 onPress={onPress}
684 onPressIn={() => (scale.value = withSpring(0.93, PRESS))}
685 onPressOut={() => (scale.value = withSpring(1, PRESS))}
686 >
687 <Animated.View style={[styles.slot, { width, backgroundColor: full ? c.booked : c.card, borderColor: full ? c.booked : c.line }, box]}>
688 <View style={styles.slotClip}>
689 <Animated.View style={[StyleSheet.absoluteFill, styles.slotFill, { backgroundColor: c.accentFill }, fill]} />
690 </View>
691 {full ? (
692 <Text style={[styles.slotFullText, { color: c.faint }, styles.tabular]}>{time}</Text>
693 ) : (
694 <Animated.Text style={[styles.slotText, styles.tabular, label]}>{time}</Animated.Text>
695 )}
696 {few && (
697 <View style={[styles.slotTag, { backgroundColor: c.card, borderColor: c.accentLine }]}>
698 <Text style={[styles.slotTagText, { color: c.accentText }]}>{left} left</Text>
699 </View>
700 )}
701 </Animated.View>
702 </Pressable>
703 </Animated.View>
704 );
705}
706
707function NotifyLink({ on, onPress }: { on: boolean; onPress: () => void }) {
708 const c = usePalette();
709 const ring = useSharedValue(0);
710 const booted = useRef(false);
711 useEffect(() => {
712 if (booted.current && on) ring.value = withSequence(withTiming(-16, { duration: 70 }), withTiming(14, { duration: 90 }), withTiming(-8, { duration: 80 }), withTiming(0, { duration: 90 }));
713 booted.current = true;
714 }, [on, ring]);
715 const bell = useAnimatedStyle(() => ({ transform: [{ rotate: `${ring.value}deg` }] }));
716 return (
717 <Pressable role="button" aria-label={on ? 'Stop notifying me' : 'Notify me if a table opens'} aria-pressed={on} onPress={onPress} hitSlop={8} style={({ pressed }) => [styles.notify, { backgroundColor: c.accentSoft, opacity: pressed ? 0.7 : 1 }]}>
718 <Animated.View style={bell}>{on ? <BellRing size={13} color={c.accentText} strokeWidth={2.4} /> : <Bell size={13} color={c.accentText} strokeWidth={2.4} />}</Animated.View>
719 <Text style={[styles.notifyText, { color: c.accentText }]}>{on ? "We'll text you" : 'Notify me'}</Text>
720 </Pressable>
721 );
722}
723
724function Sittings({ day, party, selected, notify, width, onSelect, onNotify }: { day: Day; party: number; selected: number | null; notify: string[]; width: number; onSelect: (minute: number) => void; onNotify: (key: string) => void }) {
725 const c = usePalette();
726 const slotW = Math.floor((width - SIDE * 2 - 8 * 3) / 4);
727 let order = 0;
728 if (day.closed) {
729 return (
730 <View style={[styles.closed, { backgroundColor: c.track }]}>
731 <Text style={[styles.closedText, { color: c.muted }]}>Closed on {day.long}s</Text>
732 </View>
733 );
734 }
735 return (
736 <View style={styles.sittings}>
737 {SITTINGS.map((s, si) => {
738 const left = s.times.map((_, j) => tablesFor(day.tables[si][j], party));
739 const open = left.filter(Boolean).length;
740 const key = `${day.index}-${s.id}`;
741 const Icon = s.icon;
742 return (
743 <View key={s.id} role="radiogroup" aria-label={`${s.label}, ${open ? `${open} open` : 'fully booked'}`}>
744 <View style={styles.sittingHead}>
745 <Icon size={15} color={c.accentText} strokeWidth={2.2} />
746 <Text style={[styles.sittingLabel, { color: c.fg }]}>{s.label}</Text>
747 <Text numberOfLines={1} style={[styles.sittingHours, { color: c.muted }]}>
748 {s.hours}
749 </Text>
750 {open ? (
751 <Text style={[styles.sittingCount, { color: c.muted }, styles.tabular]}>{open} open</Text>
752 ) : (
753 <Animated.View entering={FadeIn.duration(220)}>
754 <NotifyLink on={notify.includes(key)} onPress={() => onNotify(key)} />
755 </Animated.View>
756 )}
757 </View>
758 <View style={styles.slots}>
759 {s.times.map((m, j) => (
760 <SlotPill key={m} minute={m} left={left[j]} width={slotW} order={order++} selected={m === selected} onPress={() => onSelect(m)} />
761 ))}
762 </View>
763 </View>
764 );
765 })}
766 </View>
767 );
768}
769
770// ─── Seating, occasion and request ──────────────────────────────────────────
771
772function SeatingControl({ value, party, onChange }: { value: SeatingId; party: number; onChange: (id: SeatingId) => void }) {
773 const c = usePalette();
774 const [trackW, setTrackW] = useState(0);
775 const index = Math.max(0, SEATING.findIndex((s) => s.id === value));
776 const cell = trackW / SEATING.length;
777 const pos = useSharedValue(index);
778 useEffect(() => {
779 pos.value = withSpring(index, GLIDE);
780 }, [index, pos]);
781 const thumb = useAnimatedStyle(() => ({ transform: [{ translateX: pos.value * cell }] }));
782 const current = SEATING[index];
783 return (
784 <View>
785 <View role="radiogroup" aria-label="Seating preference" onLayout={(e: LayoutChangeEvent) => setTrackW(e.nativeEvent.layout.width - 8)} style={[styles.segments, { backgroundColor: c.track }]}>
786 {trackW > 0 && <Animated.View style={[styles.segmentThumb, { width: cell, backgroundColor: c.thumb }, c.dark ? styles.segmentThumbDark : styles.segmentThumbLight, thumb]} />}
787 {SEATING.map((s) => {
788 const on = s.id === value;
789 const off = s.id === 'bar' && party > BAR_MAX;
790 const Icon = s.icon;
791 return (
792 <Pressable
793 key={s.id}
794 role="radio"
795 aria-checked={on}
796 aria-disabled={off}
797 aria-label={off ? `${s.label}, up to ${BAR_MAX} guests` : s.label}
798 disabled={off}
799 onPress={() => onChange(s.id)}
800 style={[styles.segment, { opacity: off ? 0.38 : 1 }]}
801 >
802 <Icon size={15} color={on ? c.accentText : c.muted} strokeWidth={2.2} />
803 <Text numberOfLines={1} style={[styles.segmentLabel, { color: on ? c.fg : c.muted }]}>
804 {s.label}
805 </Text>
806 </Pressable>
807 );
808 })}
809 </View>
810 <View style={styles.seatNote}>
811 <CrossFade lines={2} text={party > BAR_MAX && value !== 'bar' ? `${current.note}. The bar counter seats up to ${BAR_MAX}.` : current.note} style={[styles.note, { color: c.muted }]} />
812 </View>
813 </View>
814 );
815}
816
817function OccasionChip({ item, on, onPress }: { item: (typeof OCCASIONS)[number]; on: boolean; onPress: () => void }) {
818 const c = usePalette();
819 const pop = useSharedValue(1);
820 const booted = useRef(false);
821 useEffect(() => {
822 if (booted.current && on) pop.value = withSequence(withTiming(0.6, { duration: 90 }), withSpring(1, POP));
823 booted.current = true;
824 }, [on, pop]);
825 const icon = useAnimatedStyle(() => ({ transform: [{ scale: pop.value }] }));
826 const Icon = item.icon;
827 return (
828 <Pressable
829 role="checkbox"
830 aria-checked={on}
831 aria-label={item.label}
832 onPress={onPress}
833 style={({ pressed }) => [styles.chip, { backgroundColor: on ? c.accentSoft : c.card, borderColor: on ? c.accentLine : c.line, opacity: pressed ? 0.75 : 1 }]}
834 >
835 <Animated.View style={icon}>
836 <Icon size={19} color={on ? c.accentText : c.muted} fill={on ? c.accentSoft : c.clear} strokeWidth={2.1} />
837 </Animated.View>
838 <Text style={[styles.chipLabel, { color: on ? c.accentText : c.fg }]}>{item.label}</Text>
839 </Pressable>
840 );
841}
842
843// ─── Reserve: holds the table, then confirms ────────────────────────────────
844
845type Status = 'idle' | 'holding';
846
847function ReserveButton({ status, enabled, fullWidth, onPress }: { status: Status; enabled: boolean; fullWidth: number; onPress: () => void }) {
848 const c = usePalette();
849 const width = useSharedValue(BTN_W);
850 const ready = useSharedValue(enabled ? 1 : 0);
851 const hold = useSharedValue(0);
852 const progress = useSharedValue(0);
853 const scale = useSharedValue(1);
854 useEffect(() => {
855 ready.value = withTiming(enabled ? 1 : 0, { duration: 220 });
856 }, [enabled, ready]);
857 useEffect(() => {
858 const holding = status === 'holding';
859 width.value = withTiming(holding ? fullWidth : BTN_W, { duration: 420, easing: Easing.inOut(Easing.cubic) });
860 hold.value = withTiming(holding ? 1 : 0, { duration: 260 });
861 progress.value = holding ? withDelay(200, withTiming(1, { duration: HOLD_MS - 200, easing: Easing.inOut(Easing.quad) })) : withTiming(0, { duration: 0 });
862 }, [status, fullWidth, width, hold, progress]);
863 const box = useAnimatedStyle(() => ({ width: width.value, transform: [{ scale: scale.value }] }));
864 const accent = useAnimatedStyle(() => ({ opacity: ready.value }));
865 const sweep = useAnimatedStyle(() => ({ width: `${progress.value * 100}%` }));
866 const idleLabel = useAnimatedStyle(() => ({ opacity: 1 - hold.value }));
867 const holdLabel = useAnimatedStyle(() => ({ opacity: hold.value, transform: [{ translateY: (1 - hold.value) * 6 }] }));
868 const idleText = useAnimatedStyle(() => ({ color: interpolateColor(ready.value, [0, 1], [c.faint, ON_ACCENT]) }));
869 return (
870 <Pressable
871 role="button"
872 aria-label={status === 'holding' ? 'Holding your table' : enabled ? 'Reserve this table' : 'Choose a time to reserve'}
873 aria-disabled={!enabled}
874 aria-busy={status === 'holding'}
875 disabled={!enabled || status !== 'idle'}
876 onPress={onPress}
877 onPressIn={() => (scale.value = withSpring(0.96, PRESS))}
878 onPressOut={() => (scale.value = withSpring(1, PRESS))}
879 style={styles.reserveSlot}
880 >
881 <Animated.View style={[styles.reserve, enabled ? styles.reserveOn : styles.reserveOff, box]}>
882 <View style={[styles.reserveFace, { backgroundColor: c.track }]}>
883 <Animated.View style={[StyleSheet.absoluteFill, styles.reserveAccent, accent]}>
884 <LinearGradient colors={[spin(ACCENT, 6, 0.06), ACCENT, ACCENT_DEEP]} start={{ x: 0, y: 0 }} end={{ x: 1, y: 1 }} style={styles.fill} />
885 </Animated.View>
886 <Animated.View style={[styles.reserveSweep, sweep]} />
887 <Animated.View style={[styles.reserveLabelRow, idleLabel]}>
888 <Animated.Text style={[styles.reserveLabel, idleText]}>Reserve</Animated.Text>
889 <ArrowRight size={18} color={enabled ? ON_ACCENT : c.faint} strokeWidth={2.4} />
890 </Animated.View>
891 {status === 'holding' && (
892 <Animated.View style={[StyleSheet.absoluteFill, styles.reserveLabelRow, holdLabel]}>
893 <Spinner color={ON_ACCENT} />
894 <Text numberOfLines={1} style={styles.reserveHoldLabel}>
895 Holding your table
896 </Text>
897 </Animated.View>
898 )}
899 </View>
900 </Animated.View>
901 </Pressable>
902 );
903}
904
905// ─── Confirmation: a ticket with a perforated stub ──────────────────────────
906
907type Booking = { n: number; day: Day; minute: number; party: number; seating: SeatingId; occasion: OccasionId | null; request: string; code: string };
908
909/** Bar widths for a decorative barcode, read off the confirmation code. */
910function barsFor(code: string) {
911 const out: number[] = [];
912 for (const ch of code) {
913 const n = ch.charCodeAt(0);
914 out.push(1 + (n % 3), 1 + ((n >> 2) % 2), 2 + ((n >> 1) % 2), 1 + ((n >> 3) % 2), 1 + ((n >> 4) % 3), 2);
915 }
916 return out;
917}
918
919function CalendarButton({ added, onPress }: { added: boolean; onPress: () => void }) {
920 const c = usePalette();
921 const flip = useSharedValue(added ? 1 : 0);
922 const scale = useSharedValue(1);
923 useEffect(() => {
924 flip.value = withTiming(added ? 1 : 0, { duration: 560, easing: Easing.inOut(Easing.cubic) });
925 }, [added, flip]);
926 const front = useAnimatedStyle(() => ({ opacity: flip.value < 0.5 ? 1 : 0, transform: [{ perspective: 700 }, { rotateX: `${flip.value * 180}deg` }] }));
927 const back = useAnimatedStyle(() => ({ opacity: flip.value >= 0.5 ? 1 : 0, transform: [{ perspective: 700 }, { rotateX: `${flip.value * 180 - 180}deg` }] }));
928 const box = useAnimatedStyle(() => ({ transform: [{ scale: scale.value }] }));
929 return (
930 <Pressable
931 role="button"
932 aria-label={added ? 'Added to calendar. Remove it' : 'Add to calendar'}
933 aria-pressed={added}
934 onPress={onPress}
935 onPressIn={() => (scale.value = withSpring(0.96, PRESS))}
936 onPressOut={() => (scale.value = withSpring(1, PRESS))}
937 style={styles.fill}
938 >
939 <Animated.View style={[styles.action, box]}>
940 <Animated.View style={[StyleSheet.absoluteFill, styles.actionFace, { backgroundColor: c.accentFill }, front]}>
941 <CalendarPlus size={18} color={ON_ACCENT} strokeWidth={2.2} />
942 <Text style={[styles.actionLabel, styles.onAccent]}>Add to calendar</Text>
943 </Animated.View>
944 <Animated.View style={[StyleSheet.absoluteFill, styles.actionFace, { backgroundColor: c.accentSoft, borderColor: c.accentLine }, styles.actionBorder, back]}>
945 <CalendarCheck size={18} color={c.accentText} strokeWidth={2.2} />
946 <Text style={[styles.actionLabel, { color: c.accentText }]}>Added</Text>
947 </Animated.View>
948 </Animated.View>
949 </Pressable>
950 );
951}
952
953function Detail({ label, value, order }: { label: string; value: string; order: number }) {
954 const c = usePalette();
955 return (
956 <Animated.View entering={FadeInDown.delay(420 + order * 60).duration(360)} style={styles.detail}>
957 <Text style={[styles.detailLabel, { color: c.muted }]}>{label}</Text>
958 <Text numberOfLines={1} style={[styles.detailValue, { color: c.fg }]}>
959 {value}
960 </Text>
961 </Animated.View>
962 );
963}
964
965function TicketView({ booking, width, onModify }: { booking: Booking; width: number; onModify: () => void }) {
966 const c = usePalette();
967 const insets = useSafeAreaInsets();
968 const [added, setAdded] = useState(false);
969 const seal = useSharedValue(0);
970 const wave = useSharedValue(0);
971 const rise = useSharedValue(0);
972 useEffect(() => {
973 seal.value = withDelay(60, withSpring(1, POP));
974 wave.value = withDelay(140, withTiming(1, { duration: 1000, easing: Easing.out(Easing.cubic) }));
975 rise.value = withDelay(160, withSpring(1, { damping: 15, stiffness: 120, mass: 0.9 }));
976 }, [seal, wave, rise]);
977 const sealStyle = useAnimatedStyle(() => ({ transform: [{ scale: seal.value }, { rotate: `${(1 - seal.value) * -40}deg` }] }));
978 const waveStyle = useAnimatedStyle(() => ({ opacity: 0.45 * (1 - wave.value), transform: [{ scale: 1 + wave.value * 1.3 }] }));
979 const ticketStyle = useAnimatedStyle(() => ({
980 opacity: Math.min(1, rise.value * 2),
981 transform: [{ translateY: (1 - rise.value) * 80 }, { rotate: `${(1 - rise.value) * -5}deg` }],
982 }));
983 const occasion = OCCASIONS.find((o) => o.id === booking.occasion);
984 const OccasionIcon = occasion?.icon ?? Cake;
985 const request = booking.request.trim();
986 const bars = barsFor(booking.code);
987 return (
988 <ScrollView showsVerticalScrollIndicator={false} contentContainerStyle={[styles.ticketPage, { paddingTop: insets.top + 10, paddingBottom: insets.bottom + 24 }]}>
989 <Animated.View entering={FadeIn.duration(300)} style={styles.brandRow}>
990 <View style={[styles.brandMark, { backgroundColor: c.accentFill }]}>
991 <View style={styles.brandPlate} />
992 </View>
993 <Text style={[styles.brandName, { color: c.fg }]}>{APP_NAME}</Text>
994 </Animated.View>
995
996 <View style={styles.sealWrap}>
997 <Animated.View style={[styles.sealWave, { borderColor: c.accentText }, waveStyle]} />
998 <Animated.View style={[styles.seal, { backgroundColor: c.accentFill }, sealStyle]}>
999 <Check size={30} color={ON_ACCENT} strokeWidth={3} />
1000 </Animated.View>
1001 </View>
1002 <Animated.Text entering={FadeInDown.delay(180).duration(420)} role="heading" aria-level={1} style={[styles.ticketTitle, { color: c.fg }]}>
1003 See you {booking.day.long}
1004 </Animated.Text>
1005 <Animated.Text entering={FadeInDown.delay(240).duration(420)} style={[styles.ticketSubtitle, { color: c.muted }]}>
1006 {RESTAURANT.name} is holding a table for {booking.party}.
1007 </Animated.Text>
1008
1009 <Animated.View style={[styles.ticketShadow, { width: width - SIDE * 2 }, c.dark ? styles.ticketShadowDark : styles.ticketShadowLight, ticketStyle]}>
1010 <View style={[styles.ticket, { backgroundColor: c.card, borderColor: c.line }]}>
1011 <View style={styles.ticketTop}>
1012 <Photo uri={RESTAURANT.dish} alt={`A plated dish at ${RESTAURANT.name}`} style={styles.ticketPhoto} />
1013 <View style={styles.fill}>
1014 <Text style={[styles.ticketKicker, { color: c.accentText }]}>{`${APP_NAME} reservation`}</Text>
1015 <Text numberOfLines={1} style={[styles.ticketName, { color: c.fg }]}>
1016 {RESTAURANT.name}
1017 </Text>
1018 <Text numberOfLines={1} style={[styles.ticketAddress, { color: c.muted }]}>
1019 {RESTAURANT.street} · {RESTAURANT.area}
1020 </Text>
1021 </View>
1022 </View>
1023 <View style={[styles.ticketRule, { backgroundColor: c.line }]} />
1024 <View style={styles.details}>
1025 <Detail label="Date" value={shortDate(booking.day)} order={0} />
1026 <Detail label="Time" value={clock(booking.minute)} order={1} />
1027 <Detail label="Guests" value={guests(booking.party)} order={2} />
1028 <Detail label="Seating" value={seatingLabel(booking.seating)} order={3} />
1029 </View>
1030 {occasion && (
1031 <Animated.View entering={FadeInDown.delay(660).duration(360)} style={[styles.extra, { backgroundColor: c.accentSoft }]}>
1032 <OccasionIcon size={15} color={c.accentText} strokeWidth={2.2} />
1033 <Text numberOfLines={2} style={[styles.extraText, { color: c.fg }]}>
1034 <Text style={styles.extraStrong}>{occasion.label}</Text> · {occasion.perk}
1035 </Text>
1036 </Animated.View>
1037 )}
1038 {request !== '' && (
1039 <Animated.View entering={FadeInDown.delay(700).duration(360)} style={styles.requestQuote}>
1040 <View style={[styles.quoteBar, { backgroundColor: c.accentLine }]} />
1041 <Text numberOfLines={3} style={[styles.quoteText, { color: c.muted }]}>
1042 {request}
1043 </Text>
1044 </Animated.View>
1045 )}
1046
1047 {/* Perforated edge: two notches and a row of dashes. */}
1048 <View style={styles.perforation}>
1049 <View style={[styles.notch, styles.notchLeft, { backgroundColor: c.bg, borderColor: c.line }]} />
1050 <View style={styles.dashes}>
1051 {Array.from({ length: 22 }, (_, i) => (
1052 <View key={i} style={[styles.dash, { backgroundColor: c.line }]} />
1053 ))}
1054 </View>
1055 <View style={[styles.notch, styles.notchRight, { backgroundColor: c.bg, borderColor: c.line }]} />
1056 </View>
1057
1058 <View style={[styles.stub, { backgroundColor: c.stub }]}>
1059 <View style={styles.fill}>
1060 <Text style={[styles.detailLabel, { color: c.muted }]}>Confirmation</Text>
1061 <Text selectable style={[styles.code, { color: c.fg }]}>
1062 {booking.code}
1063 </Text>
1064 </View>
1065 <View aria-hidden style={styles.barcode}>
1066 {bars.map((w, i) => (
1067 <View key={i} style={{ width: w, height: '100%', backgroundColor: i % 2 === 0 ? c.fg : c.clear }} />
1068 ))}
1069 </View>
1070 </View>
1071 </View>
1072 </Animated.View>
1073
1074 <Animated.View entering={FadeInDown.delay(560).duration(400)} style={[styles.actions, { width: width - SIDE * 2 }]}>
1075 <CalendarButton added={added} onPress={() => setAdded((a) => !a)} />
1076 <Pressable
1077 role="button"
1078 aria-label="Modify reservation"
1079 onPress={onModify}
1080 style={({ pressed }) => [styles.fill, styles.action, styles.actionFace, styles.actionBorder, { backgroundColor: c.card, borderColor: c.line, opacity: pressed ? 0.7 : 1 }]}
1081 >
1082 <PencilLine size={17} color={c.fg} strokeWidth={2.2} />
1083 <Text style={[styles.actionLabel, { color: c.fg }]}>Modify</Text>
1084 </Pressable>
1085 </Animated.View>
1086 <Animated.View entering={FadeIn.delay(700).duration(400)} style={styles.footnote}>
1087 <ShieldCheck size={14} color={c.muted} strokeWidth={2.2} />
1088 <Text style={[styles.footnoteText, { color: c.muted }]}>
1089 Free cancellation until {RESTAURANT.cancelBy} on {shortDate(booking.day)}
1090 </Text>
1091 </Animated.View>
1092 </ScrollView>
1093 );
1094}
1095
1096// ─── Screen ─────────────────────────────────────────────────────────────────
1097
1098export default function TableReservationScreen() {
1099 const c = usePalette();
1100 const insets = useSafeAreaInsets();
1101 const { width } = useWindowDimensions();
1102 const col = Math.min(width, COLUMN);
1103 const heroH = insets.top + HERO_BODY;
1104
1105 const [party, setParty] = useState(START.party);
1106 const [dayIndex, setDayIndex] = useState(START.day);
1107 const [minute, setMinute] = useState<number | null>(START.minute);
1108 const [seating, setSeating] = useState<SeatingId>(START.seating);
1109 const [occasion, setOccasion] = useState<OccasionId | null>(null);
1110 const [request, setRequest] = useState('');
1111 const [focused, setFocused] = useState(false);
1112 const [notify, setNotify] = useState<string[]>([]);
1113 const [saved, setSaved] = useState(false);
1114 const [status, setStatus] = useState<Status>('idle');
1115 const [booking, setBooking] = useState<Booking | null>(null);
1116 const [view, setView] = useState<'form' | 'ticket'>('form');
1117 const [solid, setSolid] = useState(false);
1118 const timers = useRef<ReturnType<typeof setTimeout>[]>([]);
1119 useEffect(() => () => timers.current.forEach(clearTimeout), []);
1120
1121 const day = DAYS[dayIndex];
1122 const busy = status !== 'idle';
1123
1124 // The header turns solid, with the name in it, once the photo has scrolled away.
1125 const scrollY = useSharedValue(0);
1126 const onScroll = useAnimatedScrollHandler((e) => {
1127 scrollY.value = e.contentOffset.y;
1128 });
1129 const threshold = heroH - insets.top - TOP_ROW - 24;
1130 useAnimatedReaction(
1131 () => scrollY.value > threshold,
1132 (now, before) => {
1133 if (now !== before) runOnJS(setSolid)(now);
1134 },
1135 [threshold]
1136 );
1137 const topBg = useAnimatedStyle(() => ({ opacity: interpolate(scrollY.value, [threshold - 40, threshold], [0, 1], 'clamp') }));
1138 const topTitle = useAnimatedStyle(() => ({
1139 opacity: interpolate(scrollY.value, [threshold - 10, threshold + 20], [0, 1], 'clamp'),
1140 transform: [{ translateY: interpolate(scrollY.value, [threshold - 10, threshold + 20], [8, 0], 'clamp') }],
1141 }));
1142
1143 const heart = useSharedValue(1);
1144 const heartStyle = useAnimatedStyle(() => ({ transform: [{ scale: heart.value }] }));
1145
1146 // The booking form steps back while the ticket comes forward.
1147 const reveal = useSharedValue(0);
1148 useEffect(() => {
1149 reveal.value = withTiming(view === 'ticket' ? 1 : 0, { duration: 340, easing: Easing.out(Easing.cubic) });
1150 }, [view, reveal]);
1151 const formStyle = useAnimatedStyle(() => ({ opacity: 1 - reveal.value, transform: [{ scale: 1 - reveal.value * 0.05 }] }));
1152 const ticketLayer = useAnimatedStyle(() => ({ opacity: reveal.value }));
1153
1154 const changeParty = (next: number) => {
1155 const p = Math.max(MIN_PARTY, Math.min(MAX_PARTY, next));
1156 if (p === party || busy) return;
1157 setParty(p);
1158 if (minute !== null && leftAt(day, minute, p) === 0) setMinute(null);
1159 if (p > BAR_MAX && seating === 'bar') setSeating('indoor');
1160 };
1161
1162 const pickDay = (index: number) => {
1163 if (index === dayIndex || busy || DAYS[index].closed) return;
1164 setDayIndex(index);
1165 // Keep the time if it still has a table on the new day.
1166 if (minute !== null && leftAt(DAYS[index], minute, party) === 0) setMinute(null);
1167 };
1168
1169 const toggleNotify = (key: string) => setNotify((list) => (list.includes(key) ? list.filter((k) => k !== key) : [...list, key]));
1170
1171 const reserve = () => {
1172 if (minute === null || busy) return;
1173 timers.current.forEach(clearTimeout);
1174 const snapshot: Booking = { n: (booking?.n ?? 0) + 1, day, minute, party, seating, occasion, request, code: confirmationCode(dayIndex, minute, party) };
1175 setStatus('holding');
1176 // Replace with your hold and booking calls; the timer stands in for the network.
1177 timers.current = [
1178 setTimeout(() => {
1179 setBooking(snapshot);
1180 setView('ticket');
1181 }, HOLD_MS),
1182 setTimeout(() => setStatus('idle'), HOLD_MS + 500),
1183 ];
1184 };
1185
1186 const modify = () => {
1187 // Back to the form with every choice kept; the ticket unmounts once it has faded.
1188 setView('form');
1189 timers.current.push(setTimeout(() => setBooking((b) => (b ? null : b)), 380));
1190 };
1191
1192 const line1 = minute === null ? `${shortDate(day)} · Pick a time` : `${shortDate(day)} · ${clock(minute)}`;
1193 const line2 = `${guests(party)} · ${seatingLabel(seating)}`;
1194 const perk = OCCASIONS.find((o) => o.id === occasion)?.perk;
1195 const barStyle = view === 'ticket' || solid ? (c.dark ? 'light' : 'dark') : 'light';
1196
1197 return (
1198 <View style={[styles.screen, { backgroundColor: c.bg }]}>
1199 <StatusBar style={barStyle} />
1200 <View style={[styles.column, { width: col }]}>
1201 <Animated.View style={[styles.fill, { pointerEvents: view === 'form' && !busy ? 'auto' : 'none' }, formStyle]}>
1202 <Animated.ScrollView
1203 onScroll={onScroll}
1204 scrollEventThrottle={16}
1205 showsVerticalScrollIndicator={false}
1206 contentContainerStyle={{ paddingBottom: insets.bottom + BAR_BODY + 32 }}
1207 >
1208 <Hero height={heroH} scrollY={scrollY} />
1209
1210 <View style={[styles.sheet, { backgroundColor: c.bg }]}>
1211 <LiveLine />
1212
1213 <Animated.View entering={FadeInDown.delay(120).duration(440)} style={styles.block}>
1214 <PartyCard party={party} day={day} onChange={changeParty} />
1215 </Animated.View>
1216
1217 <Animated.View entering={FadeInDown.delay(190).duration(440)} style={styles.section}>
1218 <SectionHead title="Date" aside={`${day.month} ${FIRST_DAY.getFullYear()}`} />
1219 <DateStrip selected={dayIndex} party={party} width={col} onSelect={pickDay} />
1220 </Animated.View>
1221
1222 {/* Keyed by day, so the slots stagger in again whenever the date changes. */}
1223 <View key={dayIndex} style={styles.timesSection}>
1224 <Sittings day={day} party={party} selected={minute} notify={notify} width={col} onSelect={(m) => !busy && setMinute(m)} onNotify={toggleNotify} />
1225 </View>
1226
1227 <View style={styles.afterTimes}>
1228 <SectionHead title="Seating" />
1229 <View style={styles.block}>
1230 <SeatingControl value={seating} party={party} onChange={setSeating} />
1231 </View>
1232 </View>
1233
1234 <View style={styles.section}>
1235 <SectionHead title="Occasion" aside="Optional" />
1236 <View role="group" aria-label="Occasion" style={[styles.block, styles.chips]}>
1237 {OCCASIONS.map((o) => (
1238 <OccasionChip key={o.id} item={o} on={occasion === o.id} onPress={() => setOccasion((cur) => (cur === o.id ? null : o.id))} />
1239 ))}
1240 </View>
1241 <View style={styles.noteRow}>
1242 <CrossFade text={perk ?? 'Celebrating something? Let the kitchen know'} style={[styles.note, { color: perk ? c.accentText : c.muted }]} />
1243 </View>
1244 </View>
1245
1246 <View style={styles.section}>
1247 <SectionHead title="Special request" />
1248 <View style={[styles.block, styles.request, { backgroundColor: c.card, borderColor: focused ? c.accentLine : c.line }]}>
1249 <TextInput
1250 value={request}
1251 onChangeText={setRequest}
1252 onFocus={() => setFocused(true)}
1253 onBlur={() => setFocused(false)}
1254 multiline
1255 maxLength={REQUEST_MAX}
1256 placeholder="Allergies, a high chair, a table by the window"
1257 placeholderTextColor={c.faint}
1258 selectionColor={c.accentText}
1259 aria-label="Special request"
1260 style={[styles.requestInput, { color: c.fg }, NO_OUTLINE]}
1261 />
1262 <Text style={[styles.requestCount, { color: c.faint }, styles.tabular]}>
1263 {request.length}/{REQUEST_MAX}
1264 </Text>
1265 </View>
1266 </View>
1267
1268 <View style={[styles.policy, { backgroundColor: c.track }]}>
1269 <ShieldCheck size={16} color={c.accentText} strokeWidth={2.1} />
1270 <Text style={[styles.policyText, { color: c.muted }]}>
1271 Free cancellation until {RESTAURANT.cancelBy} on the day. Tables are held for 15 minutes.
1272 </Text>
1273 </View>
1274 </View>
1275 </Animated.ScrollView>
1276
1277 {/* Header: floats over the photo, turns solid once it scrolls away */}
1278 <View style={[styles.topBar, { paddingTop: insets.top }]}>
1279 <Animated.View style={[StyleSheet.absoluteFill, styles.topBarBg, { backgroundColor: c.bg, borderBottomColor: c.line }, topBg]} />
1280 <View style={styles.topRow}>
1281 {/* Go back in your navigator here. */}
1282 <RoundButton label="Back">
1283 <ChevronLeft size={22} color={c.fg} strokeWidth={2.2} style={styles.backIcon} />
1284 </RoundButton>
1285 <Animated.Text numberOfLines={1} style={[styles.topTitle, { color: c.fg }, topTitle]}>
1286 {RESTAURANT.name}
1287 </Animated.Text>
1288 <View style={styles.topActions}>
1289 <RoundButton label={`Share ${RESTAURANT.name}`}>
1290 <Share size={17} color={c.fg} strokeWidth={2.2} />
1291 </RoundButton>
1292 <RoundButton
1293 label={saved ? `Remove ${RESTAURANT.name} from saved` : `Save ${RESTAURANT.name}`}
1294 onPress={() => {
1295 setSaved((s) => !s);
1296 heart.value = withSequence(withTiming(0.7, { duration: 90 }), withSpring(1, POP));
1297 }}
1298 >
1299 <Animated.View style={heartStyle}>
1300 <Heart size={18} color={saved ? c.accentText : c.fg} fill={saved ? c.accentText : c.clear} strokeWidth={2.2} />
1301 </Animated.View>
1302 </RoundButton>
1303 </View>
1304 </View>
1305 </View>
1306
1307 {/* Summary and Reserve, above the home indicator */}
1308 <Animated.View entering={FadeInDown.delay(320).duration(420)} style={[styles.bar, { paddingBottom: insets.bottom + 12, backgroundColor: c.card, borderTopColor: c.line }]}>
1309 <View style={styles.barRow}>
1310 <Animated.View style={[styles.barSummary, { opacity: busy ? 0 : 1 }]}>
1311 <CrossFade text={line1} style={[styles.barLine1, { color: minute === null ? c.muted : c.fg }, styles.tabular]} label={`Reservation: ${line1}, ${line2}`} />
1312 <CrossFade text={line2} style={[styles.barLine2, { color: c.muted }]} />
1313 </Animated.View>
1314 <ReserveButton status={status} enabled={minute !== null} fullWidth={col - SIDE * 2} onPress={reserve} />
1315 </View>
1316 </Animated.View>
1317 </Animated.View>
1318
1319 {/* Confirmation, over the form */}
1320 <Animated.View style={[StyleSheet.absoluteFill, { backgroundColor: c.bg, pointerEvents: view === 'ticket' ? 'auto' : 'none' }, ticketLayer]}>
1321 {booking && <TicketView key={booking.n} booking={booking} width={col} onModify={modify} />}
1322 </Animated.View>
1323 </View>
1324 </View>
1325 );
1326}
1327
1328// ─── Styles ─────────────────────────────────────────────────────────────────
1329
1330const styles = StyleSheet.create({
1331 screen: { flex: 1, alignItems: 'center', overflow: 'hidden' },
1332 column: { flex: 1 },
1333 fill: { flex: 1 },
1334 tabular: { fontVariant: ['tabular-nums'] },
1335 onAccent: { color: ON_ACCENT },
1336
1337 // Small pieces
1338 photo: { overflow: 'hidden' },
1339 photoImage: { width: '100%', height: '100%' },
1340 fadeLeaving: { position: 'absolute', left: 0, right: 0, top: 0 },
1341 round: { width: 40, height: 40, borderRadius: 20, alignItems: 'center', justifyContent: 'center' },
1342 roundLight: { shadowColor: '#000000', shadowOpacity: 0.16, shadowRadius: 10, shadowOffset: { width: 0, height: 3 } },
1343 roundDark: { shadowColor: '#000000', shadowOpacity: 0.4, shadowRadius: 10, shadowOffset: { width: 0, height: 3 } },
1344 backIcon: { marginLeft: -2 },
1345 sectionHead: { flexDirection: 'row', alignItems: 'baseline', justifyContent: 'space-between', paddingHorizontal: SIDE },
1346 sectionTitle: { fontSize: 17, fontWeight: '700', letterSpacing: -0.3 },
1347 sectionAside: { fontSize: 13, fontWeight: '500' },
1348 spinner: { width: 17, height: 17, borderRadius: 9, borderWidth: 2.2 },
1349
1350 // Header
1351 topBar: { position: 'absolute', top: 0, left: 0, right: 0, pointerEvents: 'box-none' },
1352 topBarBg: { borderBottomWidth: StyleSheet.hairlineWidth, pointerEvents: 'none' },
1353 topRow: { pointerEvents: 'box-none', height: TOP_ROW, flexDirection: 'row', alignItems: 'center', paddingHorizontal: 14, gap: 10 },
1354 topTitle: { flex: 1, textAlign: 'center', fontFamily: SERIF, fontSize: 18, fontWeight: '700', letterSpacing: -0.2 },
1355 topActions: { flexDirection: 'row', gap: 8 },
1356
1357 // Restaurant
1358 hero: { overflow: 'hidden', backgroundColor: HERO_PLACEHOLDER },
1359 heroTopShade: { position: 'absolute', top: 0, left: 0, right: 0, height: 130 },
1360 heroBottomShade: { position: 'absolute', left: 0, right: 0, bottom: 0, height: '72%' },
1361 heroCopy: { position: 'absolute', left: SIDE, right: SIDE, bottom: SHEET_LIP + 16 },
1362 heroKicker: { color: ON_ACCENT_SOFT, fontSize: 11.5, fontWeight: '700', letterSpacing: 1.4, textTransform: 'uppercase' },
1363 heroName: { color: '#FFFFFF', fontFamily: SERIF, fontSize: 32, lineHeight: 37, letterSpacing: -0.6, marginTop: 4 },
1364 heroMeta: { flexDirection: 'row', alignItems: 'center', gap: 5, marginTop: 6 },
1365 heroRating: { flexDirection: 'row', alignItems: 'center', gap: 4 },
1366 heroMetaStrong: { color: '#FFFFFF', fontSize: 13.5, fontWeight: '700' },
1367 heroMetaText: { color: ON_ACCENT_SOFT, fontSize: 13.5, flexShrink: 1 },
1368 heroMetaDot: { color: ON_ACCENT_SOFT, fontSize: 13.5 },
1369 sheet: { marginTop: -SHEET_LIP, borderTopLeftRadius: 26, borderTopRightRadius: 26, paddingTop: 16 },
1370 live: { flexDirection: 'row', alignItems: 'center', gap: 9, paddingHorizontal: SIDE },
1371 liveDotWrap: { width: 8, height: 8 },
1372 liveDot: { position: 'absolute', width: 8, height: 8, borderRadius: 4 },
1373 liveText: { flex: 1, fontSize: 13.5 },
1374 liveStrong: { fontWeight: '700' },
1375
1376 // Sections
1377 block: { marginTop: 12, marginHorizontal: SIDE },
1378 section: { marginTop: 20 },
1379 timesSection: { marginTop: 16 },
1380 afterTimes: { marginTop: 36 },
1381
1382 // Party size
1383 party: { flexDirection: 'row', alignItems: 'center', gap: 12, padding: 8, paddingRight: 10, borderRadius: 22, borderWidth: 1 },
1384 viz: { width: VIZ, height: VIZ, borderRadius: 16 },
1385 chair: { position: 'absolute', left: VIZ / 2 - CHAIR_W / 2, top: VIZ / 2 - CHAIR_H / 2, width: CHAIR_W, height: CHAIR_H, borderRadius: 4 },
1386 table: { position: 'absolute', left: VIZ / 2, top: VIZ / 2, borderWidth: 1.5, alignItems: 'center', justifyContent: 'center' },
1387 candleGlow: { position: 'absolute', width: 16, height: 16, borderRadius: 8 },
1388 candle: { width: 6, height: 6, borderRadius: 3 },
1389 partyText: { flex: 1, minWidth: 0 },
1390 partyLabel: { fontSize: 12.5, fontWeight: '600' },
1391 partyValue: { fontSize: 21, lineHeight: 27, fontWeight: '700', letterSpacing: -0.4 },
1392 partyCaption: { flexDirection: 'row', alignItems: 'flex-start', gap: 4, height: 32, marginTop: 1 },
1393 partyPhone: { marginTop: 2 },
1394 partyCaptionText: { fontSize: 12.5, lineHeight: 16 },
1395 stepper: { flexDirection: 'row', gap: 6, padding: 4, borderRadius: 24 },
1396 stepButton: { width: 38, height: 38, borderRadius: 19, alignItems: 'center', justifyContent: 'center' },
1397 stepLight: { shadowColor: '#000000', shadowOpacity: 0.08, shadowRadius: 4, shadowOffset: { width: 0, height: 1 } },
1398 stepDark: { shadowColor: '#000000', shadowOpacity: 0, shadowRadius: 4, shadowOffset: { width: 0, height: 1 } },
1399
1400 // Date strip
1401 strip: { marginTop: 2, marginBottom: -12 },
1402 stripContent: { paddingHorizontal: SIDE, paddingTop: 10, paddingBottom: 14 },
1403 days: { flexDirection: 'row', gap: DAY_GAP },
1404 dayFrame: { position: 'absolute', top: 0, width: DAY_W, height: DAY_H, borderRadius: 18, borderWidth: 1 },
1405 dayPill: { position: 'absolute', top: 0, left: 0, width: DAY_W, height: DAY_H, borderRadius: 18 },
1406 dayPillLight: { shadowColor: ACCENT, shadowOpacity: 0.35, shadowRadius: 10, shadowOffset: { width: 0, height: 5 } },
1407 dayPillDark: { shadowColor: ACCENT, shadowOpacity: 0.5, shadowRadius: 12, shadowOffset: { width: 0, height: 4 } },
1408 dayChip: { width: DAY_W, height: DAY_H, alignItems: 'center', justifyContent: 'center' },
1409 dayWeekday: { fontSize: 11.5, fontWeight: '600' },
1410 dayDate: { fontSize: 19, lineHeight: 24, fontWeight: '700', marginTop: 1 },
1411 dayDot: { width: 6, height: 6, borderRadius: 3, borderWidth: 1.2, marginTop: 4 },
1412
1413 // Times
1414 sittings: { paddingHorizontal: SIDE, gap: 14 },
1415 sittingHead: { flexDirection: 'row', alignItems: 'center', gap: 7, height: 28, marginBottom: 8 },
1416 sittingLabel: { fontSize: 17, fontWeight: '700', letterSpacing: -0.3 },
1417 sittingHours: { flex: 1, fontSize: 13, marginLeft: 2 },
1418 sittingCount: { fontSize: 13, fontWeight: '500' },
1419 slots: { flexDirection: 'row', flexWrap: 'wrap', gap: 8, rowGap: 10 },
1420 slot: { height: 44, borderRadius: 14, borderWidth: 1, alignItems: 'center', justifyContent: 'center' },
1421 slotClip: { position: 'absolute', top: -1, left: -1, right: -1, bottom: -1, borderRadius: 14, overflow: 'hidden' },
1422 slotFill: { borderRadius: 14 },
1423 slotText: { fontSize: 14.5, fontWeight: '600', letterSpacing: -0.2 },
1424 slotFullText: { fontSize: 14.5, fontWeight: '500', textDecorationLine: 'line-through' },
1425 slotTag: { position: 'absolute', top: -8, height: 16, paddingHorizontal: 6, borderRadius: 8, borderWidth: 1, justifyContent: 'center' },
1426 slotTagText: { fontSize: 9.5, fontWeight: '800', letterSpacing: 0.2 },
1427 notify: { flexDirection: 'row', alignItems: 'center', gap: 5, height: 28, paddingHorizontal: 10, borderRadius: 14 },
1428 notifyText: { fontSize: 13, fontWeight: '700' },
1429 closed: { marginHorizontal: SIDE, height: 64, borderRadius: 18, alignItems: 'center', justifyContent: 'center' },
1430 closedText: { fontSize: 14, fontWeight: '500' },
1431
1432 // Seating, occasion, request
1433 segments: { flexDirection: 'row', padding: 4, borderRadius: 18 },
1434 segmentThumb: { position: 'absolute', top: 4, bottom: 4, left: 4, borderRadius: 14 },
1435 segmentThumbLight: { shadowColor: '#000000', shadowOpacity: 0.1, shadowRadius: 6, shadowOffset: { width: 0, height: 2 } },
1436 segmentThumbDark: { shadowColor: '#000000', shadowOpacity: 0.3, shadowRadius: 6, shadowOffset: { width: 0, height: 2 } },
1437 segment: { flex: 1, height: 44, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 6 },
1438 segmentLabel: { fontSize: 13.5, fontWeight: '600', flexShrink: 1 },
1439 noteRow: { marginTop: 9, marginHorizontal: SIDE + 2 },
1440 seatNote: { marginTop: 9, marginHorizontal: 2 },
1441 note: { fontSize: 13, lineHeight: 18 },
1442 chips: { flexDirection: 'row', gap: 8 },
1443 chip: { flex: 1, height: 66, borderRadius: 18, borderWidth: 1, alignItems: 'center', justifyContent: 'center', gap: 6 },
1444 chipLabel: { fontSize: 13.5, fontWeight: '600' },
1445 request: { borderRadius: 18, borderWidth: 1, paddingHorizontal: 14, paddingTop: 12, paddingBottom: 8 },
1446 requestInput: { minHeight: 64, fontSize: 15, lineHeight: 21, textAlignVertical: 'top', padding: 0 },
1447 requestCount: { alignSelf: 'flex-end', fontSize: 11.5, fontWeight: '500', marginTop: 4 },
1448 policy: { flexDirection: 'row', alignItems: 'center', gap: 10, marginTop: 24, marginHorizontal: SIDE, paddingHorizontal: 14, paddingVertical: 12, borderRadius: 16 },
1449 policyText: { flex: 1, fontSize: 12.5, lineHeight: 17 },
1450
1451 // Summary bar and Reserve
1452 bar: { position: 'absolute', left: 0, right: 0, bottom: 0, paddingTop: 12, paddingHorizontal: SIDE, borderTopWidth: 1 },
1453 barRow: { height: 52, justifyContent: 'center' },
1454 barSummary: { paddingRight: BTN_W + 14 },
1455 barLine1: { fontSize: 16, fontWeight: '700', letterSpacing: -0.3 },
1456 barLine2: { fontSize: 13.5, marginTop: 2 },
1457 reserveSlot: { position: 'absolute', right: 0, top: 0 },
1458 reserve: { height: 52, borderRadius: 18 },
1459 reserveOn: { shadowColor: ACCENT, shadowOpacity: 0.32, shadowRadius: 14, shadowOffset: { width: 0, height: 7 } },
1460 reserveOff: { shadowColor: ACCENT, shadowOpacity: 0, shadowRadius: 14, shadowOffset: { width: 0, height: 7 } },
1461 reserveFace: { flex: 1, borderRadius: 18, overflow: 'hidden', alignItems: 'center', justifyContent: 'center' },
1462 reserveAccent: { borderRadius: 18, overflow: 'hidden' },
1463 reserveSweep: { position: 'absolute', left: 0, top: 0, bottom: 0, backgroundColor: ON_ACCENT_SHEEN },
1464 reserveLabelRow: { flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 8 },
1465 reserveLabel: { fontSize: 16.5, fontWeight: '700', letterSpacing: -0.2 },
1466 reserveHoldLabel: { color: ON_ACCENT, fontSize: 16, fontWeight: '700', letterSpacing: -0.2 },
1467
1468 // Confirmation
1469 ticketPage: { alignItems: 'center', paddingHorizontal: SIDE },
1470 brandRow: { flexDirection: 'row', alignItems: 'center', gap: 8, height: 40 },
1471 brandMark: { width: 22, height: 22, borderRadius: 7, alignItems: 'center', justifyContent: 'center' },
1472 brandPlate: { width: 10, height: 10, borderRadius: 5, borderWidth: 2, borderColor: ON_ACCENT },
1473 brandName: { fontFamily: SERIF, fontSize: 17, fontWeight: '700', letterSpacing: -0.2 },
1474 sealWrap: { width: 66, height: 66, marginTop: 18, alignItems: 'center', justifyContent: 'center' },
1475 sealWave: { position: 'absolute', width: 66, height: 66, borderRadius: 33, borderWidth: 2 },
1476 seal: { width: 66, height: 66, borderRadius: 33, alignItems: 'center', justifyContent: 'center' },
1477 ticketTitle: { fontFamily: SERIF, fontSize: 30, lineHeight: 36, letterSpacing: -0.6, marginTop: 16, textAlign: 'center' },
1478 ticketSubtitle: { fontSize: 15, lineHeight: 21, marginTop: 4, textAlign: 'center' },
1479 ticketShadow: { marginTop: 22, borderRadius: 24 },
1480 ticketShadowLight: { shadowColor: '#2A1010', shadowOpacity: 0.12, shadowRadius: 24, shadowOffset: { width: 0, height: 12 } },
1481 ticketShadowDark: { shadowColor: '#000000', shadowOpacity: 0.5, shadowRadius: 24, shadowOffset: { width: 0, height: 12 } },
1482 ticket: { borderRadius: 24, borderWidth: 1, overflow: 'hidden' },
1483 ticketTop: { flexDirection: 'row', alignItems: 'center', gap: 14, padding: 16 },
1484 ticketPhoto: { width: 58, height: 58, borderRadius: 16 },
1485 ticketKicker: { fontSize: 10.5, fontWeight: '800', letterSpacing: 1.2, textTransform: 'uppercase' },
1486 ticketName: { fontFamily: SERIF, fontSize: 21, lineHeight: 26, fontWeight: '700', letterSpacing: -0.3, marginTop: 2 },
1487 ticketAddress: { fontSize: 13, marginTop: 1 },
1488 ticketRule: { height: 1, marginHorizontal: 16 },
1489 details: { flexDirection: 'row', flexWrap: 'wrap', paddingHorizontal: 16, paddingTop: 14, paddingBottom: 4 },
1490 detail: { width: '50%', paddingBottom: 12 },
1491 detailLabel: { fontSize: 10.5, fontWeight: '700', letterSpacing: 1.1, textTransform: 'uppercase' },
1492 detailValue: { fontSize: 17, fontWeight: '700', letterSpacing: -0.3, marginTop: 3 },
1493 extra: { flexDirection: 'row', alignItems: 'center', gap: 9, marginHorizontal: 16, marginBottom: 12, paddingHorizontal: 12, paddingVertical: 10, borderRadius: 12 },
1494 extraText: { flex: 1, fontSize: 13, lineHeight: 18 },
1495 extraStrong: { fontWeight: '700' },
1496 requestQuote: { flexDirection: 'row', gap: 10, marginHorizontal: 16, marginBottom: 12 },
1497 quoteBar: { width: 3, borderRadius: 2 },
1498 quoteText: { flex: 1, fontSize: 13, lineHeight: 18, fontStyle: 'italic' },
1499 perforation: { height: 22, justifyContent: 'center' },
1500 notch: { position: 'absolute', top: -2, width: 26, height: 26, borderRadius: 13, borderWidth: 1 },
1501 notchLeft: { left: -14 },
1502 notchRight: { right: -14 },
1503 dashes: { flexDirection: 'row', justifyContent: 'space-between', marginHorizontal: 18 },
1504 dash: { width: 7, height: 1.5, borderRadius: 1 },
1505 stub: { flexDirection: 'row', alignItems: 'center', gap: 14, paddingHorizontal: 16, paddingTop: 12, paddingBottom: 16 },
1506 code: { fontFamily: MONO, fontSize: 22, fontWeight: '700', letterSpacing: 2, marginTop: 4 },
1507 barcode: { flexDirection: 'row', height: 38, opacity: 0.85 },
1508 actions: { flexDirection: 'row', gap: 10, marginTop: 20 },
1509 action: { height: 50, borderRadius: 16 },
1510 actionFace: { flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 8, borderRadius: 16, backfaceVisibility: 'hidden' },
1511 actionBorder: { borderWidth: 1 },
1512 actionLabel: { fontSize: 15, fontWeight: '700', letterSpacing: -0.2 },
1513 footnote: { flexDirection: 'row', alignItems: 'center', gap: 7, marginTop: 18 },
1514 footnoteText: { fontSize: 12.5 },
1515});

More screens like this.

All Food & Delivery