keynesol-shared 1.0.0 → 1.0.2
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/components/Common/ErrorBoundary.js +57 -11
- package/dist/components/Common/ErrorMessage.js +18 -8
- package/dist/components/Common/Loading.js +50 -8
- package/dist/components/Common/LoadingIndicator.js +68 -16
- package/dist/components/Common/ProgramStatus.js +53 -13
- package/dist/components/Common/Skeleton.js +66 -12
- package/dist/components/Common/SkeletonScreen.js +64 -19
- package/dist/components/Common/index.js +23 -7
- package/dist/components/Wallet/TransactionStatus.js +20 -10
- package/dist/components/Wallet/WalletBalance.js +56 -17
- package/dist/components/Wallet/WalletButton.js +16 -9
- package/dist/components/Wallet/WalletConnectionModal.js +29 -16
- package/dist/components/Wallet/WalletProvider.js +57 -19
- package/dist/components/Wallet/index.js +28 -5
- package/dist/components/index.js +18 -2
- package/dist/hooks/index.js +21 -5
- package/dist/hooks/useCache.js +20 -13
- package/dist/hooks/usePolling.js +14 -10
- package/dist/hooks/useProgram.js +20 -16
- package/dist/hooks/useTokenBalance.js +27 -23
- package/dist/hooks/useVaults.js +21 -17
- package/dist/index.d.ts +8 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +72 -13
- package/dist/services/index.js +18 -2
- package/dist/services/reconciliationService.js +20 -17
- package/dist/services/syncService.js +25 -22
- package/dist/types/index.js +2 -1
- package/dist/utils/cacheManager.js +9 -6
- package/dist/utils/errorHandler.js +6 -3
- package/dist/utils/index.js +23 -7
- package/dist/utils/performanceMonitor.js +6 -3
- package/dist/utils/rpcRetry.js +4 -1
- package/dist/utils/supabase.js +10 -5
- package/dist/utils/toastService.js +22 -17
- package/dist/utils/tokenUtils.js +24 -15
- package/dist/utils/validation.js +16 -8
- package/package.json +2 -1
- package/src/index.ts +63 -11
|
@@ -1,12 +1,50 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.ErrorBoundary = void 0;
|
|
2
40
|
/**
|
|
3
41
|
* ErrorBoundary Component
|
|
4
42
|
* Requirements: 11.1 - Global error handling with React error boundaries
|
|
5
43
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const Container =
|
|
44
|
+
const react_1 = __importStar(require("react"));
|
|
45
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
46
|
+
const ErrorMessage_1 = require("./ErrorMessage");
|
|
47
|
+
const Container = styled_components_1.default.div `
|
|
10
48
|
padding: var(--spacing-xl, 1.5rem);
|
|
11
49
|
display: flex;
|
|
12
50
|
flex-direction: column;
|
|
@@ -14,18 +52,18 @@ const Container = styled.div `
|
|
|
14
52
|
justify-content: center;
|
|
15
53
|
min-height: 400px;
|
|
16
54
|
`;
|
|
17
|
-
const ErrorTitle =
|
|
55
|
+
const ErrorTitle = styled_components_1.default.h2 `
|
|
18
56
|
font-size: 1.5rem;
|
|
19
57
|
font-weight: 700;
|
|
20
58
|
color: var(--color-error, #dc3545);
|
|
21
59
|
margin-bottom: var(--spacing-md, 1rem);
|
|
22
60
|
`;
|
|
23
|
-
const ErrorDetails =
|
|
61
|
+
const ErrorDetails = styled_components_1.default.details `
|
|
24
62
|
margin-top: var(--spacing-lg, 1.5rem);
|
|
25
63
|
width: 100%;
|
|
26
64
|
max-width: 800px;
|
|
27
65
|
`;
|
|
28
|
-
const ErrorSummary =
|
|
66
|
+
const ErrorSummary = styled_components_1.default.summary `
|
|
29
67
|
cursor: pointer;
|
|
30
68
|
color: var(--color-text-secondary, #6b7280);
|
|
31
69
|
font-size: 0.875rem;
|
|
@@ -35,7 +73,7 @@ const ErrorSummary = styled.summary `
|
|
|
35
73
|
color: var(--color-text, #1a1a1a);
|
|
36
74
|
}
|
|
37
75
|
`;
|
|
38
|
-
const ErrorCode =
|
|
76
|
+
const ErrorCode = styled_components_1.default.pre `
|
|
39
77
|
background: var(--color-background, #ffffff);
|
|
40
78
|
border: 1px solid var(--color-border, #e5e7eb);
|
|
41
79
|
border-radius: var(--border-radius-md, 0.375rem);
|
|
@@ -46,7 +84,7 @@ const ErrorCode = styled.pre `
|
|
|
46
84
|
max-height: 300px;
|
|
47
85
|
overflow-y: auto;
|
|
48
86
|
`;
|
|
49
|
-
|
|
87
|
+
class ErrorBoundary extends react_1.Component {
|
|
50
88
|
constructor(props) {
|
|
51
89
|
super(props);
|
|
52
90
|
this.handleReset = () => {
|
|
@@ -86,8 +124,16 @@ export class ErrorBoundary extends Component {
|
|
|
86
124
|
return this.props.fallback;
|
|
87
125
|
}
|
|
88
126
|
const isDevelopment = typeof process !== 'undefined' && ((_a = process.env) === null || _a === void 0 ? void 0 : _a.NODE_ENV) === 'development';
|
|
89
|
-
return (
|
|
127
|
+
return (react_1.default.createElement(Container, null,
|
|
128
|
+
react_1.default.createElement(ErrorTitle, null, "Something went wrong"),
|
|
129
|
+
react_1.default.createElement(ErrorMessage_1.ErrorMessage, { message: ((_b = this.state.error) === null || _b === void 0 ? void 0 : _b.message) || 'An unexpected error occurred', onRetry: this.handleReset }),
|
|
130
|
+
isDevelopment && this.state.errorInfo && (react_1.default.createElement(ErrorDetails, null,
|
|
131
|
+
react_1.default.createElement(ErrorSummary, null, "Error Details (Development Only)"),
|
|
132
|
+
react_1.default.createElement(ErrorCode, null, (_c = this.state.error) === null || _c === void 0 ? void 0 :
|
|
133
|
+
_c.toString(),
|
|
134
|
+
this.state.errorInfo.componentStack)))));
|
|
90
135
|
}
|
|
91
136
|
return this.props.children;
|
|
92
137
|
}
|
|
93
138
|
}
|
|
139
|
+
exports.ErrorBoundary = ErrorBoundary;
|
|
@@ -1,25 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
return (_jsxs(Container, { children: [_jsx(Icon, { children: "\u26A0\uFE0F" }), _jsx(Message, { children: message }), onRetry && _jsx(RetryButton, { onClick: onRetry, children: "Try Again" })] }));
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
4
|
};
|
|
6
|
-
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ErrorMessage = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const ErrorMessage = ({ message, onRetry }) => {
|
|
10
|
+
return (react_1.default.createElement(Container, null,
|
|
11
|
+
react_1.default.createElement(Icon, null, "\u26A0\uFE0F"),
|
|
12
|
+
react_1.default.createElement(Message, null, message),
|
|
13
|
+
onRetry && react_1.default.createElement(RetryButton, { onClick: onRetry }, "Try Again")));
|
|
14
|
+
};
|
|
15
|
+
exports.ErrorMessage = ErrorMessage;
|
|
16
|
+
const Container = styled_components_1.default.div `
|
|
7
17
|
background-color: rgba(239, 68, 68, 0.1);
|
|
8
18
|
border: 1px solid var(--color-error, #dc3545);
|
|
9
19
|
border-radius: var(--border-radius-lg, 0.5rem);
|
|
10
20
|
padding: var(--spacing-xl, 1.5rem);
|
|
11
21
|
text-align: center;
|
|
12
22
|
`;
|
|
13
|
-
const Icon =
|
|
23
|
+
const Icon = styled_components_1.default.div `
|
|
14
24
|
font-size: 3rem;
|
|
15
25
|
margin-bottom: var(--spacing-md, 1rem);
|
|
16
26
|
`;
|
|
17
|
-
const Message =
|
|
27
|
+
const Message = styled_components_1.default.p `
|
|
18
28
|
color: var(--color-error, #dc3545);
|
|
19
29
|
font-size: 1rem;
|
|
20
30
|
margin-bottom: var(--spacing-md, 1rem);
|
|
21
31
|
`;
|
|
22
|
-
const RetryButton =
|
|
32
|
+
const RetryButton = styled_components_1.default.button `
|
|
23
33
|
background-color: var(--color-error, #dc3545);
|
|
24
34
|
color: white;
|
|
25
35
|
padding: var(--spacing-sm, 0.5rem) var(--spacing-lg, 1.5rem);
|
|
@@ -1,12 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.Loading = void 0;
|
|
40
|
+
const react_1 = __importDefault(require("react"));
|
|
41
|
+
const styled_components_1 = __importStar(require("styled-components"));
|
|
42
|
+
const Loading = ({ size = 'medium', text }) => {
|
|
43
|
+
return (react_1.default.createElement(Container, null,
|
|
44
|
+
react_1.default.createElement(Spinner, { size: size }),
|
|
45
|
+
text && react_1.default.createElement(LoadingText, null, text)));
|
|
5
46
|
};
|
|
6
|
-
|
|
47
|
+
exports.Loading = Loading;
|
|
48
|
+
const spin = (0, styled_components_1.keyframes) `
|
|
7
49
|
to { transform: rotate(360deg); }
|
|
8
50
|
`;
|
|
9
|
-
const Container =
|
|
51
|
+
const Container = styled_components_1.default.div `
|
|
10
52
|
display: flex;
|
|
11
53
|
flex-direction: column;
|
|
12
54
|
align-items: center;
|
|
@@ -14,7 +56,7 @@ const Container = styled.div `
|
|
|
14
56
|
gap: var(--spacing-md, 1rem);
|
|
15
57
|
padding: var(--spacing-xl, 1.5rem);
|
|
16
58
|
`;
|
|
17
|
-
const Spinner =
|
|
59
|
+
const Spinner = styled_components_1.default.div `
|
|
18
60
|
width: ${props => {
|
|
19
61
|
switch (props.size) {
|
|
20
62
|
case 'small': return '24px';
|
|
@@ -34,7 +76,7 @@ const Spinner = styled.div `
|
|
|
34
76
|
border-radius: 50%;
|
|
35
77
|
animation: ${spin} 1s linear infinite;
|
|
36
78
|
`;
|
|
37
|
-
const LoadingText =
|
|
79
|
+
const LoadingText = styled_components_1.default.p `
|
|
38
80
|
color: var(--color-text-secondary, #6b7280);
|
|
39
81
|
font-size: 1rem;
|
|
40
82
|
margin: 0;
|
|
@@ -1,9 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.LoadingIndicator = void 0;
|
|
40
|
+
/**
|
|
41
|
+
* Loading Indicator Component
|
|
42
|
+
* Displays loading feedback appropriate to context
|
|
43
|
+
* Requirements: 5.2, 5.5
|
|
44
|
+
*/
|
|
45
|
+
const react_1 = __importDefault(require("react"));
|
|
46
|
+
const styled_components_1 = __importStar(require("styled-components"));
|
|
47
|
+
const spin = (0, styled_components_1.keyframes) `
|
|
4
48
|
to { transform: rotate(360deg); }
|
|
5
49
|
`;
|
|
6
|
-
const dots = keyframes `
|
|
50
|
+
const dots = (0, styled_components_1.keyframes) `
|
|
7
51
|
0%, 20% {
|
|
8
52
|
content: '.';
|
|
9
53
|
}
|
|
@@ -14,7 +58,7 @@ const dots = keyframes `
|
|
|
14
58
|
content: '...';
|
|
15
59
|
}
|
|
16
60
|
`;
|
|
17
|
-
const Container =
|
|
61
|
+
const Container = styled_components_1.default.div `
|
|
18
62
|
display: flex;
|
|
19
63
|
flex-direction: column;
|
|
20
64
|
align-items: center;
|
|
@@ -22,7 +66,7 @@ const Container = styled.div `
|
|
|
22
66
|
gap: var(--spacing-md, 1rem);
|
|
23
67
|
padding: var(--spacing-lg, 1.5rem);
|
|
24
68
|
`;
|
|
25
|
-
const Spinner =
|
|
69
|
+
const Spinner = styled_components_1.default.div `
|
|
26
70
|
width: ${props => {
|
|
27
71
|
switch (props.size) {
|
|
28
72
|
case 'small': return '24px';
|
|
@@ -42,7 +86,7 @@ const Spinner = styled.div `
|
|
|
42
86
|
border-radius: 50%;
|
|
43
87
|
animation: ${spin} 1s linear infinite;
|
|
44
88
|
`;
|
|
45
|
-
const ProgressBarContainer =
|
|
89
|
+
const ProgressBarContainer = styled_components_1.default.div `
|
|
46
90
|
width: 100%;
|
|
47
91
|
max-width: 300px;
|
|
48
92
|
height: 8px;
|
|
@@ -50,14 +94,14 @@ const ProgressBarContainer = styled.div `
|
|
|
50
94
|
border-radius: var(--border-radius-md, 0.375rem);
|
|
51
95
|
overflow: hidden;
|
|
52
96
|
`;
|
|
53
|
-
const ProgressBar =
|
|
97
|
+
const ProgressBar = styled_components_1.default.div `
|
|
54
98
|
height: 100%;
|
|
55
99
|
width: ${props => props.progress}%;
|
|
56
100
|
background: linear-gradient(90deg, var(--color-primary, #6a8102), var(--color-secondary, #ffc107));
|
|
57
101
|
border-radius: var(--border-radius-md, 0.375rem);
|
|
58
102
|
transition: width 0.3s ease;
|
|
59
103
|
`;
|
|
60
|
-
const Dots =
|
|
104
|
+
const Dots = styled_components_1.default.div `
|
|
61
105
|
font-size: 1.5rem;
|
|
62
106
|
color: var(--color-primary, #6a8102);
|
|
63
107
|
|
|
@@ -66,30 +110,38 @@ const Dots = styled.div `
|
|
|
66
110
|
animation: ${dots} 1.5s steps(4, end) infinite;
|
|
67
111
|
}
|
|
68
112
|
`;
|
|
69
|
-
const Message =
|
|
113
|
+
const Message = styled_components_1.default.p `
|
|
70
114
|
color: var(--color-text-secondary, #6b7280);
|
|
71
115
|
font-size: 0.875rem;
|
|
72
116
|
margin: 0;
|
|
73
117
|
text-align: center;
|
|
74
118
|
`;
|
|
75
|
-
const ProgressText =
|
|
119
|
+
const ProgressText = styled_components_1.default.span `
|
|
76
120
|
color: var(--color-text-secondary, #6b7280);
|
|
77
121
|
font-size: 0.75rem;
|
|
78
122
|
font-weight: 600;
|
|
79
123
|
margin-top: var(--spacing-xs, 0.25rem);
|
|
80
124
|
`;
|
|
81
|
-
|
|
125
|
+
const LoadingIndicator = ({ type, size = 'medium', message, progress, }) => {
|
|
82
126
|
const renderIndicator = () => {
|
|
83
127
|
switch (type) {
|
|
84
128
|
case 'spinner':
|
|
85
|
-
return
|
|
129
|
+
return react_1.default.createElement(Spinner, { size: size });
|
|
86
130
|
case 'progress':
|
|
87
|
-
return (
|
|
131
|
+
return (react_1.default.createElement("div", { style: { width: '100%', maxWidth: '300px' } },
|
|
132
|
+
react_1.default.createElement(ProgressBarContainer, null,
|
|
133
|
+
react_1.default.createElement(ProgressBar, { progress: progress || 0 })),
|
|
134
|
+
progress !== undefined && (react_1.default.createElement(ProgressText, null,
|
|
135
|
+
Math.round(progress),
|
|
136
|
+
"%"))));
|
|
88
137
|
case 'dots':
|
|
89
|
-
return
|
|
138
|
+
return react_1.default.createElement(Dots, null);
|
|
90
139
|
default:
|
|
91
140
|
return null;
|
|
92
141
|
}
|
|
93
142
|
};
|
|
94
|
-
return (
|
|
143
|
+
return (react_1.default.createElement(Container, null,
|
|
144
|
+
renderIndicator(),
|
|
145
|
+
message && react_1.default.createElement(Message, null, message)));
|
|
95
146
|
};
|
|
147
|
+
exports.LoadingIndicator = LoadingIndicator;
|
|
@@ -1,16 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.ProgramStatus = void 0;
|
|
40
|
+
const react_1 = __importStar(require("react"));
|
|
41
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
42
|
+
const useProgram_1 = require("../../hooks/useProgram");
|
|
43
|
+
const ErrorMessage_1 = require("./ErrorMessage");
|
|
44
|
+
const react_hot_toast_1 = __importDefault(require("react-hot-toast"));
|
|
45
|
+
const ProgramStatus = () => {
|
|
46
|
+
const { program, idl, idlError, programId } = (0, useProgram_1.useProgram)();
|
|
47
|
+
const [showError, setShowError] = react_1.default.useState(false);
|
|
48
|
+
(0, react_1.useEffect)(() => {
|
|
11
49
|
if (idlError) {
|
|
12
50
|
setShowError(true);
|
|
13
|
-
|
|
51
|
+
react_hot_toast_1.default.error(`Failed to load program: ${idlError}`, {
|
|
14
52
|
duration: 5000,
|
|
15
53
|
});
|
|
16
54
|
}
|
|
@@ -19,8 +57,10 @@ export const ProgramStatus = () => {
|
|
|
19
57
|
if (!idlError) {
|
|
20
58
|
return null;
|
|
21
59
|
}
|
|
22
|
-
return (
|
|
60
|
+
return (react_1.default.createElement(Container, null,
|
|
61
|
+
react_1.default.createElement(ErrorMessage_1.ErrorMessage, { message: `Failed to load program contract. Please refresh the page. Error: ${idlError}`, onRetry: () => window.location.reload() })));
|
|
23
62
|
};
|
|
24
|
-
|
|
63
|
+
exports.ProgramStatus = ProgramStatus;
|
|
64
|
+
const Container = styled_components_1.default.div `
|
|
25
65
|
margin: var(--spacing-md, 1rem) 0;
|
|
26
66
|
`;
|
|
@@ -1,6 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.ProfileSkeleton = exports.StatsSkeleton = exports.VaultCardSkeleton = exports.SkeletonAvatar = exports.SkeletonButton = exports.SkeletonTitle = exports.SkeletonText = exports.SkeletonCard = void 0;
|
|
40
|
+
/**
|
|
41
|
+
* Skeleton Screen Components
|
|
42
|
+
* Requirements: 11.3 - Loading states with skeleton screens for better perceived performance
|
|
43
|
+
*/
|
|
44
|
+
const react_1 = __importDefault(require("react"));
|
|
45
|
+
const styled_components_1 = __importStar(require("styled-components"));
|
|
46
|
+
const shimmer = (0, styled_components_1.keyframes) `
|
|
4
47
|
0% {
|
|
5
48
|
background-position: -1000px 0;
|
|
6
49
|
}
|
|
@@ -8,7 +51,7 @@ const shimmer = keyframes `
|
|
|
8
51
|
background-position: 1000px 0;
|
|
9
52
|
}
|
|
10
53
|
`;
|
|
11
|
-
const SkeletonBase =
|
|
54
|
+
const SkeletonBase = styled_components_1.default.div `
|
|
12
55
|
background: linear-gradient(
|
|
13
56
|
90deg,
|
|
14
57
|
var(--color-surface, #f9fafb) 0%,
|
|
@@ -21,11 +64,11 @@ const SkeletonBase = styled.div `
|
|
|
21
64
|
width: ${props => props.width || '100%'};
|
|
22
65
|
height: ${props => props.height || '20px'};
|
|
23
66
|
`;
|
|
24
|
-
|
|
67
|
+
exports.SkeletonCard = (0, styled_components_1.default)(SkeletonBase) `
|
|
25
68
|
height: 200px;
|
|
26
69
|
margin-bottom: var(--spacing-md, 1rem);
|
|
27
70
|
`;
|
|
28
|
-
|
|
71
|
+
exports.SkeletonText = (0, styled_components_1.default)(SkeletonBase) `
|
|
29
72
|
height: 16px;
|
|
30
73
|
margin-bottom: var(--spacing-xs, 0.25rem);
|
|
31
74
|
|
|
@@ -33,21 +76,32 @@ export const SkeletonText = styled(SkeletonBase) `
|
|
|
33
76
|
margin-bottom: 0;
|
|
34
77
|
}
|
|
35
78
|
`;
|
|
36
|
-
|
|
79
|
+
exports.SkeletonTitle = (0, styled_components_1.default)(SkeletonBase) `
|
|
37
80
|
height: 24px;
|
|
38
81
|
width: 60%;
|
|
39
82
|
margin-bottom: var(--spacing-md, 1rem);
|
|
40
83
|
`;
|
|
41
|
-
|
|
84
|
+
exports.SkeletonButton = (0, styled_components_1.default)(SkeletonBase) `
|
|
42
85
|
height: 40px;
|
|
43
86
|
width: 120px;
|
|
44
87
|
border-radius: var(--border-radius-md, 0.375rem);
|
|
45
88
|
`;
|
|
46
|
-
|
|
89
|
+
exports.SkeletonAvatar = (0, styled_components_1.default)(SkeletonBase) `
|
|
47
90
|
width: 64px;
|
|
48
91
|
height: 64px;
|
|
49
92
|
border-radius: 50%;
|
|
50
93
|
`;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
94
|
+
const VaultCardSkeleton = () => (react_1.default.createElement(exports.SkeletonCard, null));
|
|
95
|
+
exports.VaultCardSkeleton = VaultCardSkeleton;
|
|
96
|
+
const StatsSkeleton = () => (react_1.default.createElement(react_1.default.Fragment, null,
|
|
97
|
+
react_1.default.createElement(exports.SkeletonTitle, null),
|
|
98
|
+
react_1.default.createElement(exports.SkeletonText, { width: "100%" }),
|
|
99
|
+
react_1.default.createElement(exports.SkeletonText, { width: "80%" }),
|
|
100
|
+
react_1.default.createElement(exports.SkeletonText, { width: "90%" })));
|
|
101
|
+
exports.StatsSkeleton = StatsSkeleton;
|
|
102
|
+
const ProfileSkeleton = () => (react_1.default.createElement(react_1.default.Fragment, null,
|
|
103
|
+
react_1.default.createElement(exports.SkeletonAvatar, { width: "80px", height: "80px" }),
|
|
104
|
+
react_1.default.createElement(exports.SkeletonTitle, { width: "40%" }),
|
|
105
|
+
react_1.default.createElement(exports.SkeletonText, { width: "60%" }),
|
|
106
|
+
react_1.default.createElement(exports.SkeletonText, { width: "50%" })));
|
|
107
|
+
exports.ProfileSkeleton = ProfileSkeleton;
|