jan/web/app/error.tsx
Faisal Amir faa09bd2bf
feat: Dekstop Revamp (#2877)
* feat: desktop revamp

* feat: refactor system monitor

* fix linter CI

* remove unused import component

* added responsive and resizeable component

* responsive and resizeable local server page

* finalize responsive and resizeable component

* fix scroll custom ui

* remove react scroll to bottom from modal troubleshoot

* fix modal troubleshoot ui

* fix setting gpu list

* text area custom scroll bar

* fix padding message input

* cleanup classname

* update inference engine model dropdown

* update loader style

* update quick ask ui

* prepare theme provider

* update dark theme

* remove update hotkey list model and navigation

* fix: cleanup hardcode classname

* fix: update feedback

* Set native theme electron

* update destop ui revamp from feedback

* update button icon component insider icon chat input message

* update model dropdown ui

* update tranaparent baclground

* update logo model provider

* fix: set background material acrylic support to blur background windows

* fix: update tranparent left and right panel

* fix: linter CI

* update app using frameless window

* styling custom style minimize, maximize and close app

* temporary hidden maximize window

* fix: responsive left and right panel

* fix: enable click outside when leftpanel responsive

* fix: remove unused import

* update transparent variable css windows

* fix: ui import model

* feat: Support Theme system (#2946)

* feat: update support theme system

* update select component

* feat: add theme folder in root project

* fix: padding left and right center panel

* fix: update padding left and right

* chore: migrate themes

* fix: rmdirsync error

* chore: update gitignore

* fix: cp recursive

* fix: files electron package json

* fix: migration

* fix: update fgit ignore

---------

Co-authored-by: Louis <louis@jan.ai>

* fix: update feedback missing state when refrash app

* fix: error test CI

* chore: refactor useLoadThemes

* chore: cleanup unused vars

* fix: revert back menubar windows

* fix minor ui

* fix: minor ui

---------

Co-authored-by: Louis <louis@jan.ai>
2024-05-29 13:37:18 +07:00

90 lines
3.1 KiB
TypeScript

'use client' // Error components must be Client Components
import { useEffect, useState } from 'react'
export default function Error({
error,
}: {
error: Error & { digest?: string }
reset: () => void
}) {
const [showFull, setShowFull] = useState(false)
useEffect(() => {
// Log the error to an error reporting service
console.error(error)
}, [error])
return (
<>
<div className="flex h-screen w-full items-center justify-center overflow-auto bg-white p-5">
<div className="w-full text-center">
<div className="inline-flex rounded-full bg-red-100 p-4">
<div className="rounded-full bg-red-200 stroke-red-600 p-4">
<svg
className="h-16 w-16"
viewBox="0 0 28 28"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M6 8H6.01M6 16H6.01M6 12H18C20.2091 12 22 10.2091 22 8C22 5.79086 20.2091 4 18 4H6C3.79086 4 2 5.79086 2 8C2 10.2091 3.79086 12 6 12ZM6 12C3.79086 12 2 13.7909 2 16C2 18.2091 3.79086 20 6 20H14"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
></path>
<path
d="M17 16L22 21M22 16L17 21"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
></path>
</svg>
</div>
</div>
<h1 className="mt-5 text-xl font-bold text-slate-800">
Oops! Unexpected error occurred.
</h1>
<p className="lg:text-md my-2 text-slate-600">
Something went wrong. Try to{' '}
<button
rel="noopener noreferrer"
className="text-[hsla(var(--app-link))] hover:underline"
onClick={() => window.location.reload()}
>
refresh this page
</button>{' '}
or <br /> feel free to{' '}
<a
rel="noopener noreferrer"
className="text-[hsla(var(--app-link))] hover:underline"
href="https://discord.gg/FTk2MvZwJH"
target="_blank_"
>
contact us
</a>{' '}
if the problem persists.
</p>
<div
className="mt-5 w-full rounded border border-red-400 bg-red-100 px-4 py-3 text-red-700"
role="alert"
>
<strong className="font-bold">Error: </strong>
<span className="block sm:inline">{error.message}</span>
<div className="mt-2 h-full w-full">
<pre className="mt-2 w-full whitespace-pre-wrap rounded bg-red-200 p-4 text-left text-red-600">
{showFull ? error.stack : error.stack?.slice(0, 200)}
</pre>
<button
onClick={() => setShowFull(!showFull)}
className="mt-1 text-red-700 underline focus:outline-none"
>
{showFull ? 'Show less' : 'Show more'}
</button>
</div>
</div>
</div>
</div>
</>
)
}