baraqex 2.0.3 → 2.0.5

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 (65) hide show
  1. package/dist/browser.js +11 -9
  2. package/dist/browser.js.map +2 -2
  3. package/dist/core/jsx-runtime.d.ts +1 -1
  4. package/dist/core/jsx-runtime.d.ts.map +1 -1
  5. package/dist/index.js +11 -9
  6. package/dist/index.js.map +2 -2
  7. package/package.json +1 -1
  8. package/templates/fullstack-app/README.md +62 -37
  9. package/templates/fullstack-app/build-wasm.js +80 -0
  10. package/templates/fullstack-app/build.mjs +133 -0
  11. package/templates/fullstack-app/go/main.go +53 -0
  12. package/templates/fullstack-app/index.html +17 -36
  13. package/templates/fullstack-app/package.json +41 -35
  14. package/templates/fullstack-app/postcss.config.js +6 -6
  15. package/templates/fullstack-app/public/wasm/.gitkeep +1 -0
  16. package/templates/fullstack-app/server.ts +239 -474
  17. package/templates/fullstack-app/src/App.tsx +77 -0
  18. package/templates/fullstack-app/src/main.tsx +31 -155
  19. package/templates/fullstack-app/src/pages/About.tsx +40 -0
  20. package/templates/fullstack-app/src/pages/Home.tsx +67 -0
  21. package/templates/fullstack-app/src/pages/WasmDemo.tsx +81 -0
  22. package/templates/fullstack-app/src/styles.css +12 -5
  23. package/templates/fullstack-app/tailwind.config.js +8 -11
  24. package/templates/fullstack-app/tsconfig.json +20 -18
  25. package/templates/fullstack-app/api/hello.js +0 -11
  26. package/templates/fullstack-app/api/hello.ts +0 -18
  27. package/templates/fullstack-app/api/users/[id].ts +0 -73
  28. package/templates/fullstack-app/api/users/index.ts +0 -32
  29. package/templates/fullstack-app/build/main.css +0 -874
  30. package/templates/fullstack-app/build/main.css.map +0 -7
  31. package/templates/fullstack-app/build/main.js +0 -967
  32. package/templates/fullstack-app/build/main.js.map +0 -7
  33. package/templates/fullstack-app/build.ts +0 -210
  34. package/templates/fullstack-app/process-tailwind.js +0 -45
  35. package/templates/fullstack-app/public/_redirects +0 -1
  36. package/templates/fullstack-app/public/route-handler.js +0 -47
  37. package/templates/fullstack-app/public/spa-fix.html +0 -17
  38. package/templates/fullstack-app/public/styles.css +0 -975
  39. package/templates/fullstack-app/public/tailwind.css +0 -15
  40. package/templates/fullstack-app/server.js +0 -267
  41. package/templates/fullstack-app/src/README.md +0 -55
  42. package/templates/fullstack-app/src/client.js +0 -87
  43. package/templates/fullstack-app/src/components/ClientHome.tsx +0 -0
  44. package/templates/fullstack-app/src/components/ErrorBoundary.tsx +0 -36
  45. package/templates/fullstack-app/src/components/Layout.tsx +0 -42
  46. package/templates/fullstack-app/src/components/StateDemo.tsx +0 -207
  47. package/templates/fullstack-app/src/components/UserList.tsx +0 -44
  48. package/templates/fullstack-app/src/config.ts +0 -42
  49. package/templates/fullstack-app/src/data/api.ts +0 -206
  50. package/templates/fullstack-app/src/middleware.ts +0 -28
  51. package/templates/fullstack-app/src/pages/404.tsx +0 -28
  52. package/templates/fullstack-app/src/pages/[id].tsx +0 -0
  53. package/templates/fullstack-app/src/pages/_app.tsx +0 -11
  54. package/templates/fullstack-app/src/pages/_document.tsx +0 -25
  55. package/templates/fullstack-app/src/pages/_error.tsx +0 -45
  56. package/templates/fullstack-app/src/pages/about/index.tsx +0 -67
  57. package/templates/fullstack-app/src/pages/about.tsx +0 -71
  58. package/templates/fullstack-app/src/pages/api/users/[id].ts +0 -73
  59. package/templates/fullstack-app/src/pages/api/users/index.ts +0 -43
  60. package/templates/fullstack-app/src/pages/index.tsx +0 -110
  61. package/templates/fullstack-app/src/pages/users/[id].tsx +0 -153
  62. package/templates/fullstack-app/src/pages/users.tsx +0 -60
  63. package/templates/fullstack-app/src/pages/wasm-demo.tsx +0 -1
  64. package/templates/fullstack-app/src/router.ts +0 -255
  65. package/templates/fullstack-app/vite.config.js +0 -87
@@ -1,207 +0,0 @@
1
- import { jsx, useState, useEffect, useMemo } from 'frontend-hamroun';
2
-
3
- // Define our state types for better type safety
4
- interface CounterState {
5
- count: number;
6
- lastUpdated: string | null;
7
- history: number[];
8
- }
9
-
10
- export default function StateDemo() {
11
- // More comprehensive state with history tracking
12
- const [state, setState] = useState<CounterState>({
13
- count: 0,
14
- lastUpdated: null,
15
- history: []
16
- });
17
-
18
- // Track UI state separately
19
- const [isLoading, setIsLoading] = useState(false);
20
- const [showHistory, setShowHistory] = useState(false);
21
-
22
- // Check for server-side rendering
23
- const isSSR = typeof window === 'undefined';
24
-
25
- // Calculate derived state with useMemo for performance
26
- const stats = useMemo(() => {
27
- // Ensure we have a valid history array
28
- if (isSSR || !state || !state.history || state.history.length === 0) {
29
- return { avg: 0, max: 0, min: 0 };
30
- }
31
-
32
- try {
33
- const sum = state.history.reduce((a, b) => a + b, 0);
34
- return {
35
- avg: parseFloat((sum / state.history.length).toFixed(1)),
36
- max: Math.max(...state.history),
37
- min: Math.min(...state.history)
38
- };
39
- } catch (error) {
40
- console.error('Error calculating stats:', error);
41
- return { avg: 0, max: 0, min: 0 };
42
- }
43
- }, [state?.history]);
44
-
45
- // Handle increment with history tracking
46
- const increment = () => {
47
- if (isSSR) return;
48
-
49
- setIsLoading(true);
50
-
51
- // Simulate async operation
52
- setTimeout(() => {
53
- setState(prevState => ({
54
- count: prevState.count + 1,
55
- lastUpdated: new Date().toLocaleTimeString(),
56
- history: [...(prevState.history || []), prevState.count + 1]
57
- }));
58
- setIsLoading(false);
59
- }, 300);
60
- };
61
-
62
- // Handle decrement with bounds checking
63
- const decrement = () => {
64
- if (isSSR) return;
65
-
66
- setIsLoading(true);
67
-
68
- // Simulate async operation
69
- setTimeout(() => {
70
- setState(prevState => ({
71
- count: Math.max(0, prevState.count - 1),
72
- lastUpdated: new Date().toLocaleTimeString(),
73
- history: prevState.count > 0 ? [...(prevState.history || []), prevState.count - 1] : (prevState.history || [])
74
- }));
75
- setIsLoading(false);
76
- }, 300);
77
- };
78
-
79
- // Reset counter
80
- const reset = () => {
81
- if (isSSR) return;
82
-
83
- setState({
84
- count: 0,
85
- lastUpdated: new Date().toLocaleTimeString(),
86
- history: []
87
- });
88
- };
89
-
90
- // Toggle history visibility
91
- const toggleHistory = () => {
92
- if (isSSR) return;
93
-
94
- setShowHistory(prev => !prev);
95
- };
96
-
97
- // For SSR, return a simpler version of the component
98
- if (isSSR) {
99
- return (
100
- <div className="bg-white shadow-lg rounded-lg p-6 mb-8">
101
- <h2 className="text-xl font-semibold text-gray-800 mb-4">
102
- State Management Demo
103
- </h2>
104
- <div className="flex items-center justify-between mb-4">
105
- <button className="px-4 py-2 bg-gray-200 text-gray-800 rounded-lg">-</button>
106
- <span className="text-2xl font-bold mx-4">0</span>
107
- <button className="px-4 py-2 bg-blue-600 text-white rounded-lg">+</button>
108
- </div>
109
- <p className="text-sm text-gray-500">Interactive counter (client-side only)</p>
110
- </div>
111
- );
112
- }
113
-
114
- // Regular client-side render
115
- return (
116
- <div className="bg-white shadow-lg rounded-lg p-6 mb-8">
117
- <h2 className="text-xl font-semibold text-gray-800 mb-4">
118
- State Management Demo
119
- </h2>
120
-
121
- <div className="mb-6">
122
- <div className="flex items-center justify-between mb-4">
123
- <button
124
- onClick={decrement}
125
- className="px-4 py-2 bg-gray-200 text-gray-800 rounded-lg hover:bg-gray-300 disabled:opacity-50"
126
- disabled={state.count === 0 || isLoading}
127
- >
128
- {isLoading ? '...' : '-'}
129
- </button>
130
-
131
- <span className="text-2xl font-bold mx-4">{state.count}</span>
132
-
133
- <button
134
- onClick={increment}
135
- className="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50"
136
- disabled={isLoading}
137
- >
138
- {isLoading ? '...' : '+'}
139
- </button>
140
- </div>
141
-
142
- <button
143
- onClick={reset}
144
- className="text-sm text-gray-600 hover:text-red-600"
145
- disabled={state.count === 0 && (!state.history || state.history.length === 0)}
146
- >
147
- Reset Counter
148
- </button>
149
- </div>
150
-
151
- {state.lastUpdated && (
152
- <div className="mb-4">
153
- <p className="text-sm text-gray-500">
154
- Last updated: {state.lastUpdated}
155
- </p>
156
- </div>
157
- )}
158
-
159
- {state.history && state.history.length > 0 && (
160
- <div className="border-t pt-4 mt-4">
161
- <div className="flex items-center justify-between mb-2">
162
- <h3 className="text-md font-medium text-gray-700">Statistics</h3>
163
- <button
164
- onClick={toggleHistory}
165
- className="text-sm text-blue-600 hover:underline"
166
- >
167
- {showHistory ? 'Hide History' : 'Show History'}
168
- </button>
169
- </div>
170
-
171
- <div className="grid grid-cols-3 gap-2 mb-3">
172
- <div className="bg-blue-50 p-2 rounded text-center">
173
- <div className="text-xs text-gray-500">Average</div>
174
- <div className="font-bold">{stats.avg}</div>
175
- </div>
176
- <div className="bg-green-50 p-2 rounded text-center">
177
- <div className="text-xs text-gray-500">Maximum</div>
178
- <div className="font-bold">{stats.max}</div>
179
- </div>
180
- <div className="bg-red-50 p-2 rounded text-center">
181
- <div className="text-xs text-gray-500">Minimum</div>
182
- <div className="font-bold">{stats.min}</div>
183
- </div>
184
- </div>
185
-
186
- {showHistory && (
187
- <div className="mt-3">
188
- <h4 className="text-sm font-medium text-gray-600 mb-1">
189
- History ({state.history.length} events)
190
- </h4>
191
- <div className="bg-gray-50 p-2 rounded max-h-24 overflow-y-auto text-xs">
192
- {state.history.map((value, index) => (
193
- <span
194
- key={index}
195
- className="inline-block bg-gray-200 rounded px-2 py-1 m-1"
196
- >
197
- {value}
198
- </span>
199
- ))}
200
- </div>
201
- </div>
202
- )}
203
- </div>
204
- )}
205
- </div>
206
- );
207
- }
@@ -1,44 +0,0 @@
1
- import { jsx } from 'frontend-hamroun';
2
-
3
- interface User {
4
- id: number;
5
- name: string;
6
- email: string;
7
- }
8
-
9
- interface UserListProps {
10
- users: User[];
11
- }
12
-
13
- export default function UserList({ users }: UserListProps) {
14
- if (!users || users.length === 0) {
15
- return (
16
- <div className="empty-state p-4 text-center bg-gray-50 rounded">
17
- <p className="text-gray-500">No users available</p>
18
- </div>
19
- );
20
- }
21
-
22
- return (
23
- <div className="user-list">
24
- <ul className="divide-y divide-gray-100">
25
- {users.map(user => (
26
- <li key={user.id} className="py-3">
27
- <div className="flex justify-between">
28
- <div>
29
- <p className="font-medium text-gray-900">{user.name}</p>
30
- <p className="text-sm text-gray-500">{user.email}</p>
31
- </div>
32
- <a
33
- href={`/users/${user.id}`}
34
- className="text-blue-600 hover:underline text-sm self-center"
35
- >
36
- View Profile
37
- </a>
38
- </div>
39
- </li>
40
- ))}
41
- </ul>
42
- </div>
43
- );
44
- }
@@ -1,42 +0,0 @@
1
- // Application configuration
2
- // Modify this file to customize your application without changing core files
3
-
4
- export const AppConfig = {
5
- // App information
6
- title: 'Frontend Hamroun App',
7
- description: 'A full-stack application built with Frontend Hamroun',
8
-
9
- // Navigation
10
- navigation: [
11
- { path: '/', label: 'Home' },
12
- { path: '/about', label: 'About' },
13
- { path: '/users', label: 'Users' }
14
- ],
15
-
16
- // API endpoints
17
- api: {
18
- baseUrl: '/api',
19
- endpoints: {
20
- users: '/users',
21
- posts: '/posts'
22
- }
23
- },
24
-
25
- // Default meta tags
26
- meta: {
27
- viewport: 'width=device-width, initial-scale=1.0',
28
- charset: 'UTF-8',
29
- author: 'Your Name',
30
- keywords: 'frontend-hamroun, fullstack, template'
31
- },
32
-
33
- // Style customization
34
- theme: {
35
- primaryColor: '#0066cc',
36
- backgroundColor: '#ffffff',
37
- textColor: '#333333',
38
- fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif'
39
- }
40
- };
41
-
42
- export default AppConfig;
@@ -1,206 +0,0 @@
1
- /**
2
- * API utilities for making requests to the backend
3
- */
4
- import { batchUpdates } from 'frontend-hamroun';
5
-
6
- // Cache for API responses
7
- const apiCache = new Map<string, { data: any, timestamp: number }>();
8
- const CACHE_DURATION = 60000; // 1 minute cache
9
-
10
- /**
11
- * Fetch data from the API with caching
12
- */
13
- export async function fetchApi(
14
- endpoint: string,
15
- options: RequestInit & {
16
- useCache?: boolean,
17
- forceFresh?: boolean
18
- } = {}
19
- ): Promise<any> {
20
- const url = endpoint.startsWith('/') ? `/api${endpoint}` : `/api/${endpoint}`;
21
- const { useCache = true, forceFresh = false, ...fetchOptions } = options;
22
-
23
- // Check cache first if enabled
24
- if (useCache && !forceFresh) {
25
- const cached = apiCache.get(url);
26
- if (cached && Date.now() - cached.timestamp < CACHE_DURATION) {
27
- console.log(`[API] Using cached data for: ${url}`);
28
- return cached.data;
29
- }
30
- }
31
-
32
- try {
33
- console.log(`[API] Fetching data from: ${url}`);
34
- const response = await fetch(url, {
35
- headers: {
36
- 'Content-Type': 'application/json',
37
- 'Accept': 'application/json',
38
- },
39
- ...fetchOptions
40
- });
41
-
42
- if (!response.ok) {
43
- throw new Error(`API request failed: ${response.status} ${response.statusText}`);
44
- }
45
-
46
- const data = await response.json();
47
- console.log(`[API] Successfully fetched data from: ${url}`);
48
-
49
- // Cache the response if caching is enabled
50
- if (useCache) {
51
- apiCache.set(url, { data, timestamp: Date.now() });
52
- }
53
-
54
- return data;
55
- } catch (error) {
56
- console.error(`[API] Error fetching from ${url}:`, error);
57
- throw error;
58
- }
59
- }
60
-
61
- /**
62
- * Clear the API cache
63
- */
64
- export function clearApiCache(endpoint?: string): void {
65
- if (endpoint) {
66
- const url = endpoint.startsWith('/') ? `/api${endpoint}` : `/api/${endpoint}`;
67
- apiCache.delete(url);
68
- } else {
69
- apiCache.clear();
70
- }
71
- }
72
-
73
- // Sample data for development
74
- const sampleUsers = [
75
- { id: 1, name: 'User 1', email: 'user1@example.com' },
76
- { id: 2, name: 'User 2', email: 'user2@example.com' },
77
- { id: 3, name: 'User 3', email: 'user3@example.com' }
78
- ];
79
-
80
- const samplePosts = [
81
- { id: 1, title: 'Post 1', content: 'Content for post 1', authorId: 1 },
82
- { id: 2, title: 'Post 2', content: 'Content for post 2', authorId: 2 },
83
- { id: 3, title: 'Post 3', content: 'Content for post 3', authorId: 1 }
84
- ];
85
-
86
- // Helper to simulate network delay
87
- const delay = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));
88
-
89
- // User API client
90
- export const UserApi = {
91
- // Get all users
92
- async getAll() {
93
- try {
94
- // In a real app, we'd fetch from API
95
- // const response = await fetch('/api/users');
96
- // if (!response.ok) throw new Error('Failed to fetch users');
97
- // return await response.json();
98
-
99
- // Simulate API delay
100
- await delay(300);
101
- return [...sampleUsers]; // Return a copy to avoid mutations
102
- } catch (error) {
103
- console.error('Error fetching users:', error);
104
- return [];
105
- }
106
- },
107
-
108
- // Get user by ID
109
- async getById(id: number | string) {
110
- try {
111
- // In a real app, we'd fetch from API
112
- // const response = await fetch(`/api/users/${id}`);
113
- // if (!response.ok) throw new Error('User not found');
114
- // return await response.json();
115
-
116
- // Convert ID to number if it's a string
117
- const userId = typeof id === 'string' ? parseInt(id, 10) : id;
118
-
119
- // Simulate API delay
120
- await delay(200);
121
-
122
- // Find user
123
- const user = sampleUsers.find(u => u.id === userId);
124
- if (!user) throw new Error('User not found');
125
-
126
- return { ...user }; // Return a copy to avoid mutations
127
- } catch (error) {
128
- console.error(`Error fetching user ${id}:`, error);
129
- return null;
130
- }
131
- },
132
-
133
- // Get posts (all or by author)
134
- async getPosts(authorId?: number | string) {
135
- try {
136
- // In a real app, we'd fetch from API
137
- // const url = authorId ? `/api/posts?authorId=${authorId}` : '/api/posts';
138
- // const response = await fetch(url);
139
- // if (!response.ok) throw new Error('Failed to fetch posts');
140
- // return await response.json();
141
-
142
- // Convert authorId to number if it's a string
143
- const userId = authorId ? (typeof authorId === 'string' ? parseInt(authorId, 10) : authorId) : undefined;
144
-
145
- // Simulate API delay
146
- await delay(400);
147
-
148
- // Filter posts if authorId is provided
149
- const posts = userId
150
- ? samplePosts.filter(p => p.authorId === userId)
151
- : samplePosts;
152
-
153
- return [...posts]; // Return a copy to avoid mutations
154
- } catch (error) {
155
- console.error('Error fetching posts:', error);
156
- return [];
157
- }
158
- }
159
- };
160
-
161
- // WASM API service
162
- export const WasmApi = {
163
- calculate: (operation: 'add' | 'multiply', a: number, b: number) =>
164
- fetchApi(`/wasm/calculate?op=${operation}&a=${a}&b=${b}`),
165
-
166
- processJson: (data: any) => fetchApi('/wasm/process-json', {
167
- method: 'POST',
168
- body: JSON.stringify(data),
169
- useCache: false
170
- })
171
- };
172
-
173
- // Batch multiple API calls for efficiency
174
- export const batchApiCalls = async <T>(
175
- apiFunctions: Array<() => Promise<T>>
176
- ): Promise<T[]> => {
177
- const results: T[] = [];
178
- let errors: Error[] = [];
179
-
180
- // Execute all API calls in parallel
181
- const promises = apiFunctions.map(fn => fn());
182
-
183
- try {
184
- const settledResults = await Promise.allSettled(promises);
185
-
186
- // Process results
187
- batchUpdates(() => {
188
- settledResults.forEach(result => {
189
- if (result.status === 'fulfilled') {
190
- results.push(result.value);
191
- } else {
192
- errors.push(result.reason);
193
- }
194
- });
195
- });
196
-
197
- if (errors.length) {
198
- console.error('[API] Some batch API calls failed:', errors);
199
- }
200
-
201
- return results;
202
- } catch (error) {
203
- console.error('[API] Batch API calls failed:', error);
204
- throw error;
205
- }
206
- };
@@ -1,28 +0,0 @@
1
- // Next.js-like global middleware
2
- import { Request, Response, NextFunction } from 'express';
3
-
4
- // Extend the Express Request interface
5
- declare global {
6
- namespace Express {
7
- interface Request {
8
- timestamp: string;
9
- }
10
- }
11
- }
12
-
13
- // This middleware will be applied to all routes (API and pages)
14
- export default async function middleware(req: Request, res: Response, next?: NextFunction) {
15
- // Add request timestamp
16
- req.timestamp = await new Date().toISOString();
17
-
18
- // Log all requests in development mode
19
- if (process.env.NODE_ENV !== 'production') {
20
- console.log(`[${req.timestamp}] ${req.method} ${req.url}`);
21
- }
22
-
23
- // Example of response header modification
24
- res.setHeader('X-Powered-By', 'Frontend Hamroun');
25
-
26
- // Continue to next middleware
27
- if (next) next();
28
- }
@@ -1,28 +0,0 @@
1
- import { jsx } from 'frontend-hamroun';
2
-
3
- export default function NotFound({ initialState }) {
4
- return (
5
- <div className="not-found-container max-w-4xl mx-auto p-6">
6
- <div className="bg-gray-50 border border-gray-200 rounded-lg p-8 shadow-sm">
7
- <h1 className="text-3xl font-bold text-gray-700 mb-4">Page Not Found</h1>
8
-
9
- <p className="text-lg text-gray-600 mb-4">
10
- The page you are looking for does not exist or has been moved.
11
- </p>
12
-
13
- <p className="text-gray-600 mb-6">
14
- Path: <code className="bg-gray-100 px-2 py-1 rounded">{initialState?.route || 'unknown'}</code>
15
- </p>
16
-
17
- <div className="mt-6">
18
- <a
19
- href="/"
20
- className="inline-block px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700"
21
- >
22
- Back to Home
23
- </a>
24
- </div>
25
- </div>
26
- </div>
27
- );
28
- }
File without changes
@@ -1,11 +0,0 @@
1
- import { jsx } from 'frontend-hamroun';
2
- import Layout from '../components/Layout';
3
-
4
- // This is the main App wrapper component similar to Next.js _app.js
5
- export default function App({ Component, pageProps, initialState }) {
6
- return (
7
- <Layout>
8
- <Component {...pageProps} initialState={initialState} />
9
- </Layout>
10
- );
11
- }
@@ -1,25 +0,0 @@
1
- import { jsx } from 'frontend-hamroun';
2
-
3
- export default function Document({
4
- title = 'Frontend Hamroun App',
5
- headContent,
6
- bodyContent,
7
- scripts
8
- }) {
9
- return (
10
- <html lang="en">
11
- <head>
12
- <meta charSet="UTF-8" />
13
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
14
- <title>{title}</title>
15
- <link rel="stylesheet" href="/styles.css" />
16
- {headContent}
17
- </head>
18
- <body>
19
- <div id="root">{bodyContent}</div>
20
- <script src="/build/main.js" type="module"></script>
21
- {scripts}
22
- </body>
23
- </html>
24
- );
25
- }
@@ -1,45 +0,0 @@
1
- import { jsx, useState, useEffect } from 'frontend-hamroun';
2
-
3
- export default function ErrorPage({ initialState }) {
4
- const { error } = initialState || {};
5
- const [showDetails, setShowDetails] = useState(false);
6
- const isDev = process.env.NODE_ENV !== 'production';
7
-
8
- return (
9
- <div className="error-page-container max-w-4xl mx-auto p-6">
10
- <div className="bg-red-50 border border-red-200 rounded-lg p-8 shadow-sm">
11
- <h1 className="text-3xl font-bold text-red-700 mb-4">Something went wrong</h1>
12
-
13
- <p className="text-lg text-red-600 mb-4">
14
- {error?.message || "An unexpected error occurred"}
15
- </p>
16
-
17
- {isDev && error?.stack && (
18
- <div className="mt-6">
19
- <button
20
- className="text-blue-600 underline mb-2"
21
- onClick={() => setShowDetails(!showDetails)}
22
- >
23
- {showDetails ? "Hide" : "Show"} technical details
24
- </button>
25
-
26
- {showDetails && (
27
- <pre className="bg-gray-100 p-4 rounded-md text-sm overflow-auto max-h-96 text-gray-800">
28
- {error.stack}
29
- </pre>
30
- )}
31
- </div>
32
- )}
33
-
34
- <div className="mt-6">
35
- <a
36
- href="/"
37
- className="inline-block px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700"
38
- >
39
- Back to Home
40
- </a>
41
- </div>
42
- </div>
43
- </div>
44
- );
45
- }