Skip to content

Commit bf1fcbf

Browse files
feat: [Re-Discover] Polishing (#7155)
* Events analytics implemented * Removed unnecessary files * Add utm_source to the events links * Fixed events_section_opened event * Implemented analytics for Places section * Added live events counter in the start menu and in the sidebar * Apply feedback: Move EventsAnalytics and PlacesAnalytics inside ExplorePanelAnalytics * Apply feedback: Remove analytics dependency from ExplorePanelController and SidebarController * Update LiveEventsCounter.prefab * Polish counter * Normalise all the badges UI * Apply feedback: Remove leftovers * The "Featured" mark in the place card is based now on the highlighted property * Rename text in the places filter dropdown * Update PlaceCard.prefab * Apply feedback * Implemented "explore places" and "get a name" buttons * Size of the loading more spinner changed * Size of the loading more spinner changed (II) * Implemented event tooltip when hover on live tag * Implemented friend tooltip when hover on a friend thumbnail * Friends connected supported now in "Recent" section * Fixes in the creator row (event detail panel) * Remove the category title, since it is redundant * Implemented friend tooltip when hover on a friend thumbnail (events) * Categories re-ordered * Keeped always visible the counter title * Don't show players counter when it's zero * Update EventsCalendarController.cs * Update EventsCalendarController.cs * Small fixes * Fixes in the creator thumbnail (place detail panel) * Added gradient in the place card header when any tag appears * Update PlaceCard.prefab * Moved live events prior to today to the end of the live events * Update live tag red colour and event's name tooltip anchor position * Update events column mask and scrollbar handle * Sidebar + Explore menu animations integrated * Fix creator name color in the place detail card * Fixed live events prior to today * Added arrow in the bottom side of each day column * Update EventsCalendarView.cs * Update live events counter badge colour * Update EventsListView.prefab * Update mask * Patch highlighted event mask * Patch event's panel mask * Quit maskable property to events list scrollbar's handle * Added discover FF into FeaturesRegistry singleton * Change order of the Places / Events buttons * Apply feedback from Claude --------- Co-authored-by: Romina Marchetti <rma.marchetti@gmail.com>
1 parent 4d1b9e2 commit bf1fcbf

File tree

337 files changed

+25605
-6339
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

337 files changed

+25605
-6339
lines changed

Explorer/Assets/DCL/Events/EventCardBigView.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using DCL.EventsApi;
44
using DCL.PlacesAPIService;
55
using DCL.Profiles;
6-
using DCL.UI;
76
using DCL.UI.Profiles.Helpers;
87
using DG.Tweening;
98
using System.Collections.Generic;

Explorer/Assets/DCL/Events/EventCardView.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public struct FriendsConnectedThumbnail
6565
{
6666
public GameObject root;
6767
public ProfilePictureView picture;
68+
public HoverableTooltip tooltip;
6869
}
6970
}
7071

@@ -187,6 +188,7 @@ public virtual void Configure(EventDTO eventInfo, ThumbnailLoader thumbnailLoade
187188
if (!friendExists) continue;
188189
Profile.CompactInfo friendInfo = friends[i];
189190
friendsThumbnails[i].picture.Setup(profileRepositoryWrapper!, friendInfo);
191+
friendsThumbnails[i].tooltip.Configure(friendInfo.Name);
190192
}
191193
}
192194
}

Explorer/Assets/DCL/Events/EventsByDayController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ private async UniTask LoadEventsAsync(DateTime fromDate, CancellationToken ct)
131131
placesIds.Add(eventInfo.place_id);
132132
}
133133

134-
Result<PlacesData.IPlacesAPIResponse> placesResponse = await placesAPIService.GetPlacesByIdsAsync(placesIds, ct)
134+
Result<PlacesData.IPlacesAPIResponse> placesResponse = await placesAPIService.GetDestinationsByIdsAsync(placesIds, ct)
135135
.SuppressToResultAsync(ReportCategory.COMMUNITIES);
136136

137137
if (placesResponse.Success)

Explorer/Assets/DCL/Events/EventsCalendarController.cs

Lines changed: 53 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public class EventsCalendarController : IDisposable
2222
{
2323
public event Action<EventDTO>? EventCardClicked;
2424

25+
private const string GET_LIVE_EVENTS_ERROR_MESSAGE = "There was an error loading live events. Please try again.";
2526
private const string GET_EVENTS_ERROR_MESSAGE = "There was an error loading events. Please try again.";
2627

2728
private readonly EventsCalendarView view;
@@ -188,7 +189,7 @@ private async UniTask CheckHighlightedBannerAsync(DateTime fromDate, Cancellatio
188189
placesIds.Add(eventInfo.place_id);
189190
}
190191

191-
Result<PlacesData.IPlacesAPIResponse> placesResponse = await placesAPIService.GetPlacesByIdsAsync(placesIds, ct)
192+
Result<PlacesData.IPlacesAPIResponse> placesResponse = await placesAPIService.GetDestinationsByIdsAsync(placesIds, ct)
192193
.SuppressToResultAsync(ReportCategory.COMMUNITIES);
193194

194195
if (placesResponse.Success)
@@ -204,6 +205,18 @@ private async UniTask LoadEventsAsync(DateTime fromDate, int numberOfDays, Cance
204205
view.ClearAllEvents();
205206
view.SetAsLoading(true);
206207

208+
Result<IReadOnlyList<EventDTO>> liveEventsResults = await eventsApiService.GetEventsAsync(ct, onlyLiveEvents: true)
209+
.SuppressToResultAsync(ReportCategory.EVENTS);
210+
211+
if (ct.IsCancellationRequested)
212+
return;
213+
214+
if (!liveEventsResults.Success)
215+
{
216+
NotificationsBusController.Instance.AddNotification(new ServerErrorNotification(GET_LIVE_EVENTS_ERROR_MESSAGE));
217+
return;
218+
}
219+
207220
var fromDateUtc = fromDate.AddDays(-1).ToUniversalTime();
208221
var toDateUtc = fromDate.AddDays(numberOfDays).AddSeconds(-1).ToUniversalTime();
209222
Result<IReadOnlyList<EventDTO>> eventsResult = await eventsApiService.GetEventsByDateRangeAsync(fromDateUtc, toDateUtc, true, ct)
@@ -218,27 +231,45 @@ private async UniTask LoadEventsAsync(DateTime fromDate, int numberOfDays, Cance
218231
return;
219232
}
220233

234+
List<EventDTO> eventsList = new ();
235+
if (fromDate.Date == DateTime.Today)
236+
{
237+
// In case we have live events prior to today, they have to be also shown on the calendar, so we add them into the current results
238+
foreach (EventDTO liveEventInfo in liveEventsResults.Value)
239+
{
240+
DateTime eventLocalDate = DateTimeOffset.Parse(liveEventInfo.next_start_at).ToLocalTime().DateTime;
241+
if (eventLocalDate.Date < fromDate)
242+
eventsList.Add(liveEventInfo);
243+
}
244+
}
245+
foreach (EventDTO eventInfo in eventsResult.Value)
246+
{
247+
DateTime eventLocalDate = DateTimeOffset.Parse(eventInfo.next_start_at).ToLocalTime().DateTime;
248+
if (eventLocalDate.Date >= fromDate)
249+
eventsList.Add(eventInfo);
250+
}
221251

222252
using PoolExtensions.Scope<List<List<EventDTO>>> eventsGroupedByDay = EVENTS_GROUPED_BY_DAY_POOL.AutoScope();
223253
for (var i = 0; i < numberOfDays; i++)
224254
eventsGroupedByDay.Value.Add(new List<EventDTO>());
225255

226-
if (eventsResult.Value.Count > 0)
256+
if (eventsList.Count > 0)
227257
{
228-
eventsStateService.AddEvents(eventsResult.Value);
258+
eventsStateService.AddEvents(eventsList);
229259

230260
List<string> placesIds = new ();
231-
foreach (EventDTO eventInfo in eventsResult.Value)
261+
List<EventDTO> liveEventsPriorToToday = new ();
262+
foreach (EventDTO eventInfo in eventsList)
232263
{
233264
DateTime eventLocalDate = DateTimeOffset.Parse(eventInfo.next_start_at).ToLocalTime().DateTime;
234265

235266
for (var i = 0; i < numberOfDays; i++)
236267
{
237-
// Live events are always shown on the calendar
268+
// Live events prior to today have to be also shown on the calendar
238269
bool isTodayColumn = i == 0;
239-
if (eventInfo.live && fromDate.Date == DateTime.Today && isTodayColumn)
270+
if (eventInfo.live && fromDate.Date == DateTime.Today && isTodayColumn && eventLocalDate.Date < fromDate)
240271
{
241-
eventsGroupedByDay.Value[i].Add(eventInfo);
272+
liveEventsPriorToToday.Add(eventInfo);
242273
break;
243274
}
244275

@@ -253,7 +284,21 @@ private async UniTask LoadEventsAsync(DateTime fromDate, int numberOfDays, Cance
253284
placesIds.Add(eventInfo.place_id);
254285
}
255286

256-
Result<PlacesData.IPlacesAPIResponse> placesResponse = await placesAPIService.GetPlacesByIdsAsync(placesIds, ct)
287+
// Live events prior to today have to be placed after the today's live events
288+
if (liveEventsPriorToToday.Count > 0)
289+
{
290+
var todayLiveEventsCount = 0;
291+
foreach (EventDTO eventInfo in eventsGroupedByDay.Value[0])
292+
{
293+
if (eventInfo.live)
294+
todayLiveEventsCount++;
295+
}
296+
297+
foreach (EventDTO liveEventInfo in liveEventsPriorToToday)
298+
eventsGroupedByDay.Value[0].Insert(todayLiveEventsCount++, liveEventInfo);
299+
}
300+
301+
Result<PlacesData.IPlacesAPIResponse> placesResponse = await placesAPIService.GetDestinationsByIdsAsync(placesIds, ct)
257302
.SuppressToResultAsync(ReportCategory.COMMUNITIES);
258303

259304
if (placesResponse.Success)

Explorer/Assets/DCL/Events/EventsCalendarView.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,12 @@ private struct EventListConfiguration
4949
public HoverableUiElement hoverableUiElement;
5050
public CanvasGroup scrollBarCanvasGroup;
5151
public SkeletonLoadingView skeletonLoadingView;
52+
public GameObject moreEventsArrow;
53+
public ScrollRect scrollRect;
5254
}
5355

5456
private readonly Dictionary<int, List<string>> currentEventsIds = new ();
57+
private readonly Dictionary<int, float> currentOccupancies = new (5);
5558
private DateTime currentFromDate;
5659
private int currentNumberOfDaysShowed;
5760
private EventsStateService eventsStateService = null!;
@@ -65,6 +68,13 @@ private void Awake()
6568

6669
foreach (EventsDaySelectorButton daySelectorButton in daySelectorButtons)
6770
daySelectorButton.ButtonClicked += OnDaySelectorButtonClicked;
71+
72+
for (var i = 0; i < eventsLists.Count; i++)
73+
{
74+
int eventsListIndex = i;
75+
EventListConfiguration eventListConfiguration = eventsLists[eventsListIndex];
76+
eventListConfiguration.scrollRect.onValueChanged.AddListener(_ => OnEventsScrollValueChanged(eventsListIndex));
77+
}
6878
}
6979

7080
private void OnDestroy()
@@ -74,6 +84,9 @@ private void OnDestroy()
7484

7585
foreach (EventsDaySelectorButton daySelectorButton in daySelectorButtons)
7686
daySelectorButton.ButtonClicked -= OnDaySelectorButtonClicked;
87+
88+
foreach (EventListConfiguration eventListConfiguration in eventsLists)
89+
eventListConfiguration.scrollRect.onValueChanged.RemoveAllListeners();
7790
}
7891

7992
public void SetDependencies(
@@ -243,6 +256,8 @@ private void FillWithEmptyCards(IReadOnlyList<EventDTO> events, int eventsListIn
243256
}
244257
}
245258

259+
currentOccupancies[eventsListIndex] = columnOccupancyValue;
260+
246261
int numberOfEmptyCards = columnOccupancyValue switch
247262
{
248263
<= 0.5f => 3,
@@ -254,6 +269,12 @@ private void FillWithEmptyCards(IReadOnlyList<EventDTO> events, int eventsListIn
254269
currentEventsIds[eventsListIndex].Add(string.Empty);
255270
}
256271

272+
private void OnEventsScrollValueChanged(int eventsListIndex)
273+
{
274+
bool scrollIsNotAtTheBottom = eventsLists[eventsListIndex].scrollRect.verticalNormalizedPosition > 0.01f && currentOccupancies[eventsListIndex] > 1.5f;
275+
eventsLists[eventsListIndex].moreEventsArrow.SetActive(scrollIsNotAtTheBottom);
276+
}
277+
257278
private void OnDaySelectorButtonClicked(DateTime date) =>
258279
DaySelectorButtonClicked?.Invoke(date);
259280

0 commit comments

Comments
 (0)