@ramme-io/create-app 1.2.5 β 1.2.7
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.
package/package.json
CHANGED
package/template/package.json
CHANGED
|
@@ -17,11 +17,13 @@
|
|
|
17
17
|
"ai": "^3.0.0",
|
|
18
18
|
"framer-motion": "^11.0.0",
|
|
19
19
|
"fs-extra": "^11.2.0",
|
|
20
|
+
"lucide-react": "^0.454.0",
|
|
20
21
|
"mqtt": "^5.3.5",
|
|
21
22
|
"react": "^18.2.0",
|
|
22
23
|
"react-dom": "^18.2.0",
|
|
23
24
|
"react-resizable-panels": "^2.0.9",
|
|
24
25
|
"react-router-dom": "^6.22.0",
|
|
26
|
+
"recharts": "^2.12.7",
|
|
25
27
|
"uuid": "^13.0.0",
|
|
26
28
|
"zod": "^3.22.0",
|
|
27
29
|
"zustand": "^4.5.7"
|
package/template/pkg.json
CHANGED
|
@@ -17,11 +17,13 @@
|
|
|
17
17
|
"ai": "^3.0.0",
|
|
18
18
|
"framer-motion": "^11.0.0",
|
|
19
19
|
"fs-extra": "^11.2.0",
|
|
20
|
+
"lucide-react": "^0.454.0",
|
|
20
21
|
"mqtt": "^5.3.5",
|
|
21
22
|
"react": "^18.2.0",
|
|
22
23
|
"react-dom": "^18.2.0",
|
|
23
24
|
"react-resizable-panels": "^2.0.9",
|
|
24
25
|
"react-router-dom": "^6.22.0",
|
|
26
|
+
"recharts": "^2.12.7",
|
|
25
27
|
"uuid": "^13.0.0",
|
|
26
28
|
"zod": "^3.22.0",
|
|
27
29
|
"zustand": "^4.5.7"
|
package/template/src/App.tsx
CHANGED
|
@@ -5,7 +5,6 @@ import { ThemeProvider } from '@ramme-io/ui';
|
|
|
5
5
|
import { AuthProvider } from './features/auth/AuthContext';
|
|
6
6
|
import { MqttProvider } from './engine/runtime/MqttContext';
|
|
7
7
|
|
|
8
|
-
|
|
9
8
|
// --- 1. IMPORT AUTH CLUSTER ---
|
|
10
9
|
import { AuthLayout } from './features/auth/pages/AuthLayout';
|
|
11
10
|
import LoginPage from './features/auth/pages/LoginPage';
|
|
@@ -30,7 +29,6 @@ import { initializeDataLake } from './engine/runtime/data-seeder';
|
|
|
30
29
|
import ScrollToTop from './components/ScrollToTop';
|
|
31
30
|
import HashLinkScroll from './components/HashLinkScroll';
|
|
32
31
|
|
|
33
|
-
|
|
34
32
|
function App() {
|
|
35
33
|
|
|
36
34
|
// Trigger data seeding on mount
|
|
@@ -41,7 +39,6 @@ function App() {
|
|
|
41
39
|
const liveDashboardRoutes = useDynamicSitemap(dashboardSitemap);
|
|
42
40
|
|
|
43
41
|
console.log("πΊοΈ ROUTER MAP:", liveDashboardRoutes.map(r => ({ path: r.path, id: r.id })));
|
|
44
|
-
|
|
45
42
|
|
|
46
43
|
return (
|
|
47
44
|
<ThemeProvider>
|
|
@@ -61,6 +58,9 @@ function App() {
|
|
|
61
58
|
|
|
62
59
|
{/* Fallback for legacy /login access */}
|
|
63
60
|
<Route path="/login" element={<Navigate to="/auth/login" replace />} />
|
|
61
|
+
|
|
62
|
+
{/* β
FIX: Redirect legacy /signup to the new location */}
|
|
63
|
+
<Route path="/signup" element={<Navigate to="/auth/signup" replace />} />
|
|
64
64
|
|
|
65
65
|
{/* --- PROTECTED APP ROUTES --- */}
|
|
66
66
|
<Route element={<ProtectedRoute />}>
|
|
@@ -68,7 +68,7 @@ function App() {
|
|
|
68
68
|
|
|
69
69
|
{/* Dashboard Template */}
|
|
70
70
|
<Route path="/dashboard/*" element={<DashboardLayout />}>
|
|
71
|
-
|
|
71
|
+
<Route index element={<Navigate to="welcome" replace />} />
|
|
72
72
|
{generateRoutes(liveDashboardRoutes)}
|
|
73
73
|
</Route>
|
|
74
74
|
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React, { createContext, useContext, useState, useEffect } from 'react';
|
|
2
2
|
// Import the User type from your mock data to ensure shape consistency
|
|
3
|
-
import type { User } from '../../data/mockData';
|
|
3
|
+
import type { User } from '../../data/mockData';
|
|
4
|
+
// β
IMPORT SEEDER AND DATA (Required for Self-Healing)
|
|
5
|
+
import { initializeDataLake } from '../../engine/runtime/data-seeder';
|
|
6
|
+
import { SEED_USERS } from '../../data/mockData';
|
|
4
7
|
|
|
5
8
|
/**
|
|
6
9
|
* @file AuthContext.tsx
|
|
@@ -12,9 +15,9 @@ import type { User } from '../../data/mockData';
|
|
|
12
15
|
* 1. **Session Persistence:** Checks localStorage on boot.
|
|
13
16
|
* 2. **Data Lake Connection:** Reads from 'ramme_db_users' to validate real accounts.
|
|
14
17
|
* 3. **Simulation:** Adds artificial latency to test loading states.
|
|
18
|
+
* 4. **Self-Healing:** Automatically re-seeds data if the database is found empty during login.
|
|
15
19
|
*/
|
|
16
20
|
|
|
17
|
-
// β
CRITICAL FIX: Match the key used by useCrudLocalStorage and data-seeder
|
|
18
21
|
const USER_DB_KEY = 'ramme_db_users';
|
|
19
22
|
const SESSION_KEY = 'ramme_session';
|
|
20
23
|
|
|
@@ -49,8 +52,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children
|
|
|
49
52
|
const login = async (email: string, password: string) => {
|
|
50
53
|
setIsLoading(true);
|
|
51
54
|
|
|
52
|
-
//
|
|
53
|
-
// This also adds a layer of realism to the mock validation.
|
|
55
|
+
// 1. Validation
|
|
54
56
|
if (!password || password.length < 3) {
|
|
55
57
|
setIsLoading(false);
|
|
56
58
|
throw new Error("Password must be at least 3 characters");
|
|
@@ -61,19 +63,20 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children
|
|
|
61
63
|
// Simulate API Delay
|
|
62
64
|
await new Promise(resolve => setTimeout(resolve, 600));
|
|
63
65
|
|
|
64
|
-
//
|
|
65
|
-
|
|
66
|
+
// 2. READ DATA LAKE
|
|
67
|
+
let storedUsers = localStorage.getItem(USER_DB_KEY);
|
|
66
68
|
|
|
67
|
-
//
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
//
|
|
72
|
-
|
|
69
|
+
// π‘οΈ SELF-HEALING LOGIC: If DB is empty/missing, re-seed it NOW.
|
|
70
|
+
// This fixes the "User not found" error on fresh installs.
|
|
71
|
+
if (!storedUsers || JSON.parse(storedUsers).length === 0) {
|
|
72
|
+
console.warn("β οΈ Data Lake empty during login. Triggering emergency re-seed...");
|
|
73
|
+
initializeDataLake(); // Force the seed
|
|
74
|
+
storedUsers = localStorage.getItem(USER_DB_KEY); // Read it again immediately
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
const users: User[] = storedUsers ? JSON.parse(storedUsers) : [];
|
|
76
78
|
|
|
79
|
+
// 3. Authenticate
|
|
77
80
|
// Case-insensitive email check
|
|
78
81
|
const foundUser = users.find(u => u.email.toLowerCase() === email.toLowerCase());
|
|
79
82
|
|
|
@@ -83,6 +86,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children
|
|
|
83
86
|
localStorage.setItem(SESSION_KEY, JSON.stringify(foundUser));
|
|
84
87
|
setIsLoading(false);
|
|
85
88
|
} else {
|
|
89
|
+
// Debugging help: List available users if login fails
|
|
86
90
|
console.error("β User NOT found. Available emails:", users.map(u => u.email));
|
|
87
91
|
setIsLoading(false);
|
|
88
92
|
throw new Error("Invalid email or password");
|
|
@@ -34,11 +34,7 @@ const LoginPage: React.FC = () => {
|
|
|
34
34
|
return (
|
|
35
35
|
<div className="flex min-h-screen items-center justify-center bg-background p-4 transition-colors duration-300">
|
|
36
36
|
|
|
37
|
-
{/* 2. REPLACED <Card> with a native <div>
|
|
38
|
-
- Removes conflicting library styles (border-border vs border-t-primary).
|
|
39
|
-
- Adds 'sm:w-[400px]' for better mobile responsiveness.
|
|
40
|
-
- Adds 'bg-card' explicitly for theme support.
|
|
41
|
-
*/}
|
|
37
|
+
{/* 2. REPLACED <Card> with a native <div> */}
|
|
42
38
|
<div className="w-full sm:w-[400px] p-8 rounded-xl shadow-2xl border-t-4 border-t-primary bg-card ring-1 ring-black/5 dark:ring-white/10">
|
|
43
39
|
|
|
44
40
|
{/* Header */}
|
|
@@ -68,7 +64,6 @@ const LoginPage: React.FC = () => {
|
|
|
68
64
|
autoComplete="email"
|
|
69
65
|
value={formData.email}
|
|
70
66
|
onChange={handleChange}
|
|
71
|
-
// Explicit background to prevent transparency issues
|
|
72
67
|
className="bg-background"
|
|
73
68
|
/>
|
|
74
69
|
|
|
@@ -94,7 +89,8 @@ const LoginPage: React.FC = () => {
|
|
|
94
89
|
{/* Footer */}
|
|
95
90
|
<div className="mt-8 pt-6 border-t border-border text-center text-sm">
|
|
96
91
|
<span className="text-muted-foreground">Don't have an account? </span>
|
|
97
|
-
|
|
92
|
+
[cite_start]{/* β
CRITICAL FIX: Updated path to /auth/signup [cite: 1937] */}
|
|
93
|
+
<Link to="/auth/signup" className="font-semibold text-primary hover:text-primary/80 transition-colors">
|
|
98
94
|
Create one
|
|
99
95
|
</Link>
|
|
100
96
|
</div>
|