({
part,
isLoading,
}: {
part?: StructuredRecipePart
isLoading: boolean
})
| 309 | } |
| 310 | |
| 311 | function 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> |
nothing calls this directly
no test coverage detected