Initial commit: ShadowBroker v0.1

Former-commit-id: 8ed321f2ba
This commit is contained in:
anoracleofra-code
2026-03-04 22:44:08 -07:00
commit 362a6e2ceb
130 changed files with 56003 additions and 0 deletions
+52
View File
@@ -0,0 +1,52 @@
"use client";
import React, { Component, ErrorInfo, ReactNode } from "react";
interface Props {
children: ReactNode;
fallback?: ReactNode;
name?: string;
}
interface State {
hasError: boolean;
error: Error | null;
}
class ErrorBoundary extends Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = { hasError: false, error: null };
}
static getDerivedStateFromError(error: Error): State {
return { hasError: true, error };
}
componentDidCatch(error: Error, errorInfo: ErrorInfo) {
console.error(`[ErrorBoundary${this.props.name ? `: ${this.props.name}` : ""}]`, error, errorInfo);
}
render() {
if (this.state.hasError) {
if (this.props.fallback) return this.props.fallback;
return (
<div className="flex items-center justify-center p-4 bg-red-950/40 border border-red-800 rounded-lg m-2">
<div className="text-center font-mono">
<div className="text-red-400 text-xs tracking-widest mb-1"> SYSTEM ERROR</div>
<div className="text-gray-400 text-[10px]">{this.props.name || "Component"} failed to render</div>
<button
onClick={() => this.setState({ hasError: false, error: null })}
className="mt-2 px-3 py-1 text-[10px] bg-red-900/60 hover:bg-red-800/60 text-red-300 rounded border border-red-700 transition-colors"
>
RETRY
</button>
</div>
</div>
);
}
return this.props.children;
}
}
export default ErrorBoundary;