diff --git a/src/App.tsx b/src/App.tsx
index e755869..eeae0c6 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,5 +1,6 @@
import { Route, Routes } from 'react-router-dom'
import { PageLayout } from './components/layout/PageLayout'
+import { ErrorPage } from './components/shared/ErrorPage'
import { HomePage } from './pages/HomePage'
import { ProfilePage } from './pages/ProfilePage'
import { RepoPage } from './pages/RepoPage'
@@ -13,6 +14,12 @@ function App() {
} />
} />
} />
+
+ }
+ />
)
diff --git a/src/components/shared/ErrorPage.tsx b/src/components/shared/ErrorPage.tsx
new file mode 100644
index 0000000..7e5134e
--- /dev/null
+++ b/src/components/shared/ErrorPage.tsx
@@ -0,0 +1,37 @@
+import { Link } from 'react-router-dom'
+import { PageContainer } from '../layout/PageContainer'
+import { SurfaceCard } from './SurfaceCard'
+
+type ErrorPageProps = {
+ title: string
+ message: string
+ details?: string
+}
+
+export function ErrorPage({ title, message, details }: ErrorPageProps) {
+ return (
+
+
+
+
+ {title}
+ {message}
+
+ {details !== undefined && (
+
+
+ Technical details
+
+ {details}
+
+ )}
+
+
+ Go home
+
+
+
+
+
+ )
+}
diff --git a/src/pages/ProfilePage.tsx b/src/pages/ProfilePage.tsx
index bc8d4c3..6676236 100644
--- a/src/pages/ProfilePage.tsx
+++ b/src/pages/ProfilePage.tsx
@@ -6,6 +6,7 @@ import { ProfileHeader } from '../components/profile/ProfileHeader'
import { ProfileSection } from '../components/profile/ProfileSection'
import { ProfileTabs } from '../components/profile/ProfileTabs'
import { RepoListItem } from '../components/repo/RepoListItem'
+import { ErrorPage } from '../components/shared/ErrorPage'
import { StringListItem } from '../components/string/StringListItem'
import { VouchList } from '../components/vouch/VouchList'
import { useProfilePage } from '../hooks/useProfilePage'
@@ -21,11 +22,17 @@ export function ProfilePage() {
const { pageData, error } = useProfilePage(handle)
if (handle === null) {
- return
Invalid handle
+ return
}
if (error) {
- return Could not load profile: {error.message}
+ return (
+
+ )
}
if (pageData === null) {
diff --git a/src/pages/RepoPage.tsx b/src/pages/RepoPage.tsx
index e505516..65b69de 100644
--- a/src/pages/RepoPage.tsx
+++ b/src/pages/RepoPage.tsx
@@ -10,6 +10,7 @@ import { RepoTabs } from '../components/repo/RepoTabs'
import { RepoView } from '../components/repo/RepoView'
import { RepoWorkspace } from '../components/repo/RepoWorkspace'
import { RepoPageSkeleton } from '../components/shared/PageSkeletons'
+import { ErrorPage } from '../components/shared/ErrorPage'
import { SurfaceCard } from '../components/shared/SurfaceCard'
import { useRepoPage } from '../hooks/useRepoPage'
import { parseHandle } from '../lib/routes'
@@ -34,11 +35,19 @@ export function RepoPage() {
}, [requestedSection, pageData])
if (handle === null || routeRepo === undefined) {
- return Invalid repository route
+ return (
+
+ )
}
if (error) {
- return Could not load repository: {error.message}
+ return (
+
+ )
}
if (pageData === null) {
diff --git a/src/pages/StringPage.tsx b/src/pages/StringPage.tsx
index 18111fd..9e0d519 100644
--- a/src/pages/StringPage.tsx
+++ b/src/pages/StringPage.tsx
@@ -1,6 +1,7 @@
import { useParams } from 'react-router-dom'
import { ProfileByline } from '../components/profile/ProfileByline'
import { ProfilePageSkeleton } from '../components/shared/PageSkeletons'
+import { ErrorPage } from '../components/shared/ErrorPage'
import { StringView } from '../components/string/StringView'
import { useStringPage } from '../hooks/useStringPage'
import { parseHandle } from '../lib/routes'
@@ -11,11 +12,17 @@ export function StringPage() {
const { pageData, error } = useStringPage(handle, routeString)
if (handle === null || routeString === undefined) {
- return Invalid string route
+ return
}
if (error) {
- return Could not load string: {error.message}
+ return (
+
+ )
}
if (pageData === null) {