forked from microsoft/github-copilot-vibe-coding-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathErrorDisplay.jsx
More file actions
30 lines (25 loc) · 838 Bytes
/
Copy pathErrorDisplay.jsx
File metadata and controls
30 lines (25 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { useApp } from '../../context/AppContext';
const ErrorDisplay = ({ error, onDismiss }) => {
const { serverStatus } = useApp();
if (!error) return null;
const isServerError = error.includes('unavailable') || serverStatus === 'offline';
return (
<div className={`error-display ${isServerError ? 'server-error' : 'general-error'}`}>
<div className="error-content">
{isServerError && (
<div className="server-status">
<span className="status-indicator offline"></span>
Backend server is offline
</div>
)}
<p className="error-message">{error}</p>
{onDismiss && (
<button onClick={onDismiss} className="dismiss-button">
×
</button>
)}
</div>
</div>
);
};
export default ErrorDisplay;