ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
refactor: consolidate error state component [skip version]
Juan Denisf1c7d1f44efd
diff --git a/frontend/src/components/ErrorBoundary.jsx b/frontend/src/components/ErrorBoundary.jsxindex c3d78308..e2405319 100644--- a/frontend/src/components/ErrorBoundary.jsx+++ b/frontend/src/components/ErrorBoundary.jsx@@ -1,7 +1,7 @@import { Component } from 'react';-import { AlertTriangle, RefreshCw } from 'lucide-react';import api from '../services/api';import { t } from '../i18n/t';+import ErrorState from './ErrorState';// Class-based Error Boundary for catching React errorsexport class ErrorBoundary extends Component {@@ -53,21 +53,11 @@ export class ErrorBoundary extends Component {render() {if (this.state.hasError) {return (- <div className="sk-error-state" role="alert">- <div className="sk-error-state__icon">- <AlertTriangle size={32} />- </div>- <h3 className="sk-error-state__title">- {t('common.error.title', 'Something went wrong')}- </h3>- <p className="sk-error-state__message">- {t('common.error.unexpected', 'An unexpected error occurred')}- </p>- <button type="button" className="btn btn-primary" onClick={this.handleRetry}>- <RefreshCw size={14} />- {t('common.actions.tryAgain', 'Try again')}- </button>- </div>+ <ErrorState+ title={t('common.error.title', 'Something went wrong')}+ message={t('common.error.unexpected', 'An unexpected error occurred')}+ onRetry={this.handleRetry}+ />);}@@ -75,46 +65,4 @@ export class ErrorBoundary extends Component {}}-// Functional component for displaying API/fetch errors-export function ErrorState({- title = t('common.error.failedToLoad', 'Failed to load'),- message,- error,- onRetry,- compact = false-}) {- const errorMessage = message || error?.message- || t('common.error.loadingData', 'An error occurred while loading data');-- if (compact) {- return (- <div className="error-state-compact">- <AlertTriangle size={16} />- <span>{errorMessage}</span>- {onRetry && (- <button type="button" className="btn btn-ghost btn-sm" onClick={onRetry}>- <RefreshCw size={14} /> {t('common.actions.retry', 'Retry')}- </button>- )}- </div>- );- }-- return (- <div className="sk-error-state">- <div className="sk-error-state__icon">- <AlertTriangle size={32} />- </div>- <h3 className="sk-error-state__title">{title}</h3>- <p className="sk-error-state__message">{errorMessage}</p>- {onRetry && (- <button type="button" className="btn btn-primary" onClick={onRetry}>- <RefreshCw size={14} />- {t('common.actions.tryAgain', 'Try again')}- </button>- )}- </div>- );-}-export default ErrorBoundary;diff --git a/frontend/src/plugins/sdk/index.js b/frontend/src/plugins/sdk/index.jsindex 94922e0d..1ecd2675 100644--- a/frontend/src/plugins/sdk/index.js+++ b/frontend/src/plugins/sdk/index.js@@ -162,7 +162,8 @@ export {// used by both the Git and WordPress surfaces; the backups protection// panel embedded by both the Backups page and WordPress). Exposing them// here pins their props as SDK contract — change them accordingly.-export { default as ErrorBoundary, ErrorState } from '../../components/ErrorBoundary';+export { default as ErrorBoundary } from '../../components/ErrorBoundary';+export { default as ErrorState } from '../../components/ErrorState';export { DangerZone } from '../../components/DangerZone';export { default as ResourceAdvisory } from '../../components/ResourceAdvisory';export { default as PluginSlot } from '../../components/PluginSlot';