# To AI Agent: Restructure Mobile Photo Viewer Layout with Fixed Viewport, Overlay Metadata, and Scrollable Comments ## 1. Context & Architectural UI Refactor We are redesigning the full-screen mobile photo inspector interface based on the visual layout annotated in `image.png`. The current structure is fragmented, causing layout instability when switching between images. ### Key Refactor Requirements: 1. **Fixed Image Viewport (Blue Zone):** Secure the photo viewport inside a strict, unyielding aspect-locked square container. Regardless of whether the active image is Landscape or Portrait, the container dimension must NOT snap, resize, or cause screen layout jumps. 2. **Geospatial Overlay (Red Arrow Destination):** Completely remove the static location metadata box from the bottom white panel. Relocate and render this location string as a clean, translucent text overlay pinned directly to the **bottom-left corner inside the image viewport**. 3. **Title Transformation (Green Arrow Destination):** Remove the text header segment "Lịch sử ảnh tại vị trí này (...)". In its place, dynamically render the active **Title of the Photo** (Tiêu đề của ảnh), serving as the primary text separator. 4. **Isolated Scrollable Comment Feed:** The entire lower comment zone must be configured to scroll dynamically. When users swipe up to read multiple comments, the layout thread must slide seamlessly underneath the fixed sticky image frame container (`z-20`). --- ## 2. Structural Layer Elevation (`z-index`) Matrix ┌────────────────────────────────────────────────────────┐ │ Tier 4: System Action Row & Closes (z-50) │ ➔ Native buttons (X, Close) ├────────────────────────────────────────────────────────┤ │ Tier 3: Fixed Photo Frame Viewport (z-20 / sticky) │ ➔ Aspect-Square Image Box │ └─► Sub-Layer: Location & Time Overlay (z-30) │ ➔ Pinned Bottom-Left on Image ├────────────────────────────────────────────────────────┤ │ Tier 2: Scrollable Comments Panel (z-10) │ ➔ Slides BEHIND Tier 3 when swiped └────────────────────────────────────────────────────────┘ --- ## 3. Code Refactoring Blueprint ### Step 1: Overhaul Layout Architecture (`MobilePhotoViewerModal.tsx`) Update or create the mobile component layout to enforce the absolute layer boundaries and fixed dimensions: ```typescript import React, { useState } from 'react'; import { X, MapPin, Calendar, Heart, Send } from 'lucide-react'; interface PhotoDetail { id: string; url: string; title: string; description?: string; latitude: number; longitude: number; locationName: string; capturedAt: string; likesCount: number; } export const MobilePhotoViewerModal: React.FC<{ photo: PhotoDetail; onClose: () => void }> = ({ photo, onClose }) => { const [commentInput, setCommentInput] = useState(''); return (
{/* TIER 4: FIXED SYSTEM ACTIONS CONTROL ROW (z-50) */}
{/* TIER 3: FIXED BLUE ZONE - ASPECT LOCKED PHOTO FRAME (z-20 / sticky) */}
{photo.title} {/* TIER 3.1: RELOCATED DYNAMIC LOCATION & TIMESTAMP OVERLAY (z-30) */}
{photo.locationName || "Vị trí không xác định"}
Ngày chụp: {new Date(photo.capturedAt).toLocaleDateString('vi-VN')}
{/* Floating Like Badge Counter */}
{photo.likesCount}
{/* TIER 2: SCROLLABLE CORE CONTENTS & COMMENTS PANEL (z-10) */} {/* This entire workspace container slides underneath the photo layout on swipe-up */}
{/* REPLACED HEADER ZONE: Title replaces the old History text strip */}

{photo.title || "Chưa có tiêu đề"}

{photo.description && (

{photo.description}

)}
{/* DYNAMIC COMMENTS FEED BLOCK */}
{/* Mock iteration loop representing user chat bubbles */} {[...Array(5)].map((_, index) => (
U
Thành viên YoTrip Vừa xong

Góc chụp đẹp quá, bối cảnh nhìn rất thoáng và đầy đủ ánh sáng tự nhiên!

))}
{/* STICKY BOTTOM INPUT SEND TRAY BAR */}
setCommentInput(e.target.value)} placeholder="Viết bình luận công khai..." className="flex-1 bg-slate-900 border border-slate-800 text-white rounded-xl p-3 text-xs outline-none focus:border-blue-500 transition-colors placeholder-slate-500" />
); }; ## 4. Quality Verification & Acceptance Criteria for AI Agent [ ] Dimension Stability Test: Switch back and forth between an ultra-wide panoramic photo and a 4:3 vertical shot. The parent blue container (aspect-square) must remain exactly static on the viewport layout, blocking size shifts. [ ] Overlay Check Validation: Verify the location marker coordinates box is completely wiped from the lower white profile zone and draws successfully on top of the image canvas at the bottom-left edge. [ ] Text Swap Alignment: Ensure the string text "Lịch sử ảnh tại vị trí này" is replaced completely by the active image title asset hook. [ ] Scroll Pass Inspection: Swipe up to read the text inside the comments panel. Verify the message rows pass behind the bottom border line of the image canvas container (z-20), while the close button at the top remains fully accessible.