MCPcopy Create free account
hub / github.com/winfunc/opcode / render

Method render

src/components/ErrorBoundary.tsx:39–84  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37 };
38
39 render() {
40 if (this.state.hasError && this.state.error) {
41 // Use custom fallback if provided
42 if (this.props.fallback) {
43 return this.props.fallback(this.state.error, this.reset);
44 }
45
46 // Default error UI
47 return (
48 <div className="flex items-center justify-center min-h-[200px] p-4">
49 <Card className="max-w-md w-full">
50 <CardContent className="p-6">
51 <div className="flex items-start gap-4">
52 <AlertCircle className="h-8 w-8 text-destructive flex-shrink-0 mt-0.5" />
53 <div className="flex-1 space-y-2">
54 <h3 className="text-lg font-semibold">Something went wrong</h3>
55 <p className="text-sm text-muted-foreground">
56 An error occurred while rendering this component.
57 </p>
58 {this.state.error.message && (
59 <details className="mt-2">
60 <summary className="text-sm cursor-pointer text-muted-foreground hover:text-foreground">
61 Error details
62 </summary>
63 <pre className="mt-2 text-xs bg-muted p-2 rounded overflow-auto">
64 {this.state.error.message}
65 </pre>
66 </details>
67 )}
68 <Button
69 onClick={this.reset}
70 size="sm"
71 className="mt-4"
72 >
73 Try again
74 </Button>
75 </div>
76 </div>
77 </CardContent>
78 </Card>
79 </div>
80 );
81 }
82
83 return this.props.children;
84 }
85}

Callers 1

main.tsxFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected