diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8594609..3be4e92 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: cache: 'npm' - name: Install dependencies - run: npm ci + run: npm install - name: Lint check run: npm run lint diff --git a/src/App.tsx b/src/App.tsx index 176107f..c40b8a1 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -20,6 +20,7 @@ import ModalPreview from "./pages/ModalPreview"; import StatusPollingDemo from "./pages/StatusPollingDemo"; import CustodyTimelinePage from "./pages/CustodyTimelinePage"; import AdminApprovalQueuePage from "./pages/AdminApprovalQueuePage"; +import NotificationPreferencesPage from './pages/settings/NotificationPreferencesPage'; function App() { @@ -45,6 +46,7 @@ function App() { } /> } /> } /> + } /> {/* Admin Approvals */} } /> diff --git a/src/pages/settings/NotificationPreferencesPage.tsx b/src/pages/settings/NotificationPreferencesPage.tsx new file mode 100644 index 0000000..b8178ea --- /dev/null +++ b/src/pages/settings/NotificationPreferencesPage.tsx @@ -0,0 +1,82 @@ +import React from 'react'; +import { useApiQuery } from '../../hooks/useApiQuery'; + +const SkeletonLoader = () => ( +
+); + +const eventGroups = [ + { name: 'Adoption events', keys: ['pet_listed', 'application_received'] }, + { name: 'Escrow events', keys: ['payment_held', 'payment_released'], isSdk: true }, + { name: 'Dispute events', keys: ['dispute_opened', 'evidence_required'] }, + { name: 'Approval events', keys: ['admin_verified'] }, +]; + +export default function NotificationPreferencesPage() { + // Task: useApiQuery: GET /notifications/preferences + const { data: preferences, isLoading } = useApiQuery('/notifications/preferences'); + + if (isLoading) { + return ( +
+

Notification Preferences

+ + + +
+ ); + } + + return ( +
+

Notification Preferences

+ +
+ + + + + + + + + + {eventGroups.map((group) => ( + + + + + {group.keys.map((key) => ( + + + + + + ))} + + ))} + +
Event TypeEmailIn-app
+ {group.name} + {group.isSdk && ( + + SDK event + + )} +
{key.replace(/_/g, ' ')} + + + +
+
+
+ ); +} \ No newline at end of file