-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #175 from osu-tournament-rating/profiles-mode-fix
Profiles gets current ruleset
- Loading branch information
Showing
3 changed files
with
109 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
.errorDiv { | ||
position: relative; | ||
min-height: 60dvh; | ||
height: 70dvh; | ||
max-height: 70dvh; | ||
margin: var(--main-padding); | ||
margin-top: 0; | ||
} | ||
|
||
.errorDiv .content { | ||
height: 100%; | ||
width: 100%; | ||
position: absolute; | ||
display: flex; | ||
flex-flow: column; | ||
align-items: center; | ||
justify-content: center; | ||
padding: var(--internal-gap); | ||
gap: var(--internal-gap); | ||
z-index: 2; | ||
} | ||
|
||
.errorDiv img { | ||
z-index: 1; | ||
} | ||
|
||
.errorDiv h1 { | ||
font-size: 4rem; | ||
} | ||
|
||
.errorDiv span { | ||
font-size: 3.5rem; | ||
letter-spacing: -2%; | ||
text-align: center; | ||
max-width: 40vw; | ||
} | ||
|
||
.errorDiv button { | ||
margin-top: 1.3rem; | ||
padding: 1rem 3rem; | ||
width: fit-content; | ||
font-weight: 500; | ||
cursor: pointer; | ||
border-radius: 0.4rem; | ||
font-size: 1rem; | ||
transition: background-color 0.2s ease-out; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
'use client'; | ||
|
||
import backgroundError from '@/public/images/error-background.svg'; | ||
import Image from 'next/image'; | ||
import { useEffect } from 'react'; | ||
import Balancer from 'react-wrap-balancer'; | ||
import styles from './error.module.css'; | ||
|
||
const errors = { | ||
'4': { | ||
title: 'No data', | ||
message: "You don't have any data for the selected ruleset", | ||
reloadBtn: true, | ||
}, | ||
'404': { | ||
title: '404', | ||
message: "We don't have that page", | ||
reloadBtn: false, | ||
}, | ||
}; | ||
|
||
export default function Error({ | ||
error, | ||
reset, | ||
}: { | ||
error: Error & { digest?: string }; | ||
reset: () => void; | ||
}) { | ||
useEffect(() => { | ||
// Log the error to an error reporting service | ||
console.error(error); | ||
}, [error]); | ||
|
||
let errorContent = !isNaN(error.message) | ||
? errors[error.message] | ||
: errors['404']; | ||
|
||
return ( | ||
<div className={styles.errorDiv}> | ||
<Image src={backgroundError} alt="Error background" fill /> | ||
<div className={styles.content}> | ||
<h1>{errorContent.title}</h1> | ||
<span>{errorContent.message}</span> | ||
{errorContent.reloadBtn && ( | ||
<button | ||
onClick={ | ||
// Attempt to recover by trying to re-render the segment | ||
() => reset() | ||
} | ||
> | ||
Try again | ||
</button> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
} |