// src/pages/admin/CorrectionsPage.tsx import React from 'react'; import { Link } from 'react-router-dom'; import { LoadingSpinner } from '../../components/LoadingSpinner'; import { ArrowPathIcon } from '../../components/icons/ArrowPathIcon'; import { CorrectionRow } from './components/CorrectionRow'; import { useSuggestedCorrectionsQuery } from '../../hooks/queries/useSuggestedCorrectionsQuery'; import { useMasterItemsQuery } from '../../hooks/queries/useMasterItemsQuery'; import { useCategoriesQuery } from '../../hooks/queries/useCategoriesQuery'; export const CorrectionsPage: React.FC = () => { // Use TanStack Query for data fetching (ADR-0005 Phase 5) const { data: corrections = [], isLoading: isLoadingCorrections, error: correctionsError, refetch: refetchCorrections, } = useSuggestedCorrectionsQuery(); const { data: masterItems = [], isLoading: isLoadingMasterItems } = useMasterItemsQuery(); const { data: categories = [], isLoading: isLoadingCategories } = useCategoriesQuery(); const isLoading = isLoadingCorrections || isLoadingMasterItems || isLoadingCategories; const error = correctionsError?.message || null; const handleCorrectionProcessed = () => { // Refetch corrections after processing refetchCorrections(); }; return (
← Back to Admin Dashboard

User-Submitted Corrections

Review and approve or reject pending data corrections.

{isLoading && (
)} {error && (
{error}
)} {!isLoading && !error && (
{corrections.length === 0 ? ( ) : ( corrections.map((correction) => ( )) )}
Item Correction Type Suggested Value Submitted By Date Actions
No pending corrections. Great job!
)}
); };