import { AlertTriangle, RefreshCw } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { t } from '@/i18n/t';
/**
* Consistent error state for pages and panels. Shows an icon, title, message,
* and optional retry action.
*
*
*/
export function ErrorState({
title = t('common.error.failedToLoad', 'Failed to load'),
message,
error,
onRetry,
compact = false,
className = '',
}) {
const errorMessage = message || error?.message
|| t('common.error.loadingData', 'An error occurred while loading data');
if (compact) {
return (
{errorMessage}
{onRetry && (
)}
);
}
return (
{title}
{errorMessage &&
{errorMessage}
}
{onRetry && (
)}
);
}
export default ErrorState;