mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-17 13:48:02 +00:00
feat: updates
This commit is contained in:
parent
cf7a4528dd
commit
0e58bb6e80
44 changed files with 1027 additions and 496 deletions
43
packages/web/components/New/ErrorBoundary.tsx
Normal file
43
packages/web/components/New/ErrorBoundary.tsx
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import { ReactNode } from 'react'
|
||||
import { ErrorBoundary as ErrorBoundaryRaw } from 'react-error-boundary'
|
||||
|
||||
function ErrorFallback({
|
||||
error,
|
||||
resetErrorBoundary,
|
||||
}: {
|
||||
error: Error
|
||||
resetErrorBoundary: () => void
|
||||
}) {
|
||||
return (
|
||||
<div
|
||||
role='alert'
|
||||
className='app-region-drag flex h-screen w-screen items-center justify-center bg-white dark:bg-black'
|
||||
>
|
||||
<div className='app-region-no-drag'>
|
||||
<p>Something went wrong:</p>
|
||||
<pre>{error.message}</pre>
|
||||
<button
|
||||
onClick={resetErrorBoundary}
|
||||
className='mt-4 rounded-full bg-brand-600 px-6 py-5 text-16 font-medium'
|
||||
>
|
||||
Try Again
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const ErrorBoundary = ({ children }: { children: ReactNode }) => {
|
||||
return (
|
||||
<ErrorBoundaryRaw
|
||||
FallbackComponent={ErrorFallback}
|
||||
onReset={() => {
|
||||
// reset the state of your app so the error doesn't happen again
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</ErrorBoundaryRaw>
|
||||
)
|
||||
}
|
||||
|
||||
export default ErrorBoundary
|
||||
Loading…
Add table
Add a link
Reference in a new issue