|
@@ -104,6 +104,7 @@ const EventScreen = ({ route }: { route: any }) => {
|
|
|
|
|
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
const [tooltipUser, setTooltipUser] = useState<number | null>(null);
|
|
const [tooltipUser, setTooltipUser] = useState<number | null>(null);
|
|
|
|
+ const [tooltipInterested, setTooltipInterested] = useState<number | null>(null);
|
|
|
|
|
|
const [event, setEvent] = useState<EventData | null>(null);
|
|
const [event, setEvent] = useState<EventData | null>(null);
|
|
const [registrationInfo, setRegistrationInfo] = useState<{ color: string; name: string } | null>(
|
|
const [registrationInfo, setRegistrationInfo] = useState<{ color: string; name: string } | null>(
|
|
@@ -112,6 +113,7 @@ const EventScreen = ({ route }: { route: any }) => {
|
|
const [filteredParticipants, setFilteredParticipants] = useState<EventData['participants_data']>(
|
|
const [filteredParticipants, setFilteredParticipants] = useState<EventData['participants_data']>(
|
|
[]
|
|
[]
|
|
);
|
|
);
|
|
|
|
+ const [filteredInterested, setFilteredInterested] = useState<EventData['participants_data']>([]);
|
|
const [maxVisibleParticipants, setMaxVisibleParticipants] = useState(0);
|
|
const [maxVisibleParticipants, setMaxVisibleParticipants] = useState(0);
|
|
const [maxVisibleParticipantsWithGap, setMaxVisibleParticipantsWithGap] = useState(0);
|
|
const [maxVisibleParticipantsWithGap, setMaxVisibleParticipantsWithGap] = useState(0);
|
|
const [joined, setJoined] = useState<0 | 1>(0);
|
|
const [joined, setJoined] = useState<0 | 1>(0);
|
|
@@ -162,7 +164,10 @@ const EventScreen = ({ route }: { route: any }) => {
|
|
const partisipantsWidth = contentWidth / 2;
|
|
const partisipantsWidth = contentWidth / 2;
|
|
setMaxVisibleParticipants(Math.floor(partisipantsWidth / 22));
|
|
setMaxVisibleParticipants(Math.floor(partisipantsWidth / 22));
|
|
setMaxVisibleParticipantsWithGap(Math.floor(partisipantsWidth / 32));
|
|
setMaxVisibleParticipantsWithGap(Math.floor(partisipantsWidth / 32));
|
|
- setFilteredParticipants(data.data.participants_data);
|
|
|
|
|
|
+ setFilteredParticipants(
|
|
|
|
+ data.data.type === 4 ? data.data.participants_approved_data : data.data.participants_data
|
|
|
|
+ );
|
|
|
|
+ setFilteredInterested(data.data.participants_data);
|
|
|
|
|
|
setRegistrationInfo(() => {
|
|
setRegistrationInfo(() => {
|
|
if (data.data.full) {
|
|
if (data.data.full) {
|
|
@@ -389,7 +394,7 @@ const EventScreen = ({ route }: { route: any }) => {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- if (event.settings.type !== 1) {
|
|
|
|
|
|
+ if (event.settings.type !== 1 && event.settings.type !== 4) {
|
|
setModalInfo({
|
|
setModalInfo({
|
|
visible: true,
|
|
visible: true,
|
|
type: 'success',
|
|
type: 'success',
|
|
@@ -588,6 +593,50 @@ const EventScreen = ({ route }: { route: any }) => {
|
|
|
|
|
|
const formatEventDate = (event: EventData) => {
|
|
const formatEventDate = (event: EventData) => {
|
|
if (event.date_from && event.date_to) {
|
|
if (event.date_from && event.date_to) {
|
|
|
|
+ if (event.date_tentative) {
|
|
|
|
+ const dateFrom = moment(event.date_from, 'YYYY-MM').format('MMM YYYY');
|
|
|
|
+ const dateTo = moment(event.date_to, 'YYYY-MM').format('MMM YYYY');
|
|
|
|
+
|
|
|
|
+ if (dateFrom === dateTo) {
|
|
|
|
+ return (
|
|
|
|
+ <View>
|
|
|
|
+ <Text
|
|
|
|
+ style={{
|
|
|
|
+ fontSize: getFontSize(12),
|
|
|
|
+ fontWeight: '600',
|
|
|
|
+ color: Colors.DARK_BLUE
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ {dateFrom}
|
|
|
|
+ </Text>
|
|
|
|
+ </View>
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ return (
|
|
|
|
+ <View>
|
|
|
|
+ <Text
|
|
|
|
+ style={{
|
|
|
|
+ fontSize: getFontSize(12),
|
|
|
|
+ fontWeight: '600',
|
|
|
|
+ color: Colors.DARK_BLUE,
|
|
|
|
+ flex: 1
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ {dateFrom} -{' '}
|
|
|
|
+ </Text>
|
|
|
|
+ <Text
|
|
|
|
+ style={{
|
|
|
|
+ fontSize: getFontSize(12),
|
|
|
|
+ fontWeight: '600',
|
|
|
|
+ color: Colors.DARK_BLUE,
|
|
|
|
+ flex: 1
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ {dateTo}
|
|
|
|
+ </Text>
|
|
|
|
+ </View>
|
|
|
|
+ );
|
|
|
|
+ }
|
|
return (
|
|
return (
|
|
<View>
|
|
<View>
|
|
<Text
|
|
<Text
|
|
@@ -615,6 +664,21 @@ const EventScreen = ({ route }: { route: any }) => {
|
|
} else {
|
|
} else {
|
|
let date = moment(event.date, 'YYYY-MM-DD').format('DD MMMM YYYY');
|
|
let date = moment(event.date, 'YYYY-MM-DD').format('DD MMMM YYYY');
|
|
|
|
|
|
|
|
+ if (event.date_tentative) {
|
|
|
|
+ return (
|
|
|
|
+ <View>
|
|
|
|
+ <Text
|
|
|
|
+ style={{
|
|
|
|
+ fontSize: getFontSize(12),
|
|
|
|
+ fontWeight: '600',
|
|
|
|
+ color: Colors.DARK_BLUE
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ {moment(event.date, 'YYYY-MM').format('MMM YYYY')}
|
|
|
|
+ </Text>
|
|
|
|
+ </View>
|
|
|
|
+ );
|
|
|
|
+ }
|
|
return (
|
|
return (
|
|
<View>
|
|
<View>
|
|
<Text
|
|
<Text
|
|
@@ -736,7 +800,9 @@ const EventScreen = ({ route }: { route: any }) => {
|
|
.catch((err) => console.error('Error opening event location', err));
|
|
.catch((err) => console.error('Error opening event location', err));
|
|
};
|
|
};
|
|
|
|
|
|
- const photoUrl = API_HOST + '/webapi/events/get-main-photo/' + event.id;
|
|
|
|
|
|
+ const photoUrl = event.photo
|
|
|
|
+ ? API_HOST + '/webapi/events/get-main-photo/' + event.id
|
|
|
|
+ : API_HOST + '/static/img/events/trip.webp';
|
|
|
|
|
|
return (
|
|
return (
|
|
<View style={styles.container}>
|
|
<View style={styles.container}>
|
|
@@ -759,7 +825,8 @@ const EventScreen = ({ route }: { route: any }) => {
|
|
showsVerticalScrollIndicator={false}
|
|
showsVerticalScrollIndicator={false}
|
|
removeClippedSubviews={false}
|
|
removeClippedSubviews={false}
|
|
>
|
|
>
|
|
- {event.settings.type === 1 && photosForRegion.length > 0 ? (
|
|
|
|
|
|
+ {(event.settings.type === 1 || event.settings.type === 4) &&
|
|
|
|
+ photosForRegion.length > 0 ? (
|
|
<ImageCarousel
|
|
<ImageCarousel
|
|
photos={photosForRegion as PhotosData[]}
|
|
photos={photosForRegion as PhotosData[]}
|
|
activeIndex={activeIndex}
|
|
activeIndex={activeIndex}
|
|
@@ -861,7 +928,7 @@ const EventScreen = ({ route }: { route: any }) => {
|
|
flex: 1
|
|
flex: 1
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
- {event.settings.address1}
|
|
|
|
|
|
+ {event.address1}
|
|
</Text>
|
|
</Text>
|
|
</View>
|
|
</View>
|
|
|
|
|
|
@@ -892,7 +959,7 @@ const EventScreen = ({ route }: { route: any }) => {
|
|
</TouchableOpacity>
|
|
</TouchableOpacity>
|
|
)}
|
|
)}
|
|
|
|
|
|
- {event.settings.registrations_info !== 1 && (
|
|
|
|
|
|
+ {event.settings.registrations_info !== 1 && event.type !== 4 && (
|
|
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 4, flex: 1 }}>
|
|
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 4, flex: 1 }}>
|
|
<NomadsIcon fill={Colors.DARK_BLUE} height={20} width={20} />
|
|
<NomadsIcon fill={Colors.DARK_BLUE} height={20} width={20} />
|
|
<Text
|
|
<Text
|
|
@@ -979,7 +1046,7 @@ const EventScreen = ({ route }: { route: any }) => {
|
|
{filteredParticipants.length > 0 ? (
|
|
{filteredParticipants.length > 0 ? (
|
|
<View style={{ gap: 8, flex: 1 }}>
|
|
<View style={{ gap: 8, flex: 1 }}>
|
|
<Text style={[styles.travelSeriesTitle, { fontSize: 12 }]}>
|
|
<Text style={[styles.travelSeriesTitle, { fontSize: 12 }]}>
|
|
- Participants{event.participants ? ` (${event.participants})` : ''}
|
|
|
|
|
|
+ Participants{` (${filteredParticipants.length})`}
|
|
</Text>
|
|
</Text>
|
|
|
|
|
|
<View style={[styles.statItem, { justifyContent: 'flex-start' }]}>
|
|
<View style={[styles.statItem, { justifyContent: 'flex-start' }]}>
|
|
@@ -1043,9 +1110,13 @@ const EventScreen = ({ route }: { route: any }) => {
|
|
...([
|
|
...([
|
|
NAVIGATION_PAGES.PARTICIPANTS_LIST,
|
|
NAVIGATION_PAGES.PARTICIPANTS_LIST,
|
|
{
|
|
{
|
|
- participants: event.participants_full_data,
|
|
|
|
|
|
+ participants:
|
|
|
|
+ event.type === 4
|
|
|
|
+ ? event.participants_approved_full_data
|
|
|
|
+ : event.participants_full_data,
|
|
eventId: event.id,
|
|
eventId: event.id,
|
|
- isHost: event.settings.host_profile === +currentUserId
|
|
|
|
|
|
+ isHost: event.settings.host_profile === +currentUserId,
|
|
|
|
+ isTrip: event.type === 4
|
|
}
|
|
}
|
|
] as never)
|
|
] as never)
|
|
)
|
|
)
|
|
@@ -1063,9 +1134,97 @@ const EventScreen = ({ route }: { route: any }) => {
|
|
)}
|
|
)}
|
|
</View>
|
|
</View>
|
|
|
|
|
|
|
|
+ {filteredInterested.length > 0 && event.type === 4 && (
|
|
|
|
+ <View>
|
|
|
|
+ <View style={{ gap: 8, flex: 1 }}>
|
|
|
|
+ <Text style={[styles.travelSeriesTitle, { fontSize: 12 }]}>
|
|
|
|
+ Interested{` (${filteredInterested.length})`}
|
|
|
|
+ </Text>
|
|
|
|
+
|
|
|
|
+ <View style={[styles.statItem, { justifyContent: 'flex-start' }]}>
|
|
|
|
+ <View style={styles.userImageContainer}>
|
|
|
|
+ {(filteredInterested.length > maxVisibleParticipants
|
|
|
|
+ ? filteredInterested.slice(0, maxVisibleParticipants - 1)
|
|
|
|
+ : filteredInterested
|
|
|
|
+ ).map((user, index) => (
|
|
|
|
+ <Tooltip
|
|
|
|
+ isVisible={tooltipInterested === index}
|
|
|
|
+ content={
|
|
|
|
+ <TouchableOpacity
|
|
|
|
+ onPress={() => {
|
|
|
|
+ setTooltipInterested(null);
|
|
|
|
+ navigation.navigate(
|
|
|
|
+ ...([
|
|
|
|
+ NAVIGATION_PAGES.PUBLIC_PROFILE_VIEW,
|
|
|
|
+ { userId: user.uid }
|
|
|
|
+ ] as never)
|
|
|
|
+ );
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ <Text>{user.name}</Text>
|
|
|
|
+ </TouchableOpacity>
|
|
|
|
+ }
|
|
|
|
+ contentStyle={{ backgroundColor: Colors.FILL_LIGHT }}
|
|
|
|
+ placement="top"
|
|
|
|
+ onClose={() => setTooltipInterested(null)}
|
|
|
|
+ key={index}
|
|
|
|
+ backgroundColor="transparent"
|
|
|
|
+ >
|
|
|
|
+ <TouchableOpacity
|
|
|
|
+ style={index !== 0 ? { marginLeft: -10 } : {}}
|
|
|
|
+ onPress={() => setTooltipInterested(index)}
|
|
|
|
+ >
|
|
|
|
+ {user.avatar ? (
|
|
|
|
+ <Image
|
|
|
|
+ key={index}
|
|
|
|
+ source={{ uri: API_HOST + user.avatar }}
|
|
|
|
+ style={[styles.userImage]}
|
|
|
|
+ />
|
|
|
|
+ ) : (
|
|
|
|
+ <AvatarWithInitials
|
|
|
|
+ text={
|
|
|
|
+ user.name?.split(' ')[0][0] + (user.name?.split(' ')[1][0] ?? '')
|
|
|
|
+ }
|
|
|
|
+ flag={API_HOST + user?.flag}
|
|
|
|
+ size={28}
|
|
|
|
+ fontSize={12}
|
|
|
|
+ borderColor={Colors.DARK_LIGHT}
|
|
|
|
+ borderWidth={1}
|
|
|
|
+ />
|
|
|
|
+ )}
|
|
|
|
+ </TouchableOpacity>
|
|
|
|
+ </Tooltip>
|
|
|
|
+ ))}
|
|
|
|
+ <TouchableOpacity
|
|
|
|
+ style={styles.userCountContainer}
|
|
|
|
+ onPress={() =>
|
|
|
|
+ navigation.navigate(
|
|
|
|
+ ...([
|
|
|
|
+ NAVIGATION_PAGES.PARTICIPANTS_LIST,
|
|
|
|
+ {
|
|
|
|
+ participants: event.participants_full_data,
|
|
|
|
+ eventId: event.id,
|
|
|
|
+ isHost: event.settings.host_profile === +currentUserId,
|
|
|
|
+ interested: true,
|
|
|
|
+ isTrip: event.type === 4
|
|
|
|
+ }
|
|
|
|
+ ] as never)
|
|
|
|
+ )
|
|
|
|
+ }
|
|
|
|
+ >
|
|
|
|
+ <View style={styles.dots}></View>
|
|
|
|
+ <View style={styles.dots}></View>
|
|
|
|
+ <View style={styles.dots}></View>
|
|
|
|
+ </TouchableOpacity>
|
|
|
|
+ </View>
|
|
|
|
+ </View>
|
|
|
|
+ </View>
|
|
|
|
+ </View>
|
|
|
|
+ )}
|
|
|
|
+
|
|
{/* TO DO */}
|
|
{/* TO DO */}
|
|
{event.settings.host_profile === +currentUserId &&
|
|
{event.settings.host_profile === +currentUserId &&
|
|
- event.settings.type === 1 &&
|
|
|
|
|
|
+ (event.settings.type === 1 || event.settings.type === 4) &&
|
|
!event.archived ? (
|
|
!event.archived ? (
|
|
<TouchableOpacity
|
|
<TouchableOpacity
|
|
style={{
|
|
style={{
|
|
@@ -1085,15 +1244,25 @@ const EventScreen = ({ route }: { route: any }) => {
|
|
{ token, event_id: event.id },
|
|
{ token, event_id: event.id },
|
|
{
|
|
{
|
|
onSuccess: (res) => {
|
|
onSuccess: (res) => {
|
|
- navigation.navigate(
|
|
|
|
- ...([
|
|
|
|
- NAVIGATION_PAGES.CREATE_EVENT,
|
|
|
|
- {
|
|
|
|
- eventId: event.id,
|
|
|
|
- event: res
|
|
|
|
- }
|
|
|
|
- ] as never)
|
|
|
|
- );
|
|
|
|
|
|
+ event.settings.type === 4
|
|
|
|
+ ? navigation.navigate(
|
|
|
|
+ ...([
|
|
|
|
+ NAVIGATION_PAGES.CREATE_SHARED_TRIP,
|
|
|
|
+ {
|
|
|
|
+ eventId: event.id,
|
|
|
|
+ event: res
|
|
|
|
+ }
|
|
|
|
+ ] as never)
|
|
|
|
+ )
|
|
|
|
+ : navigation.navigate(
|
|
|
|
+ ...([
|
|
|
|
+ NAVIGATION_PAGES.CREATE_EVENT,
|
|
|
|
+ {
|
|
|
|
+ eventId: event.id,
|
|
|
|
+ event: res
|
|
|
|
+ }
|
|
|
|
+ ] as never)
|
|
|
|
+ );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
)
|
|
)
|