Flow Meter Page Sidebar Refactor Design
Overview
Refactor the Flow Meter page to use a sidebar layout similar to the Heat Map page. The sidebar will contain filters and action buttons, while the main content area displays site cards, charts, and tables.
Layout Structure
┌─────────────────────────────────────────────────────────────┐
│ PageBreadcrumb: "Flow Meter" │
├──────────────────┬──────────────────────────────────────────┤
│ │ │
│ LEFT SIDEBAR │ MAIN CONTENT AREA │
│ (lg:w-96) │ (flex-1) │
│ │ │
│ Flow Meter │ ┌─ Sites Header + Sort dropdown ──────┐ │
│ Controls │ └─────────────────────────────────────┘ │
│ │ ┌─ Site Cards Grid (3 cols max) ─────┐ │
│ ┌─ Filters ────┐ │ │ [Card] [Card] [Card] │ │
│ │ Mine Site │ │ │ [Card] [Card] ... │ │
│ │ Date Range │ │ └─────────────────────────────────────┘ │
│ └──────────────┘ │ │
│ │ ┌─ Tank Levels ──────────────────────┐ │
│ ┌─ Actions ────┐ │ └─────────────────────────────────────┘ │
│ │ Manage Sites │ │ │
│ │ Refresh Data │ │ ┌─ Charts & Tables ──────────────────┐ │
│ │ Manage Refill│ │ │ (for selected site) │ │
│ │ Calibration │ │ └─────────────────────────────────────┘ │
│ │ Export Report│ │ │
│ └──────────────┘ │ │
└──────────────────┴──────────────────────────────────────────┘Sidebar Details
Header
- Title: "Flow Meter Controls"
- Icon:
solar:drop-bold-duotone(water drop) - Subtitle: "Adjust filters and actions"
Filters Section
Grouped in a bordered container with header "Data Filters":
Mine Site Selector
- Icon:
solar:buildings-2-bold-duotone - Dropdown showing flow_meter_enabled sites
- Shows currently selected site name below
- Icon:
Date Range Selector
- Icon:
solar:calendar-bold-duotone - Preset dropdown (Today, Last 7 Days, Last 30 Days, etc.)
- Start/End date inputs
- Display current range as text below
- Icon:
Actions Section
Grouped in a bordered container with header "Actions":
Manage Sites - Opens SiteVisibilityManager modal
- Icon:
solar:settings-bold-duotone - Style: Secondary button (border, not filled)
- Icon:
Refresh Data - Opens ScraperConfigModal
- Icon:
solar:refresh-bold-duotone - Style: Primary button (blue filled)
- Shows loading spinner when refreshing
- Icon:
Manage Refills - Link to
/refill-management- Icon:
solar:settings-bold-duotone - Style: Green button
- Icon:
Calibration Reminder - Link to
/calibration-reminders- Icon:
solar:compass-bold-duotone - Style: Amber button
- Icon:
Export Report - Triggers chart export
- Icon:
solar:download-bold-duotone - Style: Primary button
- Only enabled when a site with data is selected
- Icon:
Main Content Area
Sites Header Row
- Left: "Sites" title (h2, text-xl font-semibold)
- Right: Sort dropdown with options:
- Name (A-Z)
- Name (Z-A)
- Usage (High to Low)
- Usage (Low to High)
- Events (Most to Least)
- Events (Least to Most)
Site Cards Grid
- Responsive columns:
- xl: 3 columns (
xl:grid-cols-3) - lg: 2 columns (
lg:grid-cols-2) - md and below: 1 column
- xl: 3 columns (
- Uses existing
SiteSummaryCardcomponent - Click behavior unchanged (selects site)
Below Cards (unchanged)
- Tank Level Display
- Daily Usage Chart
- Timeline Chart
- Records Table with pagination
- Usage Gap Analysis
Responsive Behavior
Desktop (lg breakpoint and above)
- Sidebar: fixed width
lg:w-96(384px) - Main content:
flex-1fills remaining space - Both areas scroll independently
- Layout:
flex-row
Tablet/Mobile (below lg)
- Sidebar: full width, stacked above content
- Sidebar:
max-h-[40vh]withoverflow-y-auto - Main content: full width below
- Layout:
flex-col
Container
- Overall height:
h-[calc(100vh-180px)] - Minimum height:
min-h-[600px]
Implementation Notes
Files to Modify
src/app/(admin)/(pages)/flow-meter/index.tsx- Main page refactor
Components to Reference
src/app/(admin)/(pages)/heatmap/index.tsx- Sidebar layout patternsrc/components/ui/DateRangeSelector.tsx- Date range component
Key Changes
- Wrap content in flex container
- Create sidebar div with controls
- Move DateRangeSelector to sidebar
- Move action buttons to sidebar
- Adjust site cards grid columns
- Keep Sort dropdown in main area
No Changes Required
SiteSummaryCardcomponent- Chart components
- Modal components
- Data fetching logic
- State management