realtimex-crm 0.3.0 → 0.3.1
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/dist/assets/{DealList-C_0DbLKA.js → DealList-o0rCTPLg.js} +2 -2
- package/dist/assets/{DealList-C_0DbLKA.js.map → DealList-o0rCTPLg.js.map} +1 -1
- package/dist/assets/{index-CdC59W53.js → index-oof5vcGm.js} +45 -45
- package/dist/assets/{index-CdC59W53.js.map → index-oof5vcGm.js.map} +1 -1
- package/dist/index.html +1 -1
- package/dist/stats.html +1 -1
- package/package.json +1 -1
- package/src/components/atomic-crm/login/StartPage.tsx +39 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "realtimex-crm",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "RealTimeX CRM - A full-featured CRM built with React, shadcn-admin-kit, and Supabase. Fork of Atomic CRM with RealTimeX App SDK integration.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -2,26 +2,60 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
2
2
|
import { useDataProvider } from "ra-core";
|
|
3
3
|
import { Navigate } from "react-router-dom";
|
|
4
4
|
import { LoginPage } from "@/components/admin/login-page";
|
|
5
|
+
import { checkDatabaseHealth } from "@/lib/database-health-check";
|
|
6
|
+
import { getSupabaseConfig } from "@/lib/supabase-config";
|
|
7
|
+
import { DatabaseSetupGuide } from "../setup/DatabaseSetupGuide";
|
|
5
8
|
|
|
6
9
|
import type { CrmDataProvider } from "../providers/types";
|
|
7
10
|
import { LoginSkeleton } from "./LoginSkeleton";
|
|
8
11
|
|
|
9
12
|
export const StartPage = () => {
|
|
10
13
|
const dataProvider = useDataProvider<CrmDataProvider>();
|
|
14
|
+
|
|
15
|
+
// First check database health
|
|
16
|
+
const {
|
|
17
|
+
data: healthStatus,
|
|
18
|
+
error: healthError,
|
|
19
|
+
isPending: isCheckingHealth,
|
|
20
|
+
} = useQuery({
|
|
21
|
+
queryKey: ["database-health"],
|
|
22
|
+
queryFn: async () => {
|
|
23
|
+
return checkDatabaseHealth(dataProvider);
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// Then check if initialized (only if database is healthy)
|
|
11
28
|
const {
|
|
12
29
|
data: isInitialized,
|
|
13
|
-
error,
|
|
14
|
-
isPending,
|
|
30
|
+
error: initError,
|
|
31
|
+
isPending: isCheckingInit,
|
|
15
32
|
} = useQuery({
|
|
16
33
|
queryKey: ["init"],
|
|
17
34
|
queryFn: async () => {
|
|
18
35
|
return dataProvider.isInitialized();
|
|
19
36
|
},
|
|
37
|
+
enabled: healthStatus?.isHealthy === true,
|
|
20
38
|
});
|
|
21
39
|
|
|
22
|
-
|
|
23
|
-
if (
|
|
24
|
-
|
|
40
|
+
// Show loading state
|
|
41
|
+
if (isCheckingHealth || isCheckingInit) return <LoginSkeleton />;
|
|
42
|
+
|
|
43
|
+
// Show database setup guide if schema is missing
|
|
44
|
+
if (healthStatus && !healthStatus.isHealthy) {
|
|
45
|
+
const config = getSupabaseConfig();
|
|
46
|
+
if (config) {
|
|
47
|
+
return (
|
|
48
|
+
<DatabaseSetupGuide
|
|
49
|
+
missingTables={healthStatus.missingTables}
|
|
50
|
+
supabaseUrl={config.url}
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Show login page if there's an error or already initialized
|
|
57
|
+
if (healthError || initError || isInitialized) return <LoginPage />;
|
|
25
58
|
|
|
59
|
+
// Not initialized yet, go to signup
|
|
26
60
|
return <Navigate to="/sign-up" />;
|
|
27
61
|
};
|