2025-11-12 17:50:44 +01:00
|
|
|
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
|
2025-11-21 21:27:03 +01:00
|
|
|
import { Toaster } from 'react-hot-toast';
|
2025-12-05 22:28:00 +01:00
|
|
|
import { useEffect } from 'react';
|
2025-11-12 17:50:44 +01:00
|
|
|
import { AuthProvider, useAuth } from './contexts/AuthContext';
|
2025-12-05 22:28:00 +01:00
|
|
|
import { initGA } from './utils/analytics';
|
|
|
|
|
import usePageTracking from './hooks/usePageTracking';
|
2025-11-15 16:36:55 +01:00
|
|
|
import HomePage from './pages/HomePage';
|
2025-11-12 17:50:44 +01:00
|
|
|
import LoginPage from './pages/LoginPage';
|
|
|
|
|
import RegisterPage from './pages/RegisterPage';
|
feat: add email verification, password reset, and WSDC integration (Phase 1.5)
Backend features:
- AWS SES email service with HTML templates
- Email verification with dual method (link + 6-digit PIN code)
- Password reset workflow with secure tokens
- WSDC API proxy for dancer lookup and auto-fill registration
- Extended User model with verification and WSDC fields
- Email verification middleware for protected routes
Frontend features:
- Two-step registration with WSDC ID lookup
- Password strength indicator component
- Email verification page with code input
- Password reset flow (request + reset pages)
- Verification banner for unverified users
- Updated authentication context and API service
Testing:
- 65 unit tests with 100% coverage of new features
- Tests for auth utils, email service, WSDC controller, and middleware
- Integration tests for full authentication flows
- Comprehensive mocking of AWS SES and external APIs
Database:
- Migration: add WSDC fields (firstName, lastName, wsdcId)
- Migration: add email verification fields (token, code, expiry)
- Migration: add password reset fields (token, expiry)
Documentation:
- Complete Phase 1.5 documentation
- Test suite documentation and best practices
- Updated session context with new features
2025-11-13 15:47:54 +01:00
|
|
|
import VerifyEmailPage from './pages/VerifyEmailPage';
|
|
|
|
|
import ForgotPasswordPage from './pages/ForgotPasswordPage';
|
|
|
|
|
import ResetPasswordPage from './pages/ResetPasswordPage';
|
2025-11-21 21:12:25 +01:00
|
|
|
import DashboardPage from './pages/DashboardPage';
|
2025-11-12 17:50:44 +01:00
|
|
|
import EventsPage from './pages/EventsPage';
|
|
|
|
|
import EventChatPage from './pages/EventChatPage';
|
2025-12-03 19:52:00 +01:00
|
|
|
import EventDetailsPage from './pages/admin/EventDetailsPage';
|
2025-11-14 14:11:24 +01:00
|
|
|
import EventCheckinPage from './pages/EventCheckinPage';
|
2025-11-12 17:50:44 +01:00
|
|
|
import MatchChatPage from './pages/MatchChatPage';
|
2025-11-14 19:22:23 +01:00
|
|
|
import MatchesPage from './pages/MatchesPage';
|
2025-11-12 17:50:44 +01:00
|
|
|
import RatePartnerPage from './pages/RatePartnerPage';
|
|
|
|
|
import HistoryPage from './pages/HistoryPage';
|
2025-11-13 20:26:49 +01:00
|
|
|
import ProfilePage from './pages/ProfilePage';
|
2025-11-13 21:03:37 +01:00
|
|
|
import PublicProfilePage from './pages/PublicProfilePage';
|
feat(admin): implement activity logs frontend page (Phase 6-7)
Complete implementation of admin activity logs dashboard with real-time
streaming capabilities. Admin users can now monitor all system activity
through a comprehensive web interface.
Features:
- Stats dashboard with 4 key metrics (total logs, unique users, failures, 24h activity)
- Category breakdown visualization with color-coded badges
- Advanced filtering (date range, category, action type, username, success/failure)
- Paginated log table (50 entries per page) with sort by timestamp
- Real-time streaming toggle using Socket.IO
- Color-coded action badges (blue=auth, green=event, purple=match, red=admin, yellow=chat)
- Admin-only access with automatic redirect for non-admin users
- Responsive design for mobile and desktop
Frontend Changes:
- Created ActivityLogsPage.jsx (600+ lines) with complete UI implementation
- Added 3 admin API methods to api.js (getActivityLogs, getActivityLogActions, getActivityLogStats)
- Added /admin/activity-logs route to App.jsx
- Added admin navigation link to Navbar (desktop & mobile) with Shield icon
- Only visible to users with isAdmin flag
Implementation Details:
- Uses getSocket() from socket service for real-time updates
- Joins 'admin_activity_logs' Socket.IO room on streaming enable
- Receives 'activity_log_entry' events and prepends to table (first page only)
- Comprehensive error handling and loading states
- Empty states for no data
- Clean disconnect handling when streaming disabled
Testing:
- Build successful (no errors)
- Ready for manual testing and verification
Phase 8 (Testing) remains for manual verification of all features.
2025-12-02 23:17:19 +01:00
|
|
|
import ActivityLogsPage from './pages/admin/ActivityLogsPage';
|
feat(contact): add contact form with admin panel and navbar dropdown
Database changes:
- Added ContactMessage model to Prisma schema
- Fields: userId, username, firstName, lastName, email, subject, message, status, ipAddress
- Status enum: new, read, resolved
- Relation to User model
Backend changes:
- Added POST /api/public/contact endpoint for form submissions
- Works for both authenticated and non-authenticated users
- Validation for email, subject (3-255 chars), message (10-5000 chars)
- Activity logging for submissions
- Added admin endpoints:
- GET /api/admin/contact-messages - list with filtering by status
- GET /api/admin/contact-messages/:id - view single message (auto-marks as read)
- PATCH /api/admin/contact-messages/:id/status - update status
- DELETE /api/admin/contact-messages/:id - delete message
Frontend changes:
- Created ContactPage at /contact route
- For non-logged-in users: firstName, lastName, email, subject, message fields
- For logged-in users: auto-fills username, shows only email, subject, message
- Character counter for message (max 5000)
- Success screen with auto-redirect to homepage
- Created ContactMessagesPage at /admin/contact-messages
- Two-column layout: message list + detail view
- Filter by status (all, new, read, resolved)
- View message details with sender info and IP address
- Update status and delete messages
- Added admin dropdown menu to Navbar
- Desktop: dropdown with Activity Logs and Contact Messages
- Mobile: expandable submenu
- Click outside to close on desktop
- ChevronDown icon rotates when open
Note: CAPTCHA integration planned for future enhancement
2025-12-05 17:15:25 +01:00
|
|
|
import ContactMessagesPage from './pages/admin/ContactMessagesPage';
|
|
|
|
|
import ContactPage from './pages/ContactPage';
|
2025-12-05 18:30:44 +01:00
|
|
|
import AboutUsPage from './pages/AboutUsPage';
|
2025-12-05 18:33:25 +01:00
|
|
|
import HowItWorksPage from './pages/HowItWorksPage';
|
2025-12-03 20:27:51 +01:00
|
|
|
import NotFoundPage from './pages/NotFoundPage';
|
feat: add email verification, password reset, and WSDC integration (Phase 1.5)
Backend features:
- AWS SES email service with HTML templates
- Email verification with dual method (link + 6-digit PIN code)
- Password reset workflow with secure tokens
- WSDC API proxy for dancer lookup and auto-fill registration
- Extended User model with verification and WSDC fields
- Email verification middleware for protected routes
Frontend features:
- Two-step registration with WSDC ID lookup
- Password strength indicator component
- Email verification page with code input
- Password reset flow (request + reset pages)
- Verification banner for unverified users
- Updated authentication context and API service
Testing:
- 65 unit tests with 100% coverage of new features
- Tests for auth utils, email service, WSDC controller, and middleware
- Integration tests for full authentication flows
- Comprehensive mocking of AWS SES and external APIs
Database:
- Migration: add WSDC fields (firstName, lastName, wsdcId)
- Migration: add email verification fields (token, code, expiry)
- Migration: add password reset fields (token, expiry)
Documentation:
- Complete Phase 1.5 documentation
- Test suite documentation and best practices
- Updated session context with new features
2025-11-13 15:47:54 +01:00
|
|
|
import VerificationBanner from './components/common/VerificationBanner';
|
2025-11-19 20:59:26 +01:00
|
|
|
import InstallPWA from './components/pwa/InstallPWA';
|
2025-12-05 22:22:23 +01:00
|
|
|
import CookieConsent from './components/common/CookieConsent';
|
2025-11-12 17:50:44 +01:00
|
|
|
|
feat: add email verification, password reset, and WSDC integration (Phase 1.5)
Backend features:
- AWS SES email service with HTML templates
- Email verification with dual method (link + 6-digit PIN code)
- Password reset workflow with secure tokens
- WSDC API proxy for dancer lookup and auto-fill registration
- Extended User model with verification and WSDC fields
- Email verification middleware for protected routes
Frontend features:
- Two-step registration with WSDC ID lookup
- Password strength indicator component
- Email verification page with code input
- Password reset flow (request + reset pages)
- Verification banner for unverified users
- Updated authentication context and API service
Testing:
- 65 unit tests with 100% coverage of new features
- Tests for auth utils, email service, WSDC controller, and middleware
- Integration tests for full authentication flows
- Comprehensive mocking of AWS SES and external APIs
Database:
- Migration: add WSDC fields (firstName, lastName, wsdcId)
- Migration: add email verification fields (token, code, expiry)
- Migration: add password reset fields (token, expiry)
Documentation:
- Complete Phase 1.5 documentation
- Test suite documentation and best practices
- Updated session context with new features
2025-11-13 15:47:54 +01:00
|
|
|
// Protected Route Component with Verification Banner
|
2025-11-12 17:50:44 +01:00
|
|
|
const ProtectedRoute = ({ children }) => {
|
|
|
|
|
const { isAuthenticated, loading } = useAuth();
|
|
|
|
|
|
|
|
|
|
if (loading) {
|
|
|
|
|
return (
|
|
|
|
|
<div className="min-h-screen flex items-center justify-center">
|
|
|
|
|
<div className="text-lg text-gray-600">Loading...</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!isAuthenticated) {
|
|
|
|
|
return <Navigate to="/login" replace />;
|
|
|
|
|
}
|
|
|
|
|
|
feat: add email verification, password reset, and WSDC integration (Phase 1.5)
Backend features:
- AWS SES email service with HTML templates
- Email verification with dual method (link + 6-digit PIN code)
- Password reset workflow with secure tokens
- WSDC API proxy for dancer lookup and auto-fill registration
- Extended User model with verification and WSDC fields
- Email verification middleware for protected routes
Frontend features:
- Two-step registration with WSDC ID lookup
- Password strength indicator component
- Email verification page with code input
- Password reset flow (request + reset pages)
- Verification banner for unverified users
- Updated authentication context and API service
Testing:
- 65 unit tests with 100% coverage of new features
- Tests for auth utils, email service, WSDC controller, and middleware
- Integration tests for full authentication flows
- Comprehensive mocking of AWS SES and external APIs
Database:
- Migration: add WSDC fields (firstName, lastName, wsdcId)
- Migration: add email verification fields (token, code, expiry)
- Migration: add password reset fields (token, expiry)
Documentation:
- Complete Phase 1.5 documentation
- Test suite documentation and best practices
- Updated session context with new features
2025-11-13 15:47:54 +01:00
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<VerificationBanner />
|
|
|
|
|
{children}
|
|
|
|
|
</>
|
|
|
|
|
);
|
2025-11-12 17:50:44 +01:00
|
|
|
};
|
|
|
|
|
|
2025-11-21 21:12:25 +01:00
|
|
|
// Public Route Component (redirect to dashboard if already logged in)
|
2025-11-12 17:50:44 +01:00
|
|
|
const PublicRoute = ({ children }) => {
|
|
|
|
|
const { isAuthenticated, loading } = useAuth();
|
|
|
|
|
|
|
|
|
|
if (loading) {
|
|
|
|
|
return (
|
|
|
|
|
<div className="min-h-screen flex items-center justify-center">
|
|
|
|
|
<div className="text-lg text-gray-600">Loading...</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isAuthenticated) {
|
2025-11-21 21:12:25 +01:00
|
|
|
return <Navigate to="/dashboard" replace />;
|
2025-11-12 17:50:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return children;
|
|
|
|
|
};
|
|
|
|
|
|
2025-12-05 22:28:00 +01:00
|
|
|
// Analytics wrapper component
|
|
|
|
|
const AnalyticsWrapper = ({ children }) => {
|
|
|
|
|
usePageTracking(); // Track page views on route changes
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
// Initialize Google Analytics when user consents to cookies
|
|
|
|
|
const measurementId = import.meta.env.VITE_GA_MEASUREMENT_ID;
|
|
|
|
|
if (measurementId) {
|
|
|
|
|
// Wait a bit for cookie consent banner to be processed
|
|
|
|
|
const timer = setTimeout(() => {
|
|
|
|
|
initGA(measurementId);
|
|
|
|
|
}, 1500);
|
|
|
|
|
return () => clearTimeout(timer);
|
|
|
|
|
}
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
return children;
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-12 17:50:44 +01:00
|
|
|
function App() {
|
|
|
|
|
return (
|
|
|
|
|
<BrowserRouter>
|
|
|
|
|
<AuthProvider>
|
2025-12-05 22:28:00 +01:00
|
|
|
<AnalyticsWrapper>
|
|
|
|
|
{/* PWA Install Prompt */}
|
|
|
|
|
<InstallPWA />
|
2025-11-21 21:27:03 +01:00
|
|
|
|
2025-12-05 22:28:00 +01:00
|
|
|
{/* Cookie Consent Banner */}
|
|
|
|
|
<CookieConsent />
|
2025-12-05 22:22:23 +01:00
|
|
|
|
2025-11-21 21:27:03 +01:00
|
|
|
{/* Toast Notifications */}
|
|
|
|
|
<Toaster
|
|
|
|
|
position="top-right"
|
|
|
|
|
toastOptions={{
|
|
|
|
|
duration: 4000,
|
|
|
|
|
style: {
|
|
|
|
|
background: '#333',
|
|
|
|
|
color: '#fff',
|
|
|
|
|
},
|
|
|
|
|
success: {
|
|
|
|
|
iconTheme: {
|
|
|
|
|
primary: '#22c55e',
|
|
|
|
|
secondary: '#fff',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
error: {
|
|
|
|
|
iconTheme: {
|
|
|
|
|
primary: '#ef4444',
|
|
|
|
|
secondary: '#fff',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
/>
|
2025-11-19 20:59:26 +01:00
|
|
|
|
2025-11-12 17:50:44 +01:00
|
|
|
<Routes>
|
|
|
|
|
{/* Public Routes */}
|
|
|
|
|
<Route
|
|
|
|
|
path="/login"
|
|
|
|
|
element={
|
|
|
|
|
<PublicRoute>
|
|
|
|
|
<LoginPage />
|
|
|
|
|
</PublicRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
<Route
|
|
|
|
|
path="/register"
|
|
|
|
|
element={
|
|
|
|
|
<PublicRoute>
|
|
|
|
|
<RegisterPage />
|
|
|
|
|
</PublicRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
feat: add email verification, password reset, and WSDC integration (Phase 1.5)
Backend features:
- AWS SES email service with HTML templates
- Email verification with dual method (link + 6-digit PIN code)
- Password reset workflow with secure tokens
- WSDC API proxy for dancer lookup and auto-fill registration
- Extended User model with verification and WSDC fields
- Email verification middleware for protected routes
Frontend features:
- Two-step registration with WSDC ID lookup
- Password strength indicator component
- Email verification page with code input
- Password reset flow (request + reset pages)
- Verification banner for unverified users
- Updated authentication context and API service
Testing:
- 65 unit tests with 100% coverage of new features
- Tests for auth utils, email service, WSDC controller, and middleware
- Integration tests for full authentication flows
- Comprehensive mocking of AWS SES and external APIs
Database:
- Migration: add WSDC fields (firstName, lastName, wsdcId)
- Migration: add email verification fields (token, code, expiry)
- Migration: add password reset fields (token, expiry)
Documentation:
- Complete Phase 1.5 documentation
- Test suite documentation and best practices
- Updated session context with new features
2025-11-13 15:47:54 +01:00
|
|
|
<Route path="/verify-email" element={<VerifyEmailPage />} />
|
|
|
|
|
<Route path="/forgot-password" element={<ForgotPasswordPage />} />
|
|
|
|
|
<Route path="/reset-password" element={<ResetPasswordPage />} />
|
2025-11-12 17:50:44 +01:00
|
|
|
|
|
|
|
|
{/* Protected Routes */}
|
2025-11-21 21:12:25 +01:00
|
|
|
<Route
|
|
|
|
|
path="/dashboard"
|
|
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<DashboardPage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
2025-11-12 17:50:44 +01:00
|
|
|
<Route
|
|
|
|
|
path="/events"
|
|
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<EventsPage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
<Route
|
2025-11-13 21:43:58 +01:00
|
|
|
path="/events/:slug/chat"
|
2025-11-12 17:50:44 +01:00
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<EventChatPage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
2025-11-14 14:11:24 +01:00
|
|
|
<Route
|
2025-12-03 19:52:00 +01:00
|
|
|
path="/admin/events/:slug/details"
|
2025-11-14 14:11:24 +01:00
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<EventDetailsPage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
<Route
|
|
|
|
|
path="/events/checkin/:token"
|
|
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<EventCheckinPage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
2025-11-14 19:22:23 +01:00
|
|
|
<Route
|
|
|
|
|
path="/matches"
|
|
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<MatchesPage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
2025-11-12 17:50:44 +01:00
|
|
|
<Route
|
2025-11-14 22:22:11 +01:00
|
|
|
path="/matches/:slug/chat"
|
2025-11-12 17:50:44 +01:00
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<MatchChatPage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
<Route
|
2025-11-14 22:22:11 +01:00
|
|
|
path="/matches/:slug/rate"
|
2025-11-12 17:50:44 +01:00
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<RatePartnerPage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
<Route
|
|
|
|
|
path="/history"
|
|
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<HistoryPage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
2025-11-13 20:26:49 +01:00
|
|
|
<Route
|
|
|
|
|
path="/profile"
|
|
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<ProfilePage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
2025-11-12 17:50:44 +01:00
|
|
|
|
feat(admin): implement activity logs frontend page (Phase 6-7)
Complete implementation of admin activity logs dashboard with real-time
streaming capabilities. Admin users can now monitor all system activity
through a comprehensive web interface.
Features:
- Stats dashboard with 4 key metrics (total logs, unique users, failures, 24h activity)
- Category breakdown visualization with color-coded badges
- Advanced filtering (date range, category, action type, username, success/failure)
- Paginated log table (50 entries per page) with sort by timestamp
- Real-time streaming toggle using Socket.IO
- Color-coded action badges (blue=auth, green=event, purple=match, red=admin, yellow=chat)
- Admin-only access with automatic redirect for non-admin users
- Responsive design for mobile and desktop
Frontend Changes:
- Created ActivityLogsPage.jsx (600+ lines) with complete UI implementation
- Added 3 admin API methods to api.js (getActivityLogs, getActivityLogActions, getActivityLogStats)
- Added /admin/activity-logs route to App.jsx
- Added admin navigation link to Navbar (desktop & mobile) with Shield icon
- Only visible to users with isAdmin flag
Implementation Details:
- Uses getSocket() from socket service for real-time updates
- Joins 'admin_activity_logs' Socket.IO room on streaming enable
- Receives 'activity_log_entry' events and prepends to table (first page only)
- Comprehensive error handling and loading states
- Empty states for no data
- Clean disconnect handling when streaming disabled
Testing:
- Build successful (no errors)
- Ready for manual testing and verification
Phase 8 (Testing) remains for manual verification of all features.
2025-12-02 23:17:19 +01:00
|
|
|
{/* Admin Routes */}
|
|
|
|
|
<Route
|
|
|
|
|
path="/admin/activity-logs"
|
|
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<ActivityLogsPage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
feat(contact): add contact form with admin panel and navbar dropdown
Database changes:
- Added ContactMessage model to Prisma schema
- Fields: userId, username, firstName, lastName, email, subject, message, status, ipAddress
- Status enum: new, read, resolved
- Relation to User model
Backend changes:
- Added POST /api/public/contact endpoint for form submissions
- Works for both authenticated and non-authenticated users
- Validation for email, subject (3-255 chars), message (10-5000 chars)
- Activity logging for submissions
- Added admin endpoints:
- GET /api/admin/contact-messages - list with filtering by status
- GET /api/admin/contact-messages/:id - view single message (auto-marks as read)
- PATCH /api/admin/contact-messages/:id/status - update status
- DELETE /api/admin/contact-messages/:id - delete message
Frontend changes:
- Created ContactPage at /contact route
- For non-logged-in users: firstName, lastName, email, subject, message fields
- For logged-in users: auto-fills username, shows only email, subject, message
- Character counter for message (max 5000)
- Success screen with auto-redirect to homepage
- Created ContactMessagesPage at /admin/contact-messages
- Two-column layout: message list + detail view
- Filter by status (all, new, read, resolved)
- View message details with sender info and IP address
- Update status and delete messages
- Added admin dropdown menu to Navbar
- Desktop: dropdown with Activity Logs and Contact Messages
- Mobile: expandable submenu
- Click outside to close on desktop
- ChevronDown icon rotates when open
Note: CAPTCHA integration planned for future enhancement
2025-12-05 17:15:25 +01:00
|
|
|
<Route
|
|
|
|
|
path="/admin/contact-messages"
|
|
|
|
|
element={
|
|
|
|
|
<ProtectedRoute>
|
|
|
|
|
<ContactMessagesPage />
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
}
|
|
|
|
|
/>
|
feat(admin): implement activity logs frontend page (Phase 6-7)
Complete implementation of admin activity logs dashboard with real-time
streaming capabilities. Admin users can now monitor all system activity
through a comprehensive web interface.
Features:
- Stats dashboard with 4 key metrics (total logs, unique users, failures, 24h activity)
- Category breakdown visualization with color-coded badges
- Advanced filtering (date range, category, action type, username, success/failure)
- Paginated log table (50 entries per page) with sort by timestamp
- Real-time streaming toggle using Socket.IO
- Color-coded action badges (blue=auth, green=event, purple=match, red=admin, yellow=chat)
- Admin-only access with automatic redirect for non-admin users
- Responsive design for mobile and desktop
Frontend Changes:
- Created ActivityLogsPage.jsx (600+ lines) with complete UI implementation
- Added 3 admin API methods to api.js (getActivityLogs, getActivityLogActions, getActivityLogStats)
- Added /admin/activity-logs route to App.jsx
- Added admin navigation link to Navbar (desktop & mobile) with Shield icon
- Only visible to users with isAdmin flag
Implementation Details:
- Uses getSocket() from socket service for real-time updates
- Joins 'admin_activity_logs' Socket.IO room on streaming enable
- Receives 'activity_log_entry' events and prepends to table (first page only)
- Comprehensive error handling and loading states
- Empty states for no data
- Clean disconnect handling when streaming disabled
Testing:
- Build successful (no errors)
- Ready for manual testing and verification
Phase 8 (Testing) remains for manual verification of all features.
2025-12-02 23:17:19 +01:00
|
|
|
|
2025-11-13 21:03:37 +01:00
|
|
|
|
2025-11-15 16:36:55 +01:00
|
|
|
{/* Home Page */}
|
|
|
|
|
<Route path="/" element={<HomePage />} />
|
2025-12-03 20:27:51 +01:00
|
|
|
|
feat(contact): add contact form with admin panel and navbar dropdown
Database changes:
- Added ContactMessage model to Prisma schema
- Fields: userId, username, firstName, lastName, email, subject, message, status, ipAddress
- Status enum: new, read, resolved
- Relation to User model
Backend changes:
- Added POST /api/public/contact endpoint for form submissions
- Works for both authenticated and non-authenticated users
- Validation for email, subject (3-255 chars), message (10-5000 chars)
- Activity logging for submissions
- Added admin endpoints:
- GET /api/admin/contact-messages - list with filtering by status
- GET /api/admin/contact-messages/:id - view single message (auto-marks as read)
- PATCH /api/admin/contact-messages/:id/status - update status
- DELETE /api/admin/contact-messages/:id - delete message
Frontend changes:
- Created ContactPage at /contact route
- For non-logged-in users: firstName, lastName, email, subject, message fields
- For logged-in users: auto-fills username, shows only email, subject, message
- Character counter for message (max 5000)
- Success screen with auto-redirect to homepage
- Created ContactMessagesPage at /admin/contact-messages
- Two-column layout: message list + detail view
- Filter by status (all, new, read, resolved)
- View message details with sender info and IP address
- Update status and delete messages
- Added admin dropdown menu to Navbar
- Desktop: dropdown with Activity Logs and Contact Messages
- Mobile: expandable submenu
- Click outside to close on desktop
- ChevronDown icon rotates when open
Note: CAPTCHA integration planned for future enhancement
2025-12-05 17:15:25 +01:00
|
|
|
{/* Contact Page - Public route */}
|
|
|
|
|
<Route path="/contact" element={<ContactPage />} />
|
|
|
|
|
|
2025-12-05 18:30:44 +01:00
|
|
|
{/* About Us Page - Public route */}
|
|
|
|
|
<Route path="/about-us" element={<AboutUsPage />} />
|
|
|
|
|
|
2025-12-05 18:33:25 +01:00
|
|
|
{/* How It Works Page - Public route */}
|
|
|
|
|
<Route path="/how-it-works" element={<HowItWorksPage />} />
|
|
|
|
|
|
2025-12-03 20:27:51 +01:00
|
|
|
{/* Public Profile - /u/username format (no auth required) */}
|
|
|
|
|
<Route path="/u/:username" element={<PublicProfilePage />} />
|
|
|
|
|
|
|
|
|
|
{/* 404 Not Found - Catch all unmatched routes */}
|
|
|
|
|
<Route path="*" element={<NotFoundPage />} />
|
2025-11-12 17:50:44 +01:00
|
|
|
</Routes>
|
2025-12-05 22:28:00 +01:00
|
|
|
</AnalyticsWrapper>
|
2025-11-12 17:50:44 +01:00
|
|
|
</AuthProvider>
|
|
|
|
|
</BrowserRouter>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default App;
|