From 8e9683d83189af5780c85afc5207958b2cb34334 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 25 Nov 2024 17:34:06 -0800 Subject: [PATCH] error page --- gui/src/App.tsx | 1 - gui/src/components/svg/DiscordIcon.tsx | 27 +++++ .../svg/{Github.tsx => GithubIcon.tsx} | 0 gui/src/pages/error.tsx | 100 +++++++++++++++--- gui/src/pages/gui/Chat.tsx | 1 + 5 files changed, 115 insertions(+), 14 deletions(-) create mode 100644 gui/src/components/svg/DiscordIcon.tsx rename gui/src/components/svg/{Github.tsx => GithubIcon.tsx} (100%) diff --git a/gui/src/App.tsx b/gui/src/App.tsx index fcd8c5135..d71e7561a 100644 --- a/gui/src/App.tsx +++ b/gui/src/App.tsx @@ -84,7 +84,6 @@ function App() { const vscTheme = useVscTheme(); const submenuContextProvidersMethods = useSubmenuContextProviders(); - // throw new Error("hahaha"); return ( { + size?: number; +} + +export function DiscordIcon({ + size = 24, + className, + ...props +}: DiscordIconProps) { + return ( + + + + ); +} diff --git a/gui/src/components/svg/Github.tsx b/gui/src/components/svg/GithubIcon.tsx similarity index 100% rename from gui/src/components/svg/Github.tsx rename to gui/src/components/svg/GithubIcon.tsx diff --git a/gui/src/pages/error.tsx b/gui/src/pages/error.tsx index 1f36f3c1f..2c119e001 100644 --- a/gui/src/pages/error.tsx +++ b/gui/src/pages/error.tsx @@ -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 ( +//
+//

Error in Continue React App

+//

+// {error.statusText || error.message} +//

+//
+//

Click below to Continue

+ +//
+// { +// dispatch(newSession()); +// localStorage.removeItem("persist:root"); +// localStorage.removeItem("inputHistory_chat"); +// // localStorage.removeItem("showTutorialCard"); +// // localStorage.removeItem("onboardingStatus"); +// // localStorage.removeItem("lastSessionId"); +// navigate("/"); +// }} +// > + +// +// +//
+// ); +// } + +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 ( -
-

Error in Continue React App

-

- {error.statusText || error.message} -

-
-

Click below to Continue

- -
+
+

Error in Continue React App

+ +
+        
+          {error.statusText || error.message}
+        
+      
+ + +

Report the issue:

+
+ openUrl(GITHUB_LINK)} + className="flex items-center space-x-2 rounded-lg px-4 py-2 text-white" + > + + {/* Report on GitHub */} + + openUrl(DISCORD_LINK)} + className="flex items-center rounded-lg" + > + + {/* Join Discord */} + +
); -} +}; + +export default ErrorPage; diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index a810dc87a..375e16c36 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -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