From ce4c977efcdc0ce211c3d564a402ef00228e21e8 Mon Sep 17 00:00:00 2001 From: Mitchell Magro Date: Mon, 29 Dec 2025 19:54:42 +0100 Subject: [PATCH] Pushing to update server --- .../admin/matcher/MatcherPageClient.tsx | 6 ++--- app/dashboard/audits/page.tsx | 13 ++++----- .../GeneralHealthCard/GeneralHealthCard.tsx | 2 +- app/features/Pages/Approve/Approve.tsx | 7 +++-- .../DashboardHomePage/DashboardHomePage.tsx | 8 +++--- .../TransactionsWaitingApproval.tsx | 27 ++++++++++++++++--- app/services/health.ts | 2 +- 7 files changed, 42 insertions(+), 23 deletions(-) diff --git a/app/dashboard/admin/matcher/MatcherPageClient.tsx b/app/dashboard/admin/matcher/MatcherPageClient.tsx index 6485371..35ef9cb 100644 --- a/app/dashboard/admin/matcher/MatcherPageClient.tsx +++ b/app/dashboard/admin/matcher/MatcherPageClient.tsx @@ -31,8 +31,6 @@ export default function MatcherPageClient({ }: MatcherPageClientProps) { const router = useRouter(); const [matchType, setMatchType] = useState(initialMatchType); - const [sourceItems, setSourceItems] = useState(initialSourceItems); - const [targetItems, setTargetItems] = useState(initialTargetItems); const currentConfig = MATCH_CONFIGS[matchType] || initialConfig; @@ -99,8 +97,8 @@ export default function MatcherPageClient({ diff --git a/app/dashboard/audits/page.tsx b/app/dashboard/audits/page.tsx index edc1de2..c4a3309 100644 --- a/app/dashboard/audits/page.tsx +++ b/app/dashboard/audits/page.tsx @@ -9,7 +9,7 @@ import { } from "@/app/dashboard/audits/auditConstants"; type AuditPageProps = { - searchParams?: Record; + searchParams?: Promise>; }; const toSingleValue = (value?: string | string[]): string | undefined => { @@ -24,11 +24,12 @@ const clampNumber = (value: number, min: number, max?: number) => { return value; }; -export default async function AuditPage({ searchParams = {} }: AuditPageProps) { - const pageParam = toSingleValue(searchParams.page); - const limitParam = toSingleValue(searchParams.limit); - const sortParam = toSingleValue(searchParams.sort) || undefined; - const entityQuery = toSingleValue(searchParams.entity)?.trim() || ""; +export default async function AuditPage({ searchParams }: AuditPageProps) { + const params = searchParams ? await searchParams : {}; + const pageParam = toSingleValue(params?.page); + const limitParam = toSingleValue(params?.limit); + const sortParam = toSingleValue(params?.sort) || undefined; + const entityQuery = toSingleValue(params?.entity)?.trim() || ""; const page = clampNumber(parseInt(pageParam || "1", 10), 1); const parsedLimit = parseInt(limitParam || String(DEFAULT_PAGE_SIZE), 10); diff --git a/app/features/GeneralHealthCard/GeneralHealthCard.tsx b/app/features/GeneralHealthCard/GeneralHealthCard.tsx index a317e23..01ab30e 100644 --- a/app/features/GeneralHealthCard/GeneralHealthCard.tsx +++ b/app/features/GeneralHealthCard/GeneralHealthCard.tsx @@ -17,7 +17,7 @@ import { Range } from "react-date-range"; import { DateRangePicker } from "../DateRangePicker/DateRangePicker"; import { StatItem } from "./components/StatItem"; import { DEFAULT_DATE_RANGE } from "./constants"; -import { IHealthData } from "@/app/services/health"; +import { type IHealthData } from "@/app/services/types"; import { useDebouncedDateRange } from "@/app/hooks/useDebouncedDateRange"; import { dashboardService } from "@/app/services/dashboardService"; import { normalizeDateRangeForAPI } from "@/app/utils/formatDate"; diff --git a/app/features/Pages/Approve/Approve.tsx b/app/features/Pages/Approve/Approve.tsx index f031973..f18fd35 100644 --- a/app/features/Pages/Approve/Approve.tsx +++ b/app/features/Pages/Approve/Approve.tsx @@ -336,11 +336,10 @@ export function ApproveTable({ setModalOpen(false)} - handleSave={handleStatusSave} + onClose={() => setModalOpen(false)} + onStatusUpdated={handleStatusSave} /> (null); /** * Subscribe to dashboard data changes @@ -67,7 +72,7 @@ export const TransactionsWaitingApproval = ({ : ""; return { - id: tx.id?.toString() || tx.external_id || "", + id: tx.id ?? tx.external_id ?? "", user: tx.customer || "", created: formattedDate, type: tx.type || "", @@ -81,6 +86,10 @@ export const TransactionsWaitingApproval = ({ const transactions = reviewTransactions?.transactions || []; const displayTransactions = transactions.map(formatTransaction); + const handleStatusChange = (rowId: number, newStatus: string) => { + setStatusDialogData({ rowId, newStatus }); + }; + return ( @@ -141,10 +150,16 @@ export const TransactionsWaitingApproval = ({ {tx.amount} {tx.psp} - + handleStatusChange(tx.id, "approved")} + > - + handleStatusChange(tx.id, "declined")} + > @@ -164,6 +179,12 @@ export const TransactionsWaitingApproval = ({ )} + setStatusDialogData(null)} + /> ); }; diff --git a/app/services/health.ts b/app/services/health.ts index 31ece41..7fb9f8c 100644 --- a/app/services/health.ts +++ b/app/services/health.ts @@ -73,7 +73,7 @@ export async function fetchDashboardDataService({ fetchConfig ), fetch( - `${BE_BASE_URL}/api/v1/transactions?limit=1000${ + `${BE_BASE_URL}/api/v1/transactions?limit=1000&page=1${ queryString ? `&${queryString}` : "" }&Status==/review`, fetchConfig