Empty inbox

Inbox zero as a small reward: an open envelope with a paper plane circling it on a dashed orbit, twinkling sparkles and drifting clouds. Each folder tab slides the indicator and cross-fades its own illustration, tint and copy; Refresh swaps in shimmering skeleton rows before confirming "Checked just now", Compose sends a plane off, and the tip card folds away.

empty stateinboxillustrationzero stateskeletontabsanimationreanimated
Paste into Claude Code Cursor Codex Lovable RapidNative
Live preview · follows the site themeOpen full screen

Details

File
components/patterns/empty-state.tsx
Lines
1096
Stack
React Native, StyleSheet
Packages
expo-linear-gradient, 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/empty-state.tsx
1import { useEffect, useRef, useState, type ReactNode } from 'react';
2import { Pressable, StyleSheet, Text, View, useColorScheme, useWindowDimensions, type LayoutChangeEvent } from 'react-native';
3import Animated, {
4 Easing,
5 FadeIn,
6 FadeInDown,
7 ZoomIn,
8 interpolate,
9 useAnimatedStyle,
10 useSharedValue,
11 withDelay,
12 withRepeat,
13 withSequence,
14 withSpring,
15 withTiming,
16 type SharedValue,
17} from 'react-native-reanimated';
18import { LinearGradient } from 'expo-linear-gradient';
19import { useSafeAreaInsets } from 'react-native-safe-area-context';
20import Svg, { Circle, Defs, Ellipse, LinearGradient as SvgGradient, Path, Rect, Stop } from 'react-native-svg';
21import { AlarmClock, CalendarDays, Check, Inbox, Lightbulb, Mail, PenLine, RefreshCw, Search, Send, Settings, Star, Users, X, type LucideIcon } from 'lucide-react-native';
22
23// ─── Brand ──────────────────────────────────────────────────────────────────
24// The screen's accent. Every accent colour below derives from these, so changing them rebrands the screen.
25
26const ACCENT = '#2F6BFF';
27const ACCENT_DARK = '#4C7DFF'; // the accent on dark backgrounds
28const ON_ACCENT = '#FFFFFF'; // text and icons on an accent fill
29
30/** `hex` at `alpha` opacity, as rgba(). */
31function tint(hex: string, alpha: number) {
32 const n = parseInt(hex.slice(1), 16);
33 return `rgba(${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255}, ${alpha})`;
34}
35
36// ─── Sample data ────────────────────────────────────────────────────────────
37
38const ACCOUNT = { name: 'Maya Okafor', initials: 'MO', email: 'maya@fernpost.co' };
39
40type FolderKey = 'inbox' | 'starred' | 'snoozed' | 'sent';
41
42const FOLDERS: { key: FolderKey; label: string; icon: LucideIcon; title: string; body: string; tip: string }[] = [
43 {
44 key: 'inbox',
45 label: 'Inbox',
46 icon: Inbox,
47 title: "You're all caught up",
48 body: "Nothing new since 9:41. Enjoy the quiet, we'll nudge you when mail lands.",
49 tip: 'Swipe a message right to snooze it and deal with it later.',
50 },
51 {
52 key: 'starred',
53 label: 'Starred',
54 icon: Star,
55 title: 'No starred mail yet',
56 body: 'Tap the star on any message and it waits here, always within reach.',
57 tip: 'Starred mail stays put, even after you archive the thread.',
58 },
59 {
60 key: 'snoozed',
61 label: 'Snoozed',
62 icon: AlarmClock,
63 title: 'Nothing is snoozed',
64 body: 'Snooze a message to clear it for now. It returns right on schedule.',
65 tip: 'Pick "This evening" and snoozed mail is back at 6:00 pm.',
66 },
67 {
68 key: 'sent',
69 label: 'Sent',
70 icon: Send,
71 title: 'Nothing sent yet',
72 body: 'Messages you send are kept here. Write one and watch it take off.',
73 tip: 'Changed your mind? Undo send works for 10 seconds.',
74 },
75];
76
77const NAV: { label: string; icon: LucideIcon }[] = [
78 { label: 'Mail', icon: Mail },
79 { label: 'Calendar', icon: CalendarDays },
80 { label: 'Contacts', icon: Users },
81 { label: 'Settings', icon: Settings },
82];
83
84const LAST_CHECKED = 'Last checked 4 min ago';
85const REFRESH_MS = 1250;
86
87// Bone widths for the loading rows, as a share of the text column.
88const SKELETON_ROWS = [
89 { name: 0.34, subject: 0.78, snippet: 0.56 },
90 { name: 0.42, subject: 0.64, snippet: 0.7 },
91 { name: 0.28, subject: 0.82, snippet: 0.48 },
92 { name: 0.38, subject: 0.58, snippet: 0.66 },
93];
94
95// ─── Palette ────────────────────────────────────────────────────────────────
96
97const SPRING = { damping: 16, stiffness: 220, mass: 0.7 };
98
99// Every folder paints its illustration from its own tone, tuned separately for each theme.
100type Tone = {
101 tint: string;
102 soft: string;
103 deep: string;
104 disc: readonly [string, string];
105 ring: string;
106 cloud: string;
107 spark: string;
108 paper: string;
109 rule: string;
110 wing: string;
111 outline: string;
112};
113
114const LIGHT: Record<FolderKey, Tone> = {
115 inbox: { tint: '#2F6BFF', soft: '#7FA8FF', deep: '#1B45C2', disc: ['#DCE7FF', '#F6F7FB'], ring: '#8FAAEE', cloud: '#C9D9FC', spark: '#FFAE1F', paper: '#FFFFFF', rule: '#D5DFF6', wing: '#8FB2FF', outline: '#1B45C2' },
116 starred: { tint: '#F59E0B', soft: '#FFD65C', deep: '#C2710A', disc: ['#FFEFC7', '#F6F7FB'], ring: '#E0B14A', cloud: '#FCE3A6', spark: '#FF8A3D', paper: '#FFFFFF', rule: '#F3E3BD', wing: '#FCE3A6', outline: '#C2710A' },
117 snoozed: { tint: '#334EAC', soft: '#FFF0B3', deep: '#FFC44D', disc: ['#2A3F8F', '#0F1B4D'], ring: '#8EA3E0', cloud: '#D3DCF5', spark: '#FFFFFF', paper: '#FFFFFF', rule: '#D8DEF2', wing: '#D3DCF5', outline: '#0F1B4D' },
118 sent: { tint: '#0FA47F', soft: '#62DBB6', deep: '#0A7559', disc: ['#D3F4E8', '#F6F7FB'], ring: '#7CCDB4', cloud: '#BDEBDB', spark: '#FFAE1F', paper: '#FFFFFF', rule: '#CFEDE3', wing: '#62DBB6', outline: '#0A7559' },
119};
120
121const DARK: Record<FolderKey, Tone> = {
122 inbox: { tint: '#4C7DFF', soft: '#93B3FF', deep: '#2444A6', disc: ['#17224A', '#0A0B0F'], ring: '#3F548F', cloud: '#22315F', spark: '#FFD166', paper: '#EEF2FC', rule: '#BECAE8', wing: '#9DB8FF', outline: 'transparent' },
123 starred: { tint: '#F5A524', soft: '#FFDC7A', deep: '#A85F06', disc: ['#33260D', '#0A0B0F'], ring: '#7A5E22', cloud: '#43330F', spark: '#FFE7A8', paper: '#FFF7E3', rule: '#E8D7A8', wing: '#FFDC7A', outline: 'transparent' },
124 snoozed: { tint: '#7C93E8', soft: '#FFF3C2', deep: '#FFCB5C', disc: ['#1E2B66', '#0A1030'], ring: '#44549A', cloud: '#2C3A7A', spark: '#FFFFFF', paper: '#EEF1FC', rule: '#C8D0EE', wing: '#B8C6F2', outline: 'transparent' },
125 sent: { tint: '#22C39A', soft: '#7FEACB', deep: '#0C7C61', disc: ['#0F3229', '#0A0B0F'], ring: '#2B7462', cloud: '#17423A', spark: '#FFD166', paper: '#E9FBF5', rule: '#B5E3D5', wing: '#8DEBD0', outline: 'transparent' },
126};
127
128function usePalette() {
129 const dark = useColorScheme() === 'dark';
130 return {
131 dark,
132 bg: dark ? '#0A0B0F' : '#F6F7FB',
133 bar: dark ? '#0A0B0F' : '#FFFFFF',
134 card: dark ? '#15171E' : '#FFFFFF',
135 fg: dark ? '#F5F6FA' : '#0D1017',
136 muted: dark ? '#9096A6' : '#646B7C',
137 faint: dark ? '#565C6B' : '#A2A8B8',
138 line: dark ? '#20232C' : '#E7E9F0',
139 track: dark ? '#15171E' : '#EEF0F5',
140 thumb: dark ? '#262A35' : '#FFFFFF',
141 accent: dark ? ACCENT_DARK : ACCENT,
142 accentSoft: dark ? tint(ACCENT_DARK, 0.18) : tint(ACCENT, 0.11),
143 ok: dark ? '#34D399' : '#0E9F6E',
144 bone: dark ? '#232733' : '#DDE1EB',
145 // The shimmer is a band of background colour, so it only shows where it crosses a bone.
146 sheen: (dark ? ['rgba(10,11,15,0)', 'rgba(10,11,15,0.7)', 'rgba(10,11,15,0)'] : ['rgba(246,247,251,0)', 'rgba(246,247,251,0.85)', 'rgba(246,247,251,0)']) as readonly [string, string, string],
147 tones: dark ? DARK : LIGHT,
148 };
149}
150
151// ─── Motion helpers ─────────────────────────────────────────────────────────
152
153/** Runs 0 to 1 forever at a constant speed. */
154function useLoop(duration: number) {
155 const t = useSharedValue(0);
156 useEffect(() => {
157 t.value = withRepeat(withTiming(1, { duration, easing: Easing.linear }), -1, false);
158 }, [t, duration]);
159 return t;
160}
161
162/** Eases 0 to 1 and back forever. */
163function useSway(duration: number, delay = 0) {
164 const t = useSharedValue(0);
165 useEffect(() => {
166 t.value = withDelay(delay, withRepeat(withTiming(1, { duration, easing: Easing.inOut(Easing.sin) }), -1, true));
167 }, [t, duration, delay]);
168 return t;
169}
170
171type Point = readonly [number, number];
172type Curve = readonly [Point, Point, Point];
173type Orbit = { cx: number; cy: number; a: number; b: number; tilt: number };
174
175// ─── Illustration pieces ────────────────────────────────────────────────────
176
177const STAGE = { w: 300, h: 220 };
178const SPARK = 'M12 0c.9 6.6 4.5 10.2 12 12-7.5 1.8-11.1 5.4-12 12-.9-6.6-4.5-10.2-12-12C7.5 10.2 11.1 6.6 12 0Z';
179
180function starPath(cx: number, cy: number, outer: number, inner: number) {
181 let d = '';
182 for (let i = 0; i < 10; i++) {
183 const r = i % 2 ? inner : outer;
184 const a = (Math.PI / 5) * i - Math.PI / 2;
185 d += `${i ? 'L' : 'M'}${(cx + r * Math.cos(a)).toFixed(1)} ${(cy + r * Math.sin(a)).toFixed(1)}`;
186 }
187 return `${d}Z`;
188}
189const STAR = starPath(50, 53, 40, 18.5);
190
191function Disc({ tone, size = 204, edge }: { tone: Tone; size?: number; edge?: string }) {
192 return (
193 <LinearGradient
194 colors={tone.disc}
195 style={[styles.abs, { left: (STAGE.w - size) / 2, top: (STAGE.h - size) / 2 + 2, width: size, height: size, borderRadius: size / 2, borderWidth: edge ? 1 : 0, borderColor: edge }]}
196 />
197 );
198}
199
200function Cloud({ width, color }: { width: number; color: string }) {
201 return (
202 <Svg width={width} height={width / 2} viewBox="0 0 72 36">
203 <Circle cx={18} cy={24} r={12} fill={color} />
204 <Circle cx={36} cy={17} r={17} fill={color} />
205 <Circle cx={55} cy={23} r={13} fill={color} />
206 <Rect x={18} y={22} width={37} height={14} fill={color} />
207 </Svg>
208 );
209}
210
211function Plane({ size, tone }: { size: number; tone: Tone }) {
212 return (
213 <Svg width={size} height={size} viewBox="0 0 24 24">
214 <Path d="M22.5 12 2 3.5 6.8 12Z" fill="#FFFFFF" stroke={tone.outline} strokeWidth={1.2} strokeLinejoin="round" />
215 <Path d="M22.5 12 6.8 12 2 20.5Z" fill={tone.wing} stroke={tone.outline} strokeWidth={1.2} strokeLinejoin="round" />
216 </Svg>
217 );
218}
219
220function FivePoint({ size, color }: { size: number; color: string }) {
221 return (
222 <Svg width={size} height={size} viewBox="0 0 100 100">
223 <Path d={STAR} fill={color} stroke={color} strokeWidth={10} strokeLinejoin="round" />
224 </Svg>
225 );
226}
227
228/** Something that floats gently around its resting place. */
229function Drift({ x, y, dx = 0, dy = 0, duration = 4200, delay = 0, children }: { x: number; y: number; dx?: number; dy?: number; duration?: number; delay?: number; children: ReactNode }) {
230 const t = useSway(duration, delay);
231 const style = useAnimatedStyle(() => ({ transform: [{ translateX: (t.value - 0.5) * dx }, { translateY: (t.value - 0.5) * dy }] }));
232 return <Animated.View style={[styles.abs, { left: x, top: y }, style]}>{children}</Animated.View>;
233}
234
235function Twinkle({ x, y, size, color, delay = 0 }: { x: number; y: number; size: number; color: string; delay?: number }) {
236 const t = useSway(900 + size * 28, delay);
237 const style = useAnimatedStyle(() => ({ opacity: 0.45 + t.value * 0.55, transform: [{ scale: 0.6 + t.value * 0.4 }, { rotate: `${t.value * 40}deg` }] }));
238 return (
239 <Animated.View style={[styles.abs, { left: x, top: y }, style]}>
240 <Svg width={size} height={size} viewBox="0 0 24 24">
241 <Path d={SPARK} fill={color} />
242 </Svg>
243 </Animated.View>
244 );
245}
246
247/** One half of a tilted, dashed ellipse: the far half sits behind the hero, the near half in front. */
248function OrbitPath({ orbit, half, color }: { orbit: Orbit; half: 'back' | 'front'; color: string }) {
249 const { cx, cy, a, b, tilt } = orbit;
250 return (
251 <Svg width={STAGE.w} height={STAGE.h} style={StyleSheet.absoluteFill}>
252 <Path
253 d={`M${cx - a} ${cy} A${a} ${b} 0 0 ${half === 'back' ? 1 : 0} ${cx + a} ${cy}`}
254 transform={`rotate(${tilt} ${cx} ${cy})`}
255 stroke={color}
256 strokeOpacity={half === 'back' ? 0.6 : 1}
257 strokeWidth={1.6}
258 strokeDasharray="5 7"
259 strokeLinecap="round"
260 fill="none"
261 />
262 </Svg>
263 );
264}
265
266/** Rides the ellipse. Two copies are drawn, one per half, so the rider passes behind and in front of the hero. */
267function Orbiter({ t, orbit, phase = 0, side, size, heading, children }: { t: SharedValue<number>; orbit: Orbit; phase?: number; side: 'back' | 'front'; size: number; heading?: boolean; children: ReactNode }) {
268 const style = useAnimatedStyle(() => {
269 const theta = -2 * Math.PI * (t.value + phase);
270 const cos = Math.cos(theta);
271 const sin = Math.sin(theta);
272 const tilt = (orbit.tilt * Math.PI) / 180;
273 const ct = Math.cos(tilt);
274 const st = Math.sin(tilt);
275 const x = orbit.cx + orbit.a * cos * ct - orbit.b * sin * st;
276 const y = orbit.cy + orbit.a * cos * st + orbit.b * sin * ct;
277 // Direction of travel, used to point a plane along the path.
278 const dx = orbit.a * sin * ct + orbit.b * cos * st;
279 const dy = orbit.a * sin * st - orbit.b * cos * ct;
280 const near = sin >= 0;
281 return {
282 opacity: (side === 'front') === near ? 1 : 0,
283 transform: [
284 { translateX: x - size / 2 },
285 { translateY: y - size / 2 },
286 { rotate: heading ? `${Math.atan2(dy, dx)}rad` : '0rad' },
287 { scaleY: heading && dx < 0 ? -1 : 1 },
288 { scale: 0.86 + 0.14 * sin },
289 ],
290 };
291 });
292 return <Animated.View style={[styles.rider, { width: size, height: size }, style]}>{children}</Animated.View>;
293}
294
295/** A plane that flies a curve once per unit of progress, fading in at the start and out at the end. */
296function Flyer({ progress, phase = 0, curve, size, tone }: { progress: SharedValue<number>; phase?: number; curve: Curve; size: number; tone: Tone }) {
297 const style = useAnimatedStyle(() => {
298 const u = (progress.value + phase) % 1;
299 const m = 1 - u;
300 const x = m * m * curve[0][0] + 2 * m * u * curve[1][0] + u * u * curve[2][0];
301 const y = m * m * curve[0][1] + 2 * m * u * curve[1][1] + u * u * curve[2][1];
302 const dx = m * (curve[1][0] - curve[0][0]) + u * (curve[2][0] - curve[1][0]);
303 const dy = m * (curve[1][1] - curve[0][1]) + u * (curve[2][1] - curve[1][1]);
304 return {
305 opacity: interpolate(u, [0, 0.12, 0.76, 1], [0, 1, 1, 0]),
306 transform: [{ translateX: x - size / 2 }, { translateY: y - size / 2 }, { rotate: `${Math.atan2(dy, dx)}rad` }, { scale: interpolate(u, [0, 0.2, 1], [0.45, 1, 0.72]) }],
307 };
308 });
309 return (
310 <Animated.View style={[styles.rider, { width: size, height: size }, style]}>
311 <Plane size={size} tone={tone} />
312 </Animated.View>
313 );
314}
315
316function Ground({ y, width, dark }: { y: number; width: number; dark: boolean }) {
317 const t = useSway(2600);
318 const style = useAnimatedStyle(() => ({ opacity: 0.55 + t.value * 0.45, transform: [{ scaleX: 1 - t.value * 0.12 }] }));
319 return (
320 <Animated.View style={[styles.abs, { left: (STAGE.w - width) / 2, top: y }, style]}>
321 <Svg width={width} height={12}>
322 <Ellipse cx={width / 2} cy={6} rx={width / 2} ry={5} fill={dark ? '#000000' : '#1B2550'} fillOpacity={dark ? 0.45 : 0.1} />
323 </Svg>
324 </Animated.View>
325 );
326}
327
328type ArtProps = { tone: Tone; dark: boolean; kick: SharedValue<number> };
329
330// ─── Inbox: an open envelope, with a paper plane circling it ────────────────
331
332const INBOX_ORBIT: Orbit = { cx: 150, cy: 122, a: 128, b: 42, tilt: -12 };
333const TAKE_OFF: Curve = [
334 [150, 92],
335 [190, 28],
336 [306, -22],
337];
338
339function Envelope({ tone }: { tone: Tone }) {
340 const bob = useSway(2600);
341 const letter = useAnimatedStyle(() => ({ transform: [{ translateY: -bob.value * 7 }] }));
342 return (
343 <View style={styles.envelope}>
344 <Svg width={132} height={108} style={StyleSheet.absoluteFill}>
345 <Path d="M8 46 66 8 124 46Z" fill={tone.deep} stroke={tone.deep} strokeWidth={8} strokeLinejoin="round" />
346 <Rect x={0} y={42} width={132} height={66} rx={14} fill={tone.deep} />
347 </Svg>
348 <Animated.View style={[styles.letter, { backgroundColor: tone.paper }, letter]}>
349 <View style={[styles.letterTick, { backgroundColor: tone.tint }]}>
350 <Check size={14} color="#FFFFFF" strokeWidth={3.2} />
351 </View>
352 <View style={[styles.letterRuleLong, { backgroundColor: tone.rule }]} />
353 <View style={[styles.letterRuleShort, { backgroundColor: tone.rule }]} />
354 </Animated.View>
355 <Svg width={132} height={108} style={StyleSheet.absoluteFill}>
356 <Defs>
357 <SvgGradient id="envelope-front" x1="0" y1="0" x2="0" y2="1">
358 <Stop offset="0" stopColor={tone.soft} />
359 <Stop offset="1" stopColor={tone.tint} />
360 </SvgGradient>
361 </Defs>
362 <Path d="M0 50 60 85Q66 88.5 72 85L132 50V94a14 14 0 0 1-14 14H14A14 14 0 0 1 0 94Z" fill="url(#envelope-front)" />
363 <Path d="M6 103 52 79M126 103 80 79" stroke="#FFFFFF" strokeOpacity={0.4} strokeWidth={1.6} strokeLinecap="round" />
364 </Svg>
365 </View>
366 );
367}
368
369function InboxArt({ tone, dark, kick }: ArtProps) {
370 const t = useLoop(7600);
371 return (
372 <>
373 <Disc tone={tone} />
374 <Drift x={4} y={44} dx={16} duration={5200}>
375 <Cloud width={62} color={tone.cloud} />
376 </Drift>
377 <Drift x={232} y={150} dx={-14} duration={6400} delay={300}>
378 <Cloud width={46} color={tone.cloud} />
379 </Drift>
380 <Ground y={170} width={112} dark={dark} />
381 <OrbitPath orbit={INBOX_ORBIT} half="back" color={tone.ring} />
382 <Orbiter t={t} orbit={INBOX_ORBIT} phase={0.5} side="back" size={34} heading>
383 <Plane size={34} tone={tone} />
384 </Orbiter>
385 <View style={styles.envelopeSpot}>
386 <Envelope tone={tone} />
387 </View>
388 <OrbitPath orbit={INBOX_ORBIT} half="front" color={tone.ring} />
389 <Orbiter t={t} orbit={INBOX_ORBIT} phase={0.5} side="front" size={34} heading>
390 <Plane size={34} tone={tone} />
391 </Orbiter>
392 <Twinkle x={56} y={16} size={17} color={tone.spark} />
393 <Twinkle x={236} y={30} size={12} color={tone.spark} delay={500} />
394 <Twinkle x={34} y={136} size={10} color={tone.tint} delay={900} />
395 <Twinkle x={206} y={190} size={11} color={tone.spark} delay={1300} />
396 {/* Compose: a fresh plane leaves the envelope */}
397 <Flyer progress={kick} curve={TAKE_OFF} size={38} tone={tone} />
398 </>
399 );
400}
401
402// ─── Starred: a star that breathes, with small stars in orbit ───────────────
403
404const STAR_ORBIT: Orbit = { cx: 150, cy: 112, a: 124, b: 36, tilt: -14 };
405const MOONS = [
406 { phase: 0.08, size: 20 },
407 { phase: 0.44, size: 15 },
408 { phase: 0.74, size: 11 },
409];
410
411function Halo({ color, delay }: { color: string; delay: number }) {
412 const t = useSharedValue(0);
413 useEffect(() => {
414 t.value = withDelay(delay, withRepeat(withTiming(1, { duration: 2600, easing: Easing.out(Easing.quad) }), -1, false));
415 }, [t, delay]);
416 const style = useAnimatedStyle(() => ({ opacity: 0.5 * (1 - t.value), transform: [{ scale: 0.7 + t.value * 0.9 }] }));
417 return <Animated.View style={[styles.halo, { borderColor: color }, style]} />;
418}
419
420function StarredArt({ tone, dark, kick }: ArtProps) {
421 const t = useLoop(9000);
422 const breath = useSway(1500);
423 const hero = useAnimatedStyle(() => ({
424 transform: [{ scale: 1 + breath.value * 0.06 + Math.sin(kick.value * Math.PI) * 0.2 }, { rotate: `${kick.value * 72}deg` }],
425 }));
426 return (
427 <>
428 <Disc tone={tone} />
429 <Halo color={tone.tint} delay={0} />
430 <Halo color={tone.tint} delay={1300} />
431 <Ground y={176} width={92} dark={dark} />
432 <OrbitPath orbit={STAR_ORBIT} half="back" color={tone.ring} />
433 {MOONS.map((m) => (
434 <Orbiter key={m.phase} t={t} orbit={STAR_ORBIT} phase={m.phase} side="back" size={m.size}>
435 <FivePoint size={m.size} color={tone.tint} />
436 </Orbiter>
437 ))}
438 <Animated.View style={[styles.star, hero]}>
439 <Svg width={124} height={124} viewBox="0 0 100 100">
440 <Defs>
441 <SvgGradient id="star-fill" x1="0" y1="0" x2="0" y2="1">
442 <Stop offset="0" stopColor={tone.soft} />
443 <Stop offset="1" stopColor={tone.tint} />
444 </SvgGradient>
445 </Defs>
446 <Path d={STAR} fill={tone.deep} stroke={tone.deep} strokeWidth={11} strokeLinejoin="round" transform="translate(0 3.5)" />
447 <Path d={STAR} fill="url(#star-fill)" stroke="url(#star-fill)" strokeWidth={11} strokeLinejoin="round" />
448 <Path d="M35 36 44 24" stroke="#FFFFFF" strokeOpacity={0.75} strokeWidth={4} strokeLinecap="round" />
449 <Circle cx={31.5} cy={43} r={2.2} fill="#FFFFFF" fillOpacity={0.75} />
450 </Svg>
451 </Animated.View>
452 <OrbitPath orbit={STAR_ORBIT} half="front" color={tone.ring} />
453 {MOONS.map((m) => (
454 <Orbiter key={m.phase} t={t} orbit={STAR_ORBIT} phase={m.phase} side="front" size={m.size}>
455 <FivePoint size={m.size} color={tone.tint} />
456 </Orbiter>
457 ))}
458 <Twinkle x={48} y={22} size={15} color={tone.spark} />
459 <Twinkle x={240} y={150} size={13} color={tone.spark} delay={600} />
460 <Twinkle x={226} y={18} size={10} color={tone.tint} delay={1000} />
461 <Twinkle x={38} y={160} size={9} color={tone.tint} delay={1400} />
462 </>
463 );
464}
465
466// ─── Snoozed: a moon in a night window, with z marks drifting up ────────────
467
468function Zed({ t, phase, size }: { t: SharedValue<number>; phase: number; size: number }) {
469 const style = useAnimatedStyle(() => {
470 const u = (t.value + phase) % 1;
471 return {
472 opacity: interpolate(u, [0, 0.2, 0.7, 1], [0, 1, 1, 0]),
473 transform: [{ translateX: u * 34 }, { translateY: -u * 58 }, { scale: 0.6 + u * 0.6 }, { rotate: `${-8 + u * 14}deg` }],
474 };
475 });
476 return <Animated.Text style={[styles.zed, { fontSize: size, lineHeight: size + 2 }, style]}>z</Animated.Text>;
477}
478
479function SnoozedArt({ tone, dark, kick }: ArtProps) {
480 const t = useLoop(3600);
481 const hand = useLoop(8000);
482 const rock = useSway(3000);
483 const moon = useAnimatedStyle(() => ({ transform: [{ rotate: `${(rock.value - 0.5) * 8 + Math.sin(kick.value * Math.PI * 2) * 14}deg` }] }));
484 const minute = useAnimatedStyle(() => ({ transform: [{ rotate: `${hand.value * 360}deg` }] }));
485 return (
486 <>
487 <Disc tone={tone} size={200} edge={dark ? 'rgba(255,255,255,0.10)' : undefined} />
488 <Twinkle x={96} y={30} size={11} color={tone.spark} />
489 <Twinkle x={214} y={96} size={9} color={tone.spark} delay={700} />
490 <Twinkle x={150} y={182} size={8} color={tone.spark} delay={1100} />
491 <Twinkle x={70} y={92} size={7} color={tone.spark} delay={400} />
492 <Animated.View style={[styles.moon, moon]}>
493 <Svg width={100} height={100} viewBox="0 0 100 100">
494 <Defs>
495 <SvgGradient id="moon-fill" x1="0" y1="0" x2="1" y2="1">
496 <Stop offset="0" stopColor={tone.soft} />
497 <Stop offset="1" stopColor={tone.deep} />
498 </SvgGradient>
499 </Defs>
500 <Path d="M84.3 65.7A40 40 0 1 1 39.5 14.5 34 34 0 0 0 84.3 65.7Z" fill="url(#moon-fill)" />
501 <Circle cx={26} cy={60} r={5} fill={tone.deep} fillOpacity={0.55} />
502 <Circle cx={40} cy={79} r={3.4} fill={tone.deep} fillOpacity={0.55} />
503 </Svg>
504 </Animated.View>
505 <Zed t={t} phase={0} size={15} />
506 <Zed t={t} phase={0.34} size={15} />
507 <Zed t={t} phase={0.67} size={15} />
508 <Drift x={30} y={150} dx={18} duration={5600}>
509 <Cloud width={84} color={tone.cloud} />
510 </Drift>
511 {/* A small clock, for when the mail comes back */}
512 <Drift x={196} y={136} dy={6} duration={3400} delay={200}>
513 <View style={[styles.clock, { backgroundColor: tone.paper, borderColor: tone.tint }]}>
514 <View style={styles.clockHourDial}>
515 <View style={[styles.clockHour, { backgroundColor: tone.disc[1] }]} />
516 </View>
517 <Animated.View style={[styles.clockDial, minute]}>
518 <View style={[styles.clockMinute, { backgroundColor: tone.tint }]} />
519 </Animated.View>
520 <View style={[styles.clockPin, { backgroundColor: tone.disc[1] }]} />
521 </View>
522 </Drift>
523 </>
524 );
525}
526
527// ─── Sent: planes leave a sealed envelope, one after another ────────────────
528
529const ROUTES: { curve: Curve; size: number; phase: number }[] = [
530 {
531 curve: [
532 [116, 126],
533 [176, 36],
534 [298, 30],
535 ],
536 size: 32,
537 phase: 0.04,
538 },
539 {
540 curve: [
541 [122, 136],
542 [212, 118],
543 [296, 92],
544 ],
545 size: 23,
546 phase: 0.4,
547 },
548 {
549 curve: [
550 [104, 122],
551 [118, 44],
552 [226, 4],
553 ],
554 size: 19,
555 phase: 0.72,
556 },
557];
558
559function SentArt({ tone, dark, kick }: ArtProps) {
560 const c = usePalette();
561 const t = useLoop(5200);
562 return (
563 <>
564 <Disc tone={tone} />
565 <Drift x={206} y={158} dx={-18} duration={5400}>
566 <Cloud width={58} color={tone.cloud} />
567 </Drift>
568 <Drift x={8} y={62} dx={-12} duration={6600} delay={400}>
569 <Cloud width={44} color={tone.cloud} />
570 </Drift>
571 <Svg width={STAGE.w} height={STAGE.h} style={StyleSheet.absoluteFill}>
572 {ROUTES.map((r) => (
573 <Path
574 key={r.phase}
575 d={`M${r.curve[0][0]} ${r.curve[0][1]}Q${r.curve[1][0]} ${r.curve[1][1]} ${r.curve[2][0]} ${r.curve[2][1]}`}
576 stroke={tone.ring}
577 strokeWidth={1.6}
578 strokeDasharray="5 7"
579 strokeLinecap="round"
580 fill="none"
581 />
582 ))}
583 </Svg>
584 <Ground y={196} width={96} dark={dark} />
585 {ROUTES.map((r) => (
586 <Flyer key={r.phase} progress={t} phase={r.phase} curve={r.curve} size={r.size} tone={tone} />
587 ))}
588 <Drift x={36} y={122} dy={6} duration={3000}>
589 <View style={styles.sealed}>
590 <Svg width={100} height={70}>
591 <Defs>
592 <SvgGradient id="sealed" x1="0" y1="0" x2="0" y2="1">
593 <Stop offset="0" stopColor={tone.soft} />
594 <Stop offset="1" stopColor={tone.tint} />
595 </SvgGradient>
596 </Defs>
597 <Rect width={100} height={70} rx={13} fill="url(#sealed)" />
598 <Path d="M5 64 36 38M95 64 64 38" stroke="#FFFFFF" strokeOpacity={0.35} strokeWidth={1.6} strokeLinecap="round" />
599 <Path d="M5 9 44 39Q50 43 56 39L95 9" stroke="#FFFFFF" strokeOpacity={0.8} strokeWidth={2.2} strokeLinecap="round" strokeLinejoin="round" fill="none" />
600 </Svg>
601 <View style={[styles.sealedBadge, { backgroundColor: tone.deep, borderColor: c.bg }]}>
602 <Check size={14} color="#FFFFFF" strokeWidth={3.4} />
603 </View>
604 </View>
605 </Drift>
606 <Twinkle x={64} y={24} size={14} color={tone.spark} />
607 <Twinkle x={252} y={128} size={11} color={tone.spark} delay={700} />
608 <Twinkle x={170} y={186} size={9} color={tone.tint} delay={1200} />
609 {/* Compose: one more plane takes the long route out */}
610 <Flyer progress={kick} curve={ROUTES[0].curve} size={38} tone={tone} />
611 </>
612 );
613}
614
615const ART: Record<FolderKey, (props: ArtProps) => ReactNode> = { inbox: InboxArt, starred: StarredArt, snoozed: SnoozedArt, sent: SentArt };
616
617// ─── Swap: folders cross-fade, sliding in from the side they live on ────────
618
619function Swap({ index, active, distance, children }: { index: number; active: number; distance: number; children: ReactNode }) {
620 const on = useSharedValue(index === active ? 1 : 0);
621 const side = useSharedValue(index < active ? -1 : 1);
622 useEffect(() => {
623 const shown = index === active;
624 if (!shown) side.value = index < active ? -1 : 1;
625 on.value = shown ? withDelay(70, withTiming(1, { duration: 380, easing: Easing.out(Easing.cubic) })) : withTiming(0, { duration: 200, easing: Easing.out(Easing.quad) });
626 }, [index, active, on, side]);
627 const style = useAnimatedStyle(() => ({ opacity: on.value, transform: [{ translateX: (1 - on.value) * side.value * distance }] }));
628 return (
629 <Animated.View pointerEvents="none" aria-hidden={index !== active} style={[StyleSheet.absoluteFill, styles.swap, style]}>
630 {children}
631 </Animated.View>
632 );
633}
634
635// ─── Folder tabs: the thumb slides to the chosen folder ─────────────────────
636
637function FolderTabs({ active, onChange }: { active: number; onChange: (i: number) => void }) {
638 const c = usePalette();
639 const [width, setWidth] = useState(0);
640 const slot = width / FOLDERS.length;
641 const x = useSharedValue(0);
642 useEffect(() => {
643 x.value = withSpring(active * slot, { damping: 20, stiffness: 240, mass: 0.7 });
644 }, [active, slot, x]);
645 const thumb = useAnimatedStyle(() => ({ transform: [{ translateX: x.value }] }));
646 return (
647 <View role="tablist" aria-label="Folders" onLayout={(e: LayoutChangeEvent) => setWidth(e.nativeEvent.layout.width - 8)} style={[styles.tabs, { backgroundColor: c.track }]}>
648 {width > 0 && (
649 <Animated.View style={[styles.thumb, c.dark ? styles.thumbFlat : styles.thumbLifted, { width: slot, backgroundColor: c.thumb }, thumb]} />
650 )}
651 {FOLDERS.map((f, i) => {
652 const on = i === active;
653 const Icon = f.icon;
654 return (
655 <Pressable key={f.key} role="tab" aria-selected={on} aria-label={f.label} onPress={() => onChange(i)} style={styles.tab}>
656 <Icon size={14} color={on ? c.tones[f.key].tint : c.faint} strokeWidth={2.4} />
657 <Text style={[styles.tabLabel, { fontWeight: on ? '700' : '500', color: on ? c.fg : c.muted }]}>{f.label}</Text>
658 </Pressable>
659 );
660 })}
661 </View>
662 );
663}
664
665// ─── Loading rows: four mail-shaped bones under a moving sheen ──────────────
666
667function Spinner({ color, track }: { color: string; track: string }) {
668 const r = useLoop(800);
669 const style = useAnimatedStyle(() => ({ transform: [{ rotate: `${r.value * 360}deg` }] }));
670 return <Animated.View style={[styles.spinner, { borderColor: track, borderTopColor: color }, style]} />;
671}
672
673function SkeletonList({ show, busy, width }: { show: SharedValue<number>; busy: boolean; width: number }) {
674 const c = usePalette();
675 const band = 150;
676 const sweep = useLoop(1050);
677 const fade = useAnimatedStyle(() => ({ opacity: show.value, transform: [{ translateY: (1 - show.value) * -10 }] }));
678 const sheen = useAnimatedStyle(() => ({ transform: [{ translateX: interpolate(sweep.value, [0, 1], [-band, width]) }] }));
679 const bone = [styles.bone, { backgroundColor: c.bone }];
680 return (
681 <Animated.View pointerEvents="none" aria-hidden={!busy} aria-busy={busy} aria-label="Checking for new mail" style={[StyleSheet.absoluteFill, styles.clip, fade]}>
682 {SKELETON_ROWS.map((row, i) => (
683 <View key={i} style={[styles.skeletonRow, { opacity: 1 - i * 0.17 }]}>
684 <View style={[styles.skeletonAvatar, { backgroundColor: c.bone }]} />
685 <View style={styles.skeletonText}>
686 <View style={styles.skeletonTop}>
687 <View style={[bone, styles.boneName, { width: `${row.name * 100}%` }]} />
688 <View style={[bone, styles.boneTime]} />
689 </View>
690 <View style={[bone, styles.boneLine, { width: `${row.subject * 100}%` }]} />
691 <View style={[bone, styles.boneLine, { width: `${row.snippet * 100}%` }]} />
692 </View>
693 {i < SKELETON_ROWS.length - 1 && <View style={[styles.skeletonDivider, { backgroundColor: c.line }]} />}
694 </View>
695 ))}
696 <Animated.View style={[styles.sheen, { width: band }, sheen]}>
697 <LinearGradient colors={c.sheen} start={{ x: 0, y: 0.5 }} end={{ x: 1, y: 0.5 }} style={styles.fill} />
698 </Animated.View>
699 <View style={styles.skeletonStatus}>
700 <Spinner color={c.accent} track={c.line} />
701 <Text style={[styles.skeletonLabel, { color: c.muted }]}>Checking for new mail</Text>
702 </View>
703 </Animated.View>
704 );
705}
706
707// ─── Buttons ────────────────────────────────────────────────────────────────
708
709function ComposeButton({ drafted, onPress }: { drafted: boolean; onPress: () => void }) {
710 const c = usePalette();
711 const scale = useSharedValue(1);
712 const style = useAnimatedStyle(() => ({ transform: [{ scale: scale.value }] }));
713 return (
714 <Pressable
715 role="button"
716 aria-label={drafted ? 'Draft started' : 'Compose'}
717 onPress={onPress}
718 onPressIn={() => (scale.value = withSpring(0.95, SPRING))}
719 onPressOut={() => (scale.value = withSpring(1, SPRING))}
720 style={styles.composeSlot}
721 >
722 {/* The shadow takes the theme's accent, so its props stay together in the inline object. */}
723 <Animated.View
724 style={[
725 styles.compose,
726 { backgroundColor: c.accent, shadowColor: c.accent, shadowOpacity: 0.34, shadowRadius: 14, shadowOffset: { width: 0, height: 7 } },
727 style,
728 ]}
729 >
730 {drafted ? (
731 <Animated.View key="done" entering={ZoomIn.duration(220)} style={styles.row}>
732 <Check size={19} color={ON_ACCENT} strokeWidth={3} />
733 <Text style={styles.composeLabel}>Draft started</Text>
734 </Animated.View>
735 ) : (
736 <Animated.View key="idle" entering={FadeIn.duration(180)} style={styles.row}>
737 <PenLine size={18} color={ON_ACCENT} strokeWidth={2.4} />
738 <Text style={styles.composeLabel}>Compose</Text>
739 </Animated.View>
740 )}
741 </Animated.View>
742 </Pressable>
743 );
744}
745
746function RefreshButton({ busy, onPress }: { busy: boolean; onPress: () => void }) {
747 const c = usePalette();
748 const scale = useSharedValue(1);
749 const turn = useSharedValue(0);
750 const style = useAnimatedStyle(() => ({ transform: [{ scale: scale.value }] }));
751 const icon = useAnimatedStyle(() => ({ transform: [{ rotate: `${turn.value}deg` }] }));
752 return (
753 <Pressable
754 role="button"
755 aria-label="Refresh"
756 aria-busy={busy}
757 disabled={busy}
758 onPress={() => {
759 turn.value = withTiming(turn.value + 360, { duration: 700, easing: Easing.out(Easing.cubic) });
760 onPress();
761 }}
762 onPressIn={() => (scale.value = withSpring(0.95, SPRING))}
763 onPressOut={() => (scale.value = withSpring(1, SPRING))}
764 style={styles.fill}
765 >
766 <Animated.View style={[styles.row, styles.refresh, { backgroundColor: c.card, borderColor: c.line }, style]}>
767 <Animated.View style={icon}>
768 <RefreshCw size={17} color={c.fg} strokeWidth={2.4} />
769 </Animated.View>
770 <Text style={[styles.refreshLabel, { color: c.fg }]}>Refresh</Text>
771 </Animated.View>
772 </Pressable>
773 );
774}
775
776function IconButton({ label, children, onPress }: { label: string; children: ReactNode; onPress?: () => void }) {
777 const scale = useSharedValue(1);
778 const style = useAnimatedStyle(() => ({ transform: [{ scale: scale.value }] }));
779 return (
780 <Pressable role="button" aria-label={label} hitSlop={6} onPress={onPress} onPressIn={() => (scale.value = withSpring(0.9, SPRING))} onPressOut={() => (scale.value = withSpring(1, SPRING))}>
781 <Animated.View style={style}>{children}</Animated.View>
782 </Pressable>
783 );
784}
785
786// ─── Tip card: dismiss folds it away ────────────────────────────────────────
787
788const TIP_H = 68;
789
790function TipCard({ folder, onGone }: { folder: FolderKey; onGone: () => void }) {
791 const c = usePalette();
792 const open = useSharedValue(1);
793 const text = FOLDERS.find((f) => f.key === folder)?.tip ?? '';
794 const fold = useAnimatedStyle(() => ({
795 height: open.value * TIP_H,
796 marginBottom: open.value * 12,
797 opacity: interpolate(open.value, [0.35, 1], [0, 1], 'clamp'),
798 transform: [{ scale: 0.94 + open.value * 0.06 }],
799 }));
800 const dismiss = () => {
801 open.value = withTiming(0, { duration: 320, easing: Easing.inOut(Easing.cubic) });
802 setTimeout(onGone, 340);
803 };
804 return (
805 <Animated.View style={[styles.tipWrap, fold]}>
806 <Animated.View entering={FadeInDown.delay(420).duration(420)} style={[styles.tip, { backgroundColor: c.card, borderColor: c.line }]}>
807 <View style={[styles.tipIcon, { backgroundColor: c.accentSoft }]}>
808 <Lightbulb size={18} color={c.accent} strokeWidth={2.3} />
809 </View>
810 <View style={styles.fill}>
811 <Text style={[styles.tipKicker, { color: c.accent }]}>TIP</Text>
812 <Animated.Text key={folder} entering={FadeIn.duration(260)} numberOfLines={2} style={[styles.tipText, { color: c.fg }]}>
813 {text}
814 </Animated.Text>
815 </View>
816 <Pressable role="button" aria-label="Dismiss tip" onPress={dismiss} hitSlop={6} style={({ pressed }) => [styles.tipClose, { opacity: pressed ? 0.5 : 1 }]}>
817 <X size={17} color={c.muted} strokeWidth={2.4} />
818 </Pressable>
819 </Animated.View>
820 </Animated.View>
821 );
822}
823
824// ─── Bottom tab bar ─────────────────────────────────────────────────────────
825
826function TabBar() {
827 const c = usePalette();
828 const insets = useSafeAreaInsets();
829 const [tab, setTab] = useState(NAV[0].label);
830 return (
831 <View role="tablist" aria-label="Sections" style={[styles.tabBar, { paddingBottom: insets.bottom + 2, backgroundColor: c.bar, borderTopColor: c.line }]}>
832 {NAV.map(({ label, icon: Icon }) => {
833 const on = tab === label;
834 return (
835 <Pressable key={label} role="tab" aria-label={label} aria-selected={on} onPress={() => setTab(label)} style={styles.navItem}>
836 <View style={[styles.navPill, { backgroundColor: on ? c.accentSoft : 'transparent' }]}>
837 <Icon size={21} color={on ? c.accent : c.muted} strokeWidth={on ? 2.4 : 2} />
838 </View>
839 <Text style={[styles.navLabel, { fontWeight: on ? '700' : '500', color: on ? c.accent : c.muted }]}>{label}</Text>
840 </Pressable>
841 );
842 })}
843 </View>
844 );
845}
846
847// ─── Screen ─────────────────────────────────────────────────────────────────
848
849const COPY_H = 84;
850// Everything in the empty state except the illustration: gaps, copy, buttons and the status line.
851const REST_H = 18 + COPY_H + 20 + 52 + 14 + 18;
852
853export default function EmptyStateScreen() {
854 const c = usePalette();
855 const insets = useSafeAreaInsets();
856 const { width } = useWindowDimensions();
857 const [active, setActive] = useState(0);
858 const [busy, setBusy] = useState(false);
859 const [checked, setChecked] = useState(false);
860 const [drafted, setDrafted] = useState(false);
861 const [tip, setTip] = useState(true);
862 const [room, setRoom] = useState(0);
863 const loading = useSharedValue(0);
864 const kick = useSharedValue(0);
865 const timers = useRef<ReturnType<typeof setTimeout>[]>([]);
866 useEffect(() => () => timers.current.forEach(clearTimeout), []);
867
868 const folder = FOLDERS[active];
869
870 const refresh = () => {
871 if (busy) return;
872 setBusy(true);
873 loading.value = withTiming(1, { duration: 240, easing: Easing.out(Easing.quad) });
874 // Replace with your refetch; show the empty state again only if it still returns nothing.
875 timers.current.push(
876 setTimeout(() => {
877 setBusy(false);
878 setChecked(true);
879 loading.value = withTiming(0, { duration: 380, easing: Easing.out(Easing.cubic) });
880 }, REFRESH_MS)
881 );
882 };
883
884 const compose = () => {
885 if (drafted) return;
886 // Replace with navigation to your compose screen.
887 setDrafted(true);
888 kick.value = withSequence(withTiming(1, { duration: 950, easing: Easing.inOut(Easing.quad) }), withTiming(0, { duration: 0 }));
889 timers.current.push(setTimeout(() => setDrafted(false), 1700));
890 };
891
892 // The illustration shrinks on short screens so the buttons never leave the screen.
893 const artScale = Math.max(0.6, Math.min(1.12, (width - 40) / STAGE.w, room ? (room - REST_H - 16) / STAGE.h : 1));
894 const empty = useAnimatedStyle(() => ({
895 opacity: 1 - loading.value,
896 transform: [{ translateY: loading.value * 14 }, { scale: 1 - loading.value * 0.04 }],
897 }));
898
899 return (
900 <View style={[styles.fill, { backgroundColor: c.bg }]}>
901 {/* Header: opaque, runs under the status bar */}
902 <View style={[styles.header, { paddingTop: insets.top, backgroundColor: c.bar, borderBottomColor: c.line }]}>
903 <View style={styles.headerRow}>
904 <IconButton label={`Account menu, ${ACCOUNT.name}`}>
905 <LinearGradient colors={['#FF9A62', '#F0468A']} start={{ x: 0, y: 0 }} end={{ x: 1, y: 1 }} style={styles.avatar}>
906 <Text style={styles.avatarText}>{ACCOUNT.initials}</Text>
907 </LinearGradient>
908 </IconButton>
909 <View style={styles.fill}>
910 <Animated.Text key={folder.key} entering={FadeIn.duration(240)} role="heading" style={[styles.headerTitle, { color: c.fg }]}>
911 {folder.label}
912 </Animated.Text>
913 <Text numberOfLines={1} style={[styles.headerEmail, { color: c.muted }]}>
914 {ACCOUNT.email}
915 </Text>
916 </View>
917 <IconButton label="Search mail">
918 <View style={[styles.searchButton, { backgroundColor: c.track }]}>
919 <Search size={19} color={c.fg} strokeWidth={2.2} />
920 </View>
921 </IconButton>
922 </View>
923 <View style={styles.tabsWrap}>
924 <FolderTabs active={active} onChange={setActive} />
925 </View>
926 </View>
927
928 {/* Body: the empty state, or loading rows while a refresh runs */}
929 <View style={styles.fill}>
930 <View style={styles.fill} onLayout={(e: LayoutChangeEvent) => setRoom(e.nativeEvent.layout.height)}>
931 <Animated.View pointerEvents={busy ? 'none' : 'auto'} aria-hidden={busy} style={[styles.empty, empty]}>
932 <Animated.View entering={ZoomIn.duration(520)} pointerEvents="none" style={{ width: STAGE.w * artScale, height: STAGE.h * artScale }}>
933 <View style={[styles.stage, { transform: [{ scale: artScale }] }]}>
934 {FOLDERS.map((f, i) => {
935 const Art = ART[f.key];
936 return (
937 <Swap key={f.key} index={i} active={active} distance={36}>
938 <View style={styles.stageArt}>
939 <Art tone={c.tones[f.key]} dark={c.dark} kick={kick} />
940 </View>
941 </Swap>
942 );
943 })}
944 </View>
945 </Animated.View>
946
947 <Animated.View entering={FadeInDown.delay(140).duration(460)} style={styles.copy}>
948 {FOLDERS.map((f, i) => (
949 <Swap key={f.key} index={i} active={active} distance={20}>
950 <Text role="heading" style={[styles.copyTitle, { color: c.fg }]}>
951 {f.title}
952 </Text>
953 <Text style={[styles.copyBody, { color: c.muted }]}>{f.body}</Text>
954 </Swap>
955 ))}
956 </Animated.View>
957
958 <Animated.View entering={FadeInDown.delay(240).duration(460)} style={styles.actions}>
959 <ComposeButton drafted={drafted} onPress={compose} />
960 <RefreshButton busy={busy} onPress={refresh} />
961 </Animated.View>
962
963 <Animated.View entering={FadeIn.delay(380).duration(400)} style={styles.status}>
964 {checked ? (
965 <Animated.View key="now" entering={FadeInDown.duration(320)} style={[styles.row, styles.checkedRow]}>
966 <View style={[styles.okDot, { backgroundColor: c.ok }]}>
967 <Check size={10} color="#FFFFFF" strokeWidth={3.6} />
968 </View>
969 <Text style={[styles.checkedText, { color: c.fg }]}>Checked just now</Text>
970 </Animated.View>
971 ) : (
972 <Text style={[styles.lastChecked, { color: c.faint }]}>{LAST_CHECKED}</Text>
973 )}
974 </Animated.View>
975 </Animated.View>
976
977 <SkeletonList show={loading} busy={busy} width={width} />
978 </View>
979
980 {tip && <TipCard folder={folder.key} onGone={() => setTip(false)} />}
981 </View>
982
983 <TabBar />
984 </View>
985 );
986}
987
988// ─── Styles ─────────────────────────────────────────────────────────────────
989
990const styles = StyleSheet.create({
991 fill: { flex: 1 },
992 row: { flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 8 },
993
994 // Illustration
995 abs: { position: 'absolute' },
996 rider: { position: 'absolute', left: 0, top: 0 },
997 envelope: { width: 132, height: 108 },
998 envelopeSpot: { position: 'absolute', left: 84, top: 62 },
999 letter: { position: 'absolute', left: 24, top: 22, width: 84, height: 74, borderRadius: 10, alignItems: 'center', paddingTop: 9, gap: 6 },
1000 letterTick: { width: 24, height: 24, borderRadius: 12, alignItems: 'center', justifyContent: 'center' },
1001 letterRuleLong: { width: 44, height: 5, borderRadius: 3 },
1002 letterRuleShort: { width: 28, height: 5, borderRadius: 3 },
1003 halo: { position: 'absolute', left: 90, top: 50, width: 120, height: 120, borderRadius: 60, borderWidth: 2 },
1004 star: { position: 'absolute', left: 88, top: 48, width: 124, height: 124 },
1005 zed: { position: 'absolute', left: 170, top: 92, fontWeight: '800', color: '#FFFFFF' },
1006 moon: { position: 'absolute', left: 88, top: 62, width: 100, height: 100 },
1007 clock: {
1008 width: 46,
1009 height: 46,
1010 borderRadius: 23,
1011 borderWidth: 3,
1012 shadowColor: '#000',
1013 shadowOpacity: 0.22,
1014 shadowRadius: 10,
1015 shadowOffset: { width: 0, height: 5 },
1016 },
1017 clockDial: { position: 'absolute', left: 0, top: 0, width: 40, height: 40 },
1018 clockHourDial: { position: 'absolute', left: 0, top: 0, width: 40, height: 40, transform: [{ rotate: '62deg' }] },
1019 clockHour: { position: 'absolute', left: 18.5, top: 10, width: 3, height: 11, borderRadius: 2 },
1020 clockMinute: { position: 'absolute', left: 18.75, top: 5, width: 2.5, height: 16, borderRadius: 2 },
1021 clockPin: { position: 'absolute', left: 17, top: 17, width: 6, height: 6, borderRadius: 3 },
1022 sealed: { width: 100, height: 70, transform: [{ rotate: '-8deg' }] },
1023 sealedBadge: { position: 'absolute', right: -8, bottom: -9, width: 30, height: 30, borderRadius: 15, alignItems: 'center', justifyContent: 'center', borderWidth: 3 },
1024 swap: { alignItems: 'center' },
1025
1026 // Folder tabs
1027 tabs: { flexDirection: 'row', padding: 4, borderRadius: 14 },
1028 thumb: { position: 'absolute', top: 4, left: 4, bottom: 4, borderRadius: 10 },
1029 // A shadow's props stay together in one style object: React Native Web builds the shadow per object.
1030 thumbLifted: { shadowColor: '#000', shadowOpacity: 0.08, shadowRadius: 6, shadowOffset: { width: 0, height: 2 } },
1031 thumbFlat: { shadowColor: '#000', shadowOpacity: 0, shadowRadius: 6, shadowOffset: { width: 0, height: 2 } },
1032 tab: { flex: 1, height: 36, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 5 },
1033 tabLabel: { fontSize: 13 },
1034
1035 // Loading rows
1036 spinner: { width: 16, height: 16, borderRadius: 8, borderWidth: 2 },
1037 clip: { overflow: 'hidden' },
1038 skeletonRow: { height: 82, paddingHorizontal: 16, flexDirection: 'row', alignItems: 'center', gap: 12 },
1039 skeletonAvatar: { width: 44, height: 44, borderRadius: 22 },
1040 skeletonText: { flex: 1, gap: 9 },
1041 skeletonTop: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' },
1042 bone: { borderRadius: 6 },
1043 boneName: { height: 12 },
1044 boneTime: { height: 9, width: 34 },
1045 boneLine: { height: 10 },
1046 skeletonDivider: { position: 'absolute', left: 72, right: 0, bottom: 0, height: 1 },
1047 sheen: { position: 'absolute', top: 0, bottom: 0, left: 0 },
1048 skeletonStatus: { marginTop: 18, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 9 },
1049 skeletonLabel: { fontSize: 13.5, fontWeight: '500' },
1050
1051 // Buttons
1052 composeSlot: { flex: 1.3 },
1053 compose: { height: 52, borderRadius: 16, alignItems: 'center', justifyContent: 'center', borderTopWidth: 1, borderTopColor: tint(ON_ACCENT, 0.28) },
1054 composeLabel: { fontSize: 16, fontWeight: '700', color: ON_ACCENT },
1055 refresh: { height: 52, borderRadius: 16, borderWidth: 1.5 },
1056 refreshLabel: { fontSize: 16, fontWeight: '600' },
1057
1058 // Tip card
1059 tipWrap: { marginHorizontal: 16, overflow: 'hidden' },
1060 tip: { height: TIP_H, borderRadius: 18, paddingLeft: 12, paddingRight: 6, flexDirection: 'row', alignItems: 'center', gap: 12, borderWidth: 1 },
1061 tipIcon: { width: 38, height: 38, borderRadius: 12, alignItems: 'center', justifyContent: 'center' },
1062 tipKicker: { fontSize: 11, fontWeight: '700', letterSpacing: 0.8 },
1063 tipText: { marginTop: 1, fontSize: 13.5, lineHeight: 18 },
1064 tipClose: { width: 36, height: 36, borderRadius: 18, alignItems: 'center', justifyContent: 'center' },
1065
1066 // Bottom tab bar
1067 tabBar: { flexDirection: 'row', paddingTop: 6, borderTopWidth: 1 },
1068 navItem: { flex: 1, height: 50, alignItems: 'center', justifyContent: 'center', gap: 3 },
1069 navPill: { width: 54, height: 28, borderRadius: 14, alignItems: 'center', justifyContent: 'center' },
1070 navLabel: { fontSize: 11 },
1071
1072 // Header
1073 header: { borderBottomWidth: 1 },
1074 headerRow: { height: 58, paddingHorizontal: 16, flexDirection: 'row', alignItems: 'center', gap: 12 },
1075 avatar: { width: 40, height: 40, borderRadius: 20, alignItems: 'center', justifyContent: 'center' },
1076 avatarText: { fontSize: 14, fontWeight: '700', color: '#FFFFFF' },
1077 headerTitle: { fontSize: 24, lineHeight: 28, fontWeight: '800', letterSpacing: -0.6 },
1078 headerEmail: { fontSize: 12.5 },
1079 searchButton: { width: 40, height: 40, borderRadius: 20, alignItems: 'center', justifyContent: 'center' },
1080 tabsWrap: { paddingHorizontal: 16, paddingTop: 4, paddingBottom: 12 },
1081
1082 // Empty state
1083 empty: { flex: 1, alignItems: 'center', justifyContent: 'center' },
1084 stage: { width: STAGE.w, height: STAGE.h, transformOrigin: 'top left' },
1085 stageArt: { width: STAGE.w, height: STAGE.h },
1086 copy: { marginTop: 18, alignSelf: 'stretch', height: COPY_H },
1087 copyTitle: { fontSize: 24, lineHeight: 30, fontWeight: '800', letterSpacing: -0.5, textAlign: 'center' },
1088 copyBody: { marginTop: 8, maxWidth: 304, fontSize: 15, lineHeight: 22, textAlign: 'center' },
1089 actions: { marginTop: 20, alignSelf: 'stretch', paddingHorizontal: 24, flexDirection: 'row', gap: 12 },
1090 status: { marginTop: 14, height: 18, justifyContent: 'center' },
1091 checkedRow: { gap: 6 },
1092 okDot: { width: 16, height: 16, borderRadius: 8, alignItems: 'center', justifyContent: 'center' },
1093 checkedText: { fontSize: 13, fontWeight: '600' },
1094 lastChecked: { fontSize: 13 },
1095});

More screens like this.

All Feedback & States