File tree 7 files changed +71
-21
lines changed
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";
8
8
import { RouteDashboard } from "./routes/route-dashboard" ;
9
9
import { RouteCertificateSecurity } from "./routes/route-certificate-security" ;
10
10
import { RouteWorkspaceCreation } from "./routes/route-workspace-creation" ;
11
+ import { RouteNotFound } from "./routes/route-not-found" ;
11
12
12
13
export default function Page ( ) {
13
14
return (
@@ -23,6 +24,7 @@ export default function Page() {
23
24
path = "/certificates/security"
24
25
element = { < RouteCertificateSecurity /> }
25
26
/>
27
+ < Route path = "*" element = { < RouteNotFound /> } />
26
28
</ Routes >
27
29
) ;
28
30
}
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 1
1
export { default as Continue } from "./Continue" ;
2
2
export { default as Copilot } from "./Copilot" ;
3
3
export { default as Discord } from "./Discord" ;
4
- export { default as FlipBackward } from "./FlipBackward" ;
5
4
export { default as Github } from "./Github" ;
6
5
export { 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