-
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.
- Loading branch information
Showing
13 changed files
with
502 additions
and
92 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
"use client" | ||
|
||
import { ErrorDisplay } from "../_layout/ErrorDisplay" | ||
import { msg } from "@lingui/macro" | ||
import { useEffect } from "react" | ||
import { useLingui } from "@lingui/react" | ||
|
||
export default function Error({ | ||
error, | ||
reset, | ||
}: { | ||
error: Error & { digest?: string } | ||
reset: () => void | ||
}) { | ||
const { _ } = useLingui() | ||
useEffect(() => { | ||
// TODO: Log the error to an error reporting service | ||
console.error(error) | ||
}, [error]) | ||
|
||
return <ErrorDisplay reset={reset} title={_(msg`Failed to fetch stats`)} /> | ||
} |
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
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,51 @@ | ||
import { Button } from "ui/base/Button" | ||
import { DiscordIcon, GithubIcon } from "ui/icons" | ||
import { SectionTitle } from "@/components/layout/SectionTitle" | ||
import { Trans } from "@lingui/macro" | ||
|
||
type ErrorDisplayProps = { | ||
title?: string | ||
reset: () => void | ||
} | ||
|
||
export const ErrorDisplay = ({ | ||
title = "Oops, something went wrong", | ||
reset, | ||
}: ErrorDisplayProps) => { | ||
return ( | ||
<div> | ||
<SectionTitle className="text-center">{title}</SectionTitle> | ||
<div className="flex flex-col justify-center items-center gap-4"> | ||
{!!reset && ( | ||
<Button buttonStyle="primary" onClick={reset}> | ||
<Trans>Try Again</Trans> | ||
</Button> | ||
)} | ||
<div className="flex justify-center items-center gap-2"> | ||
<Button | ||
buttonStyle="outline" | ||
onClick={() => { | ||
window | ||
?.open("/discord", "_blank", "noreferrer") | ||
?.focus() | ||
}} | ||
className="flex items-center gap-2" | ||
> | ||
<DiscordIcon size={16} /> Report bug | ||
</Button> | ||
<Button | ||
buttonStyle="outline" | ||
onClick={() => { | ||
window | ||
?.open("/github", "_blank", "noreferrer") | ||
?.focus() | ||
}} | ||
className="flex items-center gap-2" | ||
> | ||
<GithubIcon size={16} /> Contribute | ||
</Button> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} |
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
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
Oops, something went wrong.