feat: implement Lenis smooth scroll and animated stat counters

- Add Lenis smooth scroll library (Landing page only)
- Create SmoothScroll wrapper component with GSAP integration
- Implement animated stat counters with scroll-triggered count-up
- Add GSAP animations for stats section (40%, 5yrs, 15m)
- Update package.json with lenis dependency
This commit is contained in:
Satyam
2026-02-14 22:54:57 +05:30
parent 6d3b1c231a
commit e88e1e4da5
5 changed files with 230 additions and 52 deletions
+52 -49
View File
@@ -10,6 +10,7 @@ import AdminSchedule from './pages/AdminSchedule';
import CustomerProfile from './pages/CustomerProfile';
import LeaderboardPage from './pages/LeaderboardPage';
import ErrorBoundary from './components/ErrorBoundary';
import SmoothScroll from './components/SmoothScroll';
import { Toaster } from 'sonner';
import NotFound from './pages/NotFound';
@@ -35,59 +36,61 @@ function App() {
return (
<ErrorBoundary>
<Toaster position="top-right" richColors closeButton expand={true} />
<Routes>
<Route element={<Layout />}>
{/* Public Routes */}
<Route path="/" element={<Landing />} />
<Route path="/login" element={<Login />} />
<SmoothScroll>
<Routes>
<Route element={<Layout />}>
{/* Public Routes */}
<Route path="/" element={<Landing />} />
<Route path="/login" element={<Login />} />
{/* Protected Field Agent Routes */}
<Route path="/portal/profile" element={
<ProtectedRoute allowedRoles={['CUSTOMER']}>
<CustomerProfile />
</ProtectedRoute>
} />
{/* Protected Field Agent Routes */}
<Route path="/portal/profile" element={
<ProtectedRoute allowedRoles={['CUSTOMER']}>
<CustomerProfile />
</ProtectedRoute>
} />
<Route
path="/emp/fa/dashboard"
element={
<ProtectedRoute allowedRoles={['FIELD_AGENT', 'ADMIN']}>
<Dashboard />
</ProtectedRoute>
}
/>
<Route
path="/emp/fa/maps"
element={
<ProtectedRoute allowedRoles={['FIELD_AGENT', 'ADMIN']}>
<Maps />
</ProtectedRoute>
}
/>
<Route
path="/emp/fa/dashboard"
element={
<ProtectedRoute allowedRoles={['FIELD_AGENT', 'ADMIN']}>
<Dashboard />
</ProtectedRoute>
}
/>
<Route
path="/emp/fa/maps"
element={
<ProtectedRoute allowedRoles={['FIELD_AGENT', 'ADMIN']}>
<Maps />
</ProtectedRoute>
}
/>
{/* Protected Admin Routes */}
<Route
path="/admin/schedule"
element={
<ProtectedRoute allowedRoles={['ADMIN']}>
<AdminSchedule />
</ProtectedRoute>
}
/>
<Route
path="/admin/leaderboard"
element={
<ProtectedRoute allowedRoles={['ADMIN']}>
<LeaderboardPage />
</ProtectedRoute>
}
/>
</Route>
{/* Protected Admin Routes */}
<Route
path="/admin/schedule"
element={
<ProtectedRoute allowedRoles={['ADMIN']}>
<AdminSchedule />
</ProtectedRoute>
}
/>
{/* Catch all */}
<Route path="*" element={<NotFound />} />
</Routes>
<Route
path="/admin/leaderboard"
element={
<ProtectedRoute allowedRoles={['ADMIN']}>
<LeaderboardPage />
</ProtectedRoute>
}
/>
</Route>
{/* Catch all */}
<Route path="*" element={<NotFound />} />
</Routes>
</SmoothScroll>
</ErrorBoundary>
);
}