diff --git a/src/lib/PageNotFound.jsx b/src/lib/PageNotFound.jsx new file mode 100644 index 0000000..cce903d --- /dev/null +++ b/src/lib/PageNotFound.jsx @@ -0,0 +1,75 @@ +import { useLocation } from 'react-router-dom'; +import { base44 } from '@/api/base44Client'; +import { useQuery } from '@tanstack/react-query'; + + +export default function PageNotFound({}) { + const location = useLocation(); + const pageName = location.pathname.substring(1); + + const { data: authData, isFetched } = useQuery({ + queryKey: ['user'], + queryFn: async () => { + try { + const user = await base44.auth.me(); + return { user, isAuthenticated: true }; + } catch (error) { + return { user: null, isAuthenticated: false }; + } + } + }); + + return ( +
+
+
+ {/* 404 Error Code */} +
+

404

+
+
+ + {/* Main Message */} +
+

+ Page Not Found +

+

+ The page "{pageName}" could not be found in this application. +

+
+ + {/* Admin Note */} + {isFetched && authData.isAuthenticated && authData.user?.role === 'admin' && ( +
+
+
+
+
+
+

Admin Note

+

+ This could mean that the AI hasn't implemented this page yet. Ask it to implement it in the chat. +

+
+
+
+ )} + + {/* Action Button */} +
+ +
+
+
+
+ ) +} \ No newline at end of file