A shop's help center with real motion: typing in the big search live-filters an article index with matched words marked, a result count and a no-results state with suggestions and Ask us instead. The open ticket's status line fills to the current step, topic tiles spring a ring on and filter the popular list behind a clearable chip, FAQ answers open one at a time on a spring with a turning chevron, articles slide in from the right (swipe from the edge to go back, scroll kept) with a reading bar and a Was this helpful vote, and Chat shows a connecting state before a Connected to Sam toast drops in.

Details
1import { useEffect, useMemo, useRef, useState, type ComponentRef, type ReactNode, type RefObject } from 'react';2import {3 PanResponder,4 Platform,5 Pressable,6 StyleSheet,7 Text,8 TextInput,9 View,10 useColorScheme,11 useWindowDimensions,12 type GestureResponderEvent,13 type LayoutChangeEvent,14 type PanResponderGestureState,15 type StyleProp,16 type TextStyle,17 type ViewStyle,18} from 'react-native';19import Animated, {20 cancelAnimation,21 Easing,22 FadeIn,23 FadeInDown,24 FadeOut,25 interpolate,26 interpolateColor,27 LinearTransition,28 runOnJS,29 useAnimatedReaction,30 useAnimatedScrollHandler,31 useAnimatedStyle,32 useSharedValue,33 withDelay,34 withRepeat,35 withSequence,36 withSpring,37 withTiming,38 ZoomIn,39 type SharedValue,40} from 'react-native-reanimated';41import { LinearGradient } from 'expo-linear-gradient';42import { useSafeAreaInsets } from 'react-native-safe-area-context';43import Svg, { Circle, Line, Path } from 'react-native-svg';44import {45 BadgePercent,46 Check,47 ChevronDown,48 ChevronLeft,49 ChevronRight,50 Clock,51 CreditCard,52 Lightbulb,53 Mail,54 MessageCircle,55 Package,56 PhoneCall,57 RotateCcw,58 Search,59 ThumbsDown,60 ThumbsUp,61 Truck,62 UserRound,63 X,64 type LucideIcon,65} from 'lucide-react-native';6667// ─── Brand ──────────────────────────────────────────────────────────────────68// The shop's accent and name. Every accent colour below derives from these, so changing them rebrands the screen.6970const ACCENT = '#4E7F4D';71const ACCENT_DARK = '#94C491'; // the accent as text and icons on dark backgrounds72const ON_ACCENT = '#FFFFFF'; // text and icons on an accent fill73const APP_NAME = 'Tillbox';7475/** `hex` at `alpha` opacity, as rgba(). */76function tint(hex: string, alpha: number) {77 const n = parseInt(hex.slice(1), 16);78 return `rgba(${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255}, ${alpha})`;79}8081/** `hex` mixed toward black (amount > 0) or white (amount < 0); amount from -1 to 1. */82function shade(hex: string, amount: number) {83 const n = parseInt(hex.slice(1), 16);84 const target = amount < 0 ? 255 : 0;85 const p = Math.abs(amount);86 const c = (v: number) => Math.round(v + (target - v) * p).toString(16).padStart(2, '0');87 return `#${c((n >> 16) & 255)}${c((n >> 8) & 255)}${c(n & 255)}`.toUpperCase();88}8990/** `hex` with its hue turned by `deg` degrees and its HSL lightness and saturation moved by `light` / `sat` (-1 to 1).91 * For accent-related colours of a different hue (an amber-to-coral gradient from one accent). */92function spin(hex: string, deg: number, light = 0, sat = 0) {93 const n = parseInt(hex.slice(1), 16);94 const r = ((n >> 16) & 255) / 255;95 const g = ((n >> 8) & 255) / 255;96 const b = (n & 255) / 255;97 const max = Math.max(r, g, b);98 const min = Math.min(r, g, b);99 const d = max - min;100 const s = Math.min(1, Math.max(0, (d === 0 ? 0 : d / (1 - Math.abs(max + min - 1))) + sat));101 const l = Math.min(1, Math.max(0, (max + min) / 2 + light));102 const h0 = d === 0 ? 0 : max === r ? ((g - b) / d + 6) % 6 : max === g ? (b - r) / d + 2 : (r - g) / d + 4;103 const h = (((h0 * 60 + deg) % 360) + 360) % 360;104 const a = s * Math.min(l, 1 - l);105 const f = (m: number) => {106 const k = (m + h / 30) % 12;107 return Math.round(255 * (l - a * Math.max(-1, Math.min(k - 3, 9 - k, 1)))).toString(16).padStart(2, '0');108 };109 return `#${f(0)}${f(8)}${f(4)}`.toUpperCase();110}111112/** `hex` with its hue turned by `deg` and saturation moved by `sat`, at an exact HSL `lightness` (0 to 1).113 * For surfaces that must stay as dark or as pale as designed whatever the accent: dark-theme backdrops, pale washes,114 * cards on them and the ink that sits on them. */115function tone(hex: string, deg: number, lightness: number, sat = 0) {116 const n = parseInt(hex.slice(1), 16);117 const r = (n >> 16) & 255; const g = (n >> 8) & 255; const b = n & 255;118 return spin(hex, deg, lightness - (Math.max(r, g, b) + Math.min(r, g, b)) / 510, sat);119}120121// ─── Sample data ────────────────────────────────────────────────────────────122123const USER = { first: 'Maya', phone: '+1 415 555 0142' };124const AGENT = { name: 'Sam', color: '#C9814F' };125126type TopicId = 'orders' | 'delivery' | 'returns' | 'payments' | 'account' | 'promos';127type Topic = { id: TopicId; name: string; icon: LucideIcon; count: number; hue: string };128129// Topic colours are a category set, not the brand, so they stay put when the accent changes.130const TOPICS: Topic[] = [131 { id: 'orders', name: 'Orders', icon: Package, count: 18, hue: '#D4862A' },132 { id: 'delivery', name: 'Delivery', icon: Truck, count: 24, hue: '#2B8C80' },133 { id: 'returns', name: 'Returns & refunds', icon: RotateCcw, count: 15, hue: '#CC5D3D' },134 { id: 'payments', name: 'Payments', icon: CreditCard, count: 12, hue: '#3A70B4' },135 { id: 'account', name: 'Account', icon: UserRound, count: 9, hue: '#5D7085' },136 { id: 'promos', name: 'Promotions', icon: BadgePercent, count: 7, hue: '#C24675' },137];138const TOPIC: Record<TopicId, Topic> = Object.fromEntries(TOPICS.map((t) => [t.id, t])) as Record<TopicId, Topic>;139140const TICKET = {141 id: 4821,142 subject: 'Refund for order 1043',143 steps: ['Opened', 'Reviewing', 'Refunded'],144 current: 1,145 lastReply: '2 h ago',146 thread: [147 { mine: true, text: 'Two jars of pasta sauce arrived broken. Photos attached.', time: 'Yesterday, 18:42' },148 { mine: false, text: `So sorry about that, ${USER.first}. I've asked our payments team to refund $7.80 to your card.`, time: '2 h ago' },149 ],150};151152type Article = { id: string; topic: TopicId; title: string; minutes: number; updated: string; intro: string; steps: string[]; tip?: string; keywords: string };153154const ARTICLES: Article[] = [155 {156 id: 'where-order',157 topic: 'delivery',158 title: 'Where is my order?',159 minutes: 2,160 updated: '3 days ago',161 intro: "Every order has a live tracker from the moment we start picking it. You'll also get a notification when your courier is 10 minutes away.",162 steps: [163 'Open Orders from the Account tab and tap the order.',164 'Check the tracker: Picking, Packed, On the way, Delivered.',165 "Tap the map to see your courier's position and the arrival window.",166 'If the window has passed by more than 30 minutes, tap Get help on the order.',167 ],168 tip: 'Late by more than an hour? We refund the delivery fee automatically.',169 keywords: 'track tracking late courier status arrive eta',170 },171 {172 id: 'refunds-work',173 topic: 'returns',174 title: "How refunds work and when you'll see the money",175 minutes: 3,176 updated: 'last week',177 intro: 'Once we approve a refund, it goes back the way you paid. Store credit lands straight away; cards take a little longer.',178 steps: [179 'We review your request, usually within 24 hours.',180 "You get an email and a notification when it's approved.",181 'Card refunds take 3 to 5 business days to show, depending on your bank.',182 'Store credit appears in Wallet at once and never expires.',183 ],184 tip: 'Choose store credit when you ask for the refund and it arrives instantly.',185 keywords: 'refund money back credit card bank approved status',186 },187 {188 id: 'missing-item',189 topic: 'orders',190 title: 'An item is missing or damaged',191 minutes: 2,192 updated: '5 days ago',193 intro: 'Sorry about that. You can report it from the order for up to 48 hours after delivery, and most reports are sorted in minutes.',194 steps: [195 'Open the order and tap Report a problem.',196 'Choose the items that were missing or damaged.',197 'Add a photo of anything damaged, so we can raise it with the supplier.',198 'Pick a refund or a free replacement on your next order.',199 ],200 keywords: 'missing damaged broken wrong item report problem',201 },202 {203 id: 'change-address',204 topic: 'delivery',205 title: 'Change your delivery address or time slot',206 minutes: 2,207 updated: '2 weeks ago',208 intro: 'You can change where and when we deliver until we start picking your order, usually 2 hours before your slot.',209 steps: ['Open the order and tap Delivery details.', 'Choose a saved address or add a new one.', 'Pick a new slot. Busy slots show a small fee.', 'Tap Save. Your courier gets the update straight away.'],210 keywords: 'address slot time reschedule change window move',211 },212 {213 id: 'promo-code',214 topic: 'promos',215 title: 'Apply a promo code at checkout',216 minutes: 1,217 updated: 'yesterday',218 intro: 'Promo codes go in on the payment step. One code per order, and the discount shows before you pay.',219 steps: ['Go to checkout and scroll to Promo code.', 'Type the code exactly as it appears, for example SPRING15.', 'Tap Apply. The new total updates at once.'],220 tip: 'Codes are case sensitive, and some need a basket of $30 or more.',221 keywords: 'promo code discount coupon voucher apply checkout',222 },223 {224 id: 'cancel-order',225 topic: 'orders',226 title: 'Cancel an order before it ships',227 minutes: 1,228 updated: '1 month ago',229 intro: 'Orders can be cancelled free of charge until picking starts. After that, you can return the items instead.',230 steps: ['Open the order from Orders.', 'Tap Cancel order at the bottom.', 'Choose a reason and confirm. Your refund starts straight away.'],231 keywords: 'cancel order stop ships refund',232 },233 {234 id: 'edit-order',235 topic: 'orders',236 title: "Edit an order after you've placed it",237 minutes: 2,238 updated: '3 weeks ago',239 intro: "Forgot the milk? Add or remove items until picking starts, and we'll adjust the charge.",240 steps: ['Open the order and tap Edit items.', 'Add, remove or change quantities.', 'Tap Update order. We only charge the difference.'],241 keywords: 'edit add remove change items order quantity',242 },243 {244 id: 'instructions',245 topic: 'delivery',246 title: 'Leave delivery instructions for your courier',247 minutes: 1,248 updated: '2 months ago',249 intro: 'Gate codes, a safe place or a quiet knock: tell your courier before they set off.',250 steps: ['Open Account, then Addresses.', 'Tap the address and add notes for the courier.', "Turn on Leave at door if you won't be home."],251 keywords: 'instructions courier notes gate code safe place leave door not home',252 },253 {254 id: 'start-return',255 topic: 'returns',256 title: 'Start a return in the app',257 minutes: 2,258 updated: '4 days ago',259 intro: "Unopened items can be returned within 30 days. We'll collect them with your next delivery, or you can drop them off.",260 steps: ['Open the order and tap Return items.', 'Choose the items and a reason.', 'Pick a collection with your next delivery or a drop-off point.', 'Your refund starts once the items are scanned in.'],261 keywords: 'return send back exchange refund collection drop off',262 },263 {264 id: 'no-box',265 topic: 'returns',266 title: 'Return an item without the original box',267 minutes: 1,268 updated: '2 months ago',269 intro: 'No box, no problem. Any sturdy bag or packaging works, as long as the item itself is unopened.',270 steps: ['Start the return as usual.', 'Pack the item in any secure packaging.', 'Write your return code on the outside.'],271 keywords: 'return box packaging original',272 },273 {274 id: 'card-declined',275 topic: 'payments',276 title: 'Why was my card declined?',277 minutes: 2,278 updated: '6 days ago',279 intro: "Most declines come from the bank, not from us. Here's how to sort it quickly.",280 steps: [281 'Check the card number, expiry and billing ZIP code in Wallet.',282 "Make sure there's enough balance for the total plus a small hold.",283 'Ask your bank whether online payments are switched on.',284 'Try another card, or pay with store credit.',285 ],286 keywords: 'card declined payment failed bank error',287 },288 {289 id: 'payment-methods',290 topic: 'payments',291 title: 'Add or remove a payment method',292 minutes: 1,293 updated: '1 month ago',294 intro: 'Keep as many cards as you like and choose a default for faster checkout.',295 steps: ['Open Account, then Wallet.', 'Tap Add card, or swipe a card to remove it.', 'Tap a card and choose Make default.'],296 keywords: 'card payment method wallet add remove default',297 },298 {299 id: 'gift-card',300 topic: 'payments',301 title: 'Split a payment with a gift card',302 minutes: 1,303 updated: '3 weeks ago',304 intro: 'Gift card balance is used first, and your card pays the rest.',305 steps: ['Add the gift card in Wallet.', 'At checkout, switch on Use gift card balance.', "We'll charge the remaining total to your default card."],306 keywords: 'gift card split payment balance',307 },308 {309 id: 'reset-password',310 topic: 'account',311 title: 'Reset your password',312 minutes: 1,313 updated: '2 weeks ago',314 intro: 'Locked out? A reset link takes less than a minute.',315 steps: ['On the sign-in screen, tap Forgot password.', 'Enter the email on your account.', 'Open the link we send and choose a new password.'],316 keywords: 'password reset forgot sign in login locked',317 },318 {319 id: 'delete-account',320 topic: 'account',321 title: 'Delete your account and data',322 minutes: 2,323 updated: '1 month ago',324 intro: 'You can close your account at any time. We delete your personal data within 30 days, apart from what we must keep for tax.',325 steps: ['Open Account, then Privacy.', 'Tap Delete account and confirm with your password.', 'Any store credit is refunded to your last card.'],326 keywords: 'delete account close data privacy remove',327 },328 {329 id: 'promo-failed',330 topic: 'promos',331 title: "Why didn't my promo code work?",332 minutes: 2,333 updated: '5 days ago',334 intro: 'Codes can stop working for a few simple reasons.',335 steps: [336 'Check the expiry date in the email or post where you found it.',337 'Make sure your basket meets the minimum spend.',338 'Some codes are for first orders or certain items only.',339 'Only one code can be used per order.',340 ],341 keywords: 'promo code not working invalid expired discount coupon',342 },343 {344 id: 'refer-friend',345 topic: 'promos',346 title: 'Refer a friend and earn credit',347 minutes: 1,348 updated: '2 weeks ago',349 intro: 'Give $15 and get $15 when a friend places their first order over $40.',350 steps: ['Open Account, then Refer a friend.', 'Share your link.', 'Credit lands in Wallet after their first delivery.'],351 keywords: 'refer friend credit invite share earn',352 },353];354const ARTICLE: Record<string, Article> = Object.fromEntries(ARTICLES.map((a) => [a.id, a]));355const POPULAR = ['where-order', 'refunds-work', 'missing-item', 'change-address', 'promo-code'];356357const QUICK_SEARCHES = ['Refund status', 'Missing item', 'Change address', 'Promo code'];358const NO_RESULT_IDEAS = ['Refund', 'Late delivery', 'Promo code', 'Password'];359const NOT_HELPFUL = ["Steps didn't work", 'Not what I needed', 'Hard to follow', 'Out of date'];360361const FAQS = [362 { q: 'When will I get my refund?', a: 'Once approved, card refunds take 3 to 5 business days to show. Store credit lands in your Wallet straight away.' },363 { q: 'Can I change my order after placing it?', a: 'Yes, until we start picking it, usually 2 hours before your slot. Open the order and tap Edit items or Delivery details.' },364 { q: 'What happens if I miss my delivery?', a: "Your courier waits 10 minutes and calls once. If they can't reach you, chilled items come back to us and we refund them in full." },365 { q: 'Is there a delivery fee?', a: 'Delivery is free on orders over $35. Below that it costs $3.99, and you always see the fee before you pay.' },366 { q: 'Can I message my courier directly?', a: 'Once your order is on the way, tap Message courier on the tracker. Your number stays private.' },367];368369const CALL_SLOTS = [370 { id: 'soon', label: 'In 15 min', free: true },371 { id: '1130', label: '11:30', free: true },372 { id: '1300', label: '13:00', free: false },373 { id: '1630', label: '16:30', free: true },374];375376// ─── Palette ────────────────────────────────────────────────────────────────377378// Status colours mean the same thing whatever the brand: live is online, amber is in progress.379const LIVE = '#22C55E';380const AMBER = '#E39A22';381const COLUMN = 520; // widest the content gets on tablets and the web382const BAR_H = 48;383const GAP = 10;384const PRESS = { damping: 16, stiffness: 320, mass: 0.6 };385const POP = { damping: 13, stiffness: 240, mass: 0.6 };386const OPEN = { damping: 15, stiffness: 170, mass: 0.8 };387const CLOSE = { damping: 22, stiffness: 240, mass: 0.8 };388const SETTLE = { damping: 20, stiffness: 220, mass: 0.8 };389const NO_OUTLINE = Platform.OS === 'web' ? ({ outlineStyle: 'none' } as object) : null;390391function usePalette() {392 const dark = useColorScheme() === 'dark';393 return {394 dark,395 bg: dark ? tone(ACCENT, 0, 0.05, -0.1) : '#F5F4EF',396 surface: dark ? tone(ACCENT, 0, 0.095, -0.12) : '#FFFFFF',397 sunken: dark ? tone(ACCENT, 0, 0.14, -0.12) : '#EFEEE8',398 pressed: dark ? tone(ACCENT, 0, 0.125, -0.12) : '#F3F2ED',399 fg: dark ? '#EDF1EB' : '#17201A',400 muted: dark ? '#8F998F' : '#667067',401 faint: dark ? '#556056' : '#A6ACA6',402 line: dark ? tone(ACCENT, 0, 0.14, -0.12) : '#ECEAE3',403 track: dark ? tone(ACCENT, 0, 0.2, -0.12) : '#E3E1D9',404 // The pale wash behind the greeting, fading into the page.405 washTop: dark ? tone(ACCENT, 0, 0.15, -0.04) : tone(ACCENT, 0, 0.87),406 washMid: dark ? tone(ACCENT, 0, 0.08, -0.08) : tone(ACCENT, 0, 0.93, -0.05),407 accent: dark ? ACCENT_DARK : ACCENT,408 accentText: dark ? ACCENT_DARK : shade(ACCENT, 0.1),409 accentSoft: dark ? tint(ACCENT_DARK, 0.14) : tint(ACCENT, 0.1),410 accentRing: dark ? tint(ACCENT_DARK, 0.55) : tint(ACCENT, 0.45),411 // The tint behind matched words in search results.412 hit: dark ? tint(ACCENT_DARK, 0.26) : tint(ACCENT, 0.17),413 liveText: dark ? '#4ADE80' : '#15803D',414 amberText: dark ? '#F2BA5C' : '#9A5F08',415 amberSoft: dark ? 'rgba(227, 154, 34, 0.16)' : 'rgba(227, 154, 34, 0.14)',416 searchBorder: dark ? 'rgba(255, 255, 255, 0.08)' : 'rgba(23, 32, 26, 0.05)',417 lens: dark ? 'rgba(255, 255, 255, 0.10)' : 'rgba(255, 255, 255, 0.7)',418 toastBg: dark ? '#EEF2EC' : '#18211B',419 toastFg: dark ? '#17201A' : '#FFFFFF',420 toastMuted: dark ? '#5D675F' : '#A9B2AA',421 cardShadow: dark ? '0px 0px 0px 1px rgba(255, 255, 255, 0.05)' : '0px 1px 2px rgba(23, 32, 26, 0.04), 0px 6px 18px rgba(23, 32, 26, 0.05)',422 searchShadow: dark ? '0px 10px 30px rgba(0, 0, 0, 0.35)' : '0px 2px 4px rgba(23, 32, 26, 0.04), 0px 14px 30px rgba(46, 72, 46, 0.12)',423 bubbleShadow: dark ? '0px 6px 16px rgba(0, 0, 0, 0.4)' : '0px 6px 16px rgba(46, 72, 46, 0.14)',424 toastShadow: dark ? '0px 12px 30px rgba(0, 0, 0, 0.5)' : '0px 12px 30px rgba(10, 20, 12, 0.25)',425 layerShadow: dark ? '-1px 0px 0px rgba(255, 255, 255, 0.06)' : '-12px 0px 32px rgba(0, 0, 0, 0.10)',426 dim: dark ? 0.55 : 0.2,427 // Topic tiles: how strong the category tint is, and how far its icon ink moves toward black or white.428 topicFill: dark ? 0.2 : 0.12,429 topicInk: dark ? -0.32 : 0.06,430 };431}432type Palette = ReturnType<typeof usePalette>;433434// ─── Searching ──────────────────────────────────────────────────────────────435436const wordsOf = (query: string) => query.trim().toLowerCase().split(/\s+/).filter(Boolean);437const SEARCH_TEXT = new Map(ARTICLES.map((a) => [a.id, `${a.title} ${TOPIC[a.topic].name} ${a.keywords} ${a.intro} ${a.steps.join(' ')} ${a.tip ?? ''}`.toLowerCase()]));438439/** Every word must appear somewhere in the article. Matches in the title rank first. */440function searchArticles(words: string[]) {441 if (!words.length) return [];442 return ARTICLES.map((a, i) => ({ a, i, title: words.filter((w) => a.title.toLowerCase().includes(w)).length }))443 .filter(({ a }) => words.every((w) => (SEARCH_TEXT.get(a.id) ?? '').includes(w)))444 .sort((x, y) => y.title - x.title || x.i - y.i)445 .map((x) => x.a);446}447448/** The first sentence of the article that contains a searched word, for the result's preview line. */449function snippetOf(a: Article, words: string[]) {450 const sentences = [a.intro, ...a.steps, a.tip ?? ''].flatMap((s) => s.match(/[^.?!]+[.?!]*/g) ?? []).map((s) => s.trim());451 return sentences.find((s) => words.some((w) => s.toLowerCase().includes(w))) ?? a.intro;452}453454/** Splits text around the searched words so the matching parts can be marked. */455function segments(text: string, words: string[]) {456 if (!words.length) return [{ text, hit: false }];457 const pattern = new RegExp(`(${words.map((w) => w.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|')})`, 'ig');458 return text459 .split(pattern)460 .filter(Boolean)461 .map((part) => ({ text: part, hit: words.includes(part.toLowerCase()) }));462}463464const relatedTo = (a: Article) => ARTICLES.filter((b) => b.topic === a.topic && b.id !== a.id).slice(0, 2);465466// ─── Small pieces ───────────────────────────────────────────────────────────467468type TapProps = {469 children: ReactNode;470 label: string;471 onPress?: () => void;472 style?: StyleProp<ViewStyle>;473 outer?: StyleProp<ViewStyle>;474 to?: number;475 disabled?: boolean;476 selected?: boolean;477 expanded?: boolean;478};479480/** A pressable that dips on press, so every tap answers even when it has nowhere to go. */481function Tap({ children, label, onPress, style, outer, to = 0.96, disabled, selected, expanded }: TapProps) {482 const s = useSharedValue(1);483 const scale = useAnimatedStyle(() => ({ transform: [{ scale: s.value }] }));484 return (485 <Pressable486 role="button"487 aria-label={label}488 aria-selected={selected}489 aria-expanded={expanded}490 aria-disabled={disabled}491 disabled={disabled}492 onPress={onPress}493 onPressIn={() => (s.value = withSpring(to, PRESS))}494 onPressOut={() => (s.value = withSpring(1, PRESS))}495 style={outer}496 >497 <Animated.View style={[style, scale]}>{children}</Animated.View>498 </Pressable>499 );500}501502/** Springs between closed (0) and open (1): drives an accordion's height and its chevron together. */503function useOpenValue(open: boolean) {504 const t = useSharedValue(open ? 1 : 0);505 useEffect(() => {506 t.value = withSpring(open ? 1 : 0, open ? OPEN : CLOSE);507 }, [open, t]);508 return t;509}510511/** Content that grows from nothing to its measured height on a spring, overshooting a little as it lands. */512function Reveal({ t, open, children }: { t: SharedValue<number>; open: boolean; children: ReactNode }) {513 const h = useSharedValue(0);514 const style = useAnimatedStyle(() => ({515 height: h.value * Math.max(0, t.value),516 opacity: interpolate(t.value, [0, 0.45, 1], [0, 0.7, 1], 'clamp'),517 }));518 return (519 <Animated.View aria-hidden={!open} style={[styles.reveal, style]}>520 <View521 style={styles.revealInner}522 onLayout={(e: LayoutChangeEvent) => {523 h.value = e.nativeEvent.layout.height;524 }}525 >526 {children}527 </View>528 </Animated.View>529 );530}531532function Spinner({ color, size = 18 }: { color: string; size?: number }) {533 const r = useSharedValue(0);534 useEffect(() => {535 r.value = withRepeat(withTiming(360, { duration: 750, easing: Easing.linear }), -1);536 return () => cancelAnimation(r);537 }, [r]);538 const style = useAnimatedStyle(() => ({ transform: [{ rotate: `${r.value}deg` }] }));539 return <Animated.View style={[styles.spinner, { width: size, height: size, borderRadius: size / 2, borderColor: tint(color, 0.22), borderTopColor: color }, style]} />;540}541542/** A status dot with a ring that keeps pulsing outward. */543function LiveDot({ color, size = 8 }: { color: string; size?: number }) {544 const t = useSharedValue(0);545 useEffect(() => {546 t.value = withRepeat(withTiming(1, { duration: 1700, easing: Easing.out(Easing.quad) }), -1);547 return () => cancelAnimation(t);548 }, [t]);549 const ring = useAnimatedStyle(() => ({ opacity: 0.55 * (1 - t.value), transform: [{ scale: 1 + t.value * 1.7 }] }));550 const round = { width: size, height: size, borderRadius: size / 2, backgroundColor: color };551 return (552 <View style={{ width: size, height: size }}>553 <Animated.View style={[styles.abs, round, ring]} />554 <View style={[styles.abs, round]} />555 </View>556 );557}558559function Avatar({ initial, color, size }: { initial: string; color: string; size: number }) {560 return (561 <View style={[styles.avatar, { width: size, height: size, borderRadius: size / 2, backgroundColor: color }]}>562 <Text style={[styles.avatarText, { fontSize: size * 0.44 }]}>{initial}</Text>563 </View>564 );565}566567/** A topic's icon on a tile of its own colour, with a soft disc in the corner. */568function TopicIcon({ topic, size, pal }: { topic: Topic; size: number; pal: Palette }) {569 const Icon = topic.icon;570 return (571 <View style={[styles.topicIcon, { width: size, height: size, borderRadius: size * 0.32 }]}>572 <LinearGradient colors={[tint(topic.hue, pal.topicFill + 0.1), tint(topic.hue, pal.topicFill)]} start={{ x: 0, y: 0 }} end={{ x: 1, y: 1 }} style={styles.abs} />573 <View style={[styles.topicGlint, { width: size * 0.7, height: size * 0.7, borderRadius: size * 0.35, top: -size * 0.24, right: -size * 0.24, backgroundColor: tint(topic.hue, pal.topicFill) }]} />574 <Icon size={size * 0.5} color={shade(topic.hue, pal.topicInk)} strokeWidth={2.1} />575 </View>576 );577}578579/** Text with the searched words marked in the accent. */580function Highlight({ text, words, color, numberOfLines, style, pal }: { text: string; words: string[]; color: string; numberOfLines?: number; style: StyleProp<TextStyle>; pal: Palette }) {581 return (582 <Text numberOfLines={numberOfLines} style={[style, { color }]}>583 {segments(text, words).map((p, i) =>584 p.hit ? (585 <Text key={i} style={[styles.hit, { backgroundColor: pal.hit, color: pal.accentText }]}>586 {p.text}587 </Text>588 ) : (589 <Text key={i}>{p.text}</Text>590 )591 )}592 </Text>593 );594}595596function SectionHead({ title, children, pal }: { title: string; children?: ReactNode; pal: Palette }) {597 return (598 <View style={styles.sectionHead}>599 <Text role="heading" style={[styles.sectionTitle, { color: pal.fg }]}>600 {title}601 </Text>602 {children}603 </View>604 );605}606607// ─── Hero: a typing reply bubbles up beside the greeting ────────────────────608609function TypingDots({ color }: { color: string }) {610 const t = useSharedValue(0);611 useEffect(() => {612 t.value = withRepeat(withTiming(1, { duration: 1200, easing: Easing.linear }), -1);613 return () => cancelAnimation(t);614 }, [t]);615 return (616 <View style={styles.typing}>617 {[0, 1, 2].map((i) => (618 <TypingDot key={i} t={t} phase={i * 0.16} color={color} />619 ))}620 </View>621 );622}623624function TypingDot({ t, phase, color }: { t: SharedValue<number>; phase: number; color: string }) {625 const style = useAnimatedStyle(() => {626 const p = (t.value + 1 - phase) % 1;627 const k = p < 0.5 ? Math.sin(p * 2 * Math.PI) : 0;628 return { opacity: 0.5 + 0.5 * k, transform: [{ translateY: -3 * k }] };629 });630 return <Animated.View style={[styles.typingDot, { backgroundColor: color }, style]} />;631}632633function HeroArt({ pal }: { pal: Palette }) {634 const bob = useSharedValue(0);635 useEffect(() => {636 bob.value = withRepeat(withSequence(withTiming(1, { duration: 1900, easing: Easing.inOut(Easing.sin) }), withTiming(0, { duration: 1900, easing: Easing.inOut(Easing.sin) })), -1);637 return () => cancelAnimation(bob);638 }, [bob]);639 const mine = useAnimatedStyle(() => ({ transform: [{ translateY: bob.value * -4 }, { rotate: '6deg' }] }));640 const theirs = useAnimatedStyle(() => ({ transform: [{ translateY: bob.value * 3 }] }));641 return (642 <Animated.View entering={FadeIn.delay(260).duration(500)} style={styles.heroArt} aria-hidden>643 <View style={[styles.heroDisc, { backgroundColor: pal.accentSoft }]} />644 <Animated.View style={[styles.bubbleMine, { backgroundColor: pal.surface, boxShadow: pal.bubbleShadow }, mine]}>645 <Text style={[styles.bubbleMark, { color: pal.accentText }]}>?</Text>646 </Animated.View>647 <Animated.View style={[styles.bubbleTheirs, theirs]}>648 <TypingDots color={ON_ACCENT} />649 </Animated.View>650 </Animated.View>651 );652}653654// ─── Search field ───────────────────────────────────────────────────────────655656type SearchProps = {657 value: string;658 focused: boolean;659 inputRef: RefObject<ComponentRef<typeof TextInput> | null>;660 onChange: (v: string) => void;661 onFocus: () => void;662 onBlur: () => void;663 pal: Palette;664};665666function SearchField({ value, focused, inputRef, onChange, onFocus, onBlur, pal }: SearchProps) {667 const ring = useSharedValue(0);668 useEffect(() => {669 ring.value = withTiming(focused ? 1 : 0, { duration: 200 });670 }, [focused, ring]);671 const idle = pal.searchBorder;672 const on = pal.accentRing;673 const box = useAnimatedStyle(() => ({ borderColor: interpolateColor(ring.value, [0, 1], [idle, on]) }));674 return (675 <Animated.View style={[styles.search, { backgroundColor: pal.surface, boxShadow: pal.searchShadow }, box]}>676 <Search size={20} color={focused ? pal.accent : pal.muted} strokeWidth={2.2} />677 <TextInput678 ref={inputRef}679 value={value}680 onChangeText={onChange}681 onFocus={onFocus}682 onBlur={onBlur}683 placeholder="Search help articles"684 placeholderTextColor={pal.muted}685 selectionColor={pal.accent}686 aria-label="Search help articles"687 autoCapitalize="none"688 autoCorrect={false}689 returnKeyType="search"690 style={[styles.searchInput, { color: pal.fg }, NO_OUTLINE]}691 />692 {value ? (693 <Animated.View entering={ZoomIn.duration(160)}>694 <Pressable695 role="button"696 aria-label="Clear search"697 hitSlop={8}698 onPress={() => {699 onChange('');700 inputRef.current?.focus();701 }}702 style={[styles.searchClear, { backgroundColor: pal.faint }]}703 >704 <X size={13} color={pal.surface} strokeWidth={3} />705 </Pressable>706 </Animated.View>707 ) : null}708 </Animated.View>709 );710}711712/** Popular searches under the field while it is focused and empty. */713function SuggestRow({ open, onPick, pal }: { open: boolean; onPick: (q: string) => void; pal: Palette }) {714 const t = useOpenValue(open);715 return (716 <Reveal t={t} open={open}>717 <View style={styles.suggest}>718 <Text style={[styles.suggestLabel, { color: pal.muted }]}>Popular searches</Text>719 <View style={styles.suggestRow}>720 {QUICK_SEARCHES.map((q) => (721 <Tap key={q} label={`Search for ${q}`} onPress={() => onPick(q)} style={[styles.chip, { backgroundColor: pal.surface, borderColor: pal.line }]}>722 <Search size={12} color={pal.muted} strokeWidth={2.4} />723 <Text style={[styles.chipText, { color: pal.fg }]}>{q}</Text>724 </Tap>725 ))}726 </View>727 </View>728 </Reveal>729 );730}731732// ─── Ticket: the status line fills to the current step ──────────────────────733734function StepLine({ delay, pal }: { delay: number; pal: Palette }) {735 const fill = useSharedValue(0);736 const first = useSharedValue(0);737 const halo = useSharedValue(0);738 const target = TICKET.current / (TICKET.steps.length - 1);739 useEffect(() => {740 first.value = withDelay(delay, withTiming(1, { duration: 360, easing: Easing.out(Easing.back(2.2)) }));741 fill.value = withDelay(delay + 180, withTiming(target, { duration: 700, easing: Easing.inOut(Easing.cubic) }));742 halo.value = withDelay(delay + 900, withRepeat(withTiming(1, { duration: 1600, easing: Easing.out(Easing.quad) }), -1));743 return () => cancelAnimation(halo);744 }, [delay, target, fill, first, halo]);745 const bar = useAnimatedStyle(() => ({ width: `${fill.value * 100}%` }));746 const done = useAnimatedStyle(() => ({ transform: [{ scale: first.value }] }));747 const now = useAnimatedStyle(() => {748 const k = interpolate(fill.value, [target * 0.8, target], [0, 1], 'clamp');749 return { opacity: k, transform: [{ scale: 0.4 + 0.6 * k }] };750 });751 const ring = useAnimatedStyle(() => ({ opacity: 0.5 * (1 - halo.value), transform: [{ scale: 1 + halo.value * 0.9 }] }));752 return (753 <View role="progressbar" aria-label={`Step ${TICKET.current + 1} of ${TICKET.steps.length}: ${TICKET.steps[TICKET.current]}`}>754 <View style={styles.steps}>755 <View style={[styles.stepsTrack, { backgroundColor: pal.track }]}>756 <Animated.View style={[styles.stepsFill, { backgroundColor: pal.accent }, bar]} />757 </View>758 <View style={styles.stepsDots}>759 <Animated.View style={[styles.stepDone, { backgroundColor: pal.accent }, done]}>760 <Check size={11} color={pal.surface} strokeWidth={3.6} />761 </Animated.View>762 <Animated.View style={[styles.stepNow, now]}>763 <Animated.View style={[styles.abs, styles.stepHalo, { backgroundColor: pal.accent }, ring]} />764 <View style={[styles.abs, styles.stepHalo, { backgroundColor: pal.surface, borderColor: pal.accent }, styles.stepRing]} />765 <View style={[styles.stepCore, { backgroundColor: pal.accent }]} />766 </Animated.View>767 <View style={[styles.stepTodo, { backgroundColor: pal.surface, borderColor: pal.track }]} />768 </View>769 </View>770 <View style={styles.stepLabels}>771 {TICKET.steps.map((s, i) => (772 <Text773 key={s}774 style={[775 styles.stepLabel,776 i === 0 ? styles.alignLeft : i === TICKET.steps.length - 1 ? styles.alignRight : styles.alignCenter,777 { color: i === TICKET.current ? pal.fg : i < TICKET.current ? pal.muted : pal.faint },778 i === TICKET.current && styles.stepLabelNow,779 ]}780 >781 {s}782 </Text>783 ))}784 </View>785 </View>786 );787}788789function TicketCard({ open, onToggle, delay, pal }: { open: boolean; onToggle: () => void; delay: number; pal: Palette }) {790 const t = useOpenValue(open);791 const chevron = useAnimatedStyle(() => ({ transform: [{ rotate: `${t.value * 180}deg` }] }));792 return (793 <Animated.View entering={FadeInDown.delay(delay).duration(420)} style={[styles.card, styles.ticket, { backgroundColor: pal.surface, boxShadow: pal.cardShadow }]}>794 <View style={styles.ticketHead}>795 <View style={[styles.ticketIcon, { backgroundColor: pal.accentSoft }]}>796 <RotateCcw size={18} color={pal.accent} strokeWidth={2.3} />797 </View>798 <View style={styles.flex}>799 <View style={styles.ticketTop}>800 <Text style={[styles.ticketEyebrow, { color: pal.muted }]}>Ticket #{TICKET.id}</Text>801 <View style={[styles.statusPill, { backgroundColor: pal.amberSoft }]}>802 <LiveDot color={AMBER} size={6} />803 <Text style={[styles.statusText, { color: pal.amberText }]}>In progress</Text>804 </View>805 </View>806 <Text numberOfLines={1} style={[styles.ticketTitle, { color: pal.fg }]}>807 {TICKET.subject}808 </Text>809 </View>810 </View>811812 <StepLine delay={delay + 260} pal={pal} />813814 <Reveal t={t} open={open}>815 <View style={styles.thread}>816 {TICKET.thread.map((m) => (817 <View key={m.time} style={[styles.msgRow, m.mine && styles.msgRowMine]}>818 {!m.mine && <Avatar initial={AGENT.name[0]} color={AGENT.color} size={24} />}819 <View style={[styles.msg, m.mine ? [styles.msgMine, { backgroundColor: pal.accentSoft }] : [styles.msgTheirs, { backgroundColor: pal.sunken }]]}>820 <Text style={[styles.msgText, { color: pal.fg }]}>{m.text}</Text>821 <Text style={[styles.msgTime, { color: pal.muted }]}>{m.mine ? `You · ${m.time}` : `${AGENT.name} · ${m.time}`}</Text>822 </View>823 </View>824 ))}825 </View>826 </Reveal>827828 <View style={[styles.ticketFoot, { borderTopColor: pal.line }]}>829 <View style={styles.ticketAgent}>830 <Avatar initial={AGENT.name[0]} color={AGENT.color} size={22} />831 <Text style={[styles.ticketReply, { color: pal.muted }]}>832 Last reply <Text style={{ color: pal.fg }}>{TICKET.lastReply}</Text>833 </Text>834 </View>835 <Tap label={open ? 'Hide conversation' : 'View conversation'} expanded={open} onPress={onToggle} style={styles.ticketView}>836 <Text style={[styles.ticketViewText, { color: pal.accentText }]}>{open ? 'Hide conversation' : 'View conversation'}</Text>837 <Animated.View style={chevron}>838 <ChevronDown size={16} color={pal.accentText} strokeWidth={2.5} />839 </Animated.View>840 </Tap>841 </View>842 </Animated.View>843 );844}845846// ─── Topics: tap one to filter the popular list ─────────────────────────────847848function TopicTile({ topic, width, selected, dimmed, delay, onPress, pal }: { topic: Topic; width: number; selected: boolean; dimmed: boolean; delay: number; onPress: () => void; pal: Palette }) {849 const press = useSharedValue(1);850 const on = useSharedValue(selected ? 1 : 0);851 const fade = useSharedValue(dimmed ? 1 : 0);852 useEffect(() => {853 on.value = withSpring(selected ? 1 : 0, POP);854 }, [selected, on]);855 useEffect(() => {856 fade.value = withTiming(dimmed ? 1 : 0, { duration: 220 });857 }, [dimmed, fade]);858 const body = useAnimatedStyle(() => ({ opacity: 1 - fade.value * 0.45, transform: [{ scale: press.value }] }));859 const ring = useAnimatedStyle(() => ({ opacity: Math.min(1, on.value), transform: [{ scale: 1.06 - 0.06 * on.value }] }));860 const badge = useAnimatedStyle(() => ({ opacity: Math.min(1, Math.max(0, on.value)), transform: [{ scale: 0.6 + 0.4 * on.value }] }));861 const count = useAnimatedStyle(() => ({ opacity: 1 - Math.min(1, Math.max(0, on.value)) }));862 return (863 <Animated.View entering={FadeInDown.delay(delay).duration(380)} style={{ width }}>864 <Pressable865 role="button"866 aria-selected={selected}867 aria-label={`${topic.name}, ${topic.count} articles`}868 onPress={onPress}869 onPressIn={() => (press.value = withSpring(0.95, PRESS))}870 onPressOut={() => (press.value = withSpring(1, PRESS))}871 >872 <Animated.View style={[styles.tile, { backgroundColor: pal.surface, boxShadow: pal.cardShadow }, body]}>873 <Animated.View style={[styles.abs, styles.tileRing, { borderColor: pal.accent }, ring]} />874 <View style={styles.tileTop}>875 <TopicIcon topic={topic} size={38} pal={pal} />876 <View>877 <Animated.View style={[styles.tileCount, { backgroundColor: pal.sunken }, count]}>878 <Text style={[styles.tileCountText, { color: pal.muted }]}>{topic.count}</Text>879 </Animated.View>880 <Animated.View style={[styles.abs, styles.tileCount, styles.tileCheck, badge]}>881 <Check size={11} color={ON_ACCENT} strokeWidth={3.6} />882 </Animated.View>883 </View>884 </View>885 <Text numberOfLines={2} style={[styles.tileName, { color: pal.fg }]}>886 {topic.name}887 </Text>888 </Animated.View>889 </Pressable>890 </Animated.View>891 );892}893894// ─── Article rows (popular list and search results) ─────────────────────────895896function ArticleRow({ article, first, onPress, pal }: { article: Article; first: boolean; onPress: () => void; pal: Palette }) {897 const topic = TOPIC[article.topic];898 return (899 <Pressable900 role="link"901 aria-label={`${article.title}, ${article.minutes} minute read`}902 onPress={onPress}903 style={({ pressed }) => [styles.row, !first && styles.rowLine, { borderTopColor: pal.line }, pressed && { backgroundColor: pal.pressed }]}904 >905 <TopicIcon topic={topic} size={34} pal={pal} />906 <View style={styles.flex}>907 <Text numberOfLines={2} style={[styles.rowTitle, { color: pal.fg }]}>908 {article.title}909 </Text>910 <Text style={[styles.rowMeta, { color: pal.muted }]}>911 {topic.name} · {article.minutes} min read912 </Text>913 </View>914 <ChevronRight size={18} color={pal.faint} strokeWidth={2.2} />915 </Pressable>916 );917}918919function ResultRow({ article, words, first, onPress, pal }: { article: Article; words: string[]; first: boolean; onPress: () => void; pal: Palette }) {920 const topic = TOPIC[article.topic];921 return (922 <Pressable923 role="link"924 aria-label={`${article.title}, ${topic.name}`}925 onPress={onPress}926 style={({ pressed }) => [styles.row, styles.resultRow, !first && styles.rowLine, { borderTopColor: pal.line }, pressed && { backgroundColor: pal.pressed }]}927 >928 <TopicIcon topic={topic} size={34} pal={pal} />929 <View style={styles.flex}>930 <Highlight text={article.title} words={words} color={pal.fg} style={styles.rowTitle} pal={pal} />931 <Highlight text={snippetOf(article, words)} words={words} color={pal.muted} numberOfLines={2} style={styles.resultSnippet} pal={pal} />932 <Text style={[styles.rowMeta, { color: pal.faint }]}>933 {topic.name} · {article.minutes} min read934 </Text>935 </View>936 <ChevronRight size={18} color={pal.faint} strokeWidth={2.2} />937 </Pressable>938 );939}940941// ─── Search results and the empty state ─────────────────────────────────────942943function NoResultsArt({ pal }: { pal: Palette }) {944 const sway = useSharedValue(0);945 useEffect(() => {946 sway.value = withRepeat(withSequence(withTiming(1, { duration: 1300, easing: Easing.inOut(Easing.sin) }), withTiming(-1, { duration: 1300, easing: Easing.inOut(Easing.sin) })), -1);947 return () => cancelAnimation(sway);948 }, [sway]);949 const glass = useAnimatedStyle(() => ({ transform: [{ translateX: sway.value * 6 }, { translateY: Math.abs(sway.value) * -3 }, { rotate: `${sway.value * 8}deg` }] }));950 return (951 <View style={styles.noArt} aria-hidden>952 <View style={[styles.noDisc, { backgroundColor: pal.accentSoft }]} />953 <View style={styles.noBox}>954 <Svg width={64} height={60} viewBox="0 0 64 60">955 <Path d="M8 20 L32 10 L56 20 L32 30 Z" fill="#EBCB9C" />956 <Path d="M8 20 V44 L32 54 V30 Z" fill="#C8975E" />957 <Path d="M56 20 V44 L32 54 V30 Z" fill="#DBAE74" />958 <Path d="M20 15 L44 25 V49" stroke="#F6E6C8" strokeWidth={4} strokeLinejoin="round" fill="none" />959 </Svg>960 </View>961 <Animated.View style={[styles.noGlass, glass]}>962 <Svg width={56} height={56} viewBox="0 0 56 56">963 <Circle cx={22} cy={22} r={14} fill={pal.lens} stroke={pal.fg} strokeWidth={4} />964 <Line x1={32.5} y1={32.5} x2={45} y2={45} stroke={ACCENT} strokeWidth={7} strokeLinecap="round" />965 </Svg>966 </Animated.View>967 </View>968 );969}970971type ResultsProps = { query: string; words: string[]; results: Article[]; chat: ChatState; onOpen: (a: Article) => void; onSuggest: (q: string) => void; onAsk: () => void; pal: Palette };972973function Results({ query, words, results, chat, onOpen, onSuggest, onAsk, pal }: ResultsProps) {974 if (!results.length) {975 return (976 <Animated.View entering={FadeIn.duration(260)} style={styles.noResults}>977 <NoResultsArt pal={pal} />978 <Text role="heading" style={[styles.noTitle, { color: pal.fg }]}>979 No results for “{query.trim()}”980 </Text>981 <Text style={[styles.noBody, { color: pal.muted }]}>Check the spelling, or try one of these:</Text>982 <View style={styles.noIdeas}>983 {NO_RESULT_IDEAS.map((idea) => (984 <Tap key={idea} label={`Search for ${idea}`} onPress={() => onSuggest(idea)} style={[styles.chip, { backgroundColor: pal.surface, borderColor: pal.line }]}>985 <Search size={13} color={pal.muted} strokeWidth={2.4} />986 <Text style={[styles.chipText, { color: pal.fg }]}>{idea}</Text>987 </Tap>988 ))}989 </View>990 <ChatButton chat={chat} onPress={onAsk} idleLabel="Ask us instead" />991 </Animated.View>992 );993 }994 return (995 <View>996 <View style={styles.resultsHead} role="status" aria-live="polite">997 <Animated.Text key={results.length} entering={FadeInDown.duration(200)} style={[styles.resultsCount, { color: pal.fg }]}>998 {results.length} {results.length === 1 ? 'article' : 'articles'}999 </Animated.Text>1000 <Text numberOfLines={1} style={[styles.resultsFor, { color: pal.muted }]}>1001 for “{query.trim()}”1002 </Text>1003 </View>1004 <Animated.View layout={LinearTransition.duration(220)} style={[styles.card, { backgroundColor: pal.surface, boxShadow: pal.cardShadow }]}>1005 {results.map((a, i) => (1006 <Animated.View key={a.id} layout={LinearTransition.duration(220)} entering={FadeIn.duration(220)} exiting={FadeOut.duration(120)}>1007 <ResultRow article={a} words={words} first={i === 0} onPress={() => onOpen(a)} pal={pal} />1008 </Animated.View>1009 ))}1010 </Animated.View>1011 <Tap label="Ask us instead" onPress={onAsk} outer={styles.askLinkWrap} style={styles.askLink}>1012 <Text style={[styles.askLinkText, { color: pal.muted }]}>1013 Can't find it? <Text style={{ color: pal.accentText }}>Ask us instead</Text>1014 </Text>1015 </Tap>1016 </View>1017 );1018}10191020// ─── Chat button: connecting, then connected ────────────────────────────────10211022type ChatState = 'idle' | 'connecting' | 'connected';10231024function ChatButton({ chat, onPress, idleLabel }: { chat: ChatState; onPress: () => void; idleLabel: string }) {1025 const label = chat === 'connecting' ? 'Connecting' : chat === 'connected' ? `Chat with ${AGENT.name}` : idleLabel;1026 return (1027 <Tap label={label} onPress={onPress} disabled={chat === 'connecting'} style={[styles.chatButton, { backgroundColor: ACCENT, boxShadow: `0px 8px 20px ${tint(ACCENT, 0.3)}` }]}>1028 {chat === 'connecting' ? <Spinner color={ON_ACCENT} size={16} /> : <MessageCircle size={18} color={ON_ACCENT} strokeWidth={2.3} />}1029 <Animated.Text key={chat} entering={FadeIn.duration(180)} style={styles.chatButtonText}>1030 {label}1031 </Animated.Text>1032 </Tap>1033 );1034}10351036// ─── FAQ: one open at a time, spring height and a turning chevron ───────────10371038function FaqItem({ item, open, first, onPress, pal }: { item: (typeof FAQS)[number]; open: boolean; first: boolean; onPress: () => void; pal: Palette }) {1039 const t = useOpenValue(open);1040 const chevron = useAnimatedStyle(() => ({ transform: [{ rotate: `${t.value * 180}deg` }] }));1041 const from = pal.sunken;1042 const to = pal.accentSoft;1043 const bubble = useAnimatedStyle(() => ({ backgroundColor: interpolateColor(Math.min(1, Math.max(0, t.value)), [0, 1], [from, to]) }));1044 return (1045 <View style={[!first && styles.rowLine, { borderTopColor: pal.line }]}>1046 <Pressable role="button" aria-expanded={open} aria-label={item.q} onPress={onPress} style={({ pressed }) => [styles.faqHead, pressed && { backgroundColor: pal.pressed }]}>1047 <Text style={[styles.faqQ, { color: pal.fg }]}>{item.q}</Text>1048 <Animated.View style={[styles.faqChevron, bubble]}>1049 <Animated.View style={chevron}>1050 <ChevronDown size={16} color={open ? pal.accentText : pal.muted} strokeWidth={2.5} />1051 </Animated.View>1052 </Animated.View>1053 </Pressable>1054 <Reveal t={t} open={open}>1055 <Text style={[styles.faqA, { color: pal.muted }]}>{item.a}</Text>1056 </Reveal>1057 </View>1058 );1059}10601061// ─── Contact options ────────────────────────────────────────────────────────10621063type ContactProps = {1064 chat: ChatState;1065 callOpen: boolean;1066 callAt: string | null;1067 onChat: () => void;1068 onEmail: () => void;1069 onToggleCall: () => void;1070 onBook: (slot: (typeof CALL_SLOTS)[number]) => void;1071 pal: Palette;1072};10731074function ContactCard({ chat, callOpen, callAt, onChat, onEmail, onToggleCall, onBook, pal }: ContactProps) {1075 const t = useOpenValue(callOpen);1076 const chevron = useAnimatedStyle(() => ({ transform: [{ rotate: `${t.value * 180}deg` }] }));1077 const rowStyle = ({ pressed }: { pressed: boolean }) => [styles.contactRow, pressed && { backgroundColor: pal.pressed }];1078 return (1079 <View style={[styles.card, { backgroundColor: pal.surface, boxShadow: pal.cardShadow }]}>1080 {/* Chat */}1081 <Pressable role="button" aria-label={chat === 'connected' ? `Open chat with ${AGENT.name}` : 'Chat with us'} aria-busy={chat === 'connecting'} onPress={onChat} style={rowStyle}>1082 <View style={[styles.contactIcon, { backgroundColor: ACCENT }]}>1083 <MessageCircle size={19} color={ON_ACCENT} strokeWidth={2.3} />1084 </View>1085 <View style={styles.flex}>1086 <Text style={[styles.contactTitle, { color: pal.fg }]}>Chat with us</Text>1087 <Animated.Text key={chat} entering={FadeIn.duration(200)} style={[styles.contactSub, { color: pal.muted }]}>1088 {chat === 'connecting' ? 'Finding the next free agent' : chat === 'connected' ? `Connected to ${AGENT.name}` : 'Typical reply 2 min'}1089 </Animated.Text>1090 </View>1091 {chat === 'idle' ? (1092 <View style={styles.contactState}>1093 <LiveDot color={LIVE} />1094 <Text style={[styles.contactStateText, { color: pal.liveText }]}>Online</Text>1095 </View>1096 ) : chat === 'connecting' ? (1097 <Animated.View entering={FadeIn.duration(160)} style={styles.contactState}>1098 <Spinner color={pal.accent} size={16} />1099 <Text style={[styles.contactStateText, { color: pal.accentText }]}>Connecting</Text>1100 </Animated.View>1101 ) : (1102 <Animated.View entering={ZoomIn.duration(220)} style={[styles.openPill, { backgroundColor: ACCENT }]}>1103 <Text style={styles.openPillText}>Open</Text>1104 </Animated.View>1105 )}1106 </Pressable>11071108 {/* Email */}1109 <Pressable role="button" aria-label="Email us, we reply within 24 hours" onPress={onEmail} style={({ pressed }) => [styles.contactRow, styles.rowLine, { borderTopColor: pal.line }, pressed && { backgroundColor: pal.pressed }]}>1110 <View style={[styles.contactIcon, { backgroundColor: pal.accentSoft }]}>1111 <Mail size={19} color={pal.accent} strokeWidth={2.2} />1112 </View>1113 <View style={styles.flex}>1114 <Text style={[styles.contactTitle, { color: pal.fg }]}>Email us</Text>1115 <Text style={[styles.contactSub, { color: pal.muted }]}>Within 24 h</Text>1116 </View>1117 <Text style={[styles.contactStateText, { color: pal.muted }]}>Any time</Text>1118 </Pressable>11191120 {/* Call back, with today's slots */}1121 <View style={[styles.rowLine, { borderTopColor: pal.line }]}>1122 <Pressable role="button" aria-expanded={callOpen} aria-label="Request a call back" onPress={onToggleCall} style={rowStyle}>1123 <View style={[styles.contactIcon, { backgroundColor: pal.accentSoft }]}>1124 <PhoneCall size={18} color={pal.accent} strokeWidth={2.2} />1125 </View>1126 <View style={styles.flex}>1127 <Text style={[styles.contactTitle, { color: pal.fg }]}>Request a call back</Text>1128 <Text style={[styles.contactSub, { color: pal.muted }]}>Mon to Fri, 9 to 6</Text>1129 </View>1130 {callAt ? (1131 <Animated.View key={callAt} entering={ZoomIn.duration(220)} style={[styles.bookedPill, { backgroundColor: pal.accentSoft }]}>1132 <Check size={12} color={pal.accentText} strokeWidth={3.2} />1133 <Text style={[styles.bookedText, { color: pal.accentText }]}>{callAt}</Text>1134 </Animated.View>1135 ) : (1136 <Text style={[styles.contactStateText, { color: pal.liveText }]}>3 slots today</Text>1137 )}1138 <Animated.View style={chevron}>1139 <ChevronDown size={16} color={pal.faint} strokeWidth={2.4} />1140 </Animated.View>1141 </Pressable>1142 <Reveal t={t} open={callOpen}>1143 <View style={styles.slots}>1144 <Text style={[styles.slotsLabel, { color: pal.muted }]}>Today · we'll call {USER.phone}</Text>1145 <View style={styles.slotRow}>1146 {CALL_SLOTS.map((s) => {1147 const picked = callAt === s.label;1148 return (1149 <Tap1150 key={s.id}1151 label={s.free ? `Call me ${s.label === 'In 15 min' ? 'in 15 minutes' : `at ${s.label}`}` : `${s.label}, fully booked`}1152 selected={picked}1153 disabled={!s.free}1154 onPress={() => onBook(s)}1155 style={[1156 styles.slot,1157 { backgroundColor: picked ? ACCENT : pal.surface, borderColor: picked ? ACCENT : pal.line },1158 !s.free && { backgroundColor: pal.sunken, borderColor: pal.sunken },1159 ]}1160 >1161 <Text style={[styles.slotText, { color: picked ? ON_ACCENT : s.free ? pal.fg : pal.faint }, !s.free && styles.slotFull]}>{s.label}</Text>1162 {!s.free && <Text style={[styles.slotNote, { color: pal.faint }]}>Full</Text>}1163 </Tap>1164 );1165 })}1166 </View>1167 </View>1168 </Reveal>1169 </View>1170 </View>1171 );1172}11731174// ─── Article view: slides in from the right, swipe from the edge to go back ─11751176function Helpful({ pal }: { pal: Palette }) {1177 const [state, setState] = useState<'ask' | 'no' | 'thanks'>('ask');1178 const [reason, setReason] = useState<string | null>(null);1179 const t = useOpenValue(state === 'no');1180 const tick = useSharedValue(0);1181 const timer = useRef<ReturnType<typeof setTimeout> | null>(null);1182 useEffect(() => () => {1183 if (timer.current) clearTimeout(timer.current);1184 }, []);1185 useEffect(() => {1186 if (state === 'thanks') tick.value = withSequence(withTiming(1.18, { duration: 220, easing: Easing.out(Easing.back(2.4)) }), withTiming(1, { duration: 160 }));1187 }, [state, tick]);1188 const tickStyle = useAnimatedStyle(() => ({ transform: [{ scale: tick.value }] }));1189 const pick = (r: string) => {1190 setReason(r);1191 timer.current = setTimeout(() => setState('thanks'), 380);1192 };1193 if (state === 'thanks') {1194 return (1195 <Animated.View entering={FadeIn.duration(260)} role="status" style={[styles.card, styles.helpful, styles.thanks, { backgroundColor: pal.surface, boxShadow: pal.cardShadow }]}>1196 <Animated.View style={[styles.thanksTick, { backgroundColor: ACCENT }, tickStyle]}>1197 <Check size={18} color={ON_ACCENT} strokeWidth={3.2} />1198 </Animated.View>1199 <View style={styles.flex}>1200 <Text style={[styles.helpfulTitle, { color: pal.fg }]}>Thanks for the feedback</Text>1201 <Text style={[styles.helpfulSub, { color: pal.muted }]}>{reason ? "We'll use it to improve this article." : 'Glad it helped.'}</Text>1202 </View>1203 </Animated.View>1204 );1205 }1206 return (1207 <View style={[styles.card, styles.helpful, { backgroundColor: pal.surface, boxShadow: pal.cardShadow }]}>1208 <View style={styles.helpfulHead}>1209 <Text style={[styles.helpfulTitle, { color: pal.fg }]}>Was this helpful?</Text>1210 <View style={styles.votes}>1211 <Tap label="Yes, this was helpful" onPress={() => setState('thanks')} style={[styles.vote, { backgroundColor: pal.sunken }]}>1212 <ThumbsUp size={16} color={pal.fg} strokeWidth={2.2} />1213 <Text style={[styles.voteText, { color: pal.fg }]}>Yes</Text>1214 </Tap>1215 <Tap1216 label="No, this was not helpful"1217 selected={state === 'no'}1218 onPress={() => setState(state === 'no' ? 'ask' : 'no')}1219 style={[styles.vote, { backgroundColor: state === 'no' ? pal.accentSoft : pal.sunken }]}1220 >1221 <ThumbsDown size={16} color={state === 'no' ? pal.accentText : pal.fg} strokeWidth={2.2} />1222 <Text style={[styles.voteText, { color: state === 'no' ? pal.accentText : pal.fg }]}>No</Text>1223 </Tap>1224 </View>1225 </View>1226 <Reveal t={t} open={state === 'no'}>1227 <View style={styles.reasons}>1228 <Text style={[styles.helpfulSub, { color: pal.muted }]}>What went wrong?</Text>1229 <View style={styles.reasonRow}>1230 {NOT_HELPFUL.map((r) => {1231 const on = reason === r;1232 return (1233 <Tap key={r} label={r} selected={on} onPress={() => pick(r)} style={[styles.chip, { backgroundColor: on ? ACCENT : pal.surface, borderColor: on ? ACCENT : pal.line }]}>1234 <Text style={[styles.chipText, { color: on ? ON_ACCENT : pal.fg }]}>{r}</Text>1235 </Tap>1236 );1237 })}1238 </View>1239 </View>1240 </Reveal>1241 </View>1242 );1243}12441245type ArticleViewProps = {1246 article: Article;1247 slide: SharedValue<number>;1248 width: number;1249 top: number;1250 bottom: number;1251 chat: ChatState;1252 onBack: () => void;1253 onOpen: (a: Article) => void;1254 onChat: () => void;1255 pal: Palette;1256};12571258function ArticleView({ article, slide, width, top, bottom, chat, onBack, onOpen, onChat, pal }: ArticleViewProps) {1259 const topic = TOPIC[article.topic];1260 const progress = useSharedValue(0);1261 const offset = useSharedValue(0);1262 const onScroll = useAnimatedScrollHandler((e) => {1263 const room = e.contentSize.height - e.layoutMeasurement.height;1264 offset.value = e.contentOffset.y;1265 progress.value = room > 0 ? Math.min(1, Math.max(0, e.contentOffset.y / room)) : 0;1266 });1267 useEffect(() => {1268 progress.value = 0;1269 offset.value = 0;1270 }, [article.id, progress, offset]);1271 const topicLabel = useAnimatedStyle(() => {1272 const k = interpolate(offset.value, [60, 110], [0, 1], 'clamp');1273 return { opacity: 1 - k, transform: [{ translateY: -6 * k }] };1274 });1275 const titleLabel = useAnimatedStyle(() => {1276 const k = interpolate(offset.value, [70, 120], [0, 1], 'clamp');1277 return { opacity: k, transform: [{ translateY: 6 * (1 - k) }] };1278 });1279 const bar = useAnimatedStyle(() => ({ width: `${progress.value * 100}%`, opacity: progress.value > 0.004 ? 1 : 0 }));1280 const layer = useAnimatedStyle(() => ({ transform: [{ translateX: (1 - slide.value) * width }] }));12811282 // Swipe back from the left edge: the page follows the finger and goes back past a third of the width.1283 const live = useRef({ width, onBack });1284 live.current = { width, onBack };1285 const pan = useRef(1286 PanResponder.create({1287 onMoveShouldSetPanResponderCapture: (_e: GestureResponderEvent, g: PanResponderGestureState) => g.x0 < 32 && g.dx > 8 && Math.abs(g.dx) > Math.abs(g.dy) * 1.4,1288 onPanResponderMove: (_e: GestureResponderEvent, g: PanResponderGestureState) => {1289 slide.value = Math.min(1, Math.max(0, 1 - g.dx / live.current.width));1290 },1291 onPanResponderRelease: (_e: GestureResponderEvent, g: PanResponderGestureState) => {1292 if (g.dx > live.current.width * 0.33 || g.vx > 0.6) live.current.onBack();1293 else slide.value = withSpring(1, SETTLE);1294 },1295 onPanResponderTerminate: () => {1296 slide.value = withSpring(1, SETTLE);1297 },1298 })1299 ).current;13001301 return (1302 <Animated.View style={[styles.layer, { backgroundColor: pal.bg, boxShadow: pal.layerShadow }, layer]} {...pan.panHandlers}>1303 {/* Opaque bar with the reading progress along its bottom edge */}1304 <View style={[styles.articleBar, { paddingTop: top, backgroundColor: pal.bg, borderBottomColor: pal.line }]}>1305 <View style={styles.barRow}>1306 <Tap label="Back to help center" onPress={onBack} style={[styles.round, { backgroundColor: pal.surface, boxShadow: pal.cardShadow }]}>1307 <ChevronLeft size={21} color={pal.fg} strokeWidth={2.3} />1308 </Tap>1309 <View style={styles.barTitles}>1310 <Animated.Text numberOfLines={1} style={[styles.barTitle, styles.barTitleSwap, { color: pal.fg }, topicLabel]}>1311 {topic.name}1312 </Animated.Text>1313 <Animated.Text numberOfLines={1} aria-hidden style={[styles.barTitle, styles.barTitleSwap, { color: pal.fg }, titleLabel]}>1314 {article.title}1315 </Animated.Text>1316 </View>1317 <View style={styles.roundSpacer} />1318 </View>1319 <Animated.View style={[styles.readBar, { backgroundColor: pal.accent }, bar]} />1320 </View>13211322 <Animated.ScrollView key={article.id} onScroll={onScroll} scrollEventThrottle={16} showsVerticalScrollIndicator={false} contentContainerStyle={{ paddingBottom: bottom + 32 }}>1323 <View style={styles.column}>1324 <Animated.View entering={FadeInDown.delay(80).duration(380)} style={styles.articleHead}>1325 <View style={styles.articleTopic}>1326 <TopicIcon topic={topic} size={26} pal={pal} />1327 <Text style={[styles.articleTopicText, { color: pal.muted }]}>{topic.name}</Text>1328 </View>1329 <Text role="heading" style={[styles.articleTitle, { color: pal.fg }]}>1330 {article.title}1331 </Text>1332 <View style={styles.articleMeta}>1333 <Clock size={14} color={pal.muted} strokeWidth={2.3} />1334 <Text style={[styles.articleMetaText, { color: pal.muted }]}>1335 {article.minutes} min read · Updated {article.updated}1336 </Text>1337 </View>1338 </Animated.View>13391340 <Animated.Text entering={FadeInDown.delay(140).duration(380)} style={[styles.articleIntro, { color: pal.fg }]}>1341 {article.intro}1342 </Animated.Text>13431344 <Animated.Text entering={FadeInDown.delay(180).duration(380)} role="heading" style={[styles.articleH2, { color: pal.fg }]}>1345 How to do it1346 </Animated.Text>1347 <View role="list">1348 {article.steps.map((s, i) => (1349 <Animated.View key={s} role="listitem" entering={FadeInDown.delay(220 + i * 60).duration(360)} style={styles.step}>1350 <View style={styles.stepRail}>1351 <View style={[styles.stepNum, { backgroundColor: pal.accentSoft }]}>1352 <Text style={[styles.stepNumText, { color: pal.accentText }]}>{i + 1}</Text>1353 </View>1354 {i < article.steps.length - 1 && <View style={[styles.stepLink, { backgroundColor: pal.line }]} />}1355 </View>1356 <Text style={[styles.stepText, { color: pal.fg }]}>{s}</Text>1357 </Animated.View>1358 ))}1359 </View>13601361 {article.tip && (1362 <Animated.View entering={FadeInDown.delay(300 + article.steps.length * 60).duration(360)} style={[styles.tip, { backgroundColor: pal.accentSoft }]}>1363 <Lightbulb size={18} color={pal.accentText} strokeWidth={2.2} />1364 <Text style={[styles.tipText, { color: pal.fg }]}>{article.tip}</Text>1365 </Animated.View>1366 )}13671368 <Animated.View entering={FadeIn.delay(420).duration(360)}>1369 <Helpful key={article.id} pal={pal} />1370 </Animated.View>13711372 <View style={[styles.section, styles.gutter]}>1373 <SectionHead title="Related articles" pal={pal} />1374 <View style={[styles.card, { backgroundColor: pal.surface, boxShadow: pal.cardShadow }]}>1375 {relatedTo(article).map((r, i) => (1376 <ArticleRow key={r.id} article={r} first={i === 0} onPress={() => onOpen(r)} pal={pal} />1377 ))}1378 </View>1379 </View>13801381 <View style={[styles.card, styles.stuck, { backgroundColor: pal.surface, boxShadow: pal.cardShadow }]}>1382 <Text style={[styles.stuckTitle, { color: pal.fg }]}>Still stuck?</Text>1383 <Text style={[styles.stuckBody, { color: pal.muted }]}>Our team usually replies in about 2 minutes.</Text>1384 <ChatButton chat={chat} onPress={onChat} idleLabel="Chat with us" />1385 </View>1386 </View>1387 </Animated.ScrollView>1388 </Animated.View>1389 );1390}13911392// ─── Toast ──────────────────────────────────────────────────────────────────13931394type ToastData = { id: number; kind: 'agent' | 'call' | 'mail'; title: string; sub: string };13951396function Toast({ data, top, pal, onHide }: { data: ToastData; top: number; pal: Palette; onHide: (id: number) => void }) {1397 const t = useSharedValue(0);1398 const hide = useRef(onHide);1399 hide.current = onHide;1400 const leave = () => {1401 t.value = withTiming(0, { duration: 220, easing: Easing.in(Easing.cubic) });1402 setTimeout(() => hide.current(data.id), 240);1403 };1404 useEffect(() => {1405 t.value = withSpring(1, { damping: 15, stiffness: 210, mass: 0.7 });1406 const id = setTimeout(leave, 3200);1407 return () => clearTimeout(id);1408 // eslint-disable-next-line react-hooks/exhaustive-deps1409 }, []);1410 const style = useAnimatedStyle(() => ({1411 opacity: Math.min(1, t.value * 1.6),1412 transform: [{ translateY: (1 - t.value) * -72 }, { scale: 0.94 + 0.06 * t.value }],1413 }));1414 return (1415 <View style={[styles.toastWrap, { top }]}>1416 <Animated.View role="status" aria-live="polite" style={[styles.toast, { backgroundColor: pal.toastBg, boxShadow: pal.toastShadow }, style]}>1417 <Pressable aria-label={`${data.title}. Dismiss`} onPress={leave} style={styles.toastInner}>1418 {data.kind === 'agent' ? (1419 <View>1420 <Avatar initial={AGENT.name[0]} color={AGENT.color} size={34} />1421 <View style={[styles.toastLive, { borderColor: pal.toastBg }]} />1422 </View>1423 ) : (1424 <View style={[styles.toastIcon, { backgroundColor: ACCENT }]}>1425 {data.kind === 'call' ? <PhoneCall size={16} color={ON_ACCENT} strokeWidth={2.4} /> : <Mail size={16} color={ON_ACCENT} strokeWidth={2.4} />}1426 </View>1427 )}1428 <View style={styles.flex}>1429 <Text style={[styles.toastTitle, { color: pal.toastFg }]}>{data.title}</Text>1430 <Text numberOfLines={1} style={[styles.toastSub, { color: pal.toastMuted }]}>1431 {data.sub}1432 </Text>1433 </View>1434 </Pressable>1435 </Animated.View>1436 </View>1437 );1438}14391440// ─── Screen ─────────────────────────────────────────────────────────────────14411442export default function HelpCenterScreen() {1443 const pal = usePalette();1444 const insets = useSafeAreaInsets();1445 const { width } = useWindowDimensions();1446 const column = Math.min(width, COLUMN);1447 const tileW = (column - 32 - GAP * 2) / 3;1448 const scrollRef = useRef<Animated.ScrollView>(null);1449 const inputRef = useRef<ComponentRef<typeof TextInput>>(null);14501451 const [query, setQuery] = useState('');1452 const [focused, setFocused] = useState(false);1453 const [suggest, setSuggest] = useState(false);1454 const [topic, setTopic] = useState<TopicId | null>(null);1455 const [faq, setFaq] = useState<number | null>(null);1456 const [thread, setThread] = useState(false);1457 const [chat, setChat] = useState<ChatState>('idle');1458 const [callOpen, setCallOpen] = useState(false);1459 const [callAt, setCallAt] = useState<string | null>(null);1460 const [article, setArticle] = useState<Article | null>(null);1461 const [toast, setToast] = useState<ToastData | null>(null);1462 const [compact, setCompact] = useState(false);14631464 const words = useMemo(() => wordsOf(query), [query]);1465 const results = useMemo(() => searchArticles(words), [words]);1466 const searching = words.length > 0;1467 const popular = topic ? ARTICLES.filter((a) => a.topic === topic) : POPULAR.map((id) => ARTICLE[id]);14681469 // Timers, cleared when the screen goes away.1470 const timers = useRef<ReturnType<typeof setTimeout>[]>([]);1471 const later = (fn: () => void, ms: number) => {1472 timers.current.push(setTimeout(fn, ms));1473 };1474 useEffect(() => () => timers.current.forEach(clearTimeout), []);14751476 // The first load staggers everything in; coming back from a search only takes a quick fade.1477 const booted = useRef(false);1478 useEffect(() => {1479 const id = setTimeout(() => (booted.current = true), 1400);1480 return () => clearTimeout(id);1481 }, []);1482 const d = (ms: number) => (booted.current ? Math.min(ms, 240) * 0.35 : ms);14831484 // Scroll: the bar turns opaque and offers search once the field has scrolled away.1485 const scrollY = useSharedValue(0);1486 const heroBottom = useSharedValue(400);1487 const homeY = useRef(0);1488 const topicsY = useRef(0);1489 const barBottom = insets.top + BAR_H;1490 const onScroll = useAnimatedScrollHandler((e) => {1491 scrollY.value = e.contentOffset.y;1492 });1493 useAnimatedReaction(1494 () => scrollY.value > heroBottom.value - barBottom,1495 (now, before) => {1496 if (now !== before) runOnJS(setCompact)(now);1497 }1498 );1499 const barBack = useAnimatedStyle(() => ({ opacity: interpolate(scrollY.value, [6, 56], [0, 1], 'clamp') }));15001501 // Toasts1502 const toastId = useRef(0);1503 const showToast = (t: Omit<ToastData, 'id'>) => {1504 toastId.current += 1;1505 setToast({ ...t, id: toastId.current });1506 };15071508 // Article layer1509 const slide = useSharedValue(0);1510 const closing = useRef<ReturnType<typeof setTimeout> | null>(null);1511 const openArticle = (a: Article) => {1512 if (closing.current) clearTimeout(closing.current);1513 inputRef.current?.blur();1514 setArticle(a);1515 slide.value = withTiming(1, { duration: 380, easing: Easing.out(Easing.cubic) });1516 };1517 const closeArticle = () => {1518 slide.value = withTiming(0, { duration: 300, easing: Easing.out(Easing.cubic) });1519 if (closing.current) clearTimeout(closing.current);1520 closing.current = setTimeout(() => setArticle(null), 320);1521 };1522 const mainShift = useAnimatedStyle(() => ({ transform: [{ translateX: -slide.value * width * 0.24 }] }));1523 const dimMax = pal.dim;1524 const dimStyle = useAnimatedStyle(() => ({ opacity: slide.value * dimMax }));15251526 // Search1527 const onFocus = () => {1528 setFocused(true);1529 setSuggest(true);1530 };1531 const onBlur = () => {1532 setFocused(false);1533 // Waits a beat, so a tap on a suggestion lands before the row folds away.1534 later(() => setSuggest(false), 200);1535 };1536 const searchFor = (q: string) => {1537 setQuery(q);1538 inputRef.current?.focus();1539 };1540 const jumpToSearch = () => {1541 scrollRef.current?.scrollTo({ y: 0, animated: true });1542 later(() => inputRef.current?.focus(), 320);1543 };15441545 // Topics filter the popular list, and the page scrolls so the grid and list share the screen.1546 const pickTopic = (id: TopicId) => {1547 const next = topic === id ? null : id;1548 setTopic(next);1549 if (!next) return;1550 const target = homeY.current + topicsY.current - barBottom - 4;1551 if (scrollY.value < target - 4) scrollRef.current?.scrollTo({ y: target, animated: true });1552 };15531554 // Contact1555 const startChat = () => {1556 if (chat === 'connecting') return;1557 if (chat === 'connected') {1558 showToast({ kind: 'agent', title: `${AGENT.name} is in your chat`, sub: 'Pick up where you left off' });1559 return;1560 }1561 setChat('connecting');1562 later(() => {1563 setChat('connected');1564 showToast({ kind: 'agent', title: `Connected to ${AGENT.name}`, sub: `${APP_NAME} support · usually replies in 2 min` });1565 }, 1700);1566 };1567 const bookCall = (slot: (typeof CALL_SLOTS)[number]) => {1568 if (!slot.free) return;1569 setCallAt(slot.label);1570 showToast({ kind: 'call', title: slot.id === 'soon' ? "We'll call you in 15 min" : `We'll call you at ${slot.label}`, sub: `On ${USER.phone}` });1571 later(() => setCallOpen(false), 700);1572 };15731574 const topicTotal = topic ? popular.length : 0;15751576 return (1577 <View style={[styles.screen, { backgroundColor: pal.bg }]}>1578 <Animated.View aria-hidden={!!article} style={[styles.fill, mainShift]}>1579 <Animated.ScrollView1580 ref={scrollRef}1581 onScroll={onScroll}1582 scrollEventThrottle={16}1583 keyboardShouldPersistTaps="handled"1584 keyboardDismissMode="on-drag"1585 showsVerticalScrollIndicator={false}1586 contentContainerStyle={{ paddingBottom: insets.bottom + 36 }}1587 >1588 {/* The wash runs full width behind the greeting, under the status bar */}1589 <LinearGradient colors={[pal.washTop, pal.washMid, pal.bg]} locations={[0, 0.55, 1]} style={[styles.wash, { height: insets.top + 360 }]} />15901591 <View style={styles.column}>1592 {/* Greeting and search */}1593 <View1594 style={[styles.hero, { paddingTop: insets.top + BAR_H + 4 }]}1595 onLayout={(e: LayoutChangeEvent) => {1596 heroBottom.value = e.nativeEvent.layout.y + e.nativeEvent.layout.height - 40;1597 }}1598 >1599 <View style={styles.greet}>1600 <HeroArt pal={pal} />1601 <Animated.Text entering={FadeInDown.duration(420)} style={[styles.hi, { color: pal.accentText }]}>1602 Hi {USER.first},1603 </Animated.Text>1604 <Animated.Text entering={FadeInDown.delay(60).duration(420)} role="heading" style={[styles.headline, { color: pal.fg }]}>1605 How can we help?1606 </Animated.Text>1607 </View>1608 <Animated.View entering={FadeInDown.delay(120).duration(420)}>1609 <SearchField value={query} focused={focused} inputRef={inputRef} onChange={setQuery} onFocus={onFocus} onBlur={onBlur} pal={pal} />1610 </Animated.View>1611 <SuggestRow open={suggest && !searching} onPick={searchFor} pal={pal} />1612 </View>16131614 {searching ? (1615 <View key="results" style={styles.body}>1616 <Results query={query} words={words} results={results} chat={chat} onOpen={openArticle} onSuggest={searchFor} onAsk={startChat} pal={pal} />1617 </View>1618 ) : (1619 <View1620 key="home"1621 style={styles.body}1622 onLayout={(e: LayoutChangeEvent) => {1623 homeY.current = e.nativeEvent.layout.y;1624 }}1625 >1626 <TicketCard open={thread} onToggle={() => setThread((v) => !v)} delay={d(180)} pal={pal} />16271628 <View1629 style={styles.section}1630 onLayout={(e: LayoutChangeEvent) => {1631 topicsY.current = e.nativeEvent.layout.y;1632 }}1633 >1634 <SectionHead title="Browse by topic" pal={pal} />1635 <View style={styles.grid}>1636 {TOPICS.map((tp, i) => (1637 <TopicTile1638 key={tp.id}1639 topic={tp}1640 width={tileW}1641 selected={topic === tp.id}1642 dimmed={!!topic && topic !== tp.id}1643 delay={d(280 + i * 45)}1644 onPress={() => pickTopic(tp.id)}1645 pal={pal}1646 />1647 ))}1648 </View>1649 </View>16501651 <View style={styles.section}>1652 <SectionHead title="Popular articles" pal={pal}>1653 {topic ? (1654 <Animated.View key={topic} entering={ZoomIn.duration(200)}>1655 <Tap label={`Clear ${TOPIC[topic].name} filter`} onPress={() => setTopic(null)} style={[styles.filterChip, { backgroundColor: pal.accentSoft }]}>1656 <Text style={[styles.filterChipText, { color: pal.accentText }]}>1657 {TOPIC[topic].name} · {topicTotal}1658 </Text>1659 <View style={[styles.filterClear, { backgroundColor: pal.accentText }]}>1660 <X size={10} color={pal.surface} strokeWidth={3.4} />1661 </View>1662 </Tap>1663 </Animated.View>1664 ) : (1665 <Text style={[styles.sectionNote, { color: pal.muted }]}>This week</Text>1666 )}1667 </SectionHead>1668 <Animated.View layout={LinearTransition.duration(240)} style={[styles.card, { backgroundColor: pal.surface, boxShadow: pal.cardShadow }]}>1669 {popular.map((a, i) => (1670 <Animated.View key={`${topic ?? 'top'}-${a.id}`} entering={FadeInDown.delay(topic ? i * 50 : d(460 + i * 50)).duration(320)}>1671 <ArticleRow article={a} first={i === 0} onPress={() => openArticle(a)} pal={pal} />1672 </Animated.View>1673 ))}1674 </Animated.View>1675 </View>16761677 <View style={styles.section}>1678 <SectionHead title="Common questions" pal={pal} />1679 <View style={[styles.card, { backgroundColor: pal.surface, boxShadow: pal.cardShadow }]}>1680 {FAQS.map((f, i) => (1681 <FaqItem key={f.q} item={f} first={i === 0} open={faq === i} onPress={() => setFaq(faq === i ? null : i)} pal={pal} />1682 ))}1683 </View>1684 </View>16851686 <View style={styles.section}>1687 <SectionHead title="Still need help?" pal={pal} />1688 <Text style={[styles.sectionLead, { color: pal.muted }]}>Real people, 7 days a week. Pick whatever suits you.</Text>1689 <ContactCard1690 chat={chat}1691 callOpen={callOpen}1692 callAt={callAt}1693 onChat={startChat}1694 onEmail={() => showToast({ kind: 'mail', title: 'New email to support', sub: 'We reply within 24 h, usually sooner' })}1695 onToggleCall={() => setCallOpen((v) => !v)}1696 onBook={bookCall}1697 pal={pal}1698 />1699 </View>1700 </View>1701 )}1702 </View>1703 </Animated.ScrollView>17041705 {/* Top bar: clear over the wash, opaque once content slides under it */}1706 <View style={[styles.topBar, { paddingTop: insets.top }]}>1707 <Animated.View style={[styles.abs, styles.topBarBack, { backgroundColor: pal.bg, borderBottomColor: pal.line }, barBack]} />1708 <View style={styles.barRow}>1709 <Tap label="Back" style={[styles.round, { backgroundColor: pal.surface, boxShadow: pal.cardShadow }]}>1710 <ChevronLeft size={21} color={pal.fg} strokeWidth={2.3} />1711 </Tap>1712 <Text role="heading" style={[styles.barTitle, { color: pal.fg }]}>1713 Help center1714 </Text>1715 {compact ? (1716 <Animated.View entering={ZoomIn.duration(180)}>1717 <Tap label="Jump to search" onPress={jumpToSearch} style={[styles.round, { backgroundColor: pal.surface, boxShadow: pal.cardShadow }]}>1718 <Search size={18} color={pal.fg} strokeWidth={2.3} />1719 </Tap>1720 </Animated.View>1721 ) : (1722 <View style={styles.roundSpacer} />1723 )}1724 </View>1725 </View>1726 </Animated.View>17271728 {article && (1729 <>1730 <Animated.View style={[styles.abs, styles.dim, dimStyle]} />1731 <ArticleView1732 article={article}1733 slide={slide}1734 width={width}1735 top={insets.top}1736 bottom={insets.bottom}1737 chat={chat}1738 onBack={closeArticle}1739 onOpen={openArticle}1740 onChat={startChat}1741 pal={pal}1742 />1743 </>1744 )}17451746 {toast && <Toast key={toast.id} data={toast} top={insets.top + 8} pal={pal} onHide={(id) => setToast((t) => (t?.id === id ? null : t))} />}1747 </View>1748 );1749}17501751// ─── Styles ─────────────────────────────────────────────────────────────────17521753const styles = StyleSheet.create({1754 screen: { flex: 1, overflow: 'hidden' },1755 fill: { flex: 1 },1756 flex: { flex: 1, minWidth: 0 },1757 abs: { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 },1758 column: { width: '100%', maxWidth: COLUMN, alignSelf: 'center' },1759 body: { paddingHorizontal: 16, paddingTop: 18 },1760 gutter: { paddingHorizontal: 16 },1761 card: { borderRadius: 20, overflow: 'hidden' },1762 reveal: { overflow: 'hidden' },1763 revealInner: { position: 'absolute', top: 0, left: 0, right: 0 },1764 spinner: { borderWidth: 2.25 },1765 avatar: { alignItems: 'center', justifyContent: 'center' },1766 avatarText: { color: '#FFFFFF', fontWeight: '700' },1767 hit: { fontWeight: '700', borderRadius: 4 },17681769 // Top bar1770 topBar: { position: 'absolute', top: 0, left: 0, right: 0 },1771 topBarBack: { borderBottomWidth: StyleSheet.hairlineWidth },1772 barRow: { height: BAR_H, width: '100%', maxWidth: COLUMN, alignSelf: 'center', flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', paddingHorizontal: 12 },1773 barTitle: { flex: 1, textAlign: 'center', fontSize: 16, fontWeight: '600', letterSpacing: -0.2, marginHorizontal: 8 },1774 barTitles: { flex: 1, height: BAR_H, marginHorizontal: 8 },1775 barTitleSwap: { position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, marginHorizontal: 0, lineHeight: BAR_H },1776 round: { width: 38, height: 38, borderRadius: 19, alignItems: 'center', justifyContent: 'center' },1777 roundSpacer: { width: 38 },17781779 // Hero1780 wash: { position: 'absolute', top: 0, left: 0, right: 0 },1781 hero: { paddingHorizontal: 16 },1782 greet: { paddingTop: 4, paddingBottom: 16 },1783 hi: { fontSize: 16, lineHeight: 22, fontWeight: '600' },1784 headline: { marginTop: 2, fontSize: 29, lineHeight: 35, fontWeight: '800', letterSpacing: -0.9 },1785 heroArt: { position: 'absolute', right: 0, top: -12, width: 104, height: 84, pointerEvents: 'none' },1786 heroDisc: { position: 'absolute', right: 10, top: 2, width: 80, height: 80, borderRadius: 40 },1787 bubbleMine: { position: 'absolute', right: 2, top: 4, width: 42, height: 36, borderRadius: 18, borderBottomRightRadius: 6, alignItems: 'center', justifyContent: 'center' },1788 bubbleMark: { fontSize: 19, fontWeight: '800', marginTop: -1 },1789 bubbleTheirs: { position: 'absolute', left: 6, top: 38, width: 62, height: 36, borderRadius: 18, borderBottomLeftRadius: 6, backgroundColor: ACCENT, alignItems: 'center', justifyContent: 'center', boxShadow: `0px 8px 18px ${tint(ACCENT, 0.35)}` },1790 typing: { flexDirection: 'row', gap: 5, alignItems: 'center' },1791 typingDot: { width: 6, height: 6, borderRadius: 3 },17921793 // Search1794 search: { height: 56, borderRadius: 18, borderWidth: 1.5, flexDirection: 'row', alignItems: 'center', paddingLeft: 16, paddingRight: 12, gap: 11 },1795 searchInput: { flex: 1, height: '100%', fontSize: 16.5, minWidth: 0 },1796 searchClear: { width: 22, height: 22, borderRadius: 11, alignItems: 'center', justifyContent: 'center' },1797 suggest: { paddingTop: 14 },1798 suggestLabel: { fontSize: 12.5, fontWeight: '600', marginBottom: 8 },1799 suggestRow: { flexDirection: 'row', flexWrap: 'wrap', gap: 8 },1800 chip: { height: 34, borderRadius: 17, borderWidth: 1, paddingHorizontal: 12, flexDirection: 'row', alignItems: 'center', gap: 6 },1801 chipText: { fontSize: 13.5, fontWeight: '600' },18021803 // Sections1804 section: { marginTop: 24 },1805 sectionHead: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', marginBottom: 10, minHeight: 26 },1806 sectionTitle: { fontSize: 18, fontWeight: '700', letterSpacing: -0.4 },1807 sectionNote: { fontSize: 13, fontWeight: '500' },1808 sectionLead: { fontSize: 14, lineHeight: 20, marginTop: -6, marginBottom: 12 },18091810 // Ticket1811 ticket: { padding: 14, paddingBottom: 0 },1812 ticketHead: { flexDirection: 'row', alignItems: 'center', gap: 12, marginBottom: 16 },1813 ticketTop: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: 8 },1814 ticketIcon: { width: 44, height: 44, borderRadius: 14, alignItems: 'center', justifyContent: 'center' },1815 ticketEyebrow: { fontSize: 12.5, fontWeight: '600', letterSpacing: 0.1, fontVariant: ['tabular-nums'] },1816 ticketTitle: { marginTop: 2, fontSize: 16.5, fontWeight: '700', letterSpacing: -0.2 },1817 statusPill: { flexDirection: 'row', alignItems: 'center', gap: 6, height: 22, paddingHorizontal: 9, borderRadius: 11 },1818 statusText: { fontSize: 11.5, fontWeight: '700' },1819 steps: { height: 20, justifyContent: 'center' },1820 stepsTrack: { height: 3, marginHorizontal: 10, borderRadius: 2, overflow: 'hidden' },1821 stepsFill: { height: '100%', borderRadius: 2 },1822 stepsDots: { position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' },1823 stepDone: { width: 20, height: 20, borderRadius: 10, alignItems: 'center', justifyContent: 'center' },1824 stepNow: { width: 20, height: 20, alignItems: 'center', justifyContent: 'center' },1825 stepHalo: { borderRadius: 10 },1826 stepRing: { borderWidth: 2 },1827 stepCore: { width: 8, height: 8, borderRadius: 4 },1828 stepTodo: { width: 20, height: 20, borderRadius: 10, borderWidth: 2 },1829 stepLabels: { flexDirection: 'row', marginTop: 8 },1830 stepLabel: { flex: 1, fontSize: 12.5, fontWeight: '500' },1831 stepLabelNow: { fontWeight: '700' },1832 alignLeft: { textAlign: 'left' },1833 alignCenter: { textAlign: 'center' },1834 alignRight: { textAlign: 'right' },1835 thread: { paddingTop: 16, gap: 10 },1836 msgRow: { flexDirection: 'row', alignItems: 'flex-end', gap: 8, paddingRight: 28 },1837 msgRowMine: { justifyContent: 'flex-end', paddingRight: 0, paddingLeft: 48 },1838 msg: { paddingHorizontal: 12, paddingVertical: 9, borderRadius: 16, flexShrink: 1 },1839 msgMine: { borderBottomRightRadius: 5 },1840 msgTheirs: { borderBottomLeftRadius: 5 },1841 msgText: { fontSize: 14, lineHeight: 20 },1842 msgTime: { marginTop: 3, fontSize: 11.5, fontWeight: '500' },1843 ticketFoot: { marginTop: 12, height: 48, borderTopWidth: StyleSheet.hairlineWidth, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' },1844 ticketAgent: { flexDirection: 'row', alignItems: 'center', gap: 8 },1845 ticketReply: { fontSize: 13, fontWeight: '500' },1846 ticketView: { flexDirection: 'row', alignItems: 'center', gap: 3, height: 40 },1847 ticketViewText: { fontSize: 14, fontWeight: '700' },18481849 // Topics1850 grid: { flexDirection: 'row', flexWrap: 'wrap', gap: GAP },1851 tile: { height: 102, borderRadius: 20, padding: 11, paddingLeft: 12, justifyContent: 'space-between' },1852 tileRing: { borderRadius: 20, borderWidth: 2 },1853 tileTop: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'flex-start' },1854 tileCheck: { backgroundColor: ACCENT },1855 tileName: { fontSize: 14, lineHeight: 18, fontWeight: '700', letterSpacing: -0.2 },1856 tileCount: { minWidth: 26, height: 20, borderRadius: 10, paddingHorizontal: 6, alignItems: 'center', justifyContent: 'center' },1857 tileCountText: { fontSize: 11.5, fontWeight: '700', fontVariant: ['tabular-nums'] },1858 topicIcon: { alignItems: 'center', justifyContent: 'center', overflow: 'hidden' },1859 topicGlint: { position: 'absolute' },1860 filterChip: { height: 30, borderRadius: 15, paddingLeft: 12, paddingRight: 5, flexDirection: 'row', alignItems: 'center', gap: 8 },1861 filterChipText: { fontSize: 13, fontWeight: '700' },1862 filterClear: { width: 20, height: 20, borderRadius: 10, alignItems: 'center', justifyContent: 'center' },18631864 // Rows1865 row: { flexDirection: 'row', alignItems: 'center', gap: 12, paddingHorizontal: 14, paddingVertical: 13 },1866 rowLine: { borderTopWidth: StyleSheet.hairlineWidth },1867 rowTitle: { fontSize: 15, lineHeight: 20, fontWeight: '600', letterSpacing: -0.1 },1868 rowMeta: { marginTop: 2, fontSize: 12.5, fontWeight: '500' },1869 resultRow: { alignItems: 'flex-start' },1870 resultSnippet: { marginTop: 3, fontSize: 13.5, lineHeight: 19 },18711872 // Results1873 resultsHead: { flexDirection: 'row', alignItems: 'baseline', gap: 6, marginBottom: 12 },1874 resultsCount: { fontSize: 18, fontWeight: '700', letterSpacing: -0.4 },1875 resultsFor: { flex: 1, fontSize: 15 },1876 askLinkWrap: { alignSelf: 'center', marginTop: 14 },1877 askLink: { paddingHorizontal: 12, paddingVertical: 8 },1878 askLinkText: { fontSize: 14, fontWeight: '500' },1879 noResults: { alignItems: 'center', paddingTop: 8, paddingHorizontal: 8 },1880 noArt: { width: 132, height: 112, alignItems: 'center', justifyContent: 'center' },1881 noDisc: { position: 'absolute', width: 108, height: 108, borderRadius: 54 },1882 noBox: { position: 'absolute', left: 30, top: 34 },1883 noGlass: { position: 'absolute', right: 14, top: 6 },1884 noTitle: { marginTop: 14, fontSize: 19, fontWeight: '700', letterSpacing: -0.4, textAlign: 'center' },1885 noBody: { marginTop: 6, fontSize: 14.5, lineHeight: 20, textAlign: 'center' },1886 noIdeas: { flexDirection: 'row', flexWrap: 'wrap', justifyContent: 'center', gap: 8, marginTop: 16, marginBottom: 22 },1887 chatButton: { height: 50, borderRadius: 25, paddingHorizontal: 22, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 9 },1888 chatButtonText: { color: ON_ACCENT, fontSize: 16, fontWeight: '700', letterSpacing: -0.2 },18891890 // FAQ1891 faqHead: { flexDirection: 'row', alignItems: 'center', gap: 12, paddingHorizontal: 16, paddingVertical: 15 },1892 faqQ: { flex: 1, fontSize: 15, lineHeight: 21, fontWeight: '600', letterSpacing: -0.1 },1893 faqChevron: { width: 28, height: 28, borderRadius: 14, alignItems: 'center', justifyContent: 'center' },1894 faqA: { paddingHorizontal: 16, paddingBottom: 16, marginTop: -4, fontSize: 14.5, lineHeight: 22, paddingRight: 52 },18951896 // Contact1897 contactRow: { flexDirection: 'row', alignItems: 'center', gap: 12, paddingHorizontal: 14, paddingVertical: 14 },1898 contactIcon: { width: 40, height: 40, borderRadius: 13, alignItems: 'center', justifyContent: 'center' },1899 contactTitle: { fontSize: 15.5, fontWeight: '700', letterSpacing: -0.2 },1900 contactSub: { marginTop: 2, fontSize: 13, fontWeight: '500' },1901 contactState: { flexDirection: 'row', alignItems: 'center', gap: 7 },1902 contactStateText: { fontSize: 12.5, fontWeight: '700' },1903 openPill: { height: 28, borderRadius: 14, paddingHorizontal: 14, justifyContent: 'center' },1904 openPillText: { color: ON_ACCENT, fontSize: 13, fontWeight: '700' },1905 bookedPill: { height: 26, borderRadius: 13, paddingHorizontal: 9, flexDirection: 'row', alignItems: 'center', gap: 4 },1906 bookedText: { fontSize: 12.5, fontWeight: '700', fontVariant: ['tabular-nums'] },1907 slots: { paddingHorizontal: 14, paddingBottom: 16, paddingLeft: 66 },1908 slotsLabel: { fontSize: 12.5, fontWeight: '500', marginBottom: 10 },1909 slotRow: { flexDirection: 'row', flexWrap: 'wrap', gap: 8 },1910 slot: { height: 36, borderRadius: 12, borderWidth: 1, paddingHorizontal: 12, flexDirection: 'row', alignItems: 'center', gap: 5 },1911 slotText: { fontSize: 13.5, fontWeight: '700', fontVariant: ['tabular-nums'] },1912 slotFull: { textDecorationLine: 'line-through' },1913 slotNote: { fontSize: 11.5, fontWeight: '600' },19141915 // Article view1916 layer: { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 },1917 dim: { backgroundColor: '#000000' },1918 articleBar: { borderBottomWidth: StyleSheet.hairlineWidth, zIndex: 2 },1919 readBar: { position: 'absolute', left: 0, bottom: -1, height: 2.5, borderRadius: 2 },1920 articleHead: { paddingHorizontal: 20, paddingTop: 22 },1921 articleTopic: { flexDirection: 'row', alignItems: 'center', gap: 8 },1922 articleTopicText: { fontSize: 13.5, fontWeight: '600' },1923 articleTitle: { marginTop: 14, fontSize: 27, lineHeight: 33, fontWeight: '800', letterSpacing: -0.8 },1924 articleMeta: { marginTop: 12, flexDirection: 'row', alignItems: 'center', gap: 6 },1925 articleMetaText: { fontSize: 13.5, fontWeight: '500' },1926 articleIntro: { paddingHorizontal: 20, marginTop: 20, fontSize: 16.5, lineHeight: 26 },1927 articleH2: { paddingHorizontal: 20, marginTop: 26, marginBottom: 14, fontSize: 18, fontWeight: '700', letterSpacing: -0.4 },1928 step: { flexDirection: 'row', gap: 14, paddingHorizontal: 20 },1929 stepRail: { width: 28, alignItems: 'center' },1930 stepNum: { width: 28, height: 28, borderRadius: 14, alignItems: 'center', justifyContent: 'center' },1931 stepNumText: { fontSize: 13.5, fontWeight: '800' },1932 stepLink: { flex: 1, width: 2, borderRadius: 1, marginVertical: 4 },1933 stepText: { flex: 1, paddingTop: 4, paddingBottom: 18, fontSize: 15.5, lineHeight: 23 },1934 tip: { marginHorizontal: 20, marginTop: 4, padding: 14, borderRadius: 16, flexDirection: 'row', gap: 10 },1935 tipText: { flex: 1, fontSize: 14.5, lineHeight: 21 },1936 helpful: { marginHorizontal: 16, marginTop: 24, padding: 16 },1937 helpfulHead: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: 12 },1938 helpfulTitle: { fontSize: 16, fontWeight: '700', letterSpacing: -0.2 },1939 helpfulSub: { marginTop: 2, fontSize: 13.5, lineHeight: 19 },1940 votes: { flexDirection: 'row', gap: 8 },1941 vote: { height: 38, borderRadius: 19, paddingHorizontal: 14, flexDirection: 'row', alignItems: 'center', gap: 6 },1942 voteText: { fontSize: 14, fontWeight: '700' },1943 reasons: { paddingTop: 14 },1944 reasonRow: { flexDirection: 'row', flexWrap: 'wrap', gap: 8, marginTop: 10 },1945 thanks: { flexDirection: 'row', alignItems: 'center', gap: 14 },1946 thanksTick: { width: 40, height: 40, borderRadius: 20, alignItems: 'center', justifyContent: 'center' },1947 stuck: { marginHorizontal: 16, marginTop: 28, padding: 20, alignItems: 'center' },1948 stuckTitle: { fontSize: 18, fontWeight: '700', letterSpacing: -0.4 },1949 stuckBody: { marginTop: 4, marginBottom: 16, fontSize: 14, lineHeight: 20, textAlign: 'center' },19501951 // Toast1952 toastWrap: { position: 'absolute', left: 12, right: 12, alignItems: 'center', pointerEvents: 'box-none' },1953 toast: { width: '100%', maxWidth: 440, borderRadius: 20 },1954 toastInner: { flexDirection: 'row', alignItems: 'center', gap: 12, paddingHorizontal: 14, paddingVertical: 12 },1955 toastIcon: { width: 34, height: 34, borderRadius: 17, alignItems: 'center', justifyContent: 'center' },1956 toastLive: { position: 'absolute', right: -1, bottom: -1, width: 12, height: 12, borderRadius: 6, borderWidth: 2, backgroundColor: LIVE },1957 toastTitle: { fontSize: 15, fontWeight: '700', letterSpacing: -0.2 },1958 toastSub: { marginTop: 1, fontSize: 13, fontWeight: '500' },1959});