From c49a2e28ce3cc6a720dc7e0d1466d3c01e1bb2cc Mon Sep 17 00:00:00 2001 From: Taleef7 Date: Sun, 26 Apr 2026 23:48:20 -0400 Subject: [PATCH 1/2] feat: improve admin matching and pricing polish --- app/admin/matches/[id]/page.tsx | 30 ++++++- app/admin/payments/page.tsx | 3 +- app/admin/requests/RequestFilters.tsx | 31 +++++++ app/admin/requests/[id]/AssignTutorForm.tsx | 41 +++++++-- app/admin/requests/[id]/page.tsx | 10 +++ app/admin/requests/page.tsx | 46 +++++++--- app/admin/tutors/[id]/page.tsx | 9 ++ app/dashboard/packages/[id]/page.tsx | 3 +- app/dashboard/packages/new/page.tsx | 3 +- app/page.tsx | 3 +- components/admin/AdminBreadcrumbs.tsx | 36 ++++++++ .../admin/__tests__/AdminBreadcrumbs.test.ts | 23 +++++ docs/GAP_ANALYSIS.md | 4 +- docs/plan-CorvEd.md | 8 +- lib/admin/__tests__/request-search.test.ts | 35 ++++++++ lib/admin/request-search.ts | 37 ++++++++ lib/utils/__tests__/availability.test.ts | 53 +++++++++++ lib/utils/__tests__/currency.test.ts | 14 +++ lib/utils/availability.ts | 88 +++++++++++++++++++ lib/utils/currency.ts | 9 ++ 20 files changed, 459 insertions(+), 27 deletions(-) create mode 100644 components/admin/AdminBreadcrumbs.tsx create mode 100644 components/admin/__tests__/AdminBreadcrumbs.test.ts create mode 100644 lib/admin/__tests__/request-search.test.ts create mode 100644 lib/admin/request-search.ts create mode 100644 lib/utils/__tests__/availability.test.ts create mode 100644 lib/utils/__tests__/currency.test.ts create mode 100644 lib/utils/availability.ts create mode 100644 lib/utils/currency.ts diff --git a/app/admin/matches/[id]/page.tsx b/app/admin/matches/[id]/page.tsx index e7ebf65..508c2d2 100644 --- a/app/admin/matches/[id]/page.tsx +++ b/app/admin/matches/[id]/page.tsx @@ -11,6 +11,7 @@ import { LEVEL_LABELS } from '@/lib/utils/request' import { ReassignTutorForm, EditMatchForm, GenerateSessionsForm, DeleteSessionsForm, AdminNotesForm } from './MatchActions' import { CopyMessageButton } from '@/components/CopyMessageButton' import { WhatsAppLink } from '@/components/WhatsAppLink' +import { AdminBreadcrumbs } from '@/components/admin/AdminBreadcrumbs' import { templates } from '@/lib/whatsapp/templates' const DAY_NAMES = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] @@ -163,6 +164,14 @@ export default async function AdminMatchDetailPage({ return (
+ + {assigned === '1' && (

Tutor assigned successfully.

@@ -210,7 +219,18 @@ export default async function AdminMatchDetailPage({
Student
-
{studentName}
+
+ {studentProfile?.display_name ? ( + + {studentName} + + ) : ( + studentName + )} +
{studentProfile?.whatsapp_number && (
๐Ÿ“ฑ {studentProfile.whatsapp_number} @@ -225,6 +245,14 @@ export default async function AdminMatchDetailPage({ {tutorUserProfile?.display_name ?? 'โ€”'}
{tutorProfile?.timezone}
+
+ + View tutor profile + +
{tutorUserProfile?.whatsapp_number && (
๐Ÿ“ฑ {tutorUserProfile.whatsapp_number} diff --git a/app/admin/payments/page.tsx b/app/admin/payments/page.tsx index 42a4e5d..88d2303 100644 --- a/app/admin/payments/page.tsx +++ b/app/admin/payments/page.tsx @@ -11,6 +11,7 @@ import { PaymentQuickActions } from './PaymentQuickActions' import Link from 'next/link' import { templates } from '@/lib/whatsapp/templates' import { PAYMENT_INSTRUCTIONS } from '@/lib/config/pricing' +import { formatPkr } from '@/lib/utils/currency' import { AdminPagination, PAGE_SIZE } from '@/components/AdminPagination' const STATUS_COLOURS: Record = { @@ -149,7 +150,7 @@ export default async function AdminPaymentsPage({ {subjectName} ยท {level} ยท {pkg?.tier_sessions ?? '?'} sessions/month

- Amount: PKR {payment.amount_pkr.toLocaleString()} + Amount: {formatPkr(payment.amount_pkr)}

Submitted: {submittedDate}

{payment.reference && ( diff --git a/app/admin/requests/RequestFilters.tsx b/app/admin/requests/RequestFilters.tsx index a8a578a..0a4bd80 100644 --- a/app/admin/requests/RequestFilters.tsx +++ b/app/admin/requests/RequestFilters.tsx @@ -10,6 +10,7 @@ type RequestFiltersProps = { activeStatus: string activeSubject: string | undefined activeLevel: string | undefined + activeSearch: string | undefined } export function RequestFilters({ @@ -17,12 +18,14 @@ export function RequestFilters({ activeStatus, activeSubject, activeLevel, + activeSearch, }: RequestFiltersProps) { function buildHref(params: Record): string { const merged: Record = { status: activeStatus !== 'all' ? activeStatus : undefined, subject: activeSubject, level: activeLevel, + q: activeSearch, ...params, } const qs = Object.entries(merged) @@ -34,6 +37,34 @@ export function RequestFilters({ return (
+
+ {activeStatus !== 'all' && } + {activeSubject && } + {activeLevel && } + + + {activeSearch && ( + + Clear + + )} +
+ {/* Subject filter */}