import type { OIDCCallbackError } from '../lib/oidc';
import { Button } from './ui';

export function OIDCCallbackNotice(props: {
  error: OIDCCallbackError;
  onRetry: () => void;
}) {
  return (
    <div className="notice oidcCallbackNotice" role="alert">
      <span className="oidcCallbackMessage">
        <span>{props.error.message}</span>
        {props.error.diagnosticId && <small>诊断编号：{props.error.diagnosticId}</small>}
      </span>
      {props.error.retryable && (
        <Button type="button" variant="outline" size="sm" onClick={props.onRetry}>
          重新登录
        </Button>
      )}
    </div>
  );
}
