Application tracker

A job hunt tracker with motion: summary numbers count up and pop when they change, the up-next interview ticket ticks down second by second with rolling digits and its Add to calendar button flips over to Added with a check, a segmented filter springs its thumb between Active, Interviews, Offers and Closed while cards slide out and in with layout animation, tapping a card unfolds its timeline and Move to next stage sweeps the next progress segment full, and Archive from the card menu folds the card shut with an Undo snackbar that brings it back.

jobsjob searchapplicationstrackerpipelineinterviewtimelinecountdownanimationreanimated
Paste into Claude Code Cursor Codex Lovable RapidNative
Live preview · follows the site themeOpen full screen

Details

File
components/patterns/application-tracker.tsx
Lines
1725
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/application-tracker.tsx
1import { Fragment, useEffect, useLayoutEffect, useRef, useState, type ComponentProps, type ComponentRef, type ReactNode } from 'react';
2import {
3 PanResponder,
4 Pressable,
5 ScrollView,
6 StyleSheet,
7 Text,
8 View,
9 useColorScheme,
10 useWindowDimensions,
11 type LayoutChangeEvent,
12 type StyleProp,
13 type ViewStyle,
14} from 'react-native';
15import Animated, {
16 cancelAnimation,
17 Easing,
18 FadeIn,
19 FadeInDown,
20 FadeInLeft,
21 FadeInRight,
22 FadeOut,
23 FadeOutDown,
24 interpolate,
25 LinearTransition,
26 useAnimatedStyle,
27 useSharedValue,
28 withDelay,
29 withRepeat,
30 withSequence,
31 withSpring,
32 withTiming,
33 ZoomIn,
34} from 'react-native-reanimated';
35import { LinearGradient } from 'expo-linear-gradient';
36import { useSafeAreaInsets } from 'react-native-safe-area-context';
37import Svg, { Circle, Path } from 'react-native-svg';
38import { Archive, ArrowRight, Bell, BellOff, CalendarPlus, Check, ChevronDown, Ellipsis, Inbox, NotebookPen, Plus, Trophy, Undo2, Video, X } from 'lucide-react-native';
39
40// ─── Brand ──────────────────────────────────────────────────────────────────
41// The app's accent and name. Every accent colour below derives from these, so changing them rebrands the screen.
42// Company marks keep their own colours; they are not the app's brand.
43
44const ACCENT = '#C2255C';
45const ACCENT_DARK = '#F0679A'; // the accent as text on dark backgrounds
46const ON_ACCENT = '#FFFFFF'; // text and icons on an accent fill
47const APP_NAME = 'Nextround';
48
49/** `hex` at `alpha` opacity, as rgba(). */
50function tint(hex: string, alpha: number) {
51 const n = parseInt(hex.slice(1), 16);
52 return `rgba(${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255}, ${alpha})`;
53}
54
55/** `hex` mixed toward black (amount > 0) or white (amount < 0); amount from -1 to 1. */
56function shade(hex: string, amount: number) {
57 const n = parseInt(hex.slice(1), 16);
58 const target = amount < 0 ? 255 : 0;
59 const p = Math.abs(amount);
60 const c = (v: number) => Math.round(v + (target - v) * p).toString(16).padStart(2, '0');
61 return `#${c((n >> 16) & 255)}${c((n >> 8) & 255)}${c(n & 255)}`.toUpperCase();
62}
63
64/** `hex` with its hue turned by `deg` degrees and its HSL lightness and saturation moved by `light` / `sat` (-1 to 1).
65 * For accent-related colours of a different hue (an amber-to-coral gradient from one accent). */
66function spin(hex: string, deg: number, light = 0, sat = 0) {
67 const n = parseInt(hex.slice(1), 16);
68 const r = ((n >> 16) & 255) / 255;
69 const g = ((n >> 8) & 255) / 255;
70 const b = (n & 255) / 255;
71 const max = Math.max(r, g, b);
72 const min = Math.min(r, g, b);
73 const d = max - min;
74 const s = Math.min(1, Math.max(0, (d === 0 ? 0 : d / (1 - Math.abs(max + min - 1))) + sat));
75 const l = Math.min(1, Math.max(0, (max + min) / 2 + light));
76 const h0 = d === 0 ? 0 : max === r ? ((g - b) / d + 6) % 6 : max === g ? (b - r) / d + 2 : (r - g) / d + 4;
77 const h = (((h0 * 60 + deg) % 360) + 360) % 360;
78 const a = s * Math.min(l, 1 - l);
79 const f = (m: number) => {
80 const k = (m + h / 30) % 12;
81 return Math.round(255 * (l - a * Math.max(-1, Math.min(k - 3, 9 - k, 1)))).toString(16).padStart(2, '0');
82 };
83 return `#${f(0)}${f(8)}${f(4)}`.toUpperCase();
84}
85
86/** `hex` with its hue turned by `deg` and saturation moved by `sat`, at an exact HSL `lightness` (0 to 1).
87 * For surfaces that must stay as dark or as pale as designed whatever the accent: dark-theme backdrops, pale washes,
88 * cards on them and the ink that sits on them. */
89function tone(hex: string, deg: number, lightness: number, sat = 0) {
90 const n = parseInt(hex.slice(1), 16);
91 const r = (n >> 16) & 255; const g = (n >> 8) & 255; const b = n & 255;
92 return spin(hex, deg, lightness - (Math.max(r, g, b) + Math.min(r, g, b)) / 510, sat);
93}
94
95// ─── Sample data ────────────────────────────────────────────────────────────
96
97const STAGES = ['Applied', 'Screen', 'Interview', 'Offer'] as const;
98
99type Stage = 0 | 1 | 2 | 3;
100type Tone = 'waiting' | 'scheduled' | 'action' | 'offer' | 'closed';
101type MarkKind = 'fern' | 'arch' | 'kite' | 'sun' | 'wires' | 'drop' | 'bolt' | 'waves' | 'stone';
102type Mark = { kind: MarkKind; bg: string; fg: string };
103type TimelineEvent = { id: string; date: string; title: string; note?: string; kind: 'stage' | 'note' | 'closed' };
104
105type Application = {
106 id: string;
107 role: string;
108 company: string;
109 place: string;
110 pay: string;
111 applied: string;
112 stage: Stage;
113 closed: boolean;
114 next: string;
115 since?: string;
116 tone: Tone;
117 badge: string;
118 reminder?: boolean;
119 mark: Mark;
120 events: TimelineEvent[]; // newest first
121};
122
123const FERNWOOD: Mark = { kind: 'fern', bg: '#1F6B47', fg: '#E3F4E8' };
124
125// The next interview. It starts this long after the screen opens; use the real start time in your app.
126const UP_NEXT = {
127 company: 'Fernwood Studio',
128 round: 'Final round · Design panel',
129 when: 'Thu 10:00',
130 how: 'Video call',
131 mark: FERNWOOD,
132 startsIn: 1 * 86400 + 18 * 3600 + 24 * 60 + 36,
133};
134
135// Ordered by what needs you first. Active is everything still open; Interviews and Offers are its later stages.
136const APPLICATIONS: Application[] = [
137 {
138 id: 'kitefield', role: 'Design Systems Lead', company: 'Kitefield', place: 'Remote, US', pay: '$165k–190k', applied: 'Nov 14',
139 stage: 3, closed: false, next: 'Reply by Fri, Dec 4', tone: 'offer', badge: 'New offer',
140 mark: { kind: 'kite', bg: '#0F6E8C', fg: '#FFFFFF' },
141 events: [
142 { id: 'k4', date: 'Dec 1', title: 'Offer received', note: '$182k base, 0.08% equity, start Jan 11.', kind: 'stage' },
143 { id: 'k3', date: 'Nov 26', title: 'Final panel', note: 'Systems critique with two design leads. Went well.', kind: 'stage' },
144 { id: 'k2', date: 'Nov 19', title: 'Recruiter screen', note: 'Team of six, reports to the VP of Design.', kind: 'stage' },
145 { id: 'k1', date: 'Nov 14', title: 'Applied', note: 'Referred by a former teammate.', kind: 'stage' },
146 ],
147 },
148 {
149 id: 'halden', role: 'Product Designer, Payments', company: 'Halden & Rowe', place: 'London', pay: '£95k–110k', applied: 'Nov 18',
150 stage: 1, closed: false, next: 'Recruiter reply', since: '5 days', tone: 'waiting', badge: 'Waiting',
151 mark: { kind: 'arch', bg: '#1D355A', fg: '#F2E6CC' },
152 events: [
153 { id: 'h3', date: 'Nov 26', title: 'Sent the payments case study', note: 'They asked for it after the screen.', kind: 'note' },
154 { id: 'h2', date: 'Nov 24', title: 'Recruiter screen', note: '25 minutes with Tom. Hybrid, two days in the office.', kind: 'stage' },
155 { id: 'h1', date: 'Nov 18', title: 'Applied', note: 'Cover letter tailored to the cards team.', kind: 'stage' },
156 ],
157 },
158 {
159 id: 'sunmere', role: 'Staff UX Designer', company: 'Sunmere Health', place: 'Boston', pay: '$170k–195k', applied: 'Nov 21',
160 stage: 2, closed: false, next: 'Take-home due Mon', tone: 'action', badge: 'Your move',
161 mark: { kind: 'sun', bg: '#E2852F', fg: '#FFF6EA' },
162 events: [
163 { id: 's4', date: 'Nov 30', title: 'Take-home brief', note: 'Redesign appointment booking. Four hours, due Monday.', kind: 'stage' },
164 { id: 's3', date: 'Nov 27', title: 'Hiring manager call', note: 'Strong fit on the accessibility work.', kind: 'stage' },
165 { id: 's2', date: 'Nov 24', title: 'Recruiter screen', kind: 'stage' },
166 { id: 's1', date: 'Nov 21', title: 'Applied', kind: 'stage' },
167 ],
168 },
169 {
170 id: 'fernwood', role: 'Senior Product Designer', company: 'Fernwood Studio', place: 'Remote, EU', pay: '$150k–175k', applied: 'Nov 10',
171 stage: 2, closed: false, next: 'Final round Thu 10:00', tone: 'scheduled', badge: 'Scheduled',
172 mark: FERNWOOD,
173 events: [
174 { id: 'f4', date: 'Nov 27', title: 'Final round booked', note: 'Thursday 10:00 on video. Panel of three.', kind: 'stage' },
175 { id: 'f3', date: 'Nov 20', title: 'Portfolio review', note: 'Walked through Atlas and the design system.', kind: 'stage' },
176 { id: 'f2', date: 'Nov 13', title: 'Recruiter screen', kind: 'stage' },
177 { id: 'f1', date: 'Nov 10', title: 'Applied', kind: 'stage' },
178 ],
179 },
180 {
181 id: 'brisk', role: 'Interaction Designer', company: 'Brisk Mobility', place: 'Berlin', pay: '€85k–100k', applied: 'Nov 20',
182 stage: 1, closed: false, next: 'Recruiter call Fri 14:30', tone: 'scheduled', badge: 'Scheduled',
183 mark: { kind: 'bolt', bg: '#F1C232', fg: '#231C05' },
184 events: [
185 { id: 'b2', date: 'Nov 29', title: 'Recruiter call booked', note: 'Friday 14:30 with Jonas.', kind: 'stage' },
186 { id: 'b1', date: 'Nov 20', title: 'Applied', kind: 'stage' },
187 ],
188 },
189 {
190 id: 'inkwell', role: 'Lead Designer, Reader', company: 'Inkwell Press', place: 'Remote', pay: '$140k–160k', applied: 'Nov 28',
191 stage: 0, closed: false, next: 'Referral sent by Priya', since: '3 days', tone: 'scheduled', badge: 'Referred',
192 mark: { kind: 'drop', bg: '#26262B', fg: '#F3EFE6' },
193 events: [
194 { id: 'i2', date: 'Nov 28', title: 'Referral sent', note: 'Priya passed my profile to the hiring manager.', kind: 'note' },
195 { id: 'i1', date: 'Nov 28', title: 'Applied', kind: 'stage' },
196 ],
197 },
198 {
199 id: 'copperline', role: 'Mobile Product Designer', company: 'Copperline', place: 'Austin', pay: '$130k–150k', applied: 'Nov 26',
200 stage: 0, closed: false, next: 'No reply yet', since: '5 days', tone: 'waiting', badge: 'Waiting',
201 mark: { kind: 'wires', bg: '#B04F27', fg: '#FFE8DA' },
202 events: [{ id: 'c1', date: 'Nov 26', title: 'Applied', note: 'Through the careers page.', kind: 'stage' }],
203 },
204 {
205 id: 'saltmarsh', role: 'Senior Designer', company: 'Saltmarsh Games', place: 'Montreal', pay: '$120k–140k', applied: 'Nov 8',
206 stage: 2, closed: true, next: 'Not moving forward', since: 'Nov 25', tone: 'closed', badge: 'Closed',
207 mark: { kind: 'waves', bg: '#2F7068', fg: '#E3F3EF' },
208 events: [
209 { id: 'm4', date: 'Nov 25', title: 'Not moving forward', note: 'Went with an internal candidate. Asked to keep in touch.', kind: 'closed' },
210 { id: 'm3', date: 'Nov 19', title: 'Design exercise', kind: 'stage' },
211 { id: 'm2', date: 'Nov 12', title: 'Recruiter screen', kind: 'stage' },
212 { id: 'm1', date: 'Nov 8', title: 'Applied', kind: 'stage' },
213 ],
214 },
215 {
216 id: 'quarrystone', role: 'Product Designer', company: 'Quarrystone', place: 'Denver', pay: '$115k–135k', applied: 'Oct 31',
217 stage: 0, closed: true, next: 'No reply in 30 days', tone: 'closed', badge: 'Closed',
218 mark: { kind: 'stone', bg: '#5B6170', fg: '#EEF0F4' },
219 events: [
220 { id: 'q2', date: 'Nov 30', title: 'Marked closed', note: 'No reply in 30 days.', kind: 'closed' },
221 { id: 'q1', date: 'Oct 31', title: 'Applied', kind: 'stage' },
222 ],
223 },
224];
225
226// What changes when an application moves up a stage.
227const ADVANCE: Record<1 | 2 | 3, { next: string; tone: Tone; badge: string; note: string }> = {
228 1: { next: 'Book the recruiter call', tone: 'action', badge: 'Your move', note: 'They replied. Pick a slot for the screen.' },
229 2: { next: 'Interview loop being scheduled', tone: 'scheduled', badge: 'Scheduling', note: 'Passed the screen. The interview loop is next.' },
230 3: { next: 'Offer details on the way', tone: 'offer', badge: 'New offer', note: 'Verbal offer. Written details to follow.' },
231};
232
233type FilterId = 'active' | 'interviews' | 'offers' | 'closed';
234
235const FILTERS: { id: FilterId; label: string }[] = [
236 { id: 'active', label: 'Active' },
237 { id: 'interviews', label: 'Interviews' },
238 { id: 'offers', label: 'Offers' },
239 { id: 'closed', label: 'Closed' },
240];
241
242const PANEL = [
243 { id: 'dw', name: 'Dana W.', title: 'Head of Design', color: '#2F6FEB' },
244 { id: 'or', name: 'Omar R.', title: 'Staff Engineer', color: '#D9792B' },
245 { id: 'lk', name: 'Lena K.', title: 'Product Lead', color: '#1F8A5B' },
246];
247
248const PREP = [
249 { id: 'camera', label: 'Test camera, mic and light', sub: 'Ten minutes before the call' },
250 { id: 'atlas', label: 'Rehearse the Atlas case study', sub: '12 minutes, leave five for questions' },
251 { id: 'questions', label: 'Two questions for the panel', sub: 'Ask Lena how research shapes the roadmap' },
252 { id: 'range', label: 'Have your range ready', sub: '$165k to $175k base' },
253];
254
255// ─── Palette ────────────────────────────────────────────────────────────────
256
257const COLUMN = 520; // widest the content gets on tablets and the web
258const GUTTER = 16;
259const POP = { damping: 12, stiffness: 280, mass: 0.6 };
260const PRESS = { damping: 16, stiffness: 320, mass: 0.6 };
261const SLIDE = { damping: 19, stiffness: 230, mass: 0.7 };
262const MOVE = LinearTransition.duration(300);
263const SNACK_MS = 4500;
264const MENU_W = 224;
265const MENU_ITEM = 46;
266
267// The up-next ticket is dark in both themes, so its ink is the same in both.
268const TICKET_INK = '#FFFFFF';
269const TICKET_MUTED = 'rgba(255, 255, 255, 0.62)';
270const TICKET_SOFT = 'rgba(255, 255, 255, 0.12)';
271const TICKET_DONE = '#4ADE9B';
272const TICKET_DONE_INK = '#06281A';
273const TICKET_GLOW = [tint(spin(ACCENT, 12, 0.08), 0.75), tint(ACCENT, 0)] as const;
274
275function usePalette() {
276 const dark = useColorScheme() === 'dark';
277 return {
278 dark,
279 bg: dark ? '#000000' : '#F3F2EF',
280 surface: dark ? '#131315' : '#FFFFFF',
281 raised: dark ? '#1C1C1F' : '#FFFFFF',
282 fg: dark ? '#F4F4F5' : '#121214',
283 muted: dark ? '#8C8C93' : '#6B6B73',
284 faint: dark ? '#4A4A51' : '#BDBCC2',
285 border: dark ? '#232327' : '#E8E6E2',
286 rail: dark ? '#2E2E33' : '#DEDCD7',
287 track: dark ? '#1C1C1F' : '#E8E6E2',
288 thumb: dark ? '#303035' : '#FFFFFF',
289 bar: dark ? shade(ACCENT, -0.12) : ACCENT,
290 accentText: dark ? ACCENT_DARK : ACCENT,
291 accentSoft: dark ? tint(ACCENT, 0.22) : tint(ACCENT, 0.1),
292 accentEdge: dark ? tint(ACCENT_DARK, 0.45) : tint(ACCENT, 0.35),
293 ticket: dark ? tone(ACCENT, 0, 0.13, -0.32) : tone(ACCENT, 0, 0.11, -0.26),
294 success: dark ? '#3DDC97' : '#0F7A54',
295 successSoft: dark ? 'rgba(61, 220, 151, 0.13)' : 'rgba(16, 185, 129, 0.12)',
296 snackBg: dark ? '#F2F2F3' : '#18181B',
297 snackFg: dark ? '#121214' : '#FAFAFA',
298 snackAction: dark ? ACCENT : ACCENT_DARK,
299 scrim: dark ? 'rgba(0, 0, 0, 0.62)' : 'rgba(18, 18, 20, 0.42)',
300 cardShadow: dark ? undefined : '0px 1px 2px rgba(18, 18, 20, 0.04), 0px 8px 22px rgba(18, 18, 20, 0.05)',
301 menuShadow: dark ? '0px 0px 0px 1px rgba(255, 255, 255, 0.06), 0px 18px 40px rgba(0, 0, 0, 0.6)' : '0px 14px 36px rgba(18, 18, 20, 0.16)',
302 tones: {
303 waiting: dark ? { fg: '#F5B947', bg: 'rgba(245, 185, 71, 0.14)' } : { fg: '#9A5800', bg: 'rgba(245, 158, 11, 0.15)' },
304 scheduled: dark ? { fg: '#7EB4FF', bg: 'rgba(96, 160, 255, 0.15)' } : { fg: '#1D5BD6', bg: 'rgba(37, 99, 235, 0.10)' },
305 action: dark ? { fg: ACCENT_DARK, bg: tint(ACCENT, 0.22) } : { fg: ACCENT, bg: tint(ACCENT, 0.1) },
306 offer: dark ? { fg: '#3DDC97', bg: 'rgba(61, 220, 151, 0.14)' } : { fg: '#0F7A54', bg: 'rgba(16, 185, 129, 0.13)' },
307 closed: dark ? { fg: '#9A9AA1', bg: 'rgba(255, 255, 255, 0.07)' } : { fg: '#6B6B73', bg: 'rgba(18, 18, 20, 0.05)' },
308 } as Record<Tone, { fg: string; bg: string }>,
309 };
310}
311type Palette = ReturnType<typeof usePalette>;
312type Entering = ComponentProps<typeof Animated.View>['entering'];
313
314// ─── Tracker rules ──────────────────────────────────────────────────────────
315
316function matches(app: Application, filter: FilterId) {
317 if (filter === 'closed') return app.closed;
318 if (app.closed) return false;
319 return filter === 'active' || (filter === 'interviews' && app.stage === 2) || (filter === 'offers' && app.stage === 3);
320}
321
322/** The narrowest filter an application shows under, for "View" after it moves. */
323const homeOf = (app: Application): FilterId => (app.closed ? 'closed' : app.stage === 3 ? 'offers' : app.stage === 2 ? 'interviews' : 'active');
324const labelOf = (id: FilterId) => FILTERS.find((f) => f.id === id)?.label ?? '';
325const indexOf = (id: FilterId) => FILTERS.findIndex((f) => f.id === id);
326const pad2 = (n: number) => String(n).padStart(2, '0');
327
328/** Eases a number toward its target on the JS thread, so text can count up on web and native alike. */
329function useCountUp(target: number, delay = 0, duration = 850) {
330 const [value, setValue] = useState(0);
331 const latest = useRef(0);
332 const born = useRef(Date.now());
333 useEffect(() => {
334 const from = latest.current;
335 const wait = Math.max(0, delay - (Date.now() - born.current));
336 let frame = 0;
337 const timer = setTimeout(() => {
338 const started = Date.now();
339 const tick = () => {
340 const t = Math.min(1, (Date.now() - started) / duration);
341 latest.current = from + (target - from) * (1 - Math.pow(1 - t, 3));
342 setValue(latest.current);
343 if (t < 1) frame = requestAnimationFrame(tick);
344 };
345 frame = requestAnimationFrame(tick);
346 }, wait);
347 return () => {
348 clearTimeout(timer);
349 cancelAnimationFrame(frame);
350 };
351 }, [target, delay, duration]);
352 return value;
353}
354
355// ─── Small pieces ───────────────────────────────────────────────────────────
356
357function Tap({ label, onPress, to = 0.95, style, children }: { label: string; onPress?: () => void; to?: number; style?: StyleProp<ViewStyle>; children: ReactNode }) {
358 const scale = useSharedValue(1);
359 const anim = useAnimatedStyle(() => ({ transform: [{ scale: scale.value }] }));
360 return (
361 <Pressable
362 role="button"
363 aria-label={label}
364 onPress={onPress}
365 hitSlop={4}
366 onPressIn={() => (scale.value = withSpring(to, PRESS))}
367 onPressOut={() => (scale.value = withSpring(1, PRESS))}
368 style={style}
369 >
370 <Animated.View style={anim}>{children}</Animated.View>
371 </Pressable>
372 );
373}
374
375/** The app's own mark: two chevrons, the next round. */
376function BrandMark() {
377 return (
378 <View style={styles.brandMark}>
379 <Svg width={20} height={20} viewBox="0 0 40 40">
380 <Path d="M11 12l8 8-8 8M21 12l8 8-8 8" stroke={ON_ACCENT} strokeWidth={4.4} strokeLinecap="round" strokeLinejoin="round" fill="none" />
381 </Svg>
382 </View>
383 );
384}
385
386/** A company mark drawn from simple shapes on a solid tile, with a soft top light. */
387function CompanyMark({ mark, size, dim }: { mark: Mark; size: number; dim?: boolean }) {
388 const { kind, fg, bg } = mark;
389 return (
390 <View style={[styles.mark, { width: size, height: size, borderRadius: size * 0.3, backgroundColor: bg, opacity: dim ? 0.45 : 1 }]}>
391 <LinearGradient colors={['rgba(255, 255, 255, 0.22)', 'rgba(255, 255, 255, 0)']} start={{ x: 0, y: 0 }} end={{ x: 0.6, y: 1 }} style={StyleSheet.absoluteFill} />
392 <Svg width={size} height={size} viewBox="0 0 40 40">
393 {kind === 'fern' && (
394 <>
395 <Path d="M20 32V11" stroke={fg} strokeWidth={2.4} strokeLinecap="round" />
396 <Path d="M20 14c0-4 3-7 7.5-7 0 4-3 7-7.5 7z" fill={fg} />
397 <Path d="M20 20.5c0-4-3-7-7.5-7 0 4 3 7 7.5 7z" fill={fg} />
398 <Path d="M20 27c0-4 3-7 7.5-7 0 4-3 7-7.5 7z" fill={fg} />
399 </>
400 )}
401 {kind === 'arch' && (
402 <>
403 <Path d="M10.5 30V19.5a9.5 9.5 0 0 1 19 0V30z" fill={fg} />
404 <Path d="M16.5 30v-9.5a3.5 3.5 0 0 1 7 0V30z" fill={bg} />
405 </>
406 )}
407 {kind === 'kite' && (
408 <>
409 <Path d="M20 7l9.5 12L20 33l-9.5-14z" fill={fg} />
410 <Path d="M10.5 19h19M20 7v26" stroke={bg} strokeWidth={1.8} />
411 </>
412 )}
413 {kind === 'sun' && (
414 <>
415 <Path d="M9.5 23a10.5 10.5 0 0 1 21 0z" fill={fg} />
416 <Path d="M8 27.5h24M13 32h14" stroke={fg} strokeWidth={2.6} strokeLinecap="round" />
417 </>
418 )}
419 {kind === 'wires' && (
420 <>
421 <Path d="M10 25l9-12M16 30l12-16M24 30l6-8" stroke={fg} strokeWidth={3.2} strokeLinecap="round" />
422 </>
423 )}
424 {kind === 'drop' && (
425 <>
426 <Path d="M20 7.5c5.5 7 8.5 11.2 8.5 15.5a8.5 8.5 0 0 1-17 0c0-4.3 3-8.5 8.5-15.5z" fill={fg} />
427 <Circle cx={16.8} cy={24} r={2.4} fill={bg} />
428 </>
429 )}
430 {kind === 'bolt' && <Path d="M22.5 6.5L11.5 22h7.5l-2.5 11.5L28.5 17H21z" fill={fg} />}
431 {kind === 'waves' && (
432 <>
433 <Path d="M9 16c3-3.2 5.2-3.2 7.6 0s4.6 3.2 7.4 0 4.6-3.2 7 0" stroke={fg} strokeWidth={2.8} strokeLinecap="round" fill="none" />
434 <Path d="M9 24.5c3-3.2 5.2-3.2 7.6 0s4.6 3.2 7.4 0 4.6-3.2 7 0" stroke={fg} strokeWidth={2.8} strokeLinecap="round" fill="none" opacity={0.7} />
435 </>
436 )}
437 {kind === 'stone' && (
438 <>
439 <Path d="M14 9h12l6 9-12 14L8 18z" fill={fg} />
440 <Path d="M8 18h24M14 9l6 9 6-9M20 18v14" stroke={bg} strokeWidth={1.6} strokeLinejoin="round" fill="none" />
441 </>
442 )}
443 </Svg>
444 </View>
445 );
446}
447
448function PulseDot({ color }: { color: string }) {
449 const p = useSharedValue(0);
450 useEffect(() => {
451 p.value = withRepeat(withTiming(1, { duration: 1700, easing: Easing.out(Easing.cubic) }), -1);
452 return () => cancelAnimation(p);
453 }, [p]);
454 const ring = useAnimatedStyle(() => ({ opacity: 0.7 * (1 - p.value), transform: [{ scale: 1 + p.value * 1.8 }] }));
455 return (
456 <View style={styles.pulse}>
457 <Animated.View style={[styles.pulseRing, { backgroundColor: color }, ring]} />
458 <View style={[styles.pulseCore, { backgroundColor: color }]} />
459 </View>
460 );
461}
462
463// ─── Summary: four numbers that count up and pop when they change ───────────
464
465function Stat({ label, value, suffix, dot, ink, delay, c }: { label: string; value: number; suffix?: string; dot: string; ink: string; delay: number; c: Palette }) {
466 const shown = useCountUp(value, delay);
467 const bump = useSharedValue(1);
468 const prev = useRef(value);
469 useEffect(() => {
470 if (prev.current === value) return;
471 prev.current = value;
472 bump.value = withSequence(withTiming(1.18, { duration: 140, easing: Easing.out(Easing.quad) }), withSpring(1, POP));
473 }, [value, bump]);
474 const pop = useAnimatedStyle(() => ({ transform: [{ scale: bump.value }] }));
475 return (
476 <View style={styles.stat} aria-label={`${label}: ${value}${suffix ?? ''}`}>
477 <Animated.View style={[styles.statValueRow, pop]}>
478 <Text style={[styles.statValue, { color: ink }]}>{Math.round(shown)}</Text>
479 {suffix ? <Text style={[styles.statSuffix, { color: ink }]}>{suffix}</Text> : null}
480 </Animated.View>
481 <View style={styles.statLabelRow}>
482 <View style={[styles.statDot, { backgroundColor: dot }]} />
483 <Text numberOfLines={1} style={[styles.statLabel, { color: c.muted }]}>
484 {label}
485 </Text>
486 </View>
487 </View>
488 );
489}
490
491// ─── Up next: a ticket with a live countdown and a calendar button that flips ─
492
493/** One digit that rolls up when it changes. */
494function RollDigit({ ch }: { ch: string }) {
495 const [pair, setPair] = useState({ prev: ch, curr: ch });
496 if (pair.curr !== ch) setPair({ prev: pair.curr, curr: ch });
497 const t = useSharedValue(1);
498 useLayoutEffect(() => {
499 if (pair.prev === pair.curr) return;
500 t.value = 0;
501 t.value = withTiming(1, { duration: 240, easing: Easing.out(Easing.cubic) });
502 }, [pair, t]);
503 const out = useAnimatedStyle(() => ({ opacity: 1 - t.value, transform: [{ translateY: -t.value * 16 }] }));
504 const inn = useAnimatedStyle(() => ({ opacity: t.value, transform: [{ translateY: (1 - t.value) * 16 }] }));
505 return (
506 <View style={styles.digitSlot}>
507 <Animated.Text style={[styles.digit, styles.digitOld, out]}>{pair.prev}</Animated.Text>
508 <Animated.Text style={[styles.digit, inn]}>{pair.curr}</Animated.Text>
509 </View>
510 );
511}
512
513// The countdown holds still for this long after the screen opens, so the resting frame never catches a digit
514// mid-roll; it then counts down smoothly from where it was, without a jump.
515const HOLD_MS = 3200;
516
517function Countdown({ deadline }: { deadline: number }) {
518 const opened = useRef(Date.now());
519 const secondsLeft = () => {
520 const now = Date.now();
521 return Math.max(0, Math.ceil((deadline + Math.min(HOLD_MS, now - opened.current) - now) / 1000));
522 };
523 const [left, setLeft] = useState(secondsLeft);
524 useEffect(() => {
525 // Polls faster than once a second so a late timer never skips a digit.
526 const id = setInterval(() => setLeft(secondsLeft()), 250);
527 return () => clearInterval(id);
528 // eslint-disable-next-line react-hooks/exhaustive-deps
529 }, [deadline]);
530 const parts = [
531 { unit: 'DAY', value: Math.floor(left / 86400) },
532 { unit: 'HRS', value: Math.floor((left % 86400) / 3600) },
533 { unit: 'MIN', value: Math.floor((left % 3600) / 60) },
534 { unit: 'SEC', value: left % 60 },
535 ];
536 return (
537 <View role="timer" aria-label={`Starts in ${parts[0].value} days, ${parts[1].value} hours and ${parts[2].value} minutes`} style={styles.countdown}>
538 {parts.map((p, i) => (
539 <Fragment key={p.unit}>
540 {i > 0 && <Text style={styles.cdColon}>:</Text>}
541 <View style={styles.cdBlock}>
542 <View style={styles.cdDigits}>
543 {pad2(p.value)
544 .split('')
545 .map((ch, j) => (
546 <RollDigit key={j} ch={ch} />
547 ))}
548 </View>
549 <Text style={styles.cdUnit}>{p.unit}</Text>
550 </View>
551 </Fragment>
552 ))}
553 </View>
554 );
555}
556
557/** Flips over its horizontal axis to "Added" with a check, and back. */
558function CalendarButton({ added, onPress }: { added: boolean; onPress: () => void }) {
559 const flip = useSharedValue(added ? 1 : 0);
560 const press = useSharedValue(1);
561 useEffect(() => {
562 flip.value = withTiming(added ? 1 : 0, { duration: 560, easing: Easing.inOut(Easing.cubic) });
563 }, [added, flip]);
564 const front = useAnimatedStyle(() => ({ opacity: flip.value < 0.5 ? 1 : 0, transform: [{ perspective: 500 }, { rotateX: `${flip.value * 180}deg` }] }));
565 const back = useAnimatedStyle(() => ({ opacity: flip.value >= 0.5 ? 1 : 0, transform: [{ perspective: 500 }, { rotateX: `${flip.value * 180 - 180}deg` }] }));
566 const tick = useAnimatedStyle(() => ({ transform: [{ scale: interpolate(flip.value, [0.5, 0.8, 1], [0.2, 1.3, 1], 'clamp') }] }));
567 const body = useAnimatedStyle(() => ({ transform: [{ scale: press.value }] }));
568 return (
569 <Pressable
570 role="button"
571 aria-label={added ? 'Added to calendar. Tap to remove' : 'Add to calendar'}
572 aria-pressed={added}
573 onPress={onPress}
574 onPressIn={() => (press.value = withSpring(0.95, PRESS))}
575 onPressOut={() => (press.value = withSpring(1, PRESS))}
576 style={styles.ticketButtonSlot}
577 >
578 <Animated.View style={[styles.ticketButton, body]}>
579 <Animated.View style={[StyleSheet.absoluteFill, styles.calFront, front]}>
580 <CalendarPlus size={16} color={ON_ACCENT} strokeWidth={2.3} />
581 <Text style={[styles.ticketButtonLabel, { color: ON_ACCENT }]}>Add to calendar</Text>
582 </Animated.View>
583 <Animated.View style={[StyleSheet.absoluteFill, styles.calBack, back]}>
584 <Animated.View style={[styles.calTick, tick]}>
585 <Check size={12} color={TICKET_DONE_INK} strokeWidth={3.6} />
586 </Animated.View>
587 <Text style={[styles.ticketButtonLabel, { color: TICKET_INK }]}>Added</Text>
588 </Animated.View>
589 </Animated.View>
590 </Pressable>
591 );
592}
593
594function UpNextCard({ deadline, added, onToggleAdded, onPrep, c }: { deadline: number; added: boolean; onToggleAdded: () => void; onPrep: () => void; c: Palette }) {
595 return (
596 <View style={c.dark ? styles.ticketWrapDark : styles.ticketWrapLight}>
597 <View style={[styles.ticket, { backgroundColor: c.ticket }]}>
598 <LinearGradient colors={TICKET_GLOW} start={{ x: 1, y: 0 }} end={{ x: 0.25, y: 0.85 }} style={StyleSheet.absoluteFill} />
599 <View style={styles.ticketTop}>
600 <CompanyMark mark={UP_NEXT.mark} size={40} />
601 <View style={styles.fill}>
602 <Text numberOfLines={1} style={styles.ticketCompany}>
603 {UP_NEXT.company}
604 </Text>
605 <Text numberOfLines={1} style={styles.ticketRound}>
606 {UP_NEXT.round}
607 </Text>
608 </View>
609 <View style={styles.liveChip}>
610 <PulseDot color={TICKET_DONE} />
611 <Text style={styles.liveText}>UP NEXT</Text>
612 </View>
613 </View>
614
615 <View style={styles.ticketMid}>
616 <Countdown deadline={deadline} />
617 <View style={styles.when}>
618 <Text style={styles.whenDay}>{UP_NEXT.when}</Text>
619 <View style={styles.whenHowRow}>
620 <Video size={13} color={TICKET_MUTED} strokeWidth={2.2} />
621 <Text style={styles.whenHow}>{UP_NEXT.how}</Text>
622 </View>
623 </View>
624 </View>
625
626 {/* Perforation, with notches cut from the page colour */}
627 <View style={styles.perforation}>
628 <View style={[styles.notch, styles.notchLeft, { backgroundColor: c.bg }]} />
629 {Array.from({ length: 30 }, (_, i) => (
630 <View key={i} style={styles.dash} />
631 ))}
632 <View style={[styles.notch, styles.notchRight, { backgroundColor: c.bg }]} />
633 </View>
634
635 <View style={styles.ticketActions}>
636 <CalendarButton added={added} onPress={onToggleAdded} />
637 <Tap label="Prep notes" onPress={onPrep} style={styles.ticketButtonSlot}>
638 <View style={styles.prepButton}>
639 <NotebookPen size={16} color={TICKET_INK} strokeWidth={2.2} />
640 <Text style={[styles.ticketButtonLabel, { color: TICKET_INK }]}>Prep notes</Text>
641 </View>
642 </Tap>
643 </View>
644 <View style={[StyleSheet.absoluteFill, styles.ticketEdge]} />
645 </View>
646 </View>
647 );
648}
649
650// ─── Filter: a segmented control whose thumb springs between tabs ───────────
651
652function FilterTabs({ value, counts, onChange, c }: { value: FilterId; counts: Record<FilterId, number>; onChange: (id: FilterId) => void; c: Palette }) {
653 const [w, setW] = useState(0);
654 const index = indexOf(value);
655 const seg = w > 0 ? (w - 8) / FILTERS.length : 0;
656 const x = useSharedValue(0);
657 const placed = useRef(false);
658 useEffect(() => {
659 if (!seg) return;
660 x.value = placed.current ? withSpring(index * seg, SLIDE) : index * seg;
661 placed.current = true;
662 }, [index, seg, x]);
663 const thumb = useAnimatedStyle(() => ({ transform: [{ translateX: x.value }] }));
664 return (
665 <View role="tablist" aria-label="Filter applications" onLayout={(e: LayoutChangeEvent) => setW(e.nativeEvent.layout.width)} style={[styles.tabs, { backgroundColor: c.track }]}>
666 {seg > 0 && <Animated.View style={[styles.tabThumb, { width: seg, backgroundColor: c.thumb }, c.dark ? styles.tabThumbDark : styles.tabThumbLight, thumb]} />}
667 {FILTERS.map((f) => {
668 const on = f.id === value;
669 return (
670 <Pressable key={f.id} role="tab" aria-selected={on} aria-label={`${f.label}, ${counts[f.id]}`} onPress={() => onChange(f.id)} style={styles.tab}>
671 <Text numberOfLines={1} style={[styles.tabLabel, { color: on ? c.fg : c.muted }]}>
672 {f.label}
673 </Text>
674 <Animated.Text key={counts[f.id]} entering={FadeInDown.duration(240)} style={[styles.tabCount, { color: on ? c.accentText : c.muted }]}>
675 {counts[f.id]}
676 </Animated.Text>
677 </Pressable>
678 );
679 })}
680 </View>
681 );
682}
683
684// ─── Application card ───────────────────────────────────────────────────────
685
686/** One stage of the four: the fill sweeps in on load and when the application moves up. */
687function StageBar({ on, index, delay, color, track }: { on: boolean; index: number; delay: number; color: string; track: string }) {
688 const fill = useSharedValue(0);
689 const prev = useRef<boolean | null>(null);
690 useEffect(() => {
691 if (prev.current === on) return;
692 const first = prev.current === null;
693 prev.current = on;
694 if (first) {
695 fill.value = on ? withDelay(delay + index * 60, withTiming(1, { duration: 380, easing: Easing.out(Easing.cubic) })) : 0;
696 return;
697 }
698 fill.value = withTiming(on ? 1 : 0, { duration: on ? 700 : 240, easing: Easing.out(Easing.cubic) });
699 }, [on, index, delay, fill]);
700 const style = useAnimatedStyle(() => ({ width: `${fill.value * 100}%` }));
701 return (
702 <View style={[styles.stageBar, { backgroundColor: track }]}>
703 <Animated.View style={[styles.stageFill, { backgroundColor: color }, style]} />
704 </View>
705 );
706}
707
708function StageLabel({ label, current, color, weight }: { label: string; current: boolean; color: string; weight: '500' | '700' }) {
709 const bump = useSharedValue(1);
710 const was = useRef(current);
711 useEffect(() => {
712 if (current && !was.current) bump.value = withDelay(380, withSequence(withTiming(1.16, { duration: 150 }), withSpring(1, POP)));
713 was.current = current;
714 }, [current, bump]);
715 const style = useAnimatedStyle(() => ({ transform: [{ scale: bump.value }] }));
716 return (
717 <View style={styles.stageLabelSlot}>
718 <Animated.Text numberOfLines={1} style={[styles.stageLabel, { color, fontWeight: weight }, style]}>
719 {label}
720 </Animated.Text>
721 </View>
722 );
723}
724
725function StageTrack({ stage, closed, delay, c }: { stage: Stage; closed: boolean; delay: number; c: Palette }) {
726 return (
727 <View role="progressbar" aria-label={`Stage ${stage + 1} of 4: ${STAGES[stage]}`} aria-valuemin={1} aria-valuemax={4} aria-valuenow={stage + 1} style={styles.stages}>
728 <View style={styles.stageBars}>
729 {STAGES.map((s, i) => (
730 <StageBar key={s} on={i <= stage} index={i} delay={delay} color={closed ? c.faint : c.bar} track={c.track} />
731 ))}
732 </View>
733 <View style={styles.stageLabels}>
734 {STAGES.map((s, i) => (
735 <StageLabel
736 key={s}
737 label={s}
738 current={i === stage}
739 color={i === stage ? (closed ? c.muted : c.accentText) : i < stage ? c.muted : c.faint}
740 weight={i === stage ? '700' : '500'}
741 />
742 ))}
743 </View>
744 </View>
745 );
746}
747
748function Badge({ tone: t, label, animate, c }: { tone: Tone; label: string; animate: boolean; c: Palette }) {
749 const colors = c.tones[t];
750 return (
751 <Animated.View entering={animate ? ZoomIn.springify().damping(12).stiffness(240) : undefined} style={[styles.badge, { backgroundColor: colors.bg }]}>
752 <View style={[styles.badgeDot, { backgroundColor: colors.fg }]} />
753 <Text style={[styles.badgeLabel, { color: colors.fg }]}>{label}</Text>
754 </Animated.View>
755 );
756}
757
758function TimelineRow({ event, index, first, last, closed, c }: { event: TimelineEvent; index: number; first: boolean; last: boolean; closed: boolean; c: Palette }) {
759 const color = event.kind === 'closed' ? c.muted : closed ? c.faint : c.bar;
760 return (
761 <Animated.View entering={FadeInDown.delay(index * 45).duration(300)} layout={MOVE} style={styles.event}>
762 <View style={styles.rail}>
763 <View style={[styles.eventDotWrap, first && !closed && { backgroundColor: c.accentSoft }]}>
764 <View style={[styles.eventDot, event.kind === 'note' ? { borderWidth: 2, borderColor: color, backgroundColor: c.surface } : { backgroundColor: color }]} />
765 </View>
766 {!last && <View style={[styles.railLine, { backgroundColor: c.rail }]} />}
767 </View>
768 <View style={styles.eventBody}>
769 <View style={styles.eventHead}>
770 <Text numberOfLines={1} style={[styles.eventTitle, { color: c.fg }]}>
771 {event.title}
772 </Text>
773 <Text style={[styles.eventDate, { color: first && !closed ? c.accentText : c.muted }]}>{event.date}</Text>
774 </View>
775 {event.note ? <Text style={[styles.eventNote, { color: c.muted }]}>{event.note}</Text> : null}
776 </View>
777 </Animated.View>
778 );
779}
780
781function AdvanceButton({ next, onPress }: { next: string; onPress: () => void }) {
782 const press = useSharedValue(1);
783 const body = useAnimatedStyle(() => ({ transform: [{ scale: press.value }] }));
784 return (
785 <Pressable
786 role="button"
787 aria-label={`Move to ${next}`}
788 onPress={onPress}
789 onPressIn={() => (press.value = withSpring(0.96, PRESS))}
790 onPressOut={() => (press.value = withSpring(1, PRESS))}
791 style={styles.fill}
792 >
793 <Animated.View style={[styles.advance, body]}>
794 <Animated.Text key={next} entering={FadeInDown.duration(240)} style={styles.advanceLabel}>
795 Move to {next}
796 </Animated.Text>
797 <ArrowRight size={16} color={ON_ACCENT} strokeWidth={2.4} />
798 </Animated.View>
799 </Pressable>
800 );
801}
802
803function MoreButton({ label, onPress, c }: { label: string; onPress: (anchor: ComponentRef<typeof View> | null) => void; c: Palette }) {
804 const ref = useRef<ComponentRef<typeof View>>(null);
805 return (
806 <View ref={ref} collapsable={false} style={styles.moreSlot}>
807 <Pressable role="button" aria-label={label} hitSlop={6} onPress={() => onPress(ref.current)} style={({ pressed }) => [styles.more, pressed && { backgroundColor: c.track }]}>
808 <Ellipsis size={18} color={c.muted} strokeWidth={2.2} />
809 </Pressable>
810 </View>
811 );
812}
813
814type CardProps = {
815 app: Application;
816 expanded: boolean;
817 leaving: boolean;
818 entering: Entering;
819 barDelay: number;
820 animateBadge: boolean;
821 onToggle: () => void;
822 onMenu: (anchor: ComponentRef<typeof View> | null) => void;
823 onAdvance: () => void;
824 onReopen: () => void;
825 onCollapsed: () => void;
826 onMeasure: (y: number, h: number) => void;
827 c: Palette;
828};
829
830function ApplicationCard({ app, expanded, leaving, entering, barDelay, animateBadge, onToggle, onMenu, onAdvance, onReopen, onCollapsed, onMeasure, c }: CardProps) {
831 const press = useSharedValue(1);
832 const open = useSharedValue(expanded ? 1 : 0);
833 const detailH = useSharedValue(0);
834 const slotH = useSharedValue(0);
835 const gone = useSharedValue(0);
836 const [mounted, setMounted] = useState(expanded);
837 const collapsed = useRef(onCollapsed);
838 useEffect(() => {
839 collapsed.current = onCollapsed;
840 });
841
842 // Expanding mounts the timeline, then opens to its measured height; closing unmounts it once shut.
843 useEffect(() => {
844 if (expanded) {
845 setMounted(true);
846 open.value = withTiming(1, { duration: 420, easing: Easing.out(Easing.cubic) });
847 return;
848 }
849 open.value = withTiming(0, { duration: 280, easing: Easing.inOut(Easing.cubic) });
850 const id = setTimeout(() => setMounted(false), 300);
851 return () => clearTimeout(id);
852 }, [expanded, open]);
853
854 // Archiving folds the whole card shut, then hands it back to the screen.
855 useEffect(() => {
856 if (!leaving) return;
857 gone.value = withTiming(1, { duration: 340, easing: Easing.inOut(Easing.cubic) });
858 const id = setTimeout(() => collapsed.current(), 360);
859 return () => clearTimeout(id);
860 }, [leaving, gone]);
861
862 const slot = useAnimatedStyle(() =>
863 gone.value > 0
864 ? { height: slotH.value * (1 - gone.value), opacity: 1 - gone.value, transform: [{ scale: 1 - gone.value * 0.04 }] }
865 : { height: 'auto' as const, opacity: 1, transform: [{ scale: 1 }] }
866 );
867 const body = useAnimatedStyle(() => ({ transform: [{ scale: press.value }] }));
868 const details = useAnimatedStyle(() => ({ height: open.value * detailH.value, opacity: interpolate(open.value, [0, 0.35, 1], [0, 0.5, 1]) }));
869 const chevron = useAnimatedStyle(() => ({ transform: [{ rotate: `${open.value * 180}deg` }] }));
870
871 const onDetails = (e: LayoutChangeEvent) => {
872 const h = e.nativeEvent.layout.height;
873 detailH.value = detailH.value === 0 ? h : withTiming(h, { duration: 320, easing: Easing.out(Easing.cubic) });
874 };
875
876 return (
877 <Animated.View
878 entering={entering}
879 exiting={FadeOut.duration(160)}
880 layout={MOVE}
881 onLayout={(e: LayoutChangeEvent) => {
882 const { y, height } = e.nativeEvent.layout;
883 if (!leaving) slotH.value = height;
884 onMeasure(y, height);
885 }}
886 style={[styles.slot, leaving && styles.slotClip, slot]}
887 >
888 <Animated.View style={[styles.card, { backgroundColor: c.surface, borderColor: expanded ? c.accentEdge : c.border, boxShadow: c.cardShadow }, body]}>
889 <Pressable
890 role="button"
891 aria-expanded={expanded}
892 aria-label={`${app.role} at ${app.company}, ${app.closed ? 'closed' : `${STAGES[app.stage]} stage`}. ${expanded ? 'Hide' : 'Show'} timeline`}
893 onPress={onToggle}
894 onPressIn={() => (press.value = withSpring(0.985, PRESS))}
895 onPressOut={() => (press.value = withSpring(1, PRESS))}
896 style={styles.cardHead}
897 >
898 <View style={styles.cardTop}>
899 <CompanyMark mark={app.mark} size={44} dim={app.closed} />
900 <View style={styles.cardTitles}>
901 <Text numberOfLines={1} style={[styles.role, { color: app.closed ? c.muted : c.fg }]}>
902 {app.role}
903 </Text>
904 <Text numberOfLines={1} style={[styles.company, { color: c.muted }]}>
905 {app.company} · {app.place}
906 </Text>
907 <Text numberOfLines={1} style={[styles.pay, { color: c.muted }]}>
908 <Text style={[styles.payStrong, { color: app.closed ? c.muted : c.fg }]}>{app.pay}</Text>
909 {` · Applied ${app.applied}`}
910 </Text>
911 </View>
912 </View>
913
914 <StageTrack stage={app.stage} closed={app.closed} delay={barDelay} c={c} />
915
916 <View style={styles.nextRow}>
917 <Text numberOfLines={1} style={[styles.next, { color: app.closed ? c.muted : c.fg }]}>
918 {app.next}
919 {app.since ? <Text style={[styles.nextSince, { color: c.muted }]}>{` · ${app.since}`}</Text> : null}
920 </Text>
921 {app.reminder ? (
922 <Animated.View entering={ZoomIn.springify().damping(12)} aria-label="Reminder set">
923 <Bell size={14} color={c.accentText} strokeWidth={2.4} />
924 </Animated.View>
925 ) : null}
926 <Badge key={app.badge} tone={app.tone} label={app.badge} animate={animateBadge} c={c} />
927 <Animated.View style={chevron}>
928 <ChevronDown size={17} color={c.muted} strokeWidth={2.2} />
929 </Animated.View>
930 </View>
931 </Pressable>
932
933 <MoreButton label={`More actions for ${app.company}`} onPress={onMenu} c={c} />
934
935 <Animated.View aria-hidden={!expanded} style={[styles.detailsClip, { pointerEvents: expanded ? 'auto' : 'none' }, details]}>
936 {mounted && (
937 <View onLayout={onDetails} style={styles.detailsInner}>
938 <View style={[styles.rule, { backgroundColor: c.border }]} />
939 <View style={styles.detailsHead}>
940 <Text style={[styles.overline, { color: c.muted }]}>Timeline</Text>
941 <Text style={[styles.detailsMeta, { color: c.muted }]}>{app.events.length === 1 ? '1 update' : `${app.events.length} updates`}</Text>
942 </View>
943 <View>
944 {app.events.map((e, i) => (
945 <TimelineRow key={e.id} event={e} index={i} first={i === 0} last={i === app.events.length - 1} closed={app.closed} c={c} />
946 ))}
947 </View>
948 <View style={styles.detailActions}>
949 <Tap label="Add a note" to={0.95}>
950 <View style={[styles.ghostAction, { borderColor: c.border }]}>
951 <NotebookPen size={16} color={c.fg} strokeWidth={2.1} />
952 <Text style={[styles.ghostLabel, { color: c.fg }]}>Add note</Text>
953 </View>
954 </Tap>
955 {app.closed ? (
956 <Tap label="Reopen application" onPress={onReopen} style={styles.fill}>
957 <View style={[styles.reopen, { borderColor: c.accentEdge, backgroundColor: c.accentSoft }]}>
958 <Undo2 size={16} color={c.accentText} strokeWidth={2.3} />
959 <Text style={[styles.ghostLabel, { color: c.accentText }]}>Reopen</Text>
960 </View>
961 </Tap>
962 ) : app.stage < 3 ? (
963 <AdvanceButton next={STAGES[app.stage + 1]} onPress={onAdvance} />
964 ) : (
965 <Animated.View entering={ZoomIn.springify().damping(13)} style={[styles.finalStage, { backgroundColor: c.successSoft }]}>
966 <Trophy size={16} color={c.success} strokeWidth={2.3} />
967 <Text style={[styles.ghostLabel, { color: c.success }]}>Final stage reached</Text>
968 </Animated.View>
969 )}
970 </View>
971 </View>
972 )}
973 </Animated.View>
974 </Animated.View>
975 </Animated.View>
976 );
977}
978
979// ─── Card menu: a small popover anchored to the card's more button ──────────
980
981type MenuAnchor = { id: string; x: number; y: number; h: number };
982
983function CardMenu({
984 anchor,
985 app,
986 rootH,
987 onClose,
988 onAdvance,
989 onReminder,
990 onArchive,
991 onReopen,
992 c,
993}: {
994 anchor: MenuAnchor;
995 app: Application;
996 rootH: number;
997 onClose: () => void;
998 onAdvance: () => void;
999 onReminder: () => void;
1000 onArchive: () => void;
1001 onReopen: () => void;
1002 c: Palette;
1003}) {
1004 const items: { key: string; label: string; Icon: typeof Archive; run: () => void }[] = app.closed
1005 ? [
1006 { key: 'reopen', label: 'Reopen', Icon: Undo2, run: onReopen },
1007 { key: 'archive', label: 'Archive', Icon: Archive, run: onArchive },
1008 ]
1009 : [
1010 ...(app.stage < 3 ? [{ key: 'advance', label: `Move to ${STAGES[app.stage + 1]}`, Icon: ArrowRight, run: onAdvance }] : []),
1011 { key: 'remind', label: app.reminder ? 'Remove reminder' : 'Remind me tomorrow', Icon: app.reminder ? BellOff : Bell, run: onReminder },
1012 { key: 'archive', label: 'Archive', Icon: Archive, run: onArchive },
1013 ];
1014 const menuH = items.length * MENU_ITEM + 12;
1015 const below = anchor.y + anchor.h + 6 + menuH < rootH - 24;
1016 const top = below ? anchor.y + anchor.h + 4 : anchor.y - menuH - 4;
1017 const left = Math.max(12, anchor.x - MENU_W);
1018 const t = useSharedValue(0);
1019 useEffect(() => {
1020 t.value = withSpring(1, { damping: 18, stiffness: 340, mass: 0.6 });
1021 }, [t]);
1022 const pop = useAnimatedStyle(() => ({
1023 opacity: Math.min(1, t.value * 1.6),
1024 transform: [{ translateY: (1 - t.value) * (below ? -8 : 8) }, { scale: 0.9 + t.value * 0.1 }],
1025 }));
1026 return (
1027 <Animated.View exiting={FadeOut.duration(120)} style={StyleSheet.absoluteFill}>
1028 <Pressable aria-label="Close menu" onPress={onClose} style={StyleSheet.absoluteFill} />
1029 <Animated.View
1030 role="menu"
1031 aria-label={`Actions for ${app.company}`}
1032 style={[styles.menu, { top, left, backgroundColor: c.raised, borderColor: c.border, boxShadow: c.menuShadow, transformOrigin: below ? 'top right' : 'bottom right' }, pop]}
1033 >
1034 {items.map((it) => (
1035 <Pressable key={it.key} role="menuitem" aria-label={it.label} onPress={it.run} style={({ pressed }) => [styles.menuItem, pressed && { backgroundColor: c.track }]}>
1036 <it.Icon size={18} color={c.fg} strokeWidth={2} />
1037 <Text style={[styles.menuLabel, { color: c.fg }]}>{it.label}</Text>
1038 </Pressable>
1039 ))}
1040 </Animated.View>
1041 </Animated.View>
1042 );
1043}
1044
1045// ─── Snackbar: rises from the bottom, drains its timer, offers Undo ─────────
1046
1047type Snack = { key: number; message: string; action?: { label: string; run: () => void } };
1048
1049function SnackBody({ snack, width, c }: { snack: Snack; width: number; c: Palette }) {
1050 const drain = useSharedValue(1);
1051 useEffect(() => {
1052 drain.value = withTiming(0, { duration: SNACK_MS, easing: Easing.linear });
1053 }, [drain]);
1054 const timer = useAnimatedStyle(() => ({ transform: [{ scaleX: drain.value }] }));
1055 return (
1056 <Animated.View entering={FadeInDown.springify().damping(16).stiffness(220)} exiting={FadeOutDown.duration(200)} style={[styles.snackShadow, { width }]}>
1057 <View role="alert" style={[styles.snack, { backgroundColor: c.snackBg }]}>
1058 <Text numberOfLines={1} style={[styles.snackText, { color: c.snackFg }]}>
1059 {snack.message}
1060 </Text>
1061 {snack.action ? (
1062 <Pressable role="button" aria-label={snack.action.label} onPress={snack.action.run} hitSlop={8} style={({ pressed }) => [styles.snackAction, { opacity: pressed ? 0.6 : 1 }]}>
1063 {snack.action.label === 'Undo' ? <Undo2 size={16} color={c.snackAction} strokeWidth={2.5} /> : null}
1064 <Text style={[styles.snackActionLabel, { color: c.snackAction }]}>{snack.action.label}</Text>
1065 </Pressable>
1066 ) : null}
1067 <Animated.View style={[styles.snackTimer, { backgroundColor: c.snackAction }, timer]} />
1068 </View>
1069 </Animated.View>
1070 );
1071}
1072
1073// ─── Prep notes: a sheet you can drag down to close ─────────────────────────
1074
1075function CheckRow({ label, sub, done, onPress, c }: { label: string; sub: string; done: boolean; onPress: () => void; c: Palette }) {
1076 const t = useSharedValue(done ? 1 : 0);
1077 useEffect(() => {
1078 t.value = done ? withSpring(1, POP) : withTiming(0, { duration: 160 });
1079 }, [done, t]);
1080 const fill = useAnimatedStyle(() => ({ opacity: Math.min(1, t.value * 1.5), transform: [{ scale: interpolate(t.value, [0, 1], [0.4, 1]) }] }));
1081 return (
1082 <Pressable role="checkbox" aria-checked={done} aria-label={label} onPress={onPress} style={({ pressed }) => [styles.check, { opacity: pressed ? 0.7 : 1 }]}>
1083 <View style={[styles.checkBox, { borderColor: done ? ACCENT : c.faint }]}>
1084 <Animated.View style={[StyleSheet.absoluteFill, styles.checkFill, fill]}>
1085 <Check size={14} color={ON_ACCENT} strokeWidth={3.2} />
1086 </Animated.View>
1087 </View>
1088 <View style={styles.fill}>
1089 <Text style={[styles.checkLabel, { color: done ? c.muted : c.fg, textDecorationLine: done ? 'line-through' : 'none' }]}>{label}</Text>
1090 <Text style={[styles.checkSub, { color: c.muted }]}>{sub}</Text>
1091 </View>
1092 </Pressable>
1093 );
1094}
1095
1096function ReadyBar({ done, total, c }: { done: number; total: number; c: Palette }) {
1097 const share = useSharedValue(done / total);
1098 useEffect(() => {
1099 share.value = withTiming(done / total, { duration: 420, easing: Easing.out(Easing.cubic) });
1100 }, [done, total, share]);
1101 const fill = useAnimatedStyle(() => ({ width: `${share.value * 100}%` }));
1102 return (
1103 <View style={styles.ready}>
1104 <View style={[styles.readyTrack, { backgroundColor: c.track }]}>
1105 <Animated.View style={[styles.readyFill, fill]} />
1106 </View>
1107 <Text style={[styles.readyText, { color: done === total ? c.success : c.muted }]}>{done === total ? 'All set' : `${done} of ${total} ready`}</Text>
1108 </View>
1109 );
1110}
1111
1112function PrepSheet({ open, done, onToggle, onClose, bottom, width, c }: { open: boolean; done: string[]; onToggle: (id: string) => void; onClose: () => void; bottom: number; width: number; c: Palette }) {
1113 const [shown, setShown] = useState(open);
1114 const t = useSharedValue(0);
1115 const drag = useSharedValue(0);
1116 const close = useRef(onClose);
1117 useEffect(() => {
1118 close.current = onClose;
1119 });
1120 useEffect(() => {
1121 if (open) {
1122 setShown(true);
1123 drag.value = 0;
1124 t.value = withSpring(1, { damping: 22, stiffness: 230, mass: 0.8 });
1125 return;
1126 }
1127 t.value = withTiming(0, { duration: 240, easing: Easing.in(Easing.cubic) });
1128 const id = setTimeout(() => setShown(false), 260);
1129 return () => clearTimeout(id);
1130 }, [open, t, drag]);
1131 const pan = useRef(
1132 PanResponder.create({
1133 onMoveShouldSetPanResponder: (_e, g) => g.dy > 4 && Math.abs(g.dy) > Math.abs(g.dx),
1134 onPanResponderMove: (_e, g) => {
1135 drag.value = Math.max(0, g.dy);
1136 },
1137 onPanResponderRelease: (_e, g) => {
1138 if (g.dy > 110 || g.vy > 0.8) close.current();
1139 else drag.value = withSpring(0, SLIDE);
1140 },
1141 onPanResponderTerminate: () => {
1142 drag.value = withSpring(0, SLIDE);
1143 },
1144 // On the web a mouse drag also selects text, which would otherwise end the gesture.
1145 onPanResponderTerminationRequest: () => false,
1146 })
1147 ).current;
1148 const sheet = useAnimatedStyle(() => ({ transform: [{ translateY: (1 - t.value) * 640 + drag.value }] }));
1149 const scrim = useAnimatedStyle(() => ({ opacity: t.value * (1 - Math.min(1, drag.value / 500)) }));
1150 if (!open && !shown) return null;
1151 return (
1152 <View style={[StyleSheet.absoluteFill, styles.sheetLayer, { pointerEvents: open ? 'auto' : 'none' }]}>
1153 <Animated.View style={[StyleSheet.absoluteFill, { backgroundColor: c.scrim }, scrim]}>
1154 <Pressable aria-label="Close prep notes" onPress={onClose} style={styles.fill} />
1155 </Animated.View>
1156 <Animated.View role="dialog" aria-modal aria-label="Prep notes" style={[styles.sheet, { width, backgroundColor: c.raised, paddingBottom: bottom + 12 }, sheet]}>
1157 <View {...pan.panHandlers} style={styles.sheetHead}>
1158 <View style={[styles.grabber, { backgroundColor: c.faint }]} />
1159 <View style={styles.sheetTitleRow}>
1160 <CompanyMark mark={UP_NEXT.mark} size={40} />
1161 <View style={styles.fill}>
1162 <Text style={[styles.sheetTitle, { color: c.fg }]}>Prep notes</Text>
1163 <Text numberOfLines={1} style={[styles.sheetSub, { color: c.muted }]}>
1164 {UP_NEXT.company} · {UP_NEXT.when}
1165 </Text>
1166 </View>
1167 <Tap label="Close" onPress={onClose} to={0.9}>
1168 <View style={[styles.sheetClose, { backgroundColor: c.track }]}>
1169 <X size={17} color={c.fg} strokeWidth={2.4} />
1170 </View>
1171 </Tap>
1172 </View>
1173 <ReadyBar done={done.length} total={PREP.length} c={c} />
1174 </View>
1175
1176 <Text style={[styles.overline, styles.sheetSection, { color: c.muted }]}>Your panel</Text>
1177 <View style={styles.panel}>
1178 {PANEL.map((p) => (
1179 <View key={p.id} style={[styles.person, { backgroundColor: c.track }]}>
1180 <View style={[styles.personAvatar, { backgroundColor: p.color }]}>
1181 <Text style={styles.personInitials}>{p.name.slice(0, 1) + p.name.split(' ')[1].slice(0, 1)}</Text>
1182 </View>
1183 <Text numberOfLines={1} style={[styles.personName, { color: c.fg }]}>
1184 {p.name}
1185 </Text>
1186 <Text numberOfLines={1} style={[styles.personTitle, { color: c.muted }]}>
1187 {p.title}
1188 </Text>
1189 </View>
1190 ))}
1191 </View>
1192
1193 <Text style={[styles.overline, styles.sheetSection, { color: c.muted }]}>Checklist</Text>
1194 {PREP.map((item) => (
1195 <CheckRow key={item.id} label={item.label} sub={item.sub} done={done.includes(item.id)} onPress={() => onToggle(item.id)} c={c} />
1196 ))}
1197 </Animated.View>
1198 </View>
1199 );
1200}
1201
1202// ─── Empty state ────────────────────────────────────────────────────────────
1203
1204const EMPTY: Record<FilterId, { title: string; body: string; Icon: typeof Inbox; cta?: { label: string; to: FilterId } }> = {
1205 active: { title: 'Nothing in flight', body: 'Log an application and it shows up here with its stage and next step.', Icon: Inbox },
1206 interviews: { title: 'No interviews right now', body: 'Move an application past the screen and it lands here.', Icon: Video, cta: { label: 'See active', to: 'active' } },
1207 offers: { title: 'No offers yet', body: 'Applications land here when they reach the final stage. Keep going.', Icon: Trophy, cta: { label: 'See interviews', to: 'interviews' } },
1208 closed: { title: 'Nothing closed', body: 'Rejections and roles you step back from collect here, out of the way.', Icon: Archive, cta: { label: 'See active', to: 'active' } },
1209};
1210
1211function EmptyState({ filter, onGo, c }: { filter: FilterId; onGo: (id: FilterId) => void; c: Palette }) {
1212 const copy = EMPTY[filter];
1213 const turn = useSharedValue(0);
1214 useEffect(() => {
1215 turn.value = withRepeat(withTiming(1, { duration: 16000, easing: Easing.linear }), -1);
1216 return () => cancelAnimation(turn);
1217 }, [turn]);
1218 const ring = useAnimatedStyle(() => ({ transform: [{ rotate: `${turn.value * 360}deg` }] }));
1219 return (
1220 <Animated.View entering={FadeInDown.delay(180).duration(380)} exiting={FadeOut.duration(120)} style={styles.empty}>
1221 <View style={[styles.emptyIcon, { backgroundColor: c.accentSoft }]}>
1222 <Animated.View style={[styles.emptyRing, { borderColor: c.accentEdge }, ring]} />
1223 <copy.Icon size={30} color={c.accentText} strokeWidth={2} />
1224 </View>
1225 <Text style={[styles.emptyTitle, { color: c.fg }]}>{copy.title}</Text>
1226 <Text style={[styles.emptyBody, { color: c.muted }]}>{copy.body}</Text>
1227 {copy.cta ? (
1228 <Tap label={copy.cta.label} onPress={() => onGo(copy.cta!.to)}>
1229 <View style={[styles.emptyCta, { borderColor: c.border, backgroundColor: c.surface }]}>
1230 <Text style={[styles.emptyCtaLabel, { color: c.fg }]}>{copy.cta.label}</Text>
1231 <ArrowRight size={15} color={c.fg} strokeWidth={2.4} />
1232 </View>
1233 </Tap>
1234 ) : null}
1235 </Animated.View>
1236 );
1237}
1238
1239// ─── Screen ─────────────────────────────────────────────────────────────────
1240
1241export default function ApplicationTrackerScreen() {
1242 const c = usePalette();
1243 const insets = useSafeAreaInsets();
1244 const { width, height } = useWindowDimensions();
1245 const column = Math.min(width, COLUMN);
1246 const [apps, setApps] = useState(APPLICATIONS);
1247 const [archived, setArchived] = useState<string[]>([]);
1248 const [leaving, setLeaving] = useState<string[]>([]);
1249 const [filter, setFilter] = useState<FilterId>('active');
1250 const [dir, setDir] = useState(1);
1251 const [expanded, setExpanded] = useState<string | null>(null);
1252 const [lingering, setLingering] = useState<string[]>([]);
1253 const [menu, setMenu] = useState<MenuAnchor | null>(null);
1254 const [snack, setSnack] = useState<Snack | null>(null);
1255 const [added, setAdded] = useState(false);
1256 const [prepOpen, setPrepOpen] = useState(false);
1257 const [prepDone, setPrepDone] = useState<string[]>(['camera']);
1258 const [deadline] = useState(() => Date.now() + UP_NEXT.startsIn * 1000);
1259
1260 const rootRef = useRef<ComponentRef<typeof View>>(null);
1261 const scrollRef = useRef<ComponentRef<typeof ScrollView>>(null);
1262 const timers = useRef<ReturnType<typeof setTimeout>[]>([]);
1263 const snackTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
1264 const booted = useRef(false);
1265 const restored = useRef<string | null>(null);
1266 const uid = useRef(0);
1267 const latest = useRef({ apps, filter });
1268 // Layout bookkeeping, used to bring an expanded card fully into view.
1269 const frame = useRef({ scrollY: 0, viewport: 0, columnY: 0, listY: 0, cards: {} as Record<string, { y: number; h: number }> });
1270
1271 useEffect(() => {
1272 latest.current = { apps, filter };
1273 });
1274 useEffect(() => {
1275 booted.current = true;
1276 const pending = timers.current;
1277 return () => {
1278 pending.forEach(clearTimeout);
1279 if (snackTimer.current) clearTimeout(snackTimer.current);
1280 };
1281 }, []);
1282 const later = (fn: () => void, ms: number) => timers.current.push(setTimeout(fn, ms));
1283
1284 // Counts come from the tracked list, so the summary and the tabs follow every move and archive.
1285 const tracked = apps.filter((a) => !archived.includes(a.id));
1286 const counts: Record<FilterId, number> = { active: 0, interviews: 0, offers: 0, closed: 0 };
1287 tracked.forEach((a) => FILTERS.forEach((f) => matches(a, f.id) && (counts[f.id] += 1)));
1288 const responded = tracked.filter((a) => a.stage > 0).length;
1289 const rate = tracked.length ? Math.round((responded / tracked.length) * 100) : 0;
1290 const visible = tracked.filter((a) => matches(a, filter) || lingering.includes(a.id));
1291
1292 const hideSnack = () => {
1293 if (snackTimer.current) clearTimeout(snackTimer.current);
1294 setSnack(null);
1295 };
1296 const showSnack = (s: Omit<Snack, 'key'>) => {
1297 if (snackTimer.current) clearTimeout(snackTimer.current);
1298 uid.current += 1;
1299 setSnack({ ...s, key: uid.current });
1300 snackTimer.current = setTimeout(() => setSnack(null), SNACK_MS);
1301 };
1302
1303 const switchFilter = (id: FilterId) => {
1304 const from = latest.current.filter;
1305 if (id === from) return;
1306 setDir(indexOf(id) > indexOf(from) ? 1 : -1);
1307 setFilter(id);
1308 setLingering([]);
1309 setExpanded((e) => {
1310 const app = latest.current.apps.find((a) => a.id === e);
1311 return app && matches(app, id) ? e : null;
1312 });
1313 };
1314
1315 /** Saves a changed application. If it no longer fits the filter, it stays a beat so the change is seen, then leaves. */
1316 const commit = (before: Application, after: Application) => {
1317 setApps((list) => list.map((a) => (a.id === after.id ? after : a)));
1318 if (matches(after, latest.current.filter)) return;
1319 const home = homeOf(after);
1320 setLingering((l) => [...l, after.id]);
1321 later(() => {
1322 setLingering((l) => l.filter((x) => x !== after.id));
1323 setExpanded((e) => (e === after.id ? null : e));
1324 showSnack({
1325 message: after.closed === before.closed ? `${after.company} moved to ${labelOf(home)}` : `${after.company} is active again`,
1326 action: { label: 'View', run: () => (hideSnack(), switchFilter(home)) },
1327 });
1328 }, 1150);
1329 };
1330
1331 const advance = (id: string) => {
1332 setMenu(null);
1333 const app = latest.current.apps.find((a) => a.id === id);
1334 if (!app || app.closed || app.stage >= 3) return;
1335 const stage = (app.stage + 1) as 1 | 2 | 3;
1336 const step = ADVANCE[stage];
1337 uid.current += 1;
1338 commit(app, {
1339 ...app,
1340 stage,
1341 next: step.next,
1342 since: undefined,
1343 tone: step.tone,
1344 badge: step.badge,
1345 events: [{ id: `${id}-${uid.current}`, date: 'Today', title: `Moved to ${STAGES[stage]}`, note: step.note, kind: 'stage' }, ...app.events],
1346 });
1347 };
1348
1349 const reopen = (id: string) => {
1350 setMenu(null);
1351 const app = latest.current.apps.find((a) => a.id === id);
1352 if (!app || !app.closed) return;
1353 uid.current += 1;
1354 commit(app, {
1355 ...app,
1356 closed: false,
1357 next: 'Follow up with the recruiter',
1358 since: undefined,
1359 tone: 'action',
1360 badge: 'Your move',
1361 events: [{ id: `${id}-${uid.current}`, date: 'Today', title: 'Reopened', note: 'Back on your active list.', kind: 'note' }, ...app.events],
1362 });
1363 };
1364
1365 const toggleReminder = (id: string) => {
1366 setMenu(null);
1367 const app = latest.current.apps.find((a) => a.id === id);
1368 if (!app) return;
1369 const on = !app.reminder;
1370 setApps((list) => list.map((a) => (a.id === id ? { ...a, reminder: on } : a)));
1371 showSnack({ message: on ? `Reminder set for tomorrow, 9:00` : 'Reminder removed' });
1372 };
1373
1374 const archive = (id: string) => {
1375 setMenu(null);
1376 setLeaving((l) => (l.includes(id) ? l : [...l, id]));
1377 };
1378 const finishArchive = (id: string) => {
1379 const app = latest.current.apps.find((a) => a.id === id);
1380 setLeaving((l) => l.filter((x) => x !== id));
1381 setArchived((s) => [...s, id]);
1382 setExpanded((e) => (e === id ? null : e));
1383 showSnack({
1384 message: `Archived ${app?.company ?? 'application'}`,
1385 action: {
1386 label: 'Undo',
1387 run: () => {
1388 restored.current = id;
1389 setArchived((s) => s.filter((x) => x !== id));
1390 hideSnack();
1391 },
1392 },
1393 });
1394 };
1395
1396 const toggle = (id: string) => {
1397 const opening = expanded !== id;
1398 setExpanded(opening ? id : null);
1399 if (!opening) return;
1400 // Once open, scroll just enough to show the whole card.
1401 later(() => {
1402 const f = frame.current;
1403 const card = f.cards[id];
1404 if (!card) return;
1405 const top = f.columnY + f.listY + card.y;
1406 const bottom = top + card.h;
1407 const visibleBottom = f.scrollY + f.viewport - insets.bottom - 72;
1408 if (bottom > visibleBottom) scrollRef.current?.scrollTo({ y: Math.min(top - insets.top - 8, f.scrollY + bottom - visibleBottom), animated: true });
1409 }, 460);
1410 };
1411
1412 const openMenu = (id: string, anchor: ComponentRef<typeof View> | null) => {
1413 const root = rootRef.current;
1414 if (!anchor || !root) return;
1415 root.measureInWindow((rx: number, ry: number) => {
1416 anchor.measureInWindow((x: number, y: number, w: number, h: number) => setMenu({ id, x: x - rx + w, y: y - ry, h }));
1417 });
1418 };
1419
1420 const enterCard = (id: string, i: number): Entering => {
1421 if (!booted.current) return FadeInDown.delay(300 + i * 70).duration(440);
1422 if (restored.current === id) return FadeIn.duration(320);
1423 return (dir > 0 ? FadeInRight : FadeInLeft).delay(60 + i * 45).duration(320);
1424 };
1425
1426 const menuApp = menu ? apps.find((a) => a.id === menu.id) : undefined;
1427
1428 return (
1429 <View ref={rootRef} style={[styles.screen, { backgroundColor: c.bg }]}>
1430 <ScrollView
1431 ref={scrollRef}
1432 showsVerticalScrollIndicator={false}
1433 scrollEventThrottle={32}
1434 onScroll={(e) => (frame.current.scrollY = e.nativeEvent.contentOffset.y)}
1435 onLayout={(e: LayoutChangeEvent) => (frame.current.viewport = e.nativeEvent.layout.height)}
1436 contentContainerStyle={[styles.content, { paddingTop: insets.top, paddingBottom: insets.bottom + 92 }]}
1437 >
1438 <View onLayout={(e: LayoutChangeEvent) => (frame.current.columnY = e.nativeEvent.layout.y)} style={[styles.column, { width: column }]}>
1439 {/* Header */}
1440 <Animated.View entering={FadeIn.duration(320)} style={styles.header}>
1441 <View style={styles.fill}>
1442 <View style={styles.brandRow}>
1443 <BrandMark />
1444 <Text style={[styles.brandName, { color: c.fg }]}>{APP_NAME}</Text>
1445 <Text numberOfLines={1} style={[styles.brandWeek, { color: c.muted }]}>
1446 · Week 7 of your search
1447 </Text>
1448 </View>
1449 <Text role="heading" style={[styles.title, { color: c.fg }]}>
1450 My applications
1451 </Text>
1452 </View>
1453 <Tap label="Log an application" to={0.9}>
1454 <View style={styles.addButton}>
1455 <Plus size={21} color={ON_ACCENT} strokeWidth={2.5} />
1456 </View>
1457 </Tap>
1458 </Animated.View>
1459
1460 {/* Summary */}
1461 <Animated.View entering={FadeInDown.delay(60).duration(420)} style={styles.section}>
1462 <View style={[styles.summary, { backgroundColor: c.surface, borderColor: c.border, boxShadow: c.cardShadow }]}>
1463 <Stat label="Applied" value={tracked.length} dot={c.muted} ink={c.fg} delay={250} c={c} />
1464 <View style={[styles.statRule, { backgroundColor: c.border }]} />
1465 <Stat label="Interviews" value={counts.interviews} dot={c.tones.scheduled.fg} ink={c.fg} delay={320} c={c} />
1466 <View style={[styles.statRule, { backgroundColor: c.border }]} />
1467 <Stat label="Offers" value={counts.offers} dot={c.tones.offer.fg} ink={c.fg} delay={390} c={c} />
1468 <View style={[styles.statRule, { backgroundColor: c.border }]} />
1469 <Stat label="Response" value={rate} suffix="%" dot={c.bar} ink={c.accentText} delay={460} c={c} />
1470 </View>
1471 </Animated.View>
1472
1473 {/* Up next */}
1474 <Animated.View entering={FadeInDown.delay(140).duration(460)} style={[styles.section, styles.ticketSection]}>
1475 <UpNextCard deadline={deadline} added={added} onToggleAdded={() => setAdded((v) => !v)} onPrep={() => setPrepOpen(true)} c={c} />
1476 </Animated.View>
1477
1478 {/* Filter */}
1479 <Animated.View entering={FadeInDown.delay(220).duration(440)} style={styles.section}>
1480 <FilterTabs value={filter} counts={counts} onChange={switchFilter} c={c} />
1481 </Animated.View>
1482
1483 {/* Applications */}
1484 <View onLayout={(e: LayoutChangeEvent) => (frame.current.listY = e.nativeEvent.layout.y)} style={styles.list}>
1485 {visible.map((app, i) => (
1486 <ApplicationCard
1487 key={app.id}
1488 app={app}
1489 expanded={expanded === app.id}
1490 leaving={leaving.includes(app.id)}
1491 entering={enterCard(app.id, i)}
1492 barDelay={booted.current ? 160 + i * 40 : 420 + i * 70}
1493 animateBadge={booted.current}
1494 onToggle={() => toggle(app.id)}
1495 onMenu={(anchor) => openMenu(app.id, anchor)}
1496 onAdvance={() => advance(app.id)}
1497 onReopen={() => reopen(app.id)}
1498 onCollapsed={() => finishArchive(app.id)}
1499 onMeasure={(y, h) => (frame.current.cards[app.id] = { y, h })}
1500 c={c}
1501 />
1502 ))}
1503 {visible.length === 0 && <EmptyState key={filter} filter={filter} onGo={switchFilter} c={c} />}
1504 </View>
1505 </View>
1506 </ScrollView>
1507
1508 {/* Opaque strip under the status bar, so the list never shows through it */}
1509 <View style={[styles.statusCover, { height: insets.top, backgroundColor: c.bg }]} />
1510
1511 <View style={[styles.snackLayer, { bottom: insets.bottom + 12 }]}>{snack ? <SnackBody key={snack.key} snack={snack} width={column - GUTTER * 2} c={c} /> : null}</View>
1512
1513 {menu && menuApp ? (
1514 <CardMenu
1515 anchor={menu}
1516 app={menuApp}
1517 rootH={height}
1518 onClose={() => setMenu(null)}
1519 onAdvance={() => advance(menuApp.id)}
1520 onReminder={() => toggleReminder(menuApp.id)}
1521 onArchive={() => archive(menuApp.id)}
1522 onReopen={() => reopen(menuApp.id)}
1523 c={c}
1524 />
1525 ) : null}
1526
1527 <PrepSheet
1528 open={prepOpen}
1529 done={prepDone}
1530 onToggle={(id) => setPrepDone((d) => (d.includes(id) ? d.filter((x) => x !== id) : [...d, id]))}
1531 onClose={() => setPrepOpen(false)}
1532 bottom={insets.bottom}
1533 width={column}
1534 c={c}
1535 />
1536 </View>
1537 );
1538}
1539
1540// ─── Styles ─────────────────────────────────────────────────────────────────
1541
1542const styles = StyleSheet.create({
1543 screen: { flex: 1, overflow: 'hidden' },
1544 fill: { flex: 1 },
1545 content: { alignItems: 'center' },
1546 column: { alignSelf: 'center' },
1547 section: { paddingHorizontal: GUTTER },
1548 statusCover: { position: 'absolute', top: 0, left: 0, right: 0 },
1549
1550 // Header
1551 header: { flexDirection: 'row', alignItems: 'flex-end', gap: 12, paddingHorizontal: GUTTER + 4, paddingTop: 4, paddingBottom: 14 },
1552 brandRow: { flexDirection: 'row', alignItems: 'center', gap: 6 },
1553 brandMark: { width: 20, height: 20, borderRadius: 6, backgroundColor: ACCENT, alignItems: 'center', justifyContent: 'center' },
1554 brandName: { fontSize: 13.5, fontWeight: '800', letterSpacing: -0.2 },
1555 brandWeek: { flexShrink: 1, fontSize: 13.5, fontWeight: '500' },
1556 title: { marginTop: 4, fontSize: 30, lineHeight: 34, fontWeight: '800', letterSpacing: -1 },
1557 addButton: { width: 44, height: 44, borderRadius: 22, backgroundColor: ACCENT, alignItems: 'center', justifyContent: 'center', boxShadow: `0px 8px 18px ${tint(ACCENT, 0.34)}` },
1558
1559 // Small pieces
1560 mark: { overflow: 'hidden', alignItems: 'center', justifyContent: 'center' },
1561 pulse: { width: 8, height: 8, alignItems: 'center', justifyContent: 'center' },
1562 pulseRing: { position: 'absolute', width: 8, height: 8, borderRadius: 4 },
1563 pulseCore: { width: 8, height: 8, borderRadius: 4 },
1564
1565 // Summary
1566 summary: { flexDirection: 'row', alignItems: 'center', borderRadius: 20, borderWidth: StyleSheet.hairlineWidth, paddingVertical: 12 },
1567 stat: { flex: 1, alignItems: 'center' },
1568 statValueRow: { flexDirection: 'row', alignItems: 'flex-end', height: 30 },
1569 statValue: { fontSize: 25, lineHeight: 30, fontWeight: '800', letterSpacing: -0.9, fontVariant: ['tabular-nums'] },
1570 statSuffix: { marginLeft: 1, marginBottom: 3, fontSize: 15, lineHeight: 20, fontWeight: '800', letterSpacing: -0.3 },
1571 statLabelRow: { marginTop: 3, flexDirection: 'row', alignItems: 'center', gap: 5 },
1572 statDot: { width: 6, height: 6, borderRadius: 3 },
1573 statLabel: { fontSize: 11.5, fontWeight: '600' },
1574 statRule: { width: StyleSheet.hairlineWidth, height: 32 },
1575
1576 // Up next ticket
1577 ticketSection: { marginTop: 12 },
1578 ticketWrapLight: { borderRadius: 26, boxShadow: `0px 16px 32px ${tint(shade(ACCENT, 0.6), 0.28)}` },
1579 ticketWrapDark: { borderRadius: 26 },
1580 ticket: { borderRadius: 26, padding: 16, overflow: 'hidden' },
1581 ticketEdge: { borderRadius: 26, borderWidth: 1, borderColor: 'rgba(255, 255, 255, 0.08)', pointerEvents: 'none' },
1582 ticketTop: { flexDirection: 'row', alignItems: 'center', gap: 12 },
1583 ticketCompany: { color: TICKET_INK, fontSize: 16.5, fontWeight: '700', letterSpacing: -0.3 },
1584 ticketRound: { marginTop: 2, color: TICKET_MUTED, fontSize: 13, fontWeight: '500' },
1585 liveChip: { flexDirection: 'row', alignItems: 'center', gap: 7, height: 26, paddingHorizontal: 10, borderRadius: 13, backgroundColor: TICKET_SOFT },
1586 liveText: { color: TICKET_INK, fontSize: 10.5, fontWeight: '800', letterSpacing: 1 },
1587 ticketMid: { marginTop: 14, flexDirection: 'row', alignItems: 'flex-end', justifyContent: 'space-between' },
1588 countdown: { flexDirection: 'row', alignItems: 'flex-start' },
1589 cdBlock: { alignItems: 'center' },
1590 cdDigits: { flexDirection: 'row' },
1591 digitSlot: { height: 32, overflow: 'hidden' },
1592 digit: { color: TICKET_INK, fontSize: 28, lineHeight: 32, fontWeight: '700', letterSpacing: -0.6, fontVariant: ['tabular-nums'] },
1593 digitOld: { position: 'absolute', top: 0, left: 0 },
1594 cdUnit: { marginTop: 3, color: TICKET_MUTED, fontSize: 9.5, fontWeight: '800', letterSpacing: 1.1 },
1595 cdColon: { marginHorizontal: 4, color: 'rgba(255, 255, 255, 0.3)', fontSize: 22, lineHeight: 30, fontWeight: '600' },
1596 when: { alignItems: 'flex-end', paddingBottom: 2 },
1597 whenDay: { color: TICKET_INK, fontSize: 16.5, fontWeight: '700', letterSpacing: -0.3 },
1598 whenHowRow: { marginTop: 3, flexDirection: 'row', alignItems: 'center', gap: 5 },
1599 whenHow: { color: TICKET_MUTED, fontSize: 12.5, fontWeight: '500' },
1600 perforation: { height: 1, marginVertical: 14, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' },
1601 dash: { width: 5, height: 1.5, borderRadius: 1, backgroundColor: 'rgba(255, 255, 255, 0.18)' },
1602 notch: { position: 'absolute', top: -9, width: 18, height: 18, borderRadius: 9 },
1603 notchLeft: { left: -25 },
1604 notchRight: { right: -25 },
1605 ticketActions: { flexDirection: 'row', gap: 10 },
1606 ticketButtonSlot: { flex: 1 },
1607 ticketButton: { height: 42 },
1608 calFront: { borderRadius: 21, backgroundColor: ACCENT, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 7 },
1609 calBack: { borderRadius: 21, backgroundColor: TICKET_SOFT, borderWidth: 1, borderColor: 'rgba(255, 255, 255, 0.14)', flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 8 },
1610 calTick: { width: 18, height: 18, borderRadius: 9, backgroundColor: TICKET_DONE, alignItems: 'center', justifyContent: 'center' },
1611 prepButton: { height: 42, borderRadius: 21, backgroundColor: TICKET_SOFT, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 7 },
1612 ticketButtonLabel: { fontSize: 14, fontWeight: '700', letterSpacing: -0.1 },
1613
1614 // Filter
1615 tabs: { marginTop: 14, height: 42, borderRadius: 15, padding: 4, flexDirection: 'row' },
1616 tabThumb: { position: 'absolute', top: 4, bottom: 4, left: 4, borderRadius: 11 },
1617 tabThumbLight: { boxShadow: '0px 1px 2px rgba(18, 18, 20, 0.08), 0px 3px 10px rgba(18, 18, 20, 0.07)' },
1618 tabThumbDark: { boxShadow: '0px 0px 0px 1px rgba(255, 255, 255, 0.05)' },
1619 tab: { flex: 1, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 4 },
1620 tabLabel: { fontSize: 13, fontWeight: '700', letterSpacing: -0.2 },
1621 tabCount: { fontSize: 12, fontWeight: '700', fontVariant: ['tabular-nums'] },
1622
1623 // Application cards
1624 list: { marginTop: 12 },
1625 slot: { paddingHorizontal: GUTTER, paddingBottom: 12 },
1626 slotClip: { overflow: 'hidden' },
1627 card: { borderRadius: 22, borderWidth: 1 },
1628 cardHead: { padding: 15, paddingBottom: 14 },
1629 cardTop: { flexDirection: 'row', gap: 12, paddingRight: 30 },
1630 cardTitles: { flex: 1, minWidth: 0 },
1631 role: { fontSize: 16, lineHeight: 21, fontWeight: '700', letterSpacing: -0.3 },
1632 company: { marginTop: 1, fontSize: 13.5, lineHeight: 18, fontWeight: '500' },
1633 pay: { marginTop: 2, fontSize: 12.5, lineHeight: 17, fontWeight: '500', fontVariant: ['tabular-nums'] },
1634 payStrong: { fontWeight: '700' },
1635 moreSlot: { position: 'absolute', top: 9, right: 9 },
1636 more: { width: 34, height: 34, borderRadius: 17, alignItems: 'center', justifyContent: 'center' },
1637 stages: { marginTop: 13 },
1638 stageBars: { flexDirection: 'row', gap: 4 },
1639 stageBar: { flex: 1, height: 5, borderRadius: 3, overflow: 'hidden' },
1640 stageFill: { height: '100%', borderRadius: 3 },
1641 stageLabels: { marginTop: 6, flexDirection: 'row', gap: 4 },
1642 stageLabelSlot: { flex: 1, alignItems: 'flex-start' },
1643 stageLabel: { fontSize: 11, letterSpacing: 0.1, transformOrigin: 'left' },
1644 nextRow: { marginTop: 11, flexDirection: 'row', alignItems: 'center', gap: 8 },
1645 next: { flex: 1, fontSize: 13.5, fontWeight: '600', letterSpacing: -0.1 },
1646 nextSince: { fontWeight: '500' },
1647 badge: { height: 24, paddingHorizontal: 9, borderRadius: 12, flexDirection: 'row', alignItems: 'center', gap: 5 },
1648 badgeDot: { width: 6, height: 6, borderRadius: 3 },
1649 badgeLabel: { fontSize: 12, fontWeight: '700' },
1650
1651 // Expanded timeline
1652 detailsClip: { overflow: 'hidden' },
1653 detailsInner: { position: 'absolute', top: 0, left: 0, right: 0, paddingHorizontal: 15, paddingBottom: 15 },
1654 rule: { height: StyleSheet.hairlineWidth, marginBottom: 14 },
1655 detailsHead: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', marginBottom: 12 },
1656 overline: { fontSize: 11, fontWeight: '800', letterSpacing: 1.1, textTransform: 'uppercase' },
1657 detailsMeta: { fontSize: 12, fontWeight: '500' },
1658 event: { flexDirection: 'row', gap: 10 },
1659 rail: { width: 18, alignItems: 'center' },
1660 eventDotWrap: { width: 18, height: 18, borderRadius: 9, alignItems: 'center', justifyContent: 'center' },
1661 eventDot: { width: 10, height: 10, borderRadius: 5 },
1662 railLine: { flex: 1, width: 2, borderRadius: 1, marginTop: 2, marginBottom: 2 },
1663 eventBody: { flex: 1, paddingBottom: 14 },
1664 eventHead: { flexDirection: 'row', alignItems: 'center', gap: 8, minHeight: 18 },
1665 eventTitle: { flex: 1, fontSize: 14, fontWeight: '700', letterSpacing: -0.2 },
1666 eventDate: { fontSize: 12, fontWeight: '700', fontVariant: ['tabular-nums'] },
1667 eventNote: { marginTop: 3, fontSize: 13, lineHeight: 18 },
1668 detailActions: { marginTop: 2, flexDirection: 'row', gap: 8 },
1669 ghostAction: { height: 44, paddingHorizontal: 14, borderRadius: 14, borderWidth: 1, flexDirection: 'row', alignItems: 'center', gap: 7 },
1670 ghostLabel: { fontSize: 14, fontWeight: '700' },
1671 reopen: { height: 44, borderRadius: 14, borderWidth: 1, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 7 },
1672 advance: { height: 44, borderRadius: 14, backgroundColor: ACCENT, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 6, boxShadow: `0px 6px 14px ${tint(ACCENT, 0.3)}` },
1673 advanceLabel: { color: ON_ACCENT, fontSize: 14, fontWeight: '700' },
1674 finalStage: { flex: 1, height: 44, borderRadius: 14, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 7 },
1675
1676 // Card menu
1677 menu: { position: 'absolute', width: MENU_W, borderRadius: 16, borderWidth: StyleSheet.hairlineWidth, paddingVertical: 6 },
1678 menuItem: { height: MENU_ITEM, marginHorizontal: 6, paddingHorizontal: 12, borderRadius: 10, flexDirection: 'row', alignItems: 'center', gap: 12 },
1679 menuLabel: { fontSize: 15, fontWeight: '500' },
1680
1681 // Snackbar
1682 snackLayer: { position: 'absolute', left: 0, right: 0, alignItems: 'center', pointerEvents: 'box-none' },
1683 snackShadow: { borderRadius: 16, boxShadow: '0px 12px 30px rgba(0, 0, 0, 0.28)' },
1684 snack: { minHeight: 54, borderRadius: 16, overflow: 'hidden', flexDirection: 'row', alignItems: 'center', gap: 8, paddingLeft: 16, paddingRight: 6 },
1685 snackText: { flex: 1, fontSize: 14.5, fontWeight: '600' },
1686 snackAction: { height: 42, paddingHorizontal: 12, borderRadius: 12, flexDirection: 'row', alignItems: 'center', gap: 6 },
1687 snackActionLabel: { fontSize: 14.5, fontWeight: '800' },
1688 snackTimer: { position: 'absolute', left: 0, right: 0, bottom: 0, height: 3, transformOrigin: 'left' },
1689
1690 // Prep sheet
1691 sheetLayer: { justifyContent: 'flex-end', alignItems: 'center' },
1692 sheet: { borderTopLeftRadius: 28, borderTopRightRadius: 28, paddingHorizontal: 20 },
1693 sheetHead: { paddingTop: 10, paddingBottom: 4, userSelect: 'none' },
1694 grabber: { alignSelf: 'center', width: 40, height: 5, borderRadius: 3, marginBottom: 16 },
1695 sheetTitleRow: { flexDirection: 'row', alignItems: 'center', gap: 12 },
1696 sheetTitle: { fontSize: 21, fontWeight: '800', letterSpacing: -0.5 },
1697 sheetSub: { marginTop: 2, fontSize: 13.5, fontWeight: '500' },
1698 sheetClose: { width: 34, height: 34, borderRadius: 17, alignItems: 'center', justifyContent: 'center' },
1699 ready: { marginTop: 18, flexDirection: 'row', alignItems: 'center', gap: 12 },
1700 readyTrack: { flex: 1, height: 6, borderRadius: 3, overflow: 'hidden' },
1701 readyFill: { height: '100%', borderRadius: 3, backgroundColor: ACCENT },
1702 readyText: { fontSize: 12.5, fontWeight: '700', fontVariant: ['tabular-nums'] },
1703 sheetSection: { marginTop: 20, marginBottom: 10 },
1704 panel: { flexDirection: 'row', gap: 8 },
1705 person: { flex: 1, alignItems: 'center', paddingVertical: 12, paddingHorizontal: 6, borderRadius: 16 },
1706 personAvatar: { width: 40, height: 40, borderRadius: 20, alignItems: 'center', justifyContent: 'center' },
1707 personInitials: { color: '#FFFFFF', fontSize: 14, fontWeight: '800' },
1708 personName: { marginTop: 8, fontSize: 13, fontWeight: '700' },
1709 personTitle: { marginTop: 1, fontSize: 11.5, fontWeight: '500' },
1710 check: { flexDirection: 'row', alignItems: 'center', gap: 12, paddingVertical: 9 },
1711 checkBox: { width: 24, height: 24, borderRadius: 8, borderWidth: 2, overflow: 'hidden' },
1712 checkFill: { backgroundColor: ACCENT, alignItems: 'center', justifyContent: 'center' },
1713 checkLabel: { fontSize: 15, fontWeight: '600' },
1714 checkSub: { marginTop: 2, fontSize: 12.5 },
1715
1716 // Empty state
1717 empty: { alignItems: 'center', paddingHorizontal: 40, paddingTop: 24, paddingBottom: 20 },
1718 emptyIcon: { width: 76, height: 76, borderRadius: 38, alignItems: 'center', justifyContent: 'center' },
1719 emptyRing: { position: 'absolute', top: -12, left: -12, width: 100, height: 100, borderRadius: 50, borderWidth: 1.5, borderStyle: 'dashed' },
1720 emptyTitle: { marginTop: 22, fontSize: 18, fontWeight: '800', letterSpacing: -0.3 },
1721 emptyBody: { marginTop: 6, fontSize: 14, lineHeight: 20, textAlign: 'center' },
1722 emptyCta: { marginTop: 18, height: 40, paddingHorizontal: 16, borderRadius: 20, borderWidth: 1, flexDirection: 'row', alignItems: 'center', gap: 6 },
1723 emptyCtaLabel: { fontSize: 14, fontWeight: '700' },
1724});

More screens like this.

All Careers