12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- import { SingleEvent } from '@api/events';
- import { Text } from 'react-native';
- export const renderSpotsText = (e: SingleEvent) => {
- if (e.type === 4) {
- if (e.interested > 0 && e.joining > 0) {
- return (
- <Text>
- <Text style={{ fontWeight: '700' }}>{e.interested}</Text> interested /{' '}
- <Text style={{ fontWeight: '700' }}>{e.joining}</Text> going
- </Text>
- );
- } else if (e.interested > 0) {
- return (
- <Text>
- <Text style={{ fontWeight: '700' }}>{e.interested}</Text> interested
- </Text>
- );
- } else if (e.joining > 0) {
- return (
- <Text>
- <Text style={{ fontWeight: '700' }}>{e.joining}</Text> going
- </Text>
- );
- }
- }
- // if (e.type === 1 && e.joining > 0) {
- if (e.joining > 0) {
- return (
- <Text>
- <Text style={{ fontWeight: '700' }}>{e.joining}</Text> going
- </Text>
- );
- }
- switch (e.registrations_info) {
- case 2:
- return (
- <Text>
- <Text style={{ fontWeight: '700' }}>{(e.capacity ?? 0) - (e.available ?? 0)}</Text> total
- spots available
- </Text>
- );
- case 3:
- return (
- <Text>
- <Text style={{ fontWeight: '700' }}>{e.available}</Text> spots remaining
- </Text>
- );
- case 4:
- return (
- <Text>
- <Text style={{ fontWeight: '700' }}>{e.participants}</Text> Nomads interested
- </Text>
- );
- case 5:
- return (
- <Text>
- <Text style={{ fontWeight: '700' }}>
- {e.available ?? (e.capacity ?? 0) - (e.participants ?? 0)} / {e.capacity}
- </Text>{' '}
- spots available
- </Text>
- );
- default:
- return '';
- }
- };
|