# Property Detail Page - Documentation Index Created: 2026-04-11 Project: GoodGo Platform (Vietnamese Real Estate) --- ## ๐Ÿ“š Documentation Files ### 1. **PROPERTY_DETAIL_PAGE_ANALYSIS.md** (17KB, 553 lines) **Comprehensive Analysis** - Start here for complete understanding Contains: - โœ… Project overview (Next.js 15, Tailwind, Zustand) - โœ… Full page structure & architecture - โœ… Property images implementation - โœ… Image-related components (gallery, upload) - โœ… Project component structure & patterns - โœ… Next.js Image usage patterns - โœ… State management patterns (Zustand) - โœ… Available third-party libraries - โœ… Tailwind & design tokens - โœ… API & data types (PropertyMedia, ListingDetail) - โœ… Complete file structure - โœ… Key insights & best practices - โœ… Dependencies not present **Use when:** You need a deep understanding of the architecture --- ### 2. **PROPERTY_DETAIL_QUICK_REFERENCE.md** (13KB, 583 lines) **Code Snippets & Patterns** - Quick lookup guide Contains: - ๐ŸŽฏ Quick navigation (file paths, routes) - ๐Ÿ–ผ๏ธ Working with images (gallery, upload, data structure) - ๐ŸŽจ Styling patterns (aspect ratios, Tailwind classes) - ๐Ÿ”„ State management patterns (Zustand, local state) - ๐Ÿงฉ UI component patterns (Button, Badge, Card, Dialog) - ๐Ÿ“ฑ Responsive design patterns (breakpoints, grid) - ๐Ÿ”— Common imports (ready-to-copy imports) - ๐Ÿ“Š Data fetching examples - ๐ŸŒ Internationalization - ๐Ÿ” Security features - ๐Ÿงช Testing considerations - ๐Ÿš€ Performance optimization tips - ๐Ÿ“‹ Common tasks (add UI element, modify gallery) - ๐Ÿ› Common issues & solutions **Use when:** You need code snippets, patterns, or quick answers --- ### 3. **PROPERTY_DETAIL_COMPONENTS_MAP.md** (14KB, 601 lines) **Component Hierarchy & Architecture** - Visual reference Contains: - ๐ŸŽฏ Page component hierarchy (visual tree) - ๐Ÿ–ผ๏ธ Image Gallery component details - ๐Ÿ“ฑ Image Upload component details - ๐Ÿงฉ Related components (search results, property card) - ๐ŸŒ Data flow & API mapping - ๐ŸŽจ Styling architecture - ๐Ÿ“Š State management patterns - ๐Ÿ”— Import map & file references - ๐Ÿ“ˆ Component complexity levels - ๐Ÿš€ Performance considerations - ๐Ÿ”„ Navigation flows - ๐Ÿ“‹ Component checklists - ๐Ÿ› ๏ธ Maintenance guide **Use when:** You need to understand component relationships --- ## ๐ŸŽฏ Quick Start Guide ### For Understanding the Current Implementation: 1. Start with **PROPERTY_DETAIL_PAGE_ANALYSIS.md** sections: - Section 1: Property Detail Page Structure - Section 2: Property Images - Current Implementation - Section 3: Image-Related Components ### For Making Changes: 1. Check **PROPERTY_DETAIL_QUICK_REFERENCE.md**: - Find the relevant pattern or component - Copy the code snippet - Adapt to your needs 2. Reference **PROPERTY_DETAIL_COMPONENTS_MAP.md**: - Understand where component fits - Check data flow - Verify state management ### For Building New Image Features: 1. **PROPERTY_DETAIL_PAGE_ANALYSIS.md** - Section 5 (Next.js Image Usage) 2. **PROPERTY_DETAIL_QUICK_REFERENCE.md** - Section "Working with Images" 3. **PROPERTY_DETAIL_COMPONENTS_MAP.md** - "Image Gallery Component Details" --- ## ๐Ÿ“ Key File Locations ### Main Files - **Page**: `apps/web/app/[locale]/(public)/listings/[id]/page.tsx` - **Detail Client**: `apps/web/components/listings/listing-detail-client.tsx` - **Image Gallery**: `apps/web/components/listings/image-gallery.tsx` - **Image Upload**: `apps/web/components/listings/image-upload.tsx` - **Property Card**: `apps/web/components/search/property-card.tsx` ### Configuration - **Tailwind Config**: `apps/web/tailwind.config.ts` - **Next.js Config**: `apps/web/next.config.js` - **Global Styles**: `apps/web/app/globals.css` ### API & State - **Listings API**: `apps/web/lib/listings-api.ts` - **Auth Store**: `apps/web/lib/auth-store.ts` - **Comparison Store**: `apps/web/lib/comparison-store.ts` ### UI Components - **Button**: `apps/web/components/ui/button.tsx` - **Badge**: `apps/web/components/ui/badge.tsx` - **Card**: `apps/web/components/ui/card.tsx` - **Dialog**: `apps/web/components/ui/dialog.tsx` --- ## ๐Ÿ”‘ Key Technologies | Technology | Version | Purpose | |-----------|---------|---------| | Next.js | 15.5.14 | Full-stack framework (App Router) | | React | 18.3.0 | UI library | | Tailwind CSS | 3.4.0 | Styling with CSS variables | | Zustand | 5.0.12 | State management | | next-intl | 4.9.0 | i18n (Vietnamese/English) | | React Query | 5.96.2 | Server state management | | Lucide React | 1.7.0 | Icons | | Mapbox GL | 3.21.0 | Maps | | CVA | 0.7.1 | Component variants | --- ## โœจ Current Features ### Image Display - โœ… Responsive main image (16:9 aspect ratio) - โœ… Previous/Next navigation buttons - โœ… Image counter badge ("X / Total") - โœ… Horizontal scrollable thumbnails (64x64px) - โœ… Selected thumbnail highlighting - โœ… Empty state fallback - โœ… Next.js Image optimization (responsive sizes) - โœ… Lazy loading for thumbnails - โœ… Priority loading for first image ### Image Upload - โœ… Drag & drop support - โœ… Click to browse - โœ… File type validation (JPEG, PNG, WebP) - โœ… File size validation (10MB max) - โœ… Max 20 files limit - โœ… Preview grid - โœ… Delete button on hover - โœ… Cover photo indicator - โœ… URL cleanup on unmount ### Page Features - โœ… SEO metadata (Open Graph, Twitter Cards) - โœ… JSON-LD structured data - โœ… Breadcrumb navigation - โœ… Property details cards - โœ… Amenities list - โœ… Map integration - โœ… Contact sidebar (sticky) - โœ… Statistics (views, saves, inquiries) - โœ… Comparison feature integration --- ## ๐Ÿš€ NOT Currently Implemented - โŒ Image lightbox / modal zoom - โŒ Keyboard navigation (โ† โ†’) - โŒ Touch gestures / swipe support - โŒ Image carousel transitions - โŒ Upload progress bar - โŒ Multiple file upload progress - โŒ Image cropping / editing - โŒ Video playback - โŒ 360ยฐ panorama viewer - โŒ AI image analysis --- ## ๐Ÿ“‹ Data Structure Quick Reference ### PropertyMedia ```typescript { id: string; url: string; // HTTPS URL to image type: 'image' | 'video'; // Type filter order: number; // Sort order (0, 1, 2...) caption: string | null; // Optional caption } ``` ### ListingDetail (partial) ```typescript { id: string; property: { media: PropertyMedia[]; // Array of images/videos // ... other property fields }; // ... other listing fields } ``` --- ## ๐ŸŽ“ Learning Paths ### I want to understand how images work: 1. Read: **PROPERTY_DETAIL_PAGE_ANALYSIS.md** - Section 2 2. Review: **PROPERTY_DETAIL_QUICK_REFERENCE.md** - Section "Working with Images" 3. Check: `image-gallery.tsx` source code 4. Check: `next.config.js` image configuration ### I want to modify the gallery: 1. Check: **PROPERTY_DETAIL_QUICK_REFERENCE.md** - "Modify Image Gallery" 2. Edit: `apps/web/components/listings/image-gallery.tsx` 3. Test: Responsive behavior and state changes 4. Reference: **PROPERTY_DETAIL_COMPONENTS_MAP.md** - "Image Gallery Component Details" ### I want to add a new feature (like lightbox): 1. Choose library: **PROPERTY_DETAIL_PAGE_ANALYSIS.md** - Section 7 2. Install: Use `pnpm add package-name -F @goodgo/web` 3. Create: New component wrapper 4. Integrate: With existing ImageGallery 5. Test: Multiple images, responsive, edge cases ### I want to understand state management: 1. Read: **PROPERTY_DETAIL_PAGE_ANALYSIS.md** - Section 6 2. Review: **PROPERTY_DETAIL_QUICK_REFERENCE.md** - Section "State Management" 3. Check: `auth-store.ts` and `comparison-store.ts` ### I want to understand component patterns: 1. Read: **PROPERTY_DETAIL_PAGE_ANALYSIS.md** - Section 4 2. Check: **PROPERTY_DETAIL_COMPONENTS_MAP.md** - "Component Complexity Levels" 3. Review: **PROPERTY_DETAIL_QUICK_REFERENCE.md** - Section "UI Component Patterns" --- ## ๐Ÿ”— Navigation Between Docs ``` PROPERTY_DETAIL_PAGE_ANALYSIS.md โ”œโ”€ "Section 1" โ†’ Component structure โ†’ See PROPERTY_DETAIL_COMPONENTS_MAP.md โ”œโ”€ "Section 2" โ†’ Image implementation โ†’ See PROPERTY_DETAIL_QUICK_REFERENCE.md "Working with Images" โ”œโ”€ "Section 4" โ†’ Component patterns โ†’ See PROPERTY_DETAIL_QUICK_REFERENCE.md "UI Component Patterns" โ”œโ”€ "Section 5" โ†’ Next.js patterns โ†’ See PROPERTY_DETAIL_QUICK_REFERENCE.md "Using Images in Components" โ””โ”€ "Section 6" โ†’ State management โ†’ See PROPERTY_DETAIL_QUICK_REFERENCE.md "State Management" PROPERTY_DETAIL_QUICK_REFERENCE.md โ”œโ”€ Quick navigation โ†’ See PROPERTY_DETAIL_COMPONENTS_MAP.md for full tree โ”œโ”€ Working with images โ†’ See PROPERTY_DETAIL_PAGE_ANALYSIS.md Section 2 โ””โ”€ Common tasks โ†’ See PROPERTY_DETAIL_COMPONENTS_MAP.md "Maintenance Guide" PROPERTY_DETAIL_COMPONENTS_MAP.md โ”œโ”€ Page hierarchy โ†’ Overview โ†’ See PROPERTY_DETAIL_PAGE_ANALYSIS.md Section 1 โ”œโ”€ Gallery details โ†’ Implementation โ†’ See PROPERTY_DETAIL_PAGE_ANALYSIS.md Section 2 โ””โ”€ Import map โ†’ File paths โ†’ See PROPERTY_DETAIL_PAGE_ANALYSIS.md Section 10 ``` --- ## ๐Ÿ’ก Tips & Best Practices ### Image Optimization - Always use `sizes` prop with Next.js Image - Set `priority={true}` only for above-fold images - Use aspect ratio containers to prevent layout shift - Let Next.js handle format selection (WebP, AVIF) ### Component Design - Keep components focused (single responsibility) - Use CVA for variant management - Use composition over inheritance - Keep local state for UI, global for app state ### State Management - Use Zustand for global state (auth, comparison) - Use local React state for component UI (gallery index) - Use React Query for server state - Persist only essential data to localStorage ### Testing - Mock Next.js Image component - Test responsive behavior - Test edge cases (empty state, many images) - Mock Zustand stores --- ## ๐Ÿค Contributing Changes ### To modify the image gallery: 1. Create a new branch 2. Edit `apps/web/components/listings/image-gallery.tsx` 3. Test responsive behavior 4. Update type definitions if needed 5. Submit PR with description ### To add a new image feature: 1. Check PROPERTY_DETAIL_PAGE_ANALYSIS.md Section 12 (not present section) 2. Evaluate library options 3. Create component wrapper 4. Integrate without breaking existing features 5. Document changes ### To update documentation: 1. Edit corresponding `.md` file 2. Keep sections organized 3. Include code examples 4. Cross-reference other docs 5. Maintain consistent formatting --- ## ๐Ÿ“ž Quick Answers **Q: How do I display an image?** A: Use `next/image` with `fill` layout and aspect ratio container. See PROPERTY_DETAIL_QUICK_REFERENCE.md "Using Images in Components" **Q: How do I add state management?** A: Use Zustand for global, React.useState for local. See PROPERTY_DETAIL_PAGE_ANALYSIS.md Section 6 **Q: How do I add a lightbox?** A: Install library, create wrapper, integrate with gallery. See PROPERTY_DETAIL_QUICK_REFERENCE.md "Add Image Lightbox" **Q: Where are the UI components?** A: `apps/web/components/ui/`. See PROPERTY_DETAIL_PAGE_ANALYSIS.md Section 10 **Q: What image formats are allowed?** A: JPEG, PNG, WebP. See PROPERTY_DETAIL_QUICK_REFERENCE.md "File Upload Component" **Q: Is there keyboard navigation?** A: Not currently. See PROPERTY_DETAIL_COMPONENTS_MAP.md "Component Checklist" --- ## ๐Ÿ“Š Documentation Statistics | Metric | Value | |--------|-------| | Total Lines | 1,737 | | Analysis Document | 553 lines | | Quick Reference | 583 lines | | Components Map | 601 lines | | Code Examples | 50+ snippets | | Key Files Documented | 20+ | | Technologies Covered | 10+ | --- ## โœ… Checklist for New Developers - [ ] Read PROPERTY_DETAIL_PAGE_ANALYSIS.md (Sections 1-3) - [ ] Review PROPERTY_DETAIL_COMPONENTS_MAP.md (Page hierarchy) - [ ] Check key file locations (listed above) - [ ] Understand data structure (PropertyMedia, ListingDetail) - [ ] Review image gallery source code - [ ] Understand Zustand store pattern - [ ] Review UI component patterns - [ ] Familiarize with Tailwind classes - [ ] Test with local development environment - [ ] Bookmark this index for quick reference --- ## ๐ŸŽ“ Next Steps 1. **Understand Current State** - Read comprehensive analysis - Review component hierarchy - Check existing components 2. **Plan Your Changes** - Reference quick guide - Check code patterns - Verify data structure 3. **Implement & Test** - Use provided snippets - Follow patterns - Test responsively 4. **Document Updates** - Update this index if needed - Add to relevant sections - Maintain consistency --- **Last Updated:** 2026-04-11 **Documentation Version:** 1.0 **Status:** Complete & Comprehensive