import { Navigate, useSearchParams } from 'react-router-dom'
import { ATTENDANCE_VIOLATIONS_PENDING_PATH } from './attendancePaths'

/** Legacy `/attendance/violations` opened the pending list directly. Keep this route as a query-preserving alias. */
export function AttendanceViolationsHubPage() {
  const [searchParams] = useSearchParams()
  const query = searchParams.toString()
  const to = query ? `${ATTENDANCE_VIOLATIONS_PENDING_PATH}?${query}` : ATTENDANCE_VIOLATIONS_PENDING_PATH

  return <Navigate to={to} replace />
}
