error page

This commit is contained in:
Dallin Romney 2024-11-25 17:34:06 -08:00
parent abee83f95f
commit 8e9683d831
5 changed files with 115 additions and 14 deletions

View file

@ -84,7 +84,6 @@ function App() {
const vscTheme = useVscTheme();
const submenuContextProvidersMethods = useSubmenuContextProviders();
// throw new Error("hahaha");
return (
<VscThemeContext.Provider value={vscTheme}>
<SubmenuContextProvidersContext.Provider

View file

@ -0,0 +1,27 @@
interface DiscordIconProps extends React.SVGProps<SVGSVGElement> {
size?: number;
}
export function DiscordIcon({
size = 24,
className,
...props
}: DiscordIconProps) {
return (
<svg
width={size}
height={size}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
className={className}
{...props}
>
<path
d="M20.317 4.369a19.791 19.791 0 00-4.885-1.515.074.074 0 00-.079.038 13.875 13.875 0 00-.6 1.235 18.337 18.337 0 00-5.487 0 13.872 13.872 0 00-.601-1.235.076.076 0 00-.079-.038A19.736 19.736 0 003.677 4.369a.069.069 0 00-.032.027C.533 9.104-.32 13.726.099 18.306a.082.082 0 00.031.054 19.911 19.911 0 005.993 3.04.078.078 0 00.084-.027 14.345 14.345 0 001.273-2.084.076.076 0 00-.041-.105 13.134 13.134 0 01-1.872-.891.077.077 0 01-.008-.128c.126-.094.252-.192.373-.291a.074.074 0 01.077-.01c3.927 1.794 8.18 1.794 12.061 0a.074.074 0 01.078.009c.121.099.247.198.374.292a.077.077 0 01-.006.127 12.48 12.48 0 01-1.873.891.076.076 0 00-.04.106 14.504 14.504 0 001.273 2.083.077.077 0 00.084.028 19.888 19.888 0 005.993-3.04.077.077 0 00.031-.054c.5-5.177-.838-9.772-3.576-13.91a.061.061 0 00-.032-.028zM9.237 15.335c-1.182 0-2.156-1.085-2.156-2.419 0-1.333.955-2.418 2.156-2.418 1.21 0 2.184 1.085 2.156 2.418.001 1.334-.946 2.419-2.156 2.419zm5.526 0c-1.182 0-2.156-1.085-2.156-2.419 0-1.333.955-2.418 2.156-2.418 1.21 0 2.184 1.085 2.156 2.418 0 1.334-.946 2.419-2.156 2.419z"
fill="currentColor"
strokeWidth="0"
/>
</svg>
);
}

View file

@ -1,26 +1,80 @@
import { useDispatch } from "react-redux";
import { useNavigate, useRouteError } from "react-router-dom";
import { newSession } from "../redux/slices/stateSlice";
// import ContinueButton from "../components/mainInput/ContinueButton";
// import { vscBackground } from "../components";
import { GithubIcon } from "../components/svg/GithubIcon";
// import { useState } from "react";
import { DiscordIcon } from "../components/svg/DiscordIcon";
import { useContext } from "react";
import { IdeMessengerContext } from "../context/IdeMessenger";
import { Button, SecondaryButton } from "../components";
import ContinueButton from "../components/mainInput/ContinueButton";
import { vscBackground } from "../components";
import { GithubIcon } from "../components/svg/Github";
export default function ErrorPage() {
// const GITHUB_LINK = "https://github.com/continuedev/continue/issues/new/choose";
// const DISCORD_LINK = "https://discord.com/invite/EfJEfdFnDQ";
// export default function ErrorPage() {
// const error: any = useRouteError();
// console.error(error);
// const dispatch = useDispatch();
// const navigate = useNavigate();
// return (
// <div className="text-center" style={{ backgroundColor: vscBackground }}>
// <h1>Error in Continue React App</h1>
// <p>
// <i>{error.statusText || error.message}</i>
// </p>
// <br />
// <p>Click below to Continue</p>
// <br />
// <ContinueButton
// disabled={false}
// showStop={false}
// onClick={() => {
// dispatch(newSession());
// localStorage.removeItem("persist:root");
// localStorage.removeItem("inputHistory_chat");
// // localStorage.removeItem("showTutorialCard");
// // localStorage.removeItem("onboardingStatus");
// // localStorage.removeItem("lastSessionId");
// navigate("/");
// }}
// ></ContinueButton>
// <GithubIcon />
// <DiscordIcon />
// </div>
// );
// }
const GITHUB_LINK = "https://github.com/continuedev/continue/issues/new/choose";
const DISCORD_LINK = "https://discord.com/invite/EfJEfdFnDQ";
const ErrorPage: React.FC = () => {
const error: any = useRouteError();
console.error(error);
const dispatch = useDispatch();
const navigate = useNavigate();
const messenger = useContext(IdeMessengerContext);
const openUrl = (url: string) => {
if (messenger) {
messenger.post("openUrl", url);
}
};
return (
<div className="text-center" style={{ backgroundColor: vscBackground }}>
<h1>Error in Continue React App</h1>
<p>
<i>{error.statusText || error.message}</i>
</p>
<br />
<p>Click below to Continue</p>
<GithubIcon />
<br />
<div className="bg- flex min-h-screen flex-col items-center justify-center px-8 py-4 text-center">
<h1 className="mb-4 text-3xl font-bold">Error in Continue React App</h1>
<pre className="w-full pb-6">
<code className="w-full px-3 py-2">
{error.statusText || error.message}
</code>
</pre>
<ContinueButton
disabled={false}
showStop={false}
@ -34,6 +88,26 @@ export default function ErrorPage() {
navigate("/");
}}
></ContinueButton>
<p className="mb-0 mt-6">Report the issue:</p>
<div className="mt-4 flex space-x-4">
<SecondaryButton
onClick={() => openUrl(GITHUB_LINK)}
className="flex items-center space-x-2 rounded-lg px-4 py-2 text-white"
>
<GithubIcon size={20} />
{/* <span>Report on GitHub</span> */}
</SecondaryButton>
<SecondaryButton
onClick={() => openUrl(DISCORD_LINK)}
className="flex items-center rounded-lg"
>
<DiscordIcon size={20} />
{/* <span>Join Discord</span> */}
</SecondaryButton>
</div>
</div>
);
}
};
export default ErrorPage;

View file

@ -163,6 +163,7 @@ export function Chat() {
// smoothScrollToBottom();
// }, 400);
// }, [smoothScrollToBottom, state.sessionId]);
throw new Error("This is an error");
useEffect(() => {
// Cmd + Backspace to delete current step