Open History to see the last commit
1import { useMemo, useState } from 'react'
2import {
3 Pressable,
4 SafeAreaView,
5 ScrollView,
6 StatusBar,
7 StyleSheet,
8 Text,
9 TextInput,
10 View,
11} from 'react-native'
12import {
13 fetchHttpStream,
14 useChat,
15 xhrHttpStream,
16 xhrServerSentEvents,
17 type ConnectionAdapter,
18 type UIMessage,
19} from '@tanstack/ai-react'
20
21const baseUrl =
22 process.env.EXPO_PUBLIC_TANSTACK_AI_BASE_URL ?? 'http://127.0.0.1:8787'
23
24const expectedFetchErrorMessage =
25 'This phone runtime cannot stream with fetch; choose XHR HTTP or XHR SSE.'
26
27const starterPrompts = [
28 'Make it vegan',
29 'Remove mushrooms',
30 'Add more protein',
31 'Dinner for 4',
32]
33
34const transports = [
35 {
36 key: 'fetch-http',
37 label: 'Fetch',
38 shortLabel: 'Fetch',
39 description: 'Try this only on phone runtimes that support it.',
40 endpoint: '/chat/http',
41 },
42 {
43 key: 'xhr-http',
44 label: 'XHR HTTP',
45 shortLabel: 'XHR HTTP',
46 description: 'Recommended for most phones and emulators.',
47 endpoint: '/chat/http',
48 },
49 {
50 key: 'xhr-sse',
51 label: 'XHR SSE',
52 shortLabel: 'XHR SSE',
53 description: 'Alternate phone-friendly delivery mode.',
54 endpoint: '/chat/sse',
55 },
56] as const
57
58type TransportKey = (typeof transports)[number]['key']
59type MessagePart = UIMessage['parts'][number]
60type StructuredRecipePart = Extract<MessagePart, { type: 'structured-output' }>
61
62type RecipeValue = {
63 title?: unknown
64 summary?: unknown
65 servings?: unknown
66 totalMinutes?: unknown
67 tags?: unknown
68 ingredients?: unknown
69 steps?: unknown
70 tips?: unknown
71 warnings?: unknown
72 allergens?: unknown
73 revision?: unknown
74 fromPrompt?: unknown
75}
76
77function endpointUrl(path: string): string {
78 return `${baseUrl}${path}`
79}
80
81function useConnection(transport: TransportKey): ConnectionAdapter {
82 return useMemo(() => {
83 const selected = transports.find((item) => item.key === transport)
84 const url = endpointUrl(selected?.endpoint ?? '/chat/http')
85
86 switch (transport) {
87 case 'fetch-http':
88 return fetchHttpStream(url)
89 case 'xhr-http':
90 return xhrHttpStream(url)
91 case 'xhr-sse':
92 return xhrServerSentEvents(url)
93 }
94 }, [transport])
95}
96
97function isRecord(value: unknown): value is Record<string, unknown> {
98 return typeof value === 'object' && value !== null && !Array.isArray(value)
99}
100
101function formatValue(value: unknown): string {
102 if (value === undefined) return 'Not available yet'
103 if (typeof value === 'string') return value
104 if (
105 typeof value === 'number' ||
106 typeof value === 'boolean' ||
107 value === null
108 ) {
109 return String(value)
110 }
111
112 try {
113 return JSON.stringify(value, null, 2)
114 } catch {
115 return '[Unserializable value]'
116 }
117}
118
119function valueToString(value: unknown): string | undefined {
120 if (value === undefined || value === null) return undefined
121 if (typeof value === 'string') return value
122 if (typeof value === 'number' || typeof value === 'boolean') {
123 return String(value)
124 }
125 return formatValue(value)
126}
127
128function itemToString(item: unknown): string | undefined {
129 if (!isRecord(item)) return valueToString(item)
130
131 const amount = valueToString(item.amount)
132 const name = valueToString(item.name)
133 const title = valueToString(item.title)
134 const text = valueToString(item.text)
135 const minutes = valueToString(item.minutes)
136 const pantry = item.pantry === true ? 'pantry' : undefined
137
138 if (amount || name) {
139 return [amount, name, pantry ? `(${pantry})` : undefined]
140 .filter(Boolean)
141 .join(' ')
142 }
143
144 if (title || text || minutes) {
145 const body = [title, text].filter(Boolean).join(': ')
146 return minutes ? `${body} (${minutes} min)` : body
147 }
148
149 return valueToString(item)
150}
151
152function valueToList(value: unknown): Array<string> {
153 if (Array.isArray(value)) {
154 return value
155 .map((item) => itemToString(item))
156 .filter((item): item is string => Boolean(item))
157 }
158
159 const item = itemToString(value)
160 return item ? [item] : []
161}
162
163function dedupeLabels(labels: Array<string>): Array<string> {
164 const seen = new Set<string>()
165
166 return labels.filter((label) => {
167 const key = label.toLocaleLowerCase()
168 if (seen.has(key)) return false
169 seen.add(key)
170 return true
171 })
172}
173
174function parseRawRecipe(raw: string | undefined): RecipeValue | undefined {
175 if (!raw) return undefined
176
177 try {
178 const parsed = JSON.parse(raw)
179 return isRecord(parsed) ? parsed : undefined
180 } catch {
181 return undefined
182 }
183}
184
185function getRecipeSource(part?: StructuredRecipePart): RecipeValue | undefined {
186 if (!part) return undefined
187
188 if (isRecord(part.data)) return part.data
189 if (isRecord(part.partial)) return part.partial
190 return parseRawRecipe(part.raw)
191}
192
193function findLatestRecipePart(
194 messages: Array<UIMessage>,
195): StructuredRecipePart | undefined {
196 for (const message of [...messages].reverse()) {
197 for (const part of [...message.parts].reverse()) {
198 if (part.type === 'structured-output') return part
199 }
200 }
201
202 return undefined
203}
204
205function isExpectedFetchStreamingError(error: Error | undefined): boolean {
206 if (!error) return false
207 return (
208 error.name === 'UnsupportedResponseStreamError' ||
209 error.message.includes('Response.body') ||
210 error.message.includes('response.body')
211 )
212}
213
214function RecipeMetaPill({ label, value }: { label: string; value: string }) {
215 return (
216 <View style={styles.metaPill}>
217 <Text style={styles.metaPillLabel}>{label}</Text>
218 <Text style={styles.metaPillValue}>{value}</Text>
219 </View>
220 )
221}
222
223function TagRail({ tags }: { tags: Array<string> }) {
224 if (tags.length === 0) return null
225
226 return (
227 <View style={styles.tagRail}>
228 {tags.map((tag, index) => (
229 <Text key={`${tag}-${index}`} style={styles.recipeTag}>
230 {tag}
231 </Text>
232 ))}
233 </View>
234 )
235}
236
237function IngredientChecklist({ items }: { items: Array<string> }) {
238 if (items.length === 0) {
239 return (
240 <View style={styles.emptyRecipeSection}>
241 <Text style={styles.emptySectionText}>
242 Gathering ingredients for your recipe.
243 </Text>
244 </View>
245 )
246 }
247
248 return (
249 <View style={styles.ingredientCard}>
250 <Text style={styles.sectionTitle}>Ingredients</Text>
251 {items.map((item, index) => (
252 <View key={`${item}-${index}`} style={styles.ingredientRow}>
253 <View style={styles.checkbox} />
254 <Text style={styles.ingredientText}>{item}</Text>
255 </View>
256 ))}
257 </View>
258 )
259}
260
261function StepCards({ steps }: { steps: Array<string> }) {
262 if (steps.length === 0) {
263 return (
264 <View style={styles.emptyRecipeSection}>
265 <Text style={styles.emptySectionText}>Drafting the cooking steps.</Text>
266 </View>
267 )
268 }
269
270 return (
271 <View style={styles.stepStack}>
272 <Text style={styles.sectionTitle}>Method</Text>
273 {steps.map((step, index) => (
274 <View key={`${step}-${index}`} style={styles.stepCard}>
275 <Text style={styles.stepNumber}>{index + 1}</Text>
276 <Text style={styles.stepText}>{step}</Text>
277 </View>
278 ))}
279 </View>
280 )
281}
282
283function NoteSection({
284 title,
285 items,
286 tone = 'sage',
287}: {
288 title: string
289 items: Array<string>
290 tone?: 'sage' | 'tomato'
291}) {
292 if (items.length === 0) return null
293
294 return (
295 <View
296 style={[
297 styles.noteSection,
298 tone === 'tomato' ? styles.tomatoNote : styles.sageNote,
299 ]}
300 >
301 <Text style={styles.noteTitle}>{title}</Text>
302 {items.map((item, index) => (
303 <Text key={`${title}-${index}`} style={styles.noteText}>
304 {item}
305 </Text>
306 ))}
307 </View>
308 )
309}
310
311function RecipeHero({
312 part,
313 isLoading,
314}: {
315 part?: StructuredRecipePart
316 isLoading: boolean
317}) {
318 const recipe = getRecipeSource(part)
319 const preparing = isLoading || part?.status === 'streaming'
320 const title =
321 valueToString(recipe?.title) ??
322 (preparing ? 'Preparing your recipe...' : 'Your next recipe starts here')
323 const summary =
324 valueToString(recipe?.summary) ??
325 (preparing
326 ? 'Building a clear recipe with ingredients, steps, timing, and notes.'
327 : 'Ask for a dinner idea, then revise it with follow-up prompts. Your latest recipe appears here.')
328 const servings = valueToString(recipe?.servings)
329 const totalMinutes = valueToString(recipe?.totalMinutes)
330 const revision = valueToString(recipe?.revision)
331 const tags = valueToList(recipe?.tags)
332 const ingredients = valueToList(recipe?.ingredients)
333 const steps = valueToList(recipe?.steps)
334 const tips = valueToList(recipe?.tips)
335 const warnings = [
336 ...valueToList(recipe?.warnings),
337 ...valueToList(recipe?.allergens),
338 ]
339 const prompts = valueToList(recipe?.fromPrompt)
340 const tagLabels = dedupeLabels([...tags, ...prompts])
341
342 return (
343 <View
344 style={[styles.recipeHero, preparing ? styles.recipeHeroPreparing : null]}
345 >
346 <View style={styles.heroTopRow}>
347 <Text style={styles.heroEyebrow}>
348 {preparing ? 'Preparing your recipe...' : 'Recipe card'}
349 </Text>
350 {revision ? (
351 <Text style={styles.revisionBadge}>Revision {revision}</Text>
352 ) : null}
353 </View>
354
355 {preparing ? (
356 <View style={styles.preparingBanner}>
357 <Text style={styles.preparingTitle}>
358 {recipe ? 'Updating your recipe' : 'Starting a fresh recipe'}
359 </Text>
360 <Text style={styles.preparingText}>
361 {recipe
362 ? 'New ingredients and steps will replace this card as soon as they are ready.'
363 : 'Preparing your recipe card now.'}
364 </Text>
365 </View>
366 ) : null}
367
368 <Text style={styles.recipeTitle}>{title}</Text>
369 <Text style={styles.recipeSummary}>{summary}</Text>
370
371 <View style={styles.metaRail}>
372 {totalMinutes ? (
373 <RecipeMetaPill label="Total" value={`${totalMinutes} min`} />
374 ) : null}
375 {servings ? <RecipeMetaPill label="Serves" value={servings} /> : null}
376 <RecipeMetaPill
377 label="Recipe"
378 value={preparing ? 'Preparing' : recipe ? 'Ready' : 'Waiting'}
379 />
380 </View>
381
382 <TagRail tags={tagLabels} />
383 <IngredientChecklist items={ingredients} />
384 <StepCards steps={steps} />
385 <NoteSection title="Cook's notes" items={tips} />
386 <NoteSection
387 title="Warnings and allergens"
388 items={warnings}
389 tone="tomato"
390 />
391
392 {part?.errorMessage ? (
393 <Text style={styles.errorText}>
394 We could not finish this recipe card. Try again or simplify the
395 request.
396 </Text>
397 ) : null}
398 </View>
399 )
400}
401
402function UserRequest({ message }: { message: UIMessage }) {
403 const text = message.parts
404 .filter((part): part is Extract<MessagePart, { type: 'text' }> => {
405 return part.type === 'text'
406 })
407 .map((part) => part.content)
408 .join('\n')
409
410 if (!text) return null
411
412 return (
413 <View style={styles.requestBubble}>
414 <Text style={styles.requestLabel}>Request</Text>
415 <Text style={styles.requestText}>{text}</Text>
416 </View>
417 )
418}
419
420function RequestHistory({ messages }: { messages: Array<UIMessage> }) {
421 const userMessages = messages.filter((message) => message.role === 'user')
422
423 if (userMessages.length === 0) return null
424
425 return (
426 <View style={styles.requestSection}>
427 <Text style={styles.panelTitle}>Requests</Text>
428 <View style={styles.requestList}>
429 {userMessages.map((message) => (
430 <UserRequest key={message.id} message={message} />
431 ))}
432 </View>
433 </View>
434 )
435}
436
437export default function App() {
438 const [transport, setTransport] = useState<TransportKey>('xhr-http')
439 const [input, setInput] = useState('15-minute veggie dinner')
440 const connection = useConnection(transport)
441 const selectedTransport =
442 transports.find((item) => item.key === transport) ?? transports[1]
443
444 const {
445 messages,
446 sendMessage,
447 isLoading,
448 error,
449 stop,
450 reload,
451 clear,
452 sessionGenerating,
453 } = useChat({
454 threadId: `rn-recipe-book-${transport}`,
455 connection,
456 })
457
458 async function send(nextPrompt = input) {
459 const next = nextPrompt.trim()
460 if (!next || isLoading) return
461 setInput('')
462 await sendMessage(next)
463 }
464
465 async function reloadLast() {
466 if (isLoading || messages.length === 0) return
467 await reload()
468 }
469
470 function clearChat() {
471 clear()
472 }
473
474 const latestRecipePart = findLatestRecipePart(messages)
475 const expectedFetchError = isExpectedFetchStreamingError(error)
476 const displayedError = expectedFetchError
477 ? expectedFetchErrorMessage
478 : error?.message
479
480 return (
481 <SafeAreaView style={styles.screen}>
482 <StatusBar barStyle="dark-content" />
483 <View style={styles.backgroundSauce} />
484 <View style={styles.backgroundSage} />
485
486 <ScrollView
487 style={styles.page}
488 contentContainerStyle={styles.pageContent}
489 keyboardShouldPersistTaps="handled"
490 >
491 <View style={styles.header}>
492 <Text style={styles.eyebrow}>TanStack AI recipes</Text>
493 <Text style={styles.title}>Weeknight Kitchen</Text>
494 <Text style={styles.subtitle}>
495 Ask for dinner, then revise the recipe card until it fits your
496 pantry, taste, and table.
497 </Text>
498 </View>
499
500 <View style={styles.connectionPanel}>
501 <View style={styles.connectionHeader}>
502 <View>
503 <Text style={styles.panelTitle}>Testing mode</Text>
504 <Text style={styles.panelCopy}>
505 {selectedTransport.description}
506 </Text>
507 </View>
508 <Text style={styles.connectionBadge}>
509 {sessionGenerating || isLoading ? 'Cooking' : 'Ready'}
510 </Text>
511 </View>
512 <View style={styles.transportRail}>
513 {transports.map((item) => {
514 const active = item.key === transport
515 return (
516 <Pressable
517 accessibilityRole="button"
518 accessibilityState={{ selected: active }}
519 key={item.key}
520 onPress={() => setTransport(item.key)}
521 style={[
522 styles.transportButton,
523 active ? styles.activeTransportButton : null,
524 ]}
525 >
526 <Text
527 style={[
528 styles.transportButtonText,
529 active ? styles.activeTransportButtonText : null,
530 ]}
531 >
532 {item.shortLabel}
533 </Text>
534 </Pressable>
535 )
536 })}
537 </View>
538 </View>
539
540 {displayedError ? (
541 <View
542 style={[
543 styles.banner,
544 expectedFetchError ? styles.expectedBanner : styles.errorBanner,
545 ]}
546 >
547 <Text style={styles.bannerTitle}>
548 {expectedFetchError ? 'Fetch unsupported here' : 'Recipe alert'}
549 </Text>
550 <Text style={styles.bannerText}>{displayedError}</Text>
551 </View>
552 ) : null}
553
554 <RecipeHero part={latestRecipePart} isLoading={isLoading} />
555 <RequestHistory messages={messages} />
556 </ScrollView>
557
558 <View style={styles.composer}>
559 <View style={styles.starterRail}>
560 {starterPrompts.map((prompt) => (
561 <Pressable
562 accessibilityRole="button"
563 disabled={isLoading}
564 key={prompt}
565 onPress={() => {
566 if (messages.length === 0) {
567 void send(prompt)
568 } else {
569 setInput(prompt)
570 }
571 }}
572 style={[
573 styles.starterChip,
574 isLoading ? styles.disabledAction : null,
575 ]}
576 >
577 <Text style={styles.starterChipText}>{prompt}</Text>
578 </Pressable>
579 ))}
580 </View>
581 <TextInput
582 accessibilityLabel="Recipe prompt"
583 style={styles.input}
584 value={input}
585 onChangeText={setInput}
586 editable={!isLoading}
587 multiline
588 placeholder="Ask for a recipe or revision..."
589 placeholderTextColor={colors.cocoaMuted}
590 />
591 <View style={styles.composerActions}>
592 <Pressable
593 accessibilityRole="button"
594 onPress={isLoading ? stop : () => void send()}
595 style={[styles.primaryAction, isLoading ? styles.stopAction : null]}
596 >
597 <Text style={styles.primaryActionText}>
598 {isLoading ? 'Stop' : 'Create recipe'}
599 </Text>
600 </Pressable>
601 <Pressable
602 accessibilityRole="button"
603 disabled={isLoading || messages.length === 0}
604 onPress={reloadLast}
605 style={[
606 styles.secondaryAction,
607 isLoading || messages.length === 0 ? styles.disabledAction : null,
608 ]}
609 >
610 <Text style={styles.secondaryActionText}>Retry</Text>
611 </Pressable>
612 <Pressable
613 accessibilityRole="button"
614 disabled={messages.length === 0}
615 onPress={clearChat}
616 style={[
617 styles.secondaryAction,
618 messages.length === 0 ? styles.disabledAction : null,
619 ]}
620 >
621 <Text style={styles.secondaryActionText}>Clear</Text>
622 </Pressable>
623 </View>
624 </View>
625 </SafeAreaView>
626 )
627}
628
629const colors = {
630 ink: '#2a1a12',
631 cocoa: '#543225',
632 cocoaMuted: '#8f6652',
633 line: '#d7b98f',
634 parchment: '#fbefd3',
635 card: '#fffaf0',
636 tomato: '#c84f32',
637 tomatoSoft: '#ffe1d4',
638 olive: '#687a3e',
639 oliveDark: '#3f4b25',
640 sage: '#dce7c8',
641 butter: '#f2c96b',
642 white: '#fffdf7',
643 danger: '#b83a2f',
644}
645
646const styles = StyleSheet.create({
647 screen: {
648 flex: 1,
649 backgroundColor: colors.parchment,
650 },
651 backgroundSauce: {
652 position: 'absolute',
653 right: -76,
654 top: 52,
655 width: 190,
656 height: 190,
657 borderRadius: 95,
658 backgroundColor: colors.tomatoSoft,
659 opacity: 0.82,
660 },
661 backgroundSage: {
662 position: 'absolute',
663 left: -54,
664 top: 190,
665 width: 138,
666 height: 138,
667 borderRadius: 69,
668 backgroundColor: colors.sage,
669 opacity: 0.86,
670 },
671 page: {
672 flex: 1,
673 },
674 pageContent: {
675 gap: 14,
676 padding: 16,
677 paddingBottom: 22,
678 },
679 header: {
680 gap: 8,
681 paddingTop: 8,
682 },
683 eyebrow: {
684 color: colors.oliveDark,
685 fontSize: 12,
686 fontWeight: '900',
687 letterSpacing: 1.4,
688 textTransform: 'uppercase',
689 },
690 title: {
691 color: colors.ink,
692 fontSize: 40,
693 fontWeight: '900',
694 letterSpacing: -1.3,
695 lineHeight: 43,
696 },
697 subtitle: {
698 color: colors.cocoa,
699 fontSize: 15,
700 lineHeight: 21,
701 maxWidth: 560,
702 },
703 connectionPanel: {
704 borderColor: colors.line,
705 borderRadius: 24,
706 borderWidth: 1,
707 backgroundColor: 'rgba(255, 250, 240, 0.88)',
708 gap: 10,
709 padding: 14,
710 },
711 connectionHeader: {
712 alignItems: 'flex-start',
713 flexDirection: 'row',
714 gap: 10,
715 justifyContent: 'space-between',
716 },
717 panelTitle: {
718 color: colors.ink,
719 fontSize: 15,
720 fontWeight: '900',
721 },
722 panelCopy: {
723 color: colors.cocoaMuted,
724 fontSize: 12,
725 lineHeight: 17,
726 marginTop: 3,
727 },
728 connectionBadge: {
729 borderColor: colors.olive,
730 borderRadius: 999,
731 borderWidth: 1,
732 color: colors.oliveDark,
733 fontSize: 11,
734 fontWeight: '900',
735 overflow: 'hidden',
736 paddingHorizontal: 9,
737 paddingVertical: 5,
738 textTransform: 'uppercase',
739 },
740 transportRail: {
741 flexDirection: 'row',
742 gap: 8,
743 },
744 transportButton: {
745 flex: 1,
746 alignItems: 'center',
747 borderColor: colors.line,
748 borderRadius: 999,
749 borderWidth: 1,
750 backgroundColor: colors.white,
751 paddingVertical: 8,
752 },
753 activeTransportButton: {
754 borderColor: colors.oliveDark,
755 backgroundColor: colors.oliveDark,
756 },
757 transportButtonText: {
758 color: colors.cocoa,
759 fontSize: 12,
760 fontWeight: '900',
761 },
762 activeTransportButtonText: {
763 color: colors.white,
764 },
765 banner: {
766 borderRadius: 20,
767 borderWidth: 1,
768 padding: 13,
769 gap: 5,
770 },
771 expectedBanner: {
772 borderColor: colors.tomato,
773 backgroundColor: '#fff2bf',
774 },
775 errorBanner: {
776 borderColor: colors.danger,
777 backgroundColor: colors.tomatoSoft,
778 },
779 bannerTitle: {
780 color: colors.ink,
781 fontSize: 12,
782 fontWeight: '900',
783 letterSpacing: 0.8,
784 textTransform: 'uppercase',
785 },
786 bannerText: {
787 color: colors.cocoa,
788 fontSize: 13,
789 lineHeight: 18,
790 },
791 recipeHero: {
792 borderColor: colors.line,
793 borderRadius: 34,
794 borderWidth: 1,
795 backgroundColor: colors.card,
796 gap: 15,
797 padding: 18,
798 shadowColor: colors.cocoa,
799 shadowOffset: { width: 0, height: 12 },
800 shadowOpacity: 0.14,
801 shadowRadius: 24,
802 elevation: 3,
803 },
804 recipeHeroPreparing: {
805 borderColor: colors.tomato,
806 shadowColor: colors.tomato,
807 shadowOpacity: 0.18,
808 },
809 heroTopRow: {
810 alignItems: 'center',
811 flexDirection: 'row',
812 gap: 10,
813 justifyContent: 'space-between',
814 },
815 heroEyebrow: {
816 color: colors.tomato,
817 flex: 1,
818 fontSize: 12,
819 fontWeight: '900',
820 letterSpacing: 1.2,
821 textTransform: 'uppercase',
822 },
823 revisionBadge: {
824 borderRadius: 999,
825 backgroundColor: colors.sage,
826 color: colors.oliveDark,
827 fontSize: 11,
828 fontWeight: '900',
829 overflow: 'hidden',
830 paddingHorizontal: 10,
831 paddingVertical: 5,
832 },
833 preparingBanner: {
834 borderColor: colors.butter,
835 borderRadius: 20,
836 borderWidth: 1,
837 backgroundColor: '#fff2bf',
838 gap: 4,
839 padding: 12,
840 },
841 preparingTitle: {
842 color: colors.ink,
843 fontSize: 13,
844 fontWeight: '900',
845 },
846 preparingText: {
847 color: colors.cocoa,
848 fontSize: 13,
849 lineHeight: 18,
850 },
851 recipeTitle: {
852 color: colors.ink,
853 fontSize: 32,
854 fontWeight: '900',
855 letterSpacing: -1,
856 lineHeight: 36,
857 },
858 recipeSummary: {
859 color: colors.cocoa,
860 fontSize: 15,
861 lineHeight: 22,
862 },
863 metaRail: {
864 flexDirection: 'row',
865 flexWrap: 'wrap',
866 gap: 8,
867 },
868 metaPill: {
869 borderColor: colors.line,
870 borderRadius: 17,
871 borderWidth: 1,
872 backgroundColor: colors.white,
873 minWidth: 88,
874 paddingHorizontal: 11,
875 paddingVertical: 8,
876 },
877 metaPillLabel: {
878 color: colors.cocoaMuted,
879 fontSize: 10,
880 fontWeight: '900',
881 letterSpacing: 0.8,
882 textTransform: 'uppercase',
883 },
884 metaPillValue: {
885 color: colors.ink,
886 fontSize: 14,
887 fontWeight: '900',
888 marginTop: 2,
889 },
890 tagRail: {
891 flexDirection: 'row',
892 flexWrap: 'wrap',
893 gap: 7,
894 },
895 recipeTag: {
896 borderRadius: 999,
897 backgroundColor: colors.tomatoSoft,
898 color: colors.tomato,
899 fontSize: 12,
900 fontWeight: '900',
901 overflow: 'hidden',
902 paddingHorizontal: 10,
903 paddingVertical: 6,
904 },
905 ingredientCard: {
906 borderColor: colors.line,
907 borderRadius: 22,
908 borderWidth: 1,
909 backgroundColor: colors.white,
910 gap: 10,
911 padding: 14,
912 },
913 sectionTitle: {
914 color: colors.ink,
915 fontSize: 16,
916 fontWeight: '900',
917 },
918 ingredientRow: {
919 alignItems: 'flex-start',
920 flexDirection: 'row',
921 gap: 10,
922 },
923 checkbox: {
924 width: 18,
925 height: 18,
926 borderColor: colors.olive,
927 borderRadius: 5,
928 borderWidth: 2,
929 marginTop: 1,
930 },
931 ingredientText: {
932 color: colors.cocoa,
933 flex: 1,
934 fontSize: 14,
935 lineHeight: 20,
936 },
937 stepStack: {
938 gap: 10,
939 },
940 stepCard: {
941 borderColor: colors.line,
942 borderRadius: 21,
943 borderWidth: 1,
944 backgroundColor: '#fff5dc',
945 flexDirection: 'row',
946 gap: 12,
947 padding: 13,
948 },
949 stepNumber: {
950 color: colors.tomato,
951 fontSize: 20,
952 fontWeight: '900',
953 minWidth: 24,
954 },
955 stepText: {
956 color: colors.ink,
957 flex: 1,
958 fontSize: 14,
959 lineHeight: 21,
960 },
961 emptyRecipeSection: {
962 borderColor: colors.line,
963 borderRadius: 20,
964 borderStyle: 'dashed',
965 borderWidth: 1,
966 backgroundColor: 'rgba(255, 253, 247, 0.62)',
967 padding: 13,
968 },
969 emptySectionText: {
970 color: colors.cocoaMuted,
971 fontSize: 13,
972 fontStyle: 'italic',
973 lineHeight: 18,
974 },
975 noteSection: {
976 borderRadius: 20,
977 borderWidth: 1,
978 gap: 7,
979 padding: 13,
980 },
981 sageNote: {
982 borderColor: colors.olive,
983 backgroundColor: colors.sage,
984 },
985 tomatoNote: {
986 borderColor: colors.tomato,
987 backgroundColor: colors.tomatoSoft,
988 },
989 noteTitle: {
990 color: colors.ink,
991 fontSize: 14,
992 fontWeight: '900',
993 },
994 noteText: {
995 color: colors.cocoa,
996 fontSize: 13,
997 lineHeight: 19,
998 },
999 requestSection: {
1000 gap: 9,
1001 },
1002 requestList: {
1003 gap: 8,
1004 },
1005 requestBubble: {
1006 alignSelf: 'flex-end',
1007 maxWidth: '88%',
1008 borderRadius: 20,
1009 backgroundColor: colors.tomato,
1010 paddingHorizontal: 13,
1011 paddingVertical: 10,
1012 },
1013 requestLabel: {
1014 color: '#ffe9de',
1015 fontSize: 10,
1016 fontWeight: '900',
1017 letterSpacing: 0.9,
1018 textTransform: 'uppercase',
1019 },
1020 requestText: {
1021 color: colors.white,
1022 fontSize: 14,
1023 fontWeight: '800',
1024 lineHeight: 20,
1025 marginTop: 3,
1026 },
1027 errorText: {
1028 color: colors.danger,
1029 fontSize: 13,
1030 fontWeight: '800',
1031 },
1032 composer: {
1033 borderTopColor: colors.line,
1034 borderTopWidth: 1,
1035 backgroundColor: colors.card,
1036 gap: 10,
1037 padding: 14,
1038 },
1039 starterRail: {
1040 flexDirection: 'row',
1041 flexWrap: 'wrap',
1042 gap: 8,
1043 },
1044 starterChip: {
1045 borderColor: colors.line,
1046 borderRadius: 999,
1047 borderWidth: 1,
1048 backgroundColor: colors.parchment,
1049 paddingHorizontal: 11,
1050 paddingVertical: 7,
1051 },
1052 starterChipText: {
1053 color: colors.ink,
1054 fontSize: 12,
1055 fontWeight: '900',
1056 },
1057 input: {
1058 minHeight: 66,
1059 borderColor: colors.line,
1060 borderRadius: 22,
1061 borderWidth: 1,
1062 backgroundColor: colors.white,
1063 color: colors.ink,
1064 fontSize: 15,
1065 lineHeight: 21,
1066 padding: 13,
1067 },
1068 composerActions: {
1069 flexDirection: 'row',
1070 gap: 8,
1071 },
1072 primaryAction: {
1073 flex: 1.4,
1074 alignItems: 'center',
1075 borderRadius: 18,
1076 backgroundColor: colors.tomato,
1077 paddingVertical: 13,
1078 },
1079 stopAction: {
1080 backgroundColor: colors.cocoa,
1081 },
1082 primaryActionText: {
1083 color: colors.white,
1084 fontSize: 14,
1085 fontWeight: '900',
1086 },
1087 secondaryAction: {
1088 flex: 0.75,
1089 alignItems: 'center',
1090 borderColor: colors.line,
1091 borderRadius: 18,
1092 borderWidth: 1,
1093 backgroundColor: colors.white,
1094 paddingVertical: 13,
1095 },
1096 secondaryActionText: {
1097 color: colors.ink,
1098 fontSize: 13,
1099 fontWeight: '900',
1100 },
1101 disabledAction: {
1102 opacity: 0.35,
1103 },
1104})