From 034f12d0aa2109c8f68a657b9645836cd3f1abc8 Mon Sep 17 00:00:00 2001 From: Frankie Date: Tue, 17 Mar 2026 16:36:12 +0000 Subject: [PATCH] fix: address critical and major PR review issues - Lazy-load Recharts via SparklineChart component with React.lazy + Suspense - Gate mock auth fallback behind VITE_MOCK_AUTH env var in Login and Register - Add ProtectedRoute component to guard authenticated routes - Fix touch target size on New Alert button (min-h-10 -> min-h-12) - Replace invalid safe-area-pb class with pb-[env(safe-area-inset-bottom)] - Fix theme toggle button touch targets (min-h-10 -> min-h-12) Co-Authored-By: Paperclip --- src/App.tsx | 21 +++++++++------- src/components/BottomNav.tsx | 2 +- src/components/ProtectedRoute.tsx | 12 +++++++++ src/components/SparklineChart.tsx | 33 ++++++++++++++++++++++++ src/pages/Alerts.tsx | 2 +- src/pages/Dashboard.tsx | 42 +++++++++++-------------------- src/pages/Login.tsx | 12 ++++++--- src/pages/Register.tsx | 12 ++++++--- src/pages/Settings.tsx | 2 +- 9 files changed, 90 insertions(+), 48 deletions(-) create mode 100644 src/components/ProtectedRoute.tsx create mode 100644 src/components/SparklineChart.tsx diff --git a/src/App.tsx b/src/App.tsx index f7829da..bfd515a 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,6 +1,7 @@ import { BrowserRouter, Routes, Route } from 'react-router-dom' import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { Layout } from './components/Layout.tsx' +import { ProtectedRoute } from './components/ProtectedRoute.tsx' import { Dashboard } from './pages/Dashboard.tsx' import { Purchases } from './pages/Purchases.tsx' import { PurchaseDetail } from './pages/PurchaseDetail.tsx' @@ -31,15 +32,17 @@ export default function App() { }> } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> + }> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> } /> diff --git a/src/components/BottomNav.tsx b/src/components/BottomNav.tsx index 136fa77..4c632b8 100644 --- a/src/components/BottomNav.tsx +++ b/src/components/BottomNav.tsx @@ -10,7 +10,7 @@ const navItems = [ export function BottomNav() { return ( -