Files
Deep-Package-Inspection/docs/log/2026-07-30-1445-mobile-ui-overhaul.md
T

3.4 KiB

Iteration Log: Mobile UI & UX Responsiveness Overhaul

Timestamp: 2026-07-30 14:45 Trigger: Direct Request / Mobile UI Audit & Overhaul (/goal)


1. Summary of Request & Scope

The user highlighted critical visual and UX defects on mobile screens (< 768px):

  • 3D Globe map getting cut off horizontally/vertically.
  • Layout elements tumpang tindih (overlapping).
  • KPI cards taking excessive vertical space (1200px+).
  • Floating action buttons obscuring the mobile bottom navigation bar.
  • Table card views showing generic fallback headers ("Field 1", "Field 2").
  • Modal dialogs breaking/wrapping tabs unreadably on mobile devices.

2. Steps Taken & Architectural Changes

  1. Root Viewport Configuration (src/app/layout.tsx):

    • Added explicit Viewport export (width: "device-width", initialScale: 1, maximumScale: 1, userScalable: false) ensuring mobile browsers correctly scale elements to physical device pixels.
  2. 3D Globe Map Responsiveness (src/components/ui/GlobeMap.tsx):

    • Replaced fixed 500px height with responsive breakpoint heights (h-[320px] sm:h-[400px] md:h-[480px]).
    • Added dynamic camera initial altitude (altitude: isMobile ? 2.5 : 1.8) to fit the entire sphere comfortably within mobile screens.
    • Changed container overflow to overflow-hidden to prevent Three.js WebGL canvas clipping outside card boundaries.
  3. KPI Cards Mobile Grid (src/components/dashboard/KPICards.tsx):

    • Changed grid from 1-column stack to a responsive 2-column grid on mobile (grid-cols-2 sm:grid-cols-3 xl:grid-cols-6 gap-2.5 sm:gap-4).
    • Added responsive typography (text-base sm:text-xl md:text-[25px]) and padding (p-3 sm:p-4) so all 6 KPI cards fit compactly into 3 short rows.
  4. Top Widgets & Chart Legends (src/components/dashboard/TopWidgets.tsx):

    • Set column span to col-span-full lg:col-span-3.
    • Updated PieChart container layout to flex-col sm:flex-row items-center gap-3, allowing chart legends to wrap underneath cleanly on narrow mobile viewports.
  5. Floating Navigation & FAB Alignment (src/components/ui/HelpCenterFAB.tsx & DashboardLayout.tsx):

    • Repositioned HelpCenterFAB button on mobile to bottom-20 lg:bottom-6 right-4 lg:right-6 so it floats above MobileBottomBar.
    • Increased main container bottom padding to pb-28 lg:pb-8 to guarantee bottom bar clearance.
  6. Data Table Mobile Card Headers & 256-Line Threshold Refactoring (DataTable.tsx, DataTableMobileCards.tsx, DataTableDesktopView.tsx):

    • Refactored DataTableMobileCards.tsx to render exact column header nodes directly, removing generic "Field X" text.
    • Extracted DataTableDesktopView.tsx from DataTable.tsx to comply strictly with Rule 3 (256-line LOC threshold rule), reducing DataTable.tsx from 266 lines to 184 lines.
  7. Modal & Dialog Responsiveness (src/components/ui/DeviceDetailModal.tsx):

    • Updated modal container to h-[92vh] sm:h-[85vh] and p-2 sm:p-4.
    • Changed tab bar to horizontal scrollable view (overflow-x-auto whitespace-nowrap shrink-0 flex-nowrap) preventing multi-line tab wrapping.

3. Outcome & Build Integrity

  • Build Status: Verified via npm run build.
  • Visual Standards: Compliance with AGENTS.md §9 (Nol Scrollbar Horizontal pada page level, no text clipping, elegant dark theme).
  • LOC Standard: Compliance with AGENTS.md §3 (All modified files strictly < 256 LOC).