import { getOptionalErrorMessage } from '@/shared/errors/errorMessages';
import { StatePanel } from '@/components/ui/state-panel';
import type { FrameModuleViewProps } from '@/components/frame/types';

export function FrameStatusPanel({ workflow }: FrameModuleViewProps) {
  const errorMessage = getOptionalErrorMessage(workflow.error);

  if (!errorMessage) {
    return null;
  }

  return (
    <StatePanel title="F.R.A.M.E. data is unavailable" tone="red" role="alert">
      {errorMessage}
    </StatePanel>
  );
}
