fix error states + remove run button

This commit is contained in:
Ishaan Dey 2024-05-13 15:31:48 -07:00
parent 9d5f9c37cc
commit 7141d74525
4 changed files with 11 additions and 7 deletions

View File

@ -183,7 +183,7 @@ app.post("/start", async (req, res) => {
res.status(200).send({ message: "Resources created." }) res.status(200).send({ message: "Resources created." })
} catch (error: any) { } catch (error: any) {
const body = error.response.body const body = error.response.body
console.log("Failed to create resources", body) console.log("Failed to create resources", error)
if (body.code === 409) { if (body.code === 409) {
return res.status(200).send({ message: "Resource already exists." }) return res.status(200).send({ message: "Resource already exists." })

View File

@ -19,7 +19,6 @@ export default function Editor({
userData: User; userData: User;
sandboxData: Sandbox; sandboxData: Sandbox;
}) { }) {
console.log("userData", userData);
const [isServerRunning, setIsServerRunning] = useState(false); const [isServerRunning, setIsServerRunning] = useState(false);
const [didFail, setDidFail] = useState(false); const [didFail, setDidFail] = useState(false);
@ -38,7 +37,7 @@ export default function Editor({
// }; // };
}, []); }, []);
if (!isServerRunning) if (!isServerRunning || didFail)
return <Loading didFail={didFail} text="Creating your sandbox resources" />; return <Loading didFail={didFail} text="Creating your sandbox resources" />;
return <CodeEditor userData={userData} sandboxData={sandboxData} />; return <CodeEditor userData={userData} sandboxData={sandboxData} />;

View File

@ -39,7 +39,7 @@ export default function Loading({
{didFail ? ( {didFail ? (
<> <>
<X className="h-4 w-4 mr-2 text-destructive" /> Failed to <X className="h-4 w-4 mr-2 text-destructive" /> Failed to
create resources. start server.
</> </>
) : ( ) : (
<> <>
@ -47,7 +47,12 @@ export default function Loading({
</> </>
)} )}
</DialogTitle> </DialogTitle>
{description ? ( {didFail ? (
<DialogDescription>
Try again in a minute, or contact @ishaandey_ on Twitter/X if it
still doesn't work.
</DialogDescription>
) : description ? (
<DialogDescription>{description}</DialogDescription> <DialogDescription>{description}</DialogDescription>
) : null} ) : null}
</DialogHeader> </DialogHeader>

View File

@ -200,9 +200,9 @@ export default function Sidebar({
</div> </div>
<Switch checked={ai} onCheckedChange={setAi} /> <Switch checked={ai} onCheckedChange={setAi} />
</div> </div>
<Button className="w-full"> {/* <Button className="w-full">
<MonitorPlay className="w-4 h-4 mr-2" /> Run <MonitorPlay className="w-4 h-4 mr-2" /> Run
</Button> </Button> */}
</div> </div>
</div> </div>
); );