utils.tsx 948 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import { SingleEvent } from '@api/events';
  2. import { Text } from 'react-native';
  3. export const renderSpotsText = (e: SingleEvent) => {
  4. switch (e.registrations_info) {
  5. case 2:
  6. return (
  7. <Text>
  8. <Text style={{ fontWeight: '700' }}>{(e.capacity ?? 0) - (e.available ?? 0)}</Text> total
  9. spots available
  10. </Text>
  11. );
  12. case 3:
  13. return (
  14. <Text>
  15. <Text style={{ fontWeight: '700' }}>{e.available}</Text> spots remaining
  16. </Text>
  17. );
  18. case 4:
  19. return (
  20. <Text>
  21. <Text style={{ fontWeight: '700' }}>{e.participants}</Text> Nomads joined
  22. </Text>
  23. );
  24. case 5:
  25. return (
  26. <Text>
  27. <Text style={{ fontWeight: '700' }}>
  28. {e.available ?? (e.capacity ?? 0) - (e.participants ?? 0)} / {e.capacity}
  29. </Text>{' '}
  30. spots available
  31. </Text>
  32. );
  33. default:
  34. return '';
  35. }
  36. };