Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Refactor nested conditions in the starter pack wizard (#4652)

* Refactor condition nesting by screen

* Inline indexes

* More explicit conditions

authored by

dan and committed by
GitHub
3f20e2e3 83745c92

+91 -80
+91 -80
src/screens/StarterPack/Wizard/index.tsx
··· 393 393 state.currentStep === 'Profiles' 394 394 ? [profile, ...state.profiles] 395 395 : state.feeds 396 - const initialNamesIndex = state.currentStep === 'Profiles' ? 1 : 0 397 396 398 397 const isEditEnabled = 399 398 (state.currentStep === 'Profiles' && items.length > 1) || ··· 445 444 ))} 446 445 </View> 447 446 448 - {items.length === 0 /* Assuming this can only happen for feeds */ ? ( 449 - <View style={[a.gap_sm]}> 450 - <Text style={[a.font_bold, a.text_center, textStyles]}> 451 - <Trans>Add some feeds to your starter pack!</Trans> 452 - </Text> 447 + { 448 + state.currentStep === 'Profiles' ? ( 453 449 <Text style={[a.text_center, textStyles]}> 454 - <Trans>Search for feeds that you want to suggest to others.</Trans> 450 + { 451 + items.length < 2 ? ( 452 + <Trans> 453 + It's just you right now! Add more people to your starter pack 454 + by searching above. 455 + </Trans> 456 + ) : items.length === 2 ? ( 457 + <Trans> 458 + <Text style={[a.font_bold, textStyles]}>You</Text> and 459 + <Text> </Text> 460 + <Text style={[a.font_bold, textStyles]}> 461 + {getName(items[1] /* [0] is self, skip it */)}{' '} 462 + </Text> 463 + are included in your starter pack 464 + </Trans> 465 + ) : items.length > 2 ? ( 466 + <Trans context="profiles"> 467 + <Text style={[a.font_bold, textStyles]}> 468 + {getName(items[1] /* [0] is self, skip it */)},{' '} 469 + </Text> 470 + <Text style={[a.font_bold, textStyles]}> 471 + {getName(items[2])},{' '} 472 + </Text> 473 + and{' '} 474 + <Plural 475 + value={items.length - 2} 476 + one="# other" 477 + other="# others" 478 + />{' '} 479 + are included in your starter pack 480 + </Trans> 481 + ) : null /* Should not happen. */ 482 + } 455 483 </Text> 456 - </View> 457 - ) : ( 458 - <Text style={[a.text_center, textStyles]}> 459 - { 460 - items.length === 1 && state.currentStep === 'Profiles' ? ( 461 - <Trans> 462 - It's just you right now! Add more people to your starter pack by 463 - searching above. 464 - </Trans> 465 - ) : items.length === 1 && state.currentStep === 'Feeds' ? ( 466 - <Trans> 467 - <Text style={[a.font_bold, textStyles]}> 468 - {getName(items[initialNamesIndex])} 469 - </Text>{' '} 470 - is included in your starter pack 471 - </Trans> 472 - ) : items.length === 2 && state.currentStep === 'Profiles' ? ( 473 - <Trans> 474 - <Text style={[a.font_bold, textStyles]}>You</Text> and 475 - <Text> </Text> 476 - <Text style={[a.font_bold, textStyles]}> 477 - {getName(items[initialNamesIndex])}{' '} 478 - </Text> 479 - are included in your starter pack 480 - </Trans> 481 - ) : items.length === 2 && state.currentStep === 'Feeds' ? ( 482 - <Trans> 483 - <Text style={[a.font_bold, textStyles]}> 484 - {getName(items[initialNamesIndex])} 485 - </Text>{' '} 486 - and 487 - <Text> </Text> 488 - <Text style={[a.font_bold, textStyles]}> 489 - {getName(items[initialNamesIndex + 1])}{' '} 490 - </Text> 491 - are included in your starter pack 492 - </Trans> 493 - ) : items.length > 2 && state.currentStep === 'Profiles' ? ( 494 - <Trans context="profiles"> 495 - <Text style={[a.font_bold, textStyles]}> 496 - {getName(items[initialNamesIndex])},{' '} 497 - </Text> 498 - <Text style={[a.font_bold, textStyles]}> 499 - {getName(items[initialNamesIndex + 1])},{' '} 500 - </Text> 501 - and{' '} 502 - <Plural 503 - value={items.length - 2} 504 - one="# other" 505 - other="# others" 506 - />{' '} 507 - are included in your starter pack 508 - </Trans> 509 - ) : items.length > 2 && state.currentStep === 'Feeds' ? ( 510 - <Trans context="feeds"> 511 - <Text style={[a.font_bold, textStyles]}> 512 - {getName(items[initialNamesIndex])},{' '} 513 - </Text> 514 - <Text style={[a.font_bold, textStyles]}> 515 - {getName(items[initialNamesIndex + 1])},{' '} 516 - </Text> 517 - and{' '} 518 - <Plural 519 - value={items.length - 2} 520 - one="# other" 521 - other="# others" 522 - />{' '} 523 - are included in your starter pack 524 - </Trans> 525 - ) : null /* Should not happen */ 526 - } 527 - </Text> 528 - )} 484 + ) : state.currentStep === 'Feeds' ? ( 485 + items.length === 0 ? ( 486 + <View style={[a.gap_sm]}> 487 + <Text style={[a.font_bold, a.text_center, textStyles]}> 488 + <Trans>Add some feeds to your starter pack!</Trans> 489 + </Text> 490 + <Text style={[a.text_center, textStyles]}> 491 + <Trans> 492 + Search for feeds that you want to suggest to others. 493 + </Trans> 494 + </Text> 495 + </View> 496 + ) : ( 497 + <Text style={[a.text_center, textStyles]}> 498 + { 499 + items.length === 1 ? ( 500 + <Trans> 501 + <Text style={[a.font_bold, textStyles]}> 502 + {getName(items[0])} 503 + </Text>{' '} 504 + is included in your starter pack 505 + </Trans> 506 + ) : items.length === 2 ? ( 507 + <Trans> 508 + <Text style={[a.font_bold, textStyles]}> 509 + {getName(items[0])} 510 + </Text>{' '} 511 + and 512 + <Text> </Text> 513 + <Text style={[a.font_bold, textStyles]}> 514 + {getName(items[1])}{' '} 515 + </Text> 516 + are included in your starter pack 517 + </Trans> 518 + ) : items.length > 2 ? ( 519 + <Trans context="feeds"> 520 + <Text style={[a.font_bold, textStyles]}> 521 + {getName(items[0])},{' '} 522 + </Text> 523 + <Text style={[a.font_bold, textStyles]}> 524 + {getName(items[1])},{' '} 525 + </Text> 526 + and{' '} 527 + <Plural 528 + value={items.length - 2} 529 + one="# other" 530 + other="# others" 531 + />{' '} 532 + are included in your starter pack 533 + </Trans> 534 + ) : null /* Should not happen. */ 535 + } 536 + </Text> 537 + ) 538 + ) : null /* Should not happen. */ 539 + } 529 540 530 541 <View 531 542 style={[