🎨 style(CrashErrorComponent/index.tsx): refactor CrashErrorComponent to use UI components for improved readability and maintainability

🐛 fix(CrashErrorComponent/index.tsx): fix typo in error message for better user understanding
✨ feat(CrashErrorComponent/index.tsx): add restart button to reset the app and provide a link to report errors on GitHub for community support
This commit is contained in:
cristhianzl 2024-02-28 16:35:00 -03:00
commit 34d83d82b5

View file

@ -1,4 +1,7 @@
import { XCircle } from "lucide-react";
import { crashComponentPropsType } from "../../types/components"; import { crashComponentPropsType } from "../../types/components";
import { Button } from "../ui/button";
import { Card, CardContent, CardFooter, CardHeader } from "../ui/card";
export default function CrashErrorComponent({ export default function CrashErrorComponent({
error, error,
@ -8,66 +11,52 @@ export default function CrashErrorComponent({
<div className="z-50 flex h-screen w-screen items-center justify-center bg-foreground bg-opacity-50"> <div className="z-50 flex h-screen w-screen items-center justify-center bg-foreground bg-opacity-50">
<div className="flex h-screen w-screen flex-col bg-background text-start shadow-lg"> <div className="flex h-screen w-screen flex-col bg-background text-start shadow-lg">
<div className="m-auto grid w-1/2 justify-center gap-5 text-center"> <div className="m-auto grid w-1/2 justify-center gap-5 text-center">
<div> <Card className="p-8">
<h1 className="text-3xl text-status-red"> <CardHeader>
🚀 Whoops! We've Hit a Snag. <div className="m-auto">
</h1> <XCircle strokeWidth={1.5} className="h-16 w-16" />
<small>
Hey there, it looks like we've encountered a bit of a hiccup.
</small>
</div> </div>
<div> <div>
<p className="mb-4 text-xl text-foreground"> <p className="mb-4 text-xl text-foreground">
But don't worry, it happens to the best of us! We're all about Sorry, we found an unexpectable error!
making things better together.
</p> </p>
</div> </div>
</CardHeader>
<CardContent className="grid">
<div> <div>
<p> <p>
🔧 Quick Fix: Try hitting the{" "} Click <span className="font-bold">'Restart Langflow'</span>{" "}
<span className="font-bold">'Restart the Adventure'</span> button button to reset the app. Please report errors on our{" "}
to get things moving again. It's like a magic wand for minor
glitches!
</p>
</div>
<div>
<p>
📝 Still Stuck? Let's Solve It Together: If our magic wand didn't
do the trick, we'd love your help to dig a bit deeper. By
reporting this hiccup on our{" "}
<a <a
href="https://github.com/logspace-ai/langflow/issues/new" href="https://github.com/logspace-ai/langflow/issues/new"
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
className="font-medium text-blue-600 hover:underline dark:text-blue-500" className="font-medium hover:underline "
> >
GitHub GitHub Issues
</a>{" "} </a>{" "}
page, you're not just fixing your own experience but also helping page to help the community. Thank you!
the whole community.
</p> </p>
</div> </div>
</CardContent>
<div className="mt-4 flex justify-center"> <CardFooter>
<button <div className="m-auto mt-4 flex justify-center">
onClick={resetErrorBoundary} <Button onClick={resetErrorBoundary}>Restart Langflow</Button>
className="cursor-pointer rounded-lg border-2 border-blue-600 px-3 py-2 font-bold text-blue-600 hover:bg-blue-600 hover:text-blue-100"
>
Restart the Adventure
</button>
<a <a
href="https://github.com/logspace-ai/langflow/issues/new" href="https://github.com/logspace-ai/langflow/issues/new"
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
> >
<button className="ml-3 cursor-pointer rounded-lg border-2 border-gray-600 px-3 py-2 font-bold text-gray-600 hover:bg-gray-600 hover:text-gray-100"> <Button className="ml-3" variant={"outline"}>
Report on GitHub Report on GitHub
</button> </Button>
</a> </a>
</div> </div>
</CardFooter>
</Card>
</div> </div>
</div> </div>
</div> </div>