This repository was archived by the owner on Jul 8, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +71
-21
lines changed Expand file tree Collapse file tree 7 files changed +71
-21
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ import { render } from "./lib/test-utils" ;
2+ import Page from "./Page" ;
3+
4+ test ( "render NotFound route" , ( ) => {
5+ const { getByText, getByRole } = render ( < Page /> , {
6+ routeConfig : {
7+ initialEntries : [ "/fake-route" ] ,
8+ } ,
9+ } ) ;
10+
11+ expect ( getByText ( / O o p s ! T h e r e ' s n o t h i n g h e r e / i) ) . toBeVisible ( ) ;
12+ expect ( getByRole ( "button" , { name : "Home" } ) ) . toBeVisible ( ) ;
13+ } ) ;
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import { RouteChat } from "./routes/route-chat";
88import { RouteDashboard } from "./routes/route-dashboard" ;
99import { RouteCertificateSecurity } from "./routes/route-certificate-security" ;
1010import { RouteWorkspaceCreation } from "./routes/route-workspace-creation" ;
11+ import { RouteNotFound } from "./routes/route-not-found" ;
1112
1213export default function Page ( ) {
1314 return (
@@ -23,6 +24,7 @@ export default function Page() {
2324 path = "/certificates/security"
2425 element = { < RouteCertificateSecurity /> }
2526 />
27+ < Route path = "*" element = { < RouteNotFound /> } />
2628 </ Routes >
2729 ) ;
2830}
Original file line number Diff line number Diff line change 1+ interface EmptyStateProps {
2+ children ?: React . ReactNode ;
3+ title ?: string | React . ReactNode ;
4+ description ?: string | React . ReactNode ;
5+ illustration ?: React . ReactNode ;
6+ }
7+
8+ export function EmptyState ( {
9+ illustration,
10+ title,
11+ children,
12+ description,
13+ } : EmptyStateProps ) {
14+ return (
15+ < >
16+ < div className = "my-4" >
17+ { illustration != null && (
18+ < div className = "m-auto flex w-full justify-center pb-2" >
19+ { illustration }
20+ </ div >
21+ ) }
22+ < div className = "mb-1 text-center text-xl font-medium text-gray-900" >
23+ { title }
24+ </ div >
25+ < div className = "m-auto mb-6 text-center font-normal text-secondary" >
26+ { description }
27+ </ div >
28+ { children != null && (
29+ < div className = "flex justify-center" > { children } </ div >
30+ ) }
31+ </ div >
32+ </ >
33+ ) ;
34+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11export { default as Continue } from "./Continue" ;
22export { default as Copilot } from "./Copilot" ;
33export { default as Discord } from "./Discord" ;
4- export { default as FlipBackward } from "./FlipBackward" ;
54export { default as Github } from "./Github" ;
65export { default as Youtube } from "./Youtube" ;
Original file line number Diff line number Diff line change 1+ import { EmptyState } from "@/components/EmptyState" ;
2+ import { IllustrationError , Button } from "@stacklok/ui-kit" ;
3+ import { useNavigate } from "react-router-dom" ;
4+ import { FlipBackward } from "@untitled-ui/icons-react" ;
5+
6+ export function RouteNotFound ( ) {
7+ const navigate = useNavigate ( ) ;
8+
9+ return (
10+ < div className = "flex items-center justify-center h-full" >
11+ < EmptyState
12+ title = "Oops! There's nothing here"
13+ description = "Either the page you were looking for doesn’t exist or the link may be broken."
14+ illustration = { < IllustrationError className = "w-1/2" /> }
15+ >
16+ < Button variant = "primary" onPress = { ( ) => navigate ( "/" ) } >
17+ < FlipBackward /> Home
18+ </ Button >
19+ </ EmptyState >
20+ </ div >
21+ ) ;
22+ }
You can’t perform that action at this time.
0 commit comments