arcanajs 2.1.6 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +169 -2
  2. package/framework/cli/index.js +110 -17
  3. package/framework/cli/webpack.config.js +69 -42
  4. package/framework/lib/client/index.js +22 -6
  5. package/framework/lib/index.d.ts +2 -0
  6. package/framework/lib/index.js +42 -17
  7. package/framework/lib/server/ArcanaJSMiddleware.js +17 -10
  8. package/framework/lib/server/ArcanaJSServer.js +45 -29
  9. package/framework/lib/server/ControllerBinder.js +4 -1
  10. package/framework/lib/server/CsrfMiddleware.js +10 -3
  11. package/framework/lib/server/DynamicRouter.js +5 -1
  12. package/framework/lib/server/ResponseHandlerMiddleware.js +5 -1
  13. package/framework/lib/server/Router.js +15 -7
  14. package/framework/lib/server.d.ts +9 -0
  15. package/framework/lib/server.js +40 -6
  16. package/framework/lib/shared/components/Body.js +7 -3
  17. package/framework/lib/shared/components/Head.js +47 -10
  18. package/framework/lib/shared/components/Link.js +9 -5
  19. package/framework/lib/shared/components/NavLink.js +10 -6
  20. package/framework/lib/shared/components/Page.js +9 -5
  21. package/framework/lib/shared/context/HeadContext.js +5 -2
  22. package/framework/lib/shared/context/PageContext.js +5 -2
  23. package/framework/lib/shared/context/RouterContext.js +9 -5
  24. package/framework/lib/shared/core/ArcanaJSApp.js +18 -14
  25. package/framework/lib/shared/hooks/useDynamicComponents.js +8 -4
  26. package/framework/lib/shared/hooks/useHead.d.ts +1 -1
  27. package/framework/lib/shared/hooks/useHead.js +7 -3
  28. package/framework/lib/shared/hooks/useLocation.js +7 -3
  29. package/framework/lib/shared/hooks/usePage.js +7 -3
  30. package/framework/lib/shared/hooks/useParams.js +8 -4
  31. package/framework/lib/shared/hooks/useQuery.js +7 -3
  32. package/framework/lib/shared/hooks/useRouter.d.ts +1 -1
  33. package/framework/lib/shared/hooks/useRouter.js +8 -4
  34. package/framework/lib/shared/utils/createSingletonContext.js +6 -3
  35. package/framework/lib/shared/views/ErrorPage.d.ts +7 -0
  36. package/framework/lib/shared/views/ErrorPage.js +11 -0
  37. package/framework/lib/shared/views/NotFoundPage.d.ts +5 -0
  38. package/framework/lib/shared/views/NotFoundPage.js +12 -0
  39. package/framework/templates/ErrorPage.tsx +137 -0
  40. package/framework/templates/HomePage.tsx +325 -0
  41. package/framework/templates/NotFoundPage.tsx +109 -0
  42. package/framework/templates/arcanajs.png +0 -0
  43. package/framework/templates/arcanajs.svg +12 -0
  44. package/framework/templates/client-index.tsx +7 -0
  45. package/framework/templates/favicon.ico +0 -0
  46. package/framework/templates/globals.css +198 -0
  47. package/framework/templates/package.json +15 -0
  48. package/framework/templates/postcss.config.js +6 -0
  49. package/framework/templates/server-controller-home.ts +7 -0
  50. package/framework/templates/server-index.ts +10 -0
  51. package/framework/templates/server-routes-web.ts +7 -0
  52. package/package.json +2 -2
@@ -1,14 +1,17 @@
1
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useEffect, useState } from "react";
3
- import { Page } from "../components/Page";
4
- import { RouterProvider } from "../context/RouterContext";
5
- export const ArcanaJSApp = ({ initialPage, initialData, initialParams = {}, initialUrl, csrfToken, views, layout: Layout, }) => {
6
- const [page, setPage] = useState(initialPage);
7
- const [data, setData] = useState(initialData);
8
- const [params, setParams] = useState(initialParams);
9
- const [url, setUrl] = useState(initialUrl ||
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ArcanaJSApp = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const Page_1 = require("../components/Page");
7
+ const RouterContext_1 = require("../context/RouterContext");
8
+ const ArcanaJSApp = ({ initialPage, initialData, initialParams = {}, initialUrl, csrfToken, views, layout: Layout, }) => {
9
+ const [page, setPage] = (0, react_1.useState)(initialPage);
10
+ const [data, setData] = (0, react_1.useState)(initialData);
11
+ const [params, setParams] = (0, react_1.useState)(initialParams);
12
+ const [url, setUrl] = (0, react_1.useState)(initialUrl ||
10
13
  (typeof window !== "undefined" ? window.location.pathname : "/"));
11
- useEffect(() => {
14
+ (0, react_1.useEffect)(() => {
12
15
  const handlePopState = (event) => {
13
16
  if (event.state) {
14
17
  setPage(event.state.page);
@@ -47,15 +50,16 @@ export const ArcanaJSApp = ({ initialPage, initialData, initialParams = {}, init
47
50
  }
48
51
  };
49
52
  const renderPage = () => {
50
- const Component = views[page] || views["NotFoundPage"] || (() => _jsx("div", { children: "404 Not Found" }));
51
- return (_jsx(Page, { data: data, children: _jsx(Component, { data: data, navigateTo: navigateTo, params: params }) }));
53
+ const Component = views[page] || views["NotFoundPage"] || (() => (0, jsx_runtime_1.jsx)("div", { children: "404 Not Found" }));
54
+ return ((0, jsx_runtime_1.jsx)(Page_1.Page, { data: data, children: (0, jsx_runtime_1.jsx)(Component, { data: data, navigateTo: navigateTo, params: params }) }));
52
55
  };
53
56
  const content = renderPage();
54
- return (_jsx(RouterProvider, { value: {
57
+ return ((0, jsx_runtime_1.jsx)(RouterContext_1.RouterProvider, { value: {
55
58
  navigateTo,
56
59
  currentPage: page,
57
60
  currentUrl: url,
58
61
  params,
59
62
  csrfToken,
60
- }, children: Layout ? _jsx(Layout, { children: content }) : _jsx(_Fragment, { children: content }) }));
63
+ }, children: Layout ? (0, jsx_runtime_1.jsx)(Layout, { children: content }) : (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: content }) }));
61
64
  };
65
+ exports.ArcanaJSApp = ArcanaJSApp;
@@ -1,7 +1,10 @@
1
- import { useState, useEffect } from "react";
2
- export const useDynamicComponents = (loader) => {
3
- const [component, setComponent] = useState(null);
4
- useEffect(() => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useDynamicComponents = void 0;
4
+ const react_1 = require("react");
5
+ const useDynamicComponents = (loader) => {
6
+ const [component, setComponent] = (0, react_1.useState)(null);
7
+ (0, react_1.useEffect)(() => {
5
8
  let mounted = true;
6
9
  loader().then((mod) => {
7
10
  if (mounted) {
@@ -14,3 +17,4 @@ export const useDynamicComponents = (loader) => {
14
17
  }, []); // loader dependency omitted to avoid loops if loader is inline
15
18
  return component;
16
19
  };
20
+ exports.useDynamicComponents = useDynamicComponents;
@@ -1 +1 @@
1
- export declare const useHead: () => import("../..").HeadManager | null;
1
+ export declare const useHead: () => import("../context/HeadContext").HeadManager | null;
@@ -1,3 +1,7 @@
1
- import { useContext } from "react";
2
- import { HeadContext } from "../context/HeadContext";
3
- export const useHead = () => useContext(HeadContext);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useHead = void 0;
4
+ const react_1 = require("react");
5
+ const HeadContext_1 = require("../context/HeadContext");
6
+ const useHead = () => (0, react_1.useContext)(HeadContext_1.HeadContext);
7
+ exports.useHead = useHead;
@@ -1,9 +1,13 @@
1
- import { useRouter } from "./useRouter";
2
- export const useLocation = () => {
3
- const { currentUrl } = useRouter();
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useLocation = void 0;
4
+ const useRouter_1 = require("./useRouter");
5
+ const useLocation = () => {
6
+ const { currentUrl } = (0, useRouter_1.useRouter)();
4
7
  return {
5
8
  pathname: currentUrl,
6
9
  search: typeof window !== "undefined" ? window.location.search : "",
7
10
  hash: typeof window !== "undefined" ? window.location.hash : "",
8
11
  };
9
12
  };
13
+ exports.useLocation = useLocation;
@@ -1,3 +1,7 @@
1
- import { useContext } from "react";
2
- import { PageContext } from "../context/PageContext";
3
- export const usePage = () => useContext(PageContext);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.usePage = void 0;
4
+ const react_1 = require("react");
5
+ const PageContext_1 = require("../context/PageContext");
6
+ const usePage = () => (0, react_1.useContext)(PageContext_1.PageContext);
7
+ exports.usePage = usePage;
@@ -1,9 +1,13 @@
1
- import { useContext } from "react";
2
- import { RouterContext } from "../context/RouterContext";
3
- export const useParams = () => {
4
- const context = useContext(RouterContext);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useParams = void 0;
4
+ const react_1 = require("react");
5
+ const RouterContext_1 = require("../context/RouterContext");
6
+ const useParams = () => {
7
+ const context = (0, react_1.useContext)(RouterContext_1.RouterContext);
5
8
  if (!context) {
6
9
  throw new Error("useParams must be used within an ArcanaJSApp");
7
10
  }
8
11
  return context.params;
9
12
  };
13
+ exports.useParams = useParams;
@@ -1,5 +1,9 @@
1
- import { useLocation } from "./useLocation";
2
- export const useQuery = () => {
3
- const { search } = useLocation();
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useQuery = void 0;
4
+ const useLocation_1 = require("./useLocation");
5
+ const useQuery = () => {
6
+ const { search } = (0, useLocation_1.useLocation)();
4
7
  return new URLSearchParams(search);
5
8
  };
9
+ exports.useQuery = useQuery;
@@ -1 +1 @@
1
- export declare const useRouter: () => import("../..").RouterContextType;
1
+ export declare const useRouter: () => import("../context/RouterContext").RouterContextType;
@@ -1,9 +1,13 @@
1
- import { useContext } from "react";
2
- import { RouterContext } from "../context/RouterContext";
3
- export const useRouter = () => {
4
- const context = useContext(RouterContext);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useRouter = void 0;
4
+ const react_1 = require("react");
5
+ const RouterContext_1 = require("../context/RouterContext");
6
+ const useRouter = () => {
7
+ const context = (0, react_1.useContext)(RouterContext_1.RouterContext);
5
8
  if (!context) {
6
9
  throw new Error("useRouter must be used within an ArcanaJSApp");
7
10
  }
8
11
  return context;
9
12
  };
13
+ exports.useRouter = useRouter;
@@ -1,4 +1,7 @@
1
- import { createContext } from "react";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createSingletonContext = createSingletonContext;
4
+ const react_1 = require("react");
2
5
  /**
3
6
  * Creates a React Context that persists across multiple module loads (Webpack bundles vs Node require).
4
7
  * This is essential for SSR applications where the server bundle and dynamically loaded views
@@ -8,11 +11,11 @@ import { createContext } from "react";
8
11
  * @param defaultValue The default value for the context
9
12
  * @returns A React Context instance (singleton)
10
13
  */
11
- export function createSingletonContext(key, defaultValue) {
14
+ function createSingletonContext(key, defaultValue) {
12
15
  const globalAny = global;
13
16
  const symbolKey = Symbol.for(`ARCANAJS_CONTEXT_${key}`);
14
17
  if (!globalAny[symbolKey]) {
15
- globalAny[symbolKey] = createContext(defaultValue);
18
+ globalAny[symbolKey] = (0, react_1.createContext)(defaultValue);
16
19
  }
17
20
  return globalAny[symbolKey];
18
21
  }
@@ -0,0 +1,7 @@
1
+ interface ErrorPageProps {
2
+ message?: string;
3
+ statusCode?: number;
4
+ stack?: string;
5
+ }
6
+ export default function ErrorPage({ message, statusCode, stack, }: ErrorPageProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = ErrorPage;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const Page_1 = require("../components/Page");
6
+ const Head_1 = require("../components/Head");
7
+ const Body_1 = require("../components/Body");
8
+ function ErrorPage({ message = "Something went wrong", statusCode = 500, stack, }) {
9
+ const isDevelopment = process.env.NODE_ENV === "development";
10
+ return ((0, jsx_runtime_1.jsxs)(Page_1.Page, { children: [(0, jsx_runtime_1.jsxs)(Head_1.Head, { children: [(0, jsx_runtime_1.jsxs)("title", { children: [statusCode, " - Server Error"] }), (0, jsx_runtime_1.jsx)("meta", { name: "description", content: "An error occurred on the server" })] }), (0, jsx_runtime_1.jsx)(Body_1.Body, { children: (0, jsx_runtime_1.jsx)("div", { className: "min-h-screen bg-red-50 flex flex-col justify-center items-center px-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "max-w-2xl w-full text-center", children: [(0, jsx_runtime_1.jsxs)("div", { className: "mb-8", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-6xl mb-4", children: (0, jsx_runtime_1.jsx)("span", { className: "text-red-500", children: "\u26A0\uFE0F" }) }), (0, jsx_runtime_1.jsx)("h1", { className: "text-6xl font-bold text-red-500 mb-4", children: statusCode }), (0, jsx_runtime_1.jsx)("h2", { className: "text-2xl font-semibold text-gray-900 mb-2", children: "Server Error" }), (0, jsx_runtime_1.jsx)("p", { className: "text-gray-600 mb-8", children: message })] }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsxs)("a", { href: "/", className: "inline-flex items-center justify-center px-6 py-3 border border-transparent text-base font-medium rounded-md text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 transition-colors duration-200", children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-5 h-5 mr-2", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" }) }), "Go Home"] }), (0, jsx_runtime_1.jsxs)("button", { onClick: () => window.location.reload(), className: "block w-full px-6 py-3 border border-gray-300 text-base font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 transition-colors duration-200", children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-5 h-5 inline mr-2", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" }) }), "Try Again"] })] }), isDevelopment && stack && ((0, jsx_runtime_1.jsx)("div", { className: "mt-8 text-left", children: (0, jsx_runtime_1.jsxs)("details", { className: "bg-gray-100 rounded-lg p-4", children: [(0, jsx_runtime_1.jsx)("summary", { className: "cursor-pointer font-medium text-gray-700 mb-2", children: "Stack Trace (Development Only)" }), (0, jsx_runtime_1.jsx)("pre", { className: "text-xs text-gray-600 overflow-x-auto whitespace-pre-wrap", children: stack })] }) })), (0, jsx_runtime_1.jsx)("div", { className: "mt-8 text-sm text-gray-500", children: (0, jsx_runtime_1.jsxs)("p", { children: ["If this problem persists, please", " ", (0, jsx_runtime_1.jsx)("a", { href: "/contact", className: "text-red-600 hover:text-red-500 underline", children: "contact support" }), "."] }) })] }) }) })] }));
11
+ }
@@ -0,0 +1,5 @@
1
+ interface NotFoundPageProps {
2
+ url?: string;
3
+ }
4
+ export default function NotFoundPage({ url }: NotFoundPageProps): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = NotFoundPage;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const Page_1 = require("../components/Page");
6
+ const Head_1 = require("../components/Head");
7
+ const Body_1 = require("../components/Body");
8
+ function NotFoundPage({ url }) {
9
+ return ((0, jsx_runtime_1.jsxs)(Page_1.Page, { children: [(0, jsx_runtime_1.jsxs)(Head_1.Head, { children: [(0, jsx_runtime_1.jsx)("title", { children: "404 - Page Not Found" }), (0, jsx_runtime_1.jsx)("meta", { name: "description", content: "The page you're looking for doesn't exist" })] }), (0, jsx_runtime_1.jsx)(Body_1.Body, { children: (0, jsx_runtime_1.jsx)("div", { className: "min-h-screen bg-gray-50 flex flex-col justify-center items-center px-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "max-w-md w-full text-center", children: [(0, jsx_runtime_1.jsxs)("div", { className: "mb-8", children: [(0, jsx_runtime_1.jsx)("h1", { className: "text-9xl font-bold text-gray-200 mb-4", children: "404" }), (0, jsx_runtime_1.jsx)("h2", { className: "text-2xl font-semibold text-gray-900 mb-2", children: "Page Not Found" }), (0, jsx_runtime_1.jsx)("p", { className: "text-gray-600 mb-8", children: url
10
+ ? `The page "${url}" you're looking for doesn't exist.`
11
+ : "The page you're looking for doesn't exist." })] }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsxs)("a", { href: "/", className: "inline-flex items-center justify-center px-6 py-3 border border-transparent text-base font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-colors duration-200", children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-5 h-5 mr-2", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" }) }), "Go Home"] }), (0, jsx_runtime_1.jsxs)("button", { onClick: () => window.history.back(), className: "block w-full px-6 py-3 border border-gray-300 text-base font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-colors duration-200", children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-5 h-5 inline mr-2", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 19l-7-7m0 0l7-7m-7 7h18" }) }), "Go Back"] })] }), (0, jsx_runtime_1.jsx)("div", { className: "mt-8 text-sm text-gray-500", children: (0, jsx_runtime_1.jsxs)("p", { children: ["If you think this is an error, please", " ", (0, jsx_runtime_1.jsx)("a", { href: "/contact", className: "text-blue-600 hover:text-blue-500 underline", children: "contact us" }), "."] }) })] }) }) })] }));
12
+ }
@@ -0,0 +1,137 @@
1
+ import React from "react";
2
+ import { Page, Head, Body } from "arcanajs";
3
+
4
+ interface ErrorPageProps {
5
+ message?: string;
6
+ statusCode?: number;
7
+ stack?: string;
8
+ }
9
+
10
+ export default function ErrorPage({
11
+ message = "Something went wrong",
12
+ statusCode = 500,
13
+ stack,
14
+ }: ErrorPageProps) {
15
+ const isDevelopment = process.env.NODE_ENV === "development";
16
+
17
+ return (
18
+ <Page>
19
+ <Head>
20
+ <title>{statusCode} - Server Error</title>
21
+ <meta name="description" content="An error occurred on the server" />
22
+ </Head>
23
+ <Body>
24
+ <div className="relative min-h-screen overflow-hidden bg-black text-white flex flex-col justify-center items-center px-4 font-sans">
25
+ {/* Animated Background */}
26
+ <div className="fixed inset-0 z-0 overflow-hidden pointer-events-none">
27
+ <div className="absolute inset-0 grid-pattern opacity-30"></div>
28
+ <div className="absolute top-1/4 right-1/4 w-96 h-96 bg-red-600 rounded-full opacity-20 blur-3xl animate-glow"></div>
29
+ <div
30
+ className="absolute bottom-1/4 left-1/4 w-96 h-96 bg-orange-600 rounded-full opacity-10 blur-3xl animate-glow"
31
+ style={{ animationDelay: "2s" }}
32
+ ></div>
33
+ <div className="absolute inset-0 hero-gradient"></div>
34
+ </div>
35
+
36
+ <div className="relative z-10 max-w-2xl w-full text-center animate-scale-in">
37
+ <div className="glass-card rounded-3xl p-12 border border-white/10 shadow-2xl">
38
+ <div className="mb-8">
39
+ <div className="text-6xl mb-6 animate-float">
40
+ <span className="text-red-500 drop-shadow-lg filter">⚠️</span>
41
+ </div>
42
+ <h1 className="text-8xl font-bold text-transparent bg-clip-text bg-gradient-to-br from-red-500 to-orange-500 mb-4">
43
+ {statusCode}
44
+ </h1>
45
+ <h2 className="text-3xl font-bold text-white mb-4">
46
+ Server Error
47
+ </h2>
48
+ <p className="text-gray-400 text-lg leading-relaxed">
49
+ {message}
50
+ </p>
51
+ </div>
52
+
53
+ <div className="flex flex-col sm:flex-row gap-4 justify-center mb-8">
54
+ <a
55
+ href="/"
56
+ className="btn-primary px-8 py-3.5 text-white font-semibold rounded-xl inline-flex items-center justify-center gap-2 w-full sm:w-auto bg-gradient-to-r from-red-600 to-orange-600 hover:from-red-500 hover:to-orange-500 border-none shadow-red-900/20"
57
+ >
58
+ <svg
59
+ className="w-5 h-5"
60
+ fill="none"
61
+ stroke="currentColor"
62
+ viewBox="0 0 24 24"
63
+ >
64
+ <path
65
+ strokeLinecap="round"
66
+ strokeLinejoin="round"
67
+ strokeWidth={2}
68
+ d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"
69
+ />
70
+ </svg>
71
+ Go Home
72
+ </a>
73
+
74
+ <button
75
+ onClick={() => window.location.reload()}
76
+ className="btn-secondary px-8 py-3.5 text-white font-semibold rounded-xl inline-flex items-center justify-center gap-2 w-full sm:w-auto"
77
+ >
78
+ <svg
79
+ className="w-5 h-5"
80
+ fill="none"
81
+ stroke="currentColor"
82
+ viewBox="0 0 24 24"
83
+ >
84
+ <path
85
+ strokeLinecap="round"
86
+ strokeLinejoin="round"
87
+ strokeWidth={2}
88
+ d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"
89
+ />
90
+ </svg>
91
+ Try Again
92
+ </button>
93
+ </div>
94
+
95
+ {isDevelopment && stack && (
96
+ <div className="mt-8 text-left animate-slide-up">
97
+ <details className="bg-black/40 border border-white/10 rounded-xl overflow-hidden group">
98
+ <summary className="cursor-pointer font-medium text-gray-300 p-4 hover:bg-white/5 transition-colors flex items-center justify-between select-none">
99
+ <span>Stack Trace (Development Only)</span>
100
+ <svg
101
+ className="w-5 h-5 text-gray-500 group-open:rotate-180 transition-transform"
102
+ fill="none"
103
+ stroke="currentColor"
104
+ viewBox="0 0 24 24"
105
+ >
106
+ <path
107
+ strokeLinecap="round"
108
+ strokeLinejoin="round"
109
+ strokeWidth={2}
110
+ d="M19 9l-7 7-7-7"
111
+ />
112
+ </svg>
113
+ </summary>
114
+ <pre className="text-xs text-red-300/80 p-4 overflow-x-auto whitespace-pre-wrap font-mono border-t border-white/5 bg-black/20">
115
+ {stack}
116
+ </pre>
117
+ </details>
118
+ </div>
119
+ )}
120
+ </div>
121
+
122
+ <div className="mt-8 text-gray-500 text-sm">
123
+ If this problem persists, please{" "}
124
+ <a
125
+ href="/contact"
126
+ className="text-red-400 hover:text-red-300 underline transition-colors"
127
+ >
128
+ contact support
129
+ </a>
130
+ .
131
+ </div>
132
+ </div>
133
+ </div>
134
+ </Body>
135
+ </Page>
136
+ );
137
+ }