diff --git a/.changeset/orange-hands-smile.md b/.changeset/orange-hands-smile.md new file mode 100644 index 000000000..91fb1d069 --- /dev/null +++ b/.changeset/orange-hands-smile.md @@ -0,0 +1,5 @@ +--- +"@spotlightjs/spotlight": patch +--- + +Updated the way of showing the error message div diff --git a/packages/spotlight/index.html b/packages/spotlight/index.html index 456a10cc1..dd837e34c 100644 --- a/packages/spotlight/index.html +++ b/packages/spotlight/index.html @@ -20,34 +20,6 @@ height: 100%; width: 100%; } - - .error { - color: #fff; - text-shadow: 0 0 5px #fff; - text-align: center; - font-family: system-ui, sans-serif; - } - - .header { - letter-spacing: 6px; - font-weight: 500; - font-size: 3rem; - line-height: 1.5; - } - - .error-page-navbar { - display: flex; - width: 100%; - gap: 5px; - align-items: center; - } - - .spotlight-title { - color: #fff; - font-weight: 700; - font-size: 1rem; - font-family: system-ui, sans-serif; - } diff --git a/packages/spotlight/src/electron/main/index.ts b/packages/spotlight/src/electron/main/index.ts index c65698f2e..d3c93b235 100644 --- a/packages/spotlight/src/electron/main/index.ts +++ b/packages/spotlight/src/electron/main/index.ts @@ -192,22 +192,6 @@ const createWindow = () => { document.body.appendChild(dragBar); } - // Create error screen element for showing errors - if (!document.getElementById('error-screen')) { - const errorScreen = document.createElement('div'); - errorScreen.id = 'error-screen'; - errorScreen.style.display = 'none'; - errorScreen.innerHTML = \` -
-Press Cmd + R to reload the app.
- \`; - document.body.appendChild(errorScreen); - } - // Re-create elements if body is replaced. // This can happen when Spotlight.init() replaces the entire body content // during hot module replacement (HMR) in development mode, or when the @@ -426,21 +410,6 @@ store.onDidChange("sentry-send-envelopes", newValue => { } }); -const showErrorMessage = () => { - if (win) { - win.webContents.executeJavaScript(`{ - const sentryRoot = document.getElementById('spotlight-root'); - const errorScreen = document.getElementById('error-screen'); - if (sentryRoot) { - sentryRoot.style.display = 'none'; - } - if (errorScreen) { - errorScreen.style.display = 'block'; - } - }`); - } -}; - async function askForPermissionToSendToSentry(event: Sentry.Event, hint: Sentry.EventHint) { // Handle updater errors silently - no dialogs or error screens if (event.tags?.error_source === "updater") { @@ -452,7 +421,6 @@ async function askForPermissionToSendToSentry(event: Sentry.Event, hint: Sentry. return event; } - showErrorMessage(); if (store.get("sentry-enabled") === false) { return null; } diff --git a/packages/spotlight/src/ui/App.tsx b/packages/spotlight/src/ui/App.tsx index 58f50a381..75b0cc167 100644 --- a/packages/spotlight/src/ui/App.tsx +++ b/packages/spotlight/src/ui/App.tsx @@ -1,3 +1,5 @@ +import { ErrorBoundary } from "@sentry/react"; +import { ReactComponent as Logo } from "@spotlight/ui/assets/glyph.svg"; import { Navigate, Route, Routes } from "react-router-dom"; import { ShikiProvider } from "./ShikiProvider"; // TODO: we'll lazy load this in case of multiple routes @@ -9,13 +11,30 @@ type AppProps = { export default function App({ sidecarUrl }: AppProps) { return ( -Spotlight
+Press Cmd/Ctrl + R to reload the app
+