4.3 KiB
4.3 KiB
Plan to Implement Like-Based Photo Selection, Displays, and Mobile UI Enhancements
Highlight photos with more likes across different displays and optimize the public photo modal's mobile UI layout.
Proposed Changes
1. Public Photo Modal Mobile UI Layout & Fixes
[MODIFY] PublicPhotoModal.tsx
- Fixed Photo and Scrollable Comments:
- Remove parent modal container vertical scrolling on mobile (
overflow-y-auto->overflow-hidden). - Set the parent container layout to
flex flex-col h-[90vh] md:h-[85vh] overflow-hidden. - The photo container (
h-[45vh]) and mobile uploader details container will remain static/fixed at the top. - Set the comments panel container to
flex-1 min-h-0 flex flex-coland the comments list toflex-1 overflow-y-autoso only the comments scroll on mobile.
- Remove parent modal container vertical scrolling on mobile (
- Remove Comments Header on Mobile:
- Add responsive classes to the comment header (
hidden md:block) to hide the "Bình luận cộng đồng" / "bình luận từ cộng đồng" title banner on mobile, maximizing space.
- Add responsive classes to the comment header (
- Style Uploader Details:
- Reduce font size and remove bold style for the "Người đăng" (Uploader name) elements.
- Desktop uploader text: change from
font-semiboldtotext-xs. - Mobile uploader text: change from
text-sm font-semibold text-whitetotext-xs text-slate-200.
- Safe Area Like Button:
- Shift the absolute top position of the Like button to account for safe area insets:
top-[calc(1rem+env(safe-area-inset-top,0px))]. This prevents browser address bars or notches from clipping it.
- Shift the absolute top position of the Like button to account for safe area insets:
2. Landing Page Like-Based Sorting
[MODIFY] LandingPage.tsx
- In
fetchPublicPhotos, sort the fetchedpublicPhotosarray based on the number of likes (likedUserIds.length) in descending order. - This ensures:
- The cycling background images naturally present the most-liked public photos first.
- The gallery previews at the bottom display the top 8 most-liked photos from the community.
3. Tour Banner Image Selection
[MODIFY] TourDetailPage.tsx
- Replace the simple first-photo check for
coverImagewith a function that retrieves the photo with the most likes in the tour. - If there are no photos in the tour, fall back to the default Unsplash placeholder cover image.
4. Auto-Select Most Liked Photo for Display
[MODIFY] ExploreMap.tsx
- In
groupedPhotosmemo, sort each location's photo array so that photos with the most likes appear first. - This ensures the map pin thumbnail bubble displays the most-liked photo at that coordinate, and clicking it displays that photo as the default.
[MODIFY] MyPhotosPage.tsx
- Define a helper function
getMostLikedPhoto(photos)that returns the photo with the most likes. - In the
useEffectthat updatesselectedPhotoForDisplay, use this helper to default-select the most liked photo from the filtered list.
[MODIFY] TourDetailPage.tsx
- Define the same helper function
getMostLikedPhoto(photos). - Update the default photo selection inside both
useEffecthooks (the one listening tofilteredPhotosand the one listening tocurrentTour/legschanges) to select the photo with the most likes using this helper.
Verification Plan
Automated Tests
- Run
npm run build -w frontendto verify that there are no compilation or syntax errors.
Manual Verification
- Mobile Public Photo Modal:
- View a photo on mobile browser/emulator.
- Verify only the comments scroll, and the header label is hidden.
- Verify the Like button position is adjusted.
- Verify the Uploader text size is reduced and normal.
- Landing Page background & gallery:
- Open the landing page. Verify that the previews show the most liked photos first.
- Tour Banner:
- Verify the tour banner updates to show the photo with the most likes.
- Map Marker / Photo Timeline default:
- Click map marker and verify most liked photo is active by default.