import Link from 'next/link' import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from 'ui' import _authErrorCodes from '~/content/errorCodes/authErrorCodes.toml' import _realtimeErrorCodes from '~/content/errorCodes/realtimeErrorCodes.toml' import { type ErrorCodeDefinition } from '~/resources/error/errorTypes' const errorCodesByService = { auth: _authErrorCodes as Record, realtime: _realtimeErrorCodes as Record, } interface ErrorCodesProps { service: keyof typeof errorCodesByService } export function ErrorCodes({ service }: ErrorCodesProps) { const errorCodes = errorCodesByService[service] const hasResolutions = Object.values(errorCodes).some((code) => code.resolution) return ( Error code Description {hasResolutions && Action} {Object.entries(errorCodes) .sort(([aCode], [bCode]) => aCode.localeCompare(bCode)) .map(([code, definition]) => ( {code}

{definition.description}

{!!definition.references && ( <>

Learn more:

    {definition.references.map((reference) => (
  • {reference.description}
  • ))}
)}
{hasResolutions && ( {!!definition.resolution &&

{definition.resolution}

}
)}
))}
) }