@atlashub/smartstack-cli 4.33.0 → 4.35.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.
@@ -1,126 +0,0 @@
1
- {{!-- SmartStack React Router Configuration Template --}}
2
- {{!-- Generates router configuration from NavRoute registry --}}
3
-
4
- /**
5
- * React Router Configuration
6
- *
7
- * Auto-generated by SmartStack MCP - DO NOT EDIT MANUALLY
8
- * Generated: {{generatedAt}}
9
- */
10
-
11
- import React, { Suspense, lazy } from 'react';
12
- import { createBrowserRouter, RouteObject, Navigate } from 'react-router-dom';
13
- import { ROUTES } from './navRoutes.generated';
14
- {{#if includeGuards}}
15
- import { ProtectedRoute, PermissionGuard } from './guards';
16
- {{/if}}
17
-
18
- // ============================================================================
19
- // Layouts
20
- // ============================================================================
21
-
22
- {{#each applications}}
23
- import { {{capitalize this}}Layout } from '../layouts/{{capitalize this}}Layout';
24
- {{/each}}
25
-
26
- // ============================================================================
27
- // Pages (lazy loaded for code splitting)
28
- // ============================================================================
29
-
30
- {{#each routes}}
31
- const {{pageName this.navRoute}}Page = lazy(() => import('../pages/{{pagePath this.navRoute}}'));
32
- {{/each}}
33
-
34
- // ============================================================================
35
- // Loading Component
36
- // ============================================================================
37
-
38
- const PageLoader: React.FC = () => (
39
- <div className="flex items-center justify-center h-64">
40
- <div className="animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500" />
41
- </div>
42
- );
43
-
44
- // ============================================================================
45
- // Route Configuration
46
- // ============================================================================
47
-
48
- const routes: RouteObject[] = [
49
- // Root redirect
50
- {
51
- path: '/',
52
- element: <Navigate to="{{defaultPath}}" replace />,
53
- },
54
-
55
- {{#each applicationTree}}
56
- // {{uppercase @key}} Application
57
- {
58
- path: '{{@key}}',
59
- element: <{{capitalize @key}}Layout />,
60
- children: [
61
- {{#each this}}
62
- {
63
- path: '{{modulePath this.navRoute}}',
64
- {{#if this.permissions.length}}
65
- element: (
66
- <PermissionGuard permissions={ROUTES['{{this.navRoute}}'].permissions}>
67
- <Suspense fallback={<PageLoader />}>
68
- <{{pageName this.navRoute}}Page />
69
- </Suspense>
70
- </PermissionGuard>
71
- ),
72
- {{else}}
73
- element: (
74
- <Suspense fallback={<PageLoader />}>
75
- <{{pageName this.navRoute}}Page />
76
- </Suspense>
77
- ),
78
- {{/if}}
79
- },
80
- {{/each}}
81
- ],
82
- },
83
- {{/each}}
84
-
85
- // 404 Not Found
86
- {
87
- path: '*',
88
- element: (
89
- <div className="flex flex-col items-center justify-center h-screen">
90
- <h1 className="text-4xl font-bold text-gray-900">404</h1>
91
- <p className="mt-2 text-gray-600">Page not found</p>
92
- <a href="{{defaultPath}}" className="mt-4 text-blue-600 hover:underline">
93
- Return to home
94
- </a>
95
- </div>
96
- ),
97
- },
98
- ];
99
-
100
- // ============================================================================
101
- // Router Export
102
- // ============================================================================
103
-
104
- {{#if includeGuards}}
105
- export const router = createBrowserRouter([
106
- {
107
- element: <ProtectedRoute />,
108
- children: routes,
109
- },
110
- ]);
111
- {{else}}
112
- export const router = createBrowserRouter(routes);
113
- {{/if}}
114
-
115
- export default router;
116
-
117
- // ============================================================================
118
- // Type Exports
119
- // ============================================================================
120
-
121
- export type { RouteObject };
122
-
123
- /**
124
- * Get route configuration by NavRoute path
125
- */
126
- export const getRouteConfig = (navRoute: string) => ROUTES[navRoute];