5.4 KiB
5.4 KiB
Review System
Function 1: HomePage – Homepage displaying featured rooms
Objective
Create a homepage interface introducing featured rooms, banner and navigation to room list.
Detailed Tasks
- Route: /
- Banner:
GET /api/banners?position=home- If no banner → display default image.
- Can use Carousel or static image.
- Featured rooms:
GET /api/rooms?featured=true- Display 4–6 rooms using RoomCard component.
- "View all rooms" button → navigate to /rooms.
- Loading skeleton while waiting for data.
Expected Results
- Homepage displays banner and featured room list clearly.
- When no banner → fallback image is displayed.
- Featured rooms load from API, limited to 4–6 rooms.
- Smooth UX, with skeleton when loading.
- "View all rooms" button navigates correctly to /rooms.
Function 2: RoomListPage – Room List & Filters
Objective
Display room list, allow users to filter by type, price, number of guests and pagination.
Detailed Tasks
- Route: /rooms
- Filters (RoomFilter component):
- Filter fields: room type, min–max price, number of guests.
- On submit → call API:
GET /api/rooms?type=&minPrice=&maxPrice=&capacity=&page= - Save filters to URL query.
- "Reset" button to clear all filters.
- Pagination (Pagination component).
- Display list using RoomCard.
Expected Results
- Room list displays accurately according to filter.
- Filters work smoothly, can reset easily.
- Pagination displays correct page numbers.
- Filters saved in URL (helps reload without losing).
- Responsive interface, easy to read, no breakage.
Function 3: RoomDetailPage – Room Details & Reviews
Objective
Create a complete room detail page with information, images, amenities and review section.
Detailed Tasks
- Route: /rooms/:id
- Content section:
- Room information (images, description, price, amenities)
- RoomGallery: Image carousel
- RoomAmenities: amenities list
- "Book Now" button → navigate to /booking/:roomId
- Review Section:
- Get approved review list:
GET /api/rooms/:id/reviews - If user has booked the room before:
POST /api/reviews
- Get approved review list:
- RatingStars + ReviewForm component.
- If not logged in → display "Please login to review".
- Calculate average review rating.
- Loading skeleton when waiting for reviews.
Expected Results
- Displays complete images, description, room amenities.
- Carousel works smoothly.
- Reviews display correctly, with average star rating.
- Users who have booked can write reviews (after approval).
- "Book Now" button navigates correctly to booking form.
- Skeleton displays when waiting for data.
Function 4: SearchRoom – Find available rooms
Objective
Allow users to find available rooms by date and room type.
Detailed Tasks
- Search form (on HomePage or RoomListPage):
- Input: arrival date (from), departure date (to), room type.
- API:
GET /api/rooms/available?from=&to=&type= - Validation:
- from < to
- from not less than today.
- Results:
- Display list using RoomCard.
- If no results → "No matching rooms found".
- Use react-datepicker or react-day-picker.
- Loading spinner while searching.
Expected Results
- Room search form works, validates correctly.
- When clicking search → displays available room list.
- If no results → friendly message.
- Loading displays clearly while waiting.
- Search by date & room type accurately from backend.
Function 5: Wishlist – Favorites list
Objective
Allow users to add, remove or view favorite rooms list.
Detailed Tasks
- API:
POST /api/favorites/:roomId # Add DELETE /api/favorites/:roomId # Remove GET /api/favorites # Get favorites list - UI:
- FavoriteButton (icon ❤️):
- If favorited → filled red
- If not → gray border
- Tooltip: "Add to favorites" / "Remove from favorites"
- FavoriteButton (icon ❤️):
- If not logged in:
- Save temporarily in localStorage (guestFavorites)
- When logged in → sync with server.
- Toast notification when adding/removing favorites.
Expected Results
- ❤️ button works correctly (red / gray).
- Unauthenticated users can still save favorites temporarily.
- When logged in → list syncs with backend.
- Toast displays "Added to favorites" / "Removed from favorites".
- API works correctly, no 401 error when logged in validly.
Function 6: UI/UX & Performance Optimization
Objective
Improve user experience, optimize loading speed and responsive display capability.
Detailed Tasks
- Loading skeleton when fetching rooms or reviews.
- Debounce when entering price to avoid continuous API calls.
- Infinite scroll (optional) instead of pagination.
- Responsive layout:
- Desktop: 3–4 columns
- Tablet: 2 columns
- Mobile: 1 column
- Empty states:
- No rooms → display illustration + "No matching rooms found" message.
- No reviews → "Be the first to review!".
- Toast notifications when adding favorites, submitting reviews, network errors.
Expected Results
- Page works smoothly, has skeleton when waiting for data.
- Fast response speed (debounce works).
- Responsive on all screen sizes.
- Empty states display friendly.
- Toast notifications clear, friendly UX.