# To AI Agent: Consolidate Map Top-Bar into Unified Profile/Guest Dropdown Menu and Create Profile Modals ## 1. Context & Architectural Refactor Goal We are optimizing the overcrowded top-bar control deck on the main Map Explorer page (`image_55397c.png`). Currently, a long row of utility buttons compromises mobile readability and viewport real estate. **Objective:** Consolidate all secondary control buttons into a single **Avatar/Guest Profile Button**. - When clicked, it will open an adaptive dropdown action menu (or a smooth mobile bottom-sheet) customized dynamically based on the session authentication state (**Authenticated Member** vs. **Anonymous Guest**). - Migrate the global "Language" and "Theme/Interface" buttons from the old top-bar directly into this new profile configuration lifecycle. --- ## 2. Authentication State Menus Specification ### 2.1. State A: Authenticated Member Dropdown (User is logged in) Display the user's fetched avatar image (`user.avatarUrl`). Clicking it reveals these options: 1. **Bảng điều khiển (Dashboard):** [Icon: LayoutDashboard] Redirects to user command center. *Note: Global language/theme quick-toggles are moved inside here/settings.* 2. **Cài đặt cá nhân (Settings):** [Icon: Settings] Opens the comprehensive **`ProfileSettingsModal.tsx`**. 3. **Tạo tour (Create Tour):** [Icon: Compass / MapPin] Launches the step-by-step route wizard. 4. **Báo cáo vi phạm (Report):** [Icon: ShieldAlert] Opens an infraction query form. --- (Visual Divider Line) --- 5. **Đăng xuất (Logout):** [Icon: LogOut] Standard session termination trigger. ### 2.2. State B: Anonymous Guest Dropdown (User is not logged in) Display a default vector Guest Icon. Clicking it reveals these options: 1. **Cài đặt (Settings):** [Icon: Sliders] Opens a lightweight configuration block allowing the Guest to dynamically choose **Ngôn ngữ** (Language) and **Giao diện** (Light/Dark Theme) stored in local storage cache. --- (Visual Divider Line) --- 2. **Đăng ký / Đăng nhập (Auth):** [Icon: LogIn] Spawns the central authentication entry shield modal. --- ## 3. Component Blueprints & Implementation Steps ### Step 1: Create the Unified Top-Bar Controller (`MapProfileDropdown.tsx`) Deploy this highly accessible responsive menu container. On screen dimensions mimicking mobile/Android viewports, it is highly recommended to render this as a slick **Bottom-Sheet Overlay** for better thumb-touch accuracy. ```typescript import React, { useState } from 'react'; import { useAuth } from '../context/AuthContext'; // Leverage existing state system import { LayoutDashboard, Settings, Compass, ShieldAlert, LogOut, LogIn, Sliders } from 'lucide-react'; export const MapProfileDropdown: React.FC<{ onOpenSettings: () => void }> = ({ onOpenSettings }) => { const { isAuthenticated, user, logout, loginRedirect } = useAuth(); const [isOpen, setIsOpen] = useState(false); return (
{/* TRIGGER BUTTON */} {/* DROPDOWN MENU / MOBILE BOTTOM SHEET LAYER */} {isOpen && ( <> {/* Backdrop screen closer click-catcher */}
setIsOpen(false)} />
{isAuthenticated ? ( /* --- LOGGED IN MENU OPTION ROW STACK --- */
) : ( /* --- GUEST ANONYMOUS MENU OPTION ROW STACK --- */
Tùy chỉnh nhanh
{/* Guest Quick Config Modules */}
Ngôn ngữ:
Giao diện:
)}
)}
); }; ### Step 2: Implement the Main Profile Modification Panel (ProfileSettingsModal.tsx) Create this secure responsive form layer. It must conform to absolute constraint logic (such as locking email changes) and include select toggles for app themes. import React, { useState } from 'react'; import { X, Camera } from 'lucide-react'; export const ProfileSettingsModal: React.FC<{ isOpen: boolean; onClose: () => void }> = ({ isOpen, onClose }) => { if (!isOpen) return null; return (
{/* Header bar */}
Chỉnh sửa hồ sơ cá nhân
{/* Scrollable Form Workspace Canvas */}
{/* Avatar Upload Container Component */}
Profile View
Chạm ảnh để tải lên hình đại diện mới
{/* Text Input Row Fields */}
{/* EMAIL COMPONENT BOUNDARY - CRITICAL REQUIREMENT: DISABLED CHANGING */}
{/* Security Password Mutation Stack */}
Thay đổi mật khẩu đăng nhập
{/* Core Configuration Toggles (Moved from Top-Bar into profile settings context) */}
{/* Action Bottom Save Trigger */}
); }; ## 4. Quality Verification & Acceptance Checklist for AI Agent [ ] Top-Bar Streamlining: Verify that old utility layout buttons boxed inside the top-bar (image_55397c.png) are safely stripped out, leaving only the Back button, Title, and the new single Dropdown icon asset. [ ] Cross-Platform Android Touch Targets: On mobile browser layouts, clicking the avatar must expand a screen-bottom popup block container (fixed bottom-0 left-0 right-0) ensuring an native-app tactile interaction. [ ] Email Immutability Guard: Inspect the editing form inside ProfileSettingsModal.tsx. Confirm the input node for the user's profile email address possess the disabled state attribute flag so typing alterations are completely locked out. [ ] System State Isolation: Confirm changes inside language and theme inputs successfully bubble triggers upwards to refresh local storage parameters instantly without dropping routing view connections.