@microcosmmoney/portal-react 3.12.0 → 3.12.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/auction/auction-page.js +0 -2
- package/dist/components/dashboard/dashboard-overview.js +0 -3
- package/dist/components/dashboard/ecosystem-stats.js +0 -1
- package/dist/components/mcd/mcd-page.js +1 -5
- package/dist/components/mining/mining-page.js +1 -7
- package/dist/components/organization/organization-page.js +0 -7
- package/dist/components/queue/queue-status-page.d.ts +1 -2
- package/dist/components/queue/queue-status-page.js +3 -43
- package/dist/components/stations/station-list-page.d.ts +1 -2
- package/dist/components/stations/station-list-page.js +2 -14
- package/dist/components/territory/territory-page.js +0 -39
- package/dist/components/voting/voting-page.js +0 -1
- package/dist/components/wallet/wallet-page.js +1 -9
- package/dist/menu-config.d.ts +0 -2
- package/dist/menu-config.js +0 -2
- package/package.json +3 -3
|
@@ -6,7 +6,6 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const i18n_context_1 = require("../../i18n-context");
|
|
8
8
|
const auth_react_1 = require("@microcosmmoney/auth-react");
|
|
9
|
-
/* ─── Inline SVG Icons (lucide style, 24x24) ─── */
|
|
10
9
|
const IconGavel = ({ className = 'w-4 h-4' }) => ((0, jsx_runtime_1.jsxs)("svg", { className: className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("path", { d: "m14 13-7.5 7.5c-.83.83-2.17.83-3 0 0 0 0 0 0 0a2.12 2.12 0 0 1 0-3L11 10" }), (0, jsx_runtime_1.jsx)("path", { d: "m16 16 6-6" }), (0, jsx_runtime_1.jsx)("path", { d: "m8 8 6-6" }), (0, jsx_runtime_1.jsx)("path", { d: "m9 7 8 8" }), (0, jsx_runtime_1.jsx)("path", { d: "m21 11-8-8" })] }));
|
|
11
10
|
const IconFlame = ({ className = 'w-4 h-4' }) => ((0, jsx_runtime_1.jsx)("svg", { className: className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: (0, jsx_runtime_1.jsx)("path", { d: "M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z" }) }));
|
|
12
11
|
const IconCrown = ({ className = 'w-4 h-4' }) => ((0, jsx_runtime_1.jsxs)("svg", { className: className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("path", { d: "M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z" }), (0, jsx_runtime_1.jsx)("path", { d: "M5 21h14" })] }));
|
|
@@ -26,7 +25,6 @@ const IconBuilding = ({ className = 'w-4 h-4' }) => ((0, jsx_runtime_1.jsxs)("sv
|
|
|
26
25
|
const IconGrid = ({ className = 'w-4 h-4' }) => ((0, jsx_runtime_1.jsxs)("svg", { className: className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }), (0, jsx_runtime_1.jsx)("path", { d: "M3 9h18" }), (0, jsx_runtime_1.jsx)("path", { d: "M3 15h18" }), (0, jsx_runtime_1.jsx)("path", { d: "M9 3v18" }), (0, jsx_runtime_1.jsx)("path", { d: "M15 3v18" })] }));
|
|
27
26
|
const IconMap = ({ className = 'w-4 h-4' }) => ((0, jsx_runtime_1.jsxs)("svg", { className: className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("path", { d: "M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z" }), (0, jsx_runtime_1.jsx)("path", { d: "M15 5.764v15" }), (0, jsx_runtime_1.jsx)("path", { d: "M9 3.236v15" })] }));
|
|
28
27
|
const IconGlobe = ({ className = 'w-4 h-4' }) => ((0, jsx_runtime_1.jsxs)("svg", { className: className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("circle", { cx: "12", cy: "12", r: "10" }), (0, jsx_runtime_1.jsx)("path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" }), (0, jsx_runtime_1.jsx)("path", { d: "M2 12h20" })] }));
|
|
29
|
-
/* ─── Helpers ─── */
|
|
30
28
|
const UNIT_ICONS = {
|
|
31
29
|
station: (0, jsx_runtime_1.jsx)(IconBuilding, { className: "w-4 h-4" }),
|
|
32
30
|
matrix: (0, jsx_runtime_1.jsx)(IconGrid, { className: "w-4 h-4" }),
|
|
@@ -24,11 +24,9 @@ class SafeRender extends react_1.Component {
|
|
|
24
24
|
static getDerivedStateFromError() { return { hasError: true }; }
|
|
25
25
|
render() { return this.state.hasError ? null : this.props.children; }
|
|
26
26
|
}
|
|
27
|
-
/** Skeleton placeholder matching card dimensions */
|
|
28
27
|
function CardSkeleton({ height = 'h-48' }) {
|
|
29
28
|
return ((0, jsx_runtime_1.jsx)("div", { className: `backdrop-blur-md bg-white/5 border border-white/10 rounded-xl ${height} animate-pulse blockchain-card`, children: (0, jsx_runtime_1.jsxs)("div", { className: "p-6 space-y-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-3 bg-neutral-800 rounded w-24" }), (0, jsx_runtime_1.jsx)("div", { className: "h-6 bg-neutral-800 rounded w-40" }), (0, jsx_runtime_1.jsx)("div", { className: "h-4 bg-neutral-800 rounded w-32" })] }) }));
|
|
30
29
|
}
|
|
31
|
-
/** Renders children only when the container enters the viewport */
|
|
32
30
|
function LazySection({ children, fallback }) {
|
|
33
31
|
const [visible, setVisible] = (0, react_1.useState)(false);
|
|
34
32
|
const ref = (0, react_1.useRef)(null);
|
|
@@ -49,7 +47,6 @@ function LazySection({ children, fallback }) {
|
|
|
49
47
|
}, []);
|
|
50
48
|
return (0, jsx_runtime_1.jsx)("div", { ref: ref, children: visible ? children : fallback });
|
|
51
49
|
}
|
|
52
|
-
/** Convert hex color "#d4a846" to RGB string "212,168,70" */
|
|
53
50
|
function hexToRgb(hex) {
|
|
54
51
|
const h = hex.replace('#', '');
|
|
55
52
|
const n = parseInt(h.length === 3 ? h.split('').map(c => c + c).join('') : h, 16);
|
|
@@ -5,7 +5,6 @@ exports.MicrocosmEcosystemStats = MicrocosmEcosystemStats;
|
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const auth_react_1 = require("@microcosmmoney/auth-react");
|
|
7
7
|
const i18n_context_1 = require("../../i18n-context");
|
|
8
|
-
/* Inline SVG icons (16x16, stroke-based) */
|
|
9
8
|
const IconUsersTotal = ({ stroke = '#22d3ee' }) => ((0, jsx_runtime_1.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: stroke, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }), (0, jsx_runtime_1.jsx)("circle", { cx: "9", cy: "7", r: "4" }), (0, jsx_runtime_1.jsx)("path", { d: "M22 21v-2a4 4 0 0 0-3-3.87" }), (0, jsx_runtime_1.jsx)("path", { d: "M16 3.13a4 4 0 0 1 0 7.75" })] }));
|
|
10
9
|
const IconActivity = ({ stroke = '#22d3ee' }) => ((0, jsx_runtime_1.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: stroke, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: (0, jsx_runtime_1.jsx)("path", { d: "M22 12h-4l-3 9L9 3l-3 9H2" }) }));
|
|
11
10
|
const IconHardHat = ({ stroke = '#22d3ee' }) => ((0, jsx_runtime_1.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: stroke, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("path", { d: "M2 18a1 1 0 0 0 1 1h18a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1v2z" }), (0, jsx_runtime_1.jsx)("path", { d: "M10 15V6.5a3.5 3.5 0 0 1 7 0V15" }), (0, jsx_runtime_1.jsx)("path", { d: "M4 15v-5a8 8 0 0 1 16 0v5" })] }));
|
|
@@ -6,7 +6,6 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const auth_react_1 = require("@microcosmmoney/auth-react");
|
|
8
8
|
const i18n_context_1 = require("../../i18n-context");
|
|
9
|
-
/* ── Inline SVG Icons (lucide style, 24x24 default) ── */
|
|
10
9
|
const IconCoins = ({ className = '' }) => ((0, jsx_runtime_1.jsxs)("svg", { className: className, width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("circle", { cx: "8", cy: "8", r: "6" }), (0, jsx_runtime_1.jsx)("path", { d: "M18.09 10.37A6 6 0 1 1 10.34 18" }), (0, jsx_runtime_1.jsx)("path", { d: "M7 6h1v4" }), (0, jsx_runtime_1.jsx)("path", { d: "m16.71 13.88.7.71-2.82 2.82" })] }));
|
|
11
10
|
const IconWallet = ({ className = '' }) => ((0, jsx_runtime_1.jsxs)("svg", { className: className, width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("path", { d: "M21 12V7H5a2 2 0 0 1 0-4h14v4" }), (0, jsx_runtime_1.jsx)("path", { d: "M3 5v14a2 2 0 0 0 2 2h16v-5" }), (0, jsx_runtime_1.jsx)("path", { d: "M18 12a2 2 0 0 0 0 4h4v-4Z" })] }));
|
|
12
11
|
const IconGift = ({ className = '' }) => ((0, jsx_runtime_1.jsxs)("svg", { className: className, width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("rect", { x: "3", y: "8", width: "18", height: "4", rx: "1" }), (0, jsx_runtime_1.jsx)("path", { d: "M12 8v13" }), (0, jsx_runtime_1.jsx)("path", { d: "M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7" }), (0, jsx_runtime_1.jsx)("path", { d: "M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5" })] }));
|
|
@@ -23,7 +22,6 @@ const IconEye = ({ className = '' }) => ((0, jsx_runtime_1.jsxs)("svg", { classN
|
|
|
23
22
|
const IconShield = ({ className = '' }) => ((0, jsx_runtime_1.jsx)("svg", { className: className, width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: (0, jsx_runtime_1.jsx)("path", { d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z" }) }));
|
|
24
23
|
const IconExternalLink = ({ className = '' }) => ((0, jsx_runtime_1.jsxs)("svg", { className: className, width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("path", { d: "M15 3h6v6" }), (0, jsx_runtime_1.jsx)("path", { d: "M10 14 21 3" }), (0, jsx_runtime_1.jsx)("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })] }));
|
|
25
24
|
const IconAlertTriangle = ({ className = '' }) => ((0, jsx_runtime_1.jsxs)("svg", { className: className, width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z" }), (0, jsx_runtime_1.jsx)("path", { d: "M12 9v4" }), (0, jsx_runtime_1.jsx)("path", { d: "M12 17h.01" })] }));
|
|
26
|
-
/* ── Helpers ── */
|
|
27
25
|
const fmt = (n, d = 2) => n.toLocaleString('en-US', { minimumFractionDigits: d, maximumFractionDigits: d });
|
|
28
26
|
function formatDate(dateStr) {
|
|
29
27
|
if (!dateStr)
|
|
@@ -61,7 +59,6 @@ const TX_TYPE_NAMES = {
|
|
|
61
59
|
transfer: 'Transfer',
|
|
62
60
|
refund: 'Refund',
|
|
63
61
|
};
|
|
64
|
-
/* ── Ecosystem services ── */
|
|
65
62
|
const ECOSYSTEM_SERVICES = [
|
|
66
63
|
{
|
|
67
64
|
name: 'Double Helix',
|
|
@@ -133,11 +130,10 @@ function MicrocosmMCDPage({ basePath = '', onNavigate }) {
|
|
|
133
130
|
const handleNav = (path) => {
|
|
134
131
|
onNavigate?.(resolvePath(path));
|
|
135
132
|
};
|
|
136
|
-
/* ── Not logged in ── */
|
|
137
133
|
if (!mcdData && !mcdLoading) {
|
|
138
134
|
return ((0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-center h-[60vh]", children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg p-8 text-center", children: [(0, jsx_runtime_1.jsx)(IconWallet, { className: "w-12 h-12 mx-auto mb-4 text-neutral-500" }), (0, jsx_runtime_1.jsx)("p", { className: "text-neutral-400", children: t('loginRequired', 'Please log in to view your MCD balance') })] }) }));
|
|
139
135
|
}
|
|
140
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "max-w-7xl mx-auto p-6 space-y-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h1", { className: "text-2xl font-bold text-white tracking-wider", children: t('title', 'MCD Credits') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400 mt-1", children: t('subtitle', 'Microcosm Dollar - Ecosystem consumption credits') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => handleNav('/mcc/wallet'), className: "flex items-center px-3 py-1.5 text-sm border border-neutral-700 rounded text-neutral-400 hover:bg-neutral-800 hover:text-neutral-300 bg-transparent transition-colors", children: [(0, jsx_runtime_1.jsx)(IconWallet, { className: "w-4 h-4 mr-2" }), t('manageWallet', 'Manage Wallet')] }), (0, jsx_runtime_1.jsxs)("button", { onClick: () => setShowHelp(!showHelp), className: "flex items-center px-3 py-1.5 text-sm border border-neutral-700 rounded text-neutral-400 hover:bg-neutral-800 hover:text-neutral-300 bg-transparent transition-colors", children: [(0, jsx_runtime_1.jsx)(IconHelpCircle, { className: "w-4 h-4 mr-2" }), t('helpGuide', 'Help Guide')] }), (0, jsx_runtime_1.jsxs)("button", { onClick: handleRefresh, disabled: refreshing, className: "flex items-center px-3 py-1.5 text-sm border border-neutral-700 rounded text-neutral-400 hover:bg-neutral-800 hover:text-neutral-300 bg-transparent transition-colors disabled:opacity-50", children: [(0, jsx_runtime_1.jsx)(IconRefresh, { className: `w-4 h-4 mr-2 ${refreshing ? 'animate-spin' : ''}` }), t('refresh', 'Refresh')] })] })] }), showHelp && ((0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg p-6 hover:border-cyan-400/50 transition-colors", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-white font-bold tracking-wider mb-4", children: t('mcdGuideTitle', 'MCD Credits Guide') }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-4 text-sm", children: [(0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-800 rounded p-3", children: [(0, jsx_runtime_1.jsxs)("h4", { className: "font-medium text-white mb-2 flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(IconGift, { className: "w-4 h-4 text-white" }), t('howToGetMcd', 'How to Earn MCD')] }), (0, jsx_runtime_1.jsxs)("ul", { className: "list-disc list-inside text-neutral-400 space-y-1", children: [(0, jsx_runtime_1.jsx)("li", { children: "Daily distribution from territory vault (1% of vault balance)" }), (0, jsx_runtime_1.jsx)("li", { children: "Companion yield from mining operations" }), (0, jsx_runtime_1.jsx)("li", { children: "Ecosystem service rewards" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-800 rounded p-3", children: [(0, jsx_runtime_1.jsxs)("h4", { className: "font-medium text-white mb-2 flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(IconCoins, { className: "w-4 h-4 text-white" }), t('mcdUsage', 'MCD Usage')] }), (0, jsx_runtime_1.jsxs)("ul", { className: "list-disc list-inside text-neutral-400 space-y-1", children: [(0, jsx_runtime_1.jsx)("li", { children: "Spend on ecosystem services (Double Helix, xSocial, etc.)" }), (0, jsx_runtime_1.jsx)("li", { children: "Transfer between users" }), (0, jsx_runtime_1.jsx)("li", { children: "Future governance participation" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-800 rounded p-3", children: [(0, jsx_runtime_1.jsxs)("h4", { className: "font-medium text-white mb-2 flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(IconHistory, { className: "w-4 h-4 text-white" }), t('notes', 'Notes')] }), (0, jsx_runtime_1.jsxs)("ul", { className: "list-disc list-inside text-neutral-400 space-y-1", children: [(0, jsx_runtime_1.jsx)("li", { children: "MCD is an internal ecosystem token, not tradeable on exchanges" }), (0, jsx_runtime_1.jsx)("li", { children: "Daily distribution happens automatically at 00:15 UTC" }), (0, jsx_runtime_1.jsx)("li", { children: "Check your territory page for vault balance details" })] })] })] })] })), (0, jsx_runtime_1.jsx)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg p-6 hover:border-cyan-400/50 transition-colors", children: (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-6", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-neutral-400 text-xs font-mono tracking-wider mb-1", children: "available_balance" }), mcdLoading ? ((0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2 h-10", children: (0, jsx_runtime_1.jsx)(Spinner, {}) })) : ((0, jsx_runtime_1.jsx)("div", { className: "text-4xl font-bold font-mono text-cyan-400", children: fmt(mcdAmount) })), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500 mt-1", children: "MCD" })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-neutral-400 text-xs font-mono tracking-wider mb-1", children: "total_received" }), (0, jsx_runtime_1.jsx)("div", { className: "text-2xl font-bold font-mono text-white", children: fmt(mcdReceived, 0) }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500 mt-1", children: "lifetime income" })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-neutral-400 text-xs font-mono tracking-wider mb-1", children: "total_spent" }), (0, jsx_runtime_1.jsx)("div", { className: "text-2xl font-bold font-mono text-neutral-400", children: fmt(mcdSpent, 0) }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500 mt-1", children: "lifetime spent" })] })] }) }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg p-6 hover:border-cyan-400/50 transition-colors", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between mb-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(IconCoins, { className: "w-5 h-5 text-white" }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm text-neutral-400 tracking-wider", children: t('onChainBalance', 'On-chain MCD Balance
|
|
136
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "max-w-7xl mx-auto p-6 space-y-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h1", { className: "text-2xl font-bold text-white tracking-wider", children: t('title', 'MCD Credits') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400 mt-1", children: t('subtitle', 'Microcosm Dollar - Ecosystem consumption credits') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => handleNav('/mcc/wallet'), className: "flex items-center px-3 py-1.5 text-sm border border-neutral-700 rounded text-neutral-400 hover:bg-neutral-800 hover:text-neutral-300 bg-transparent transition-colors", children: [(0, jsx_runtime_1.jsx)(IconWallet, { className: "w-4 h-4 mr-2" }), t('manageWallet', 'Manage Wallet')] }), (0, jsx_runtime_1.jsxs)("button", { onClick: () => setShowHelp(!showHelp), className: "flex items-center px-3 py-1.5 text-sm border border-neutral-700 rounded text-neutral-400 hover:bg-neutral-800 hover:text-neutral-300 bg-transparent transition-colors", children: [(0, jsx_runtime_1.jsx)(IconHelpCircle, { className: "w-4 h-4 mr-2" }), t('helpGuide', 'Help Guide')] }), (0, jsx_runtime_1.jsxs)("button", { onClick: handleRefresh, disabled: refreshing, className: "flex items-center px-3 py-1.5 text-sm border border-neutral-700 rounded text-neutral-400 hover:bg-neutral-800 hover:text-neutral-300 bg-transparent transition-colors disabled:opacity-50", children: [(0, jsx_runtime_1.jsx)(IconRefresh, { className: `w-4 h-4 mr-2 ${refreshing ? 'animate-spin' : ''}` }), t('refresh', 'Refresh')] })] })] }), showHelp && ((0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg p-6 hover:border-cyan-400/50 transition-colors", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-white font-bold tracking-wider mb-4", children: t('mcdGuideTitle', 'MCD Credits Guide') }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-4 text-sm", children: [(0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-800 rounded p-3", children: [(0, jsx_runtime_1.jsxs)("h4", { className: "font-medium text-white mb-2 flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(IconGift, { className: "w-4 h-4 text-white" }), t('howToGetMcd', 'How to Earn MCD')] }), (0, jsx_runtime_1.jsxs)("ul", { className: "list-disc list-inside text-neutral-400 space-y-1", children: [(0, jsx_runtime_1.jsx)("li", { children: "Daily distribution from territory vault (1% of vault balance)" }), (0, jsx_runtime_1.jsx)("li", { children: "Companion yield from mining operations" }), (0, jsx_runtime_1.jsx)("li", { children: "Ecosystem service rewards" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-800 rounded p-3", children: [(0, jsx_runtime_1.jsxs)("h4", { className: "font-medium text-white mb-2 flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(IconCoins, { className: "w-4 h-4 text-white" }), t('mcdUsage', 'MCD Usage')] }), (0, jsx_runtime_1.jsxs)("ul", { className: "list-disc list-inside text-neutral-400 space-y-1", children: [(0, jsx_runtime_1.jsx)("li", { children: "Spend on ecosystem services (Double Helix, xSocial, etc.)" }), (0, jsx_runtime_1.jsx)("li", { children: "Transfer between users" }), (0, jsx_runtime_1.jsx)("li", { children: "Future governance participation" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-800 rounded p-3", children: [(0, jsx_runtime_1.jsxs)("h4", { className: "font-medium text-white mb-2 flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(IconHistory, { className: "w-4 h-4 text-white" }), t('notes', 'Notes')] }), (0, jsx_runtime_1.jsxs)("ul", { className: "list-disc list-inside text-neutral-400 space-y-1", children: [(0, jsx_runtime_1.jsx)("li", { children: "MCD is an internal ecosystem token, not tradeable on exchanges" }), (0, jsx_runtime_1.jsx)("li", { children: "Daily distribution happens automatically at 00:15 UTC" }), (0, jsx_runtime_1.jsx)("li", { children: "Check your territory page for vault balance details" })] })] })] })] })), (0, jsx_runtime_1.jsx)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg p-6 hover:border-cyan-400/50 transition-colors", children: (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-6", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-neutral-400 text-xs font-mono tracking-wider mb-1", children: "available_balance" }), mcdLoading ? ((0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2 h-10", children: (0, jsx_runtime_1.jsx)(Spinner, {}) })) : ((0, jsx_runtime_1.jsx)("div", { className: "text-4xl font-bold font-mono text-cyan-400", children: fmt(mcdAmount) })), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500 mt-1", children: "MCD" })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-neutral-400 text-xs font-mono tracking-wider mb-1", children: "total_received" }), (0, jsx_runtime_1.jsx)("div", { className: "text-2xl font-bold font-mono text-white", children: fmt(mcdReceived, 0) }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500 mt-1", children: "lifetime income" })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-neutral-400 text-xs font-mono tracking-wider mb-1", children: "total_spent" }), (0, jsx_runtime_1.jsx)("div", { className: "text-2xl font-bold font-mono text-neutral-400", children: fmt(mcdSpent, 0) }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500 mt-1", children: "lifetime spent" })] })] }) }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg p-6 hover:border-cyan-400/50 transition-colors", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between mb-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(IconCoins, { className: "w-5 h-5 text-white" }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm text-neutral-400 tracking-wider", children: t('onChainBalance', 'On-chain MCD Balance') })] }), walletList.length > 1 && ((0, jsx_runtime_1.jsxs)("button", { onClick: () => setWalletsExpanded(!walletsExpanded), className: "flex items-center text-sm text-neutral-400 hover:text-cyan-400 transition-colors", children: [walletList.length, " ", t('walletsCount', 'wallets'), walletsExpanded
|
|
141
137
|
? (0, jsx_runtime_1.jsx)(IconChevronUp, { className: "w-4 h-4 ml-1" })
|
|
142
138
|
: (0, jsx_runtime_1.jsx)(IconChevronDown, { className: "w-4 h-4 ml-1" })] }))] }), walletsLoading ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(Spinner, {}), (0, jsx_runtime_1.jsx)("span", { className: "text-neutral-500 text-sm", children: t('loadingOnChain', 'Loading on-chain balance...') })] })) : walletList.length === 0 ? ((0, jsx_runtime_1.jsxs)("div", { className: "text-center py-4", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-neutral-500 mb-3", children: t('noWalletBound', 'No Solana wallet bound yet') }), (0, jsx_runtime_1.jsxs)("button", { onClick: () => handleNav('/mcc/wallet'), className: "flex items-center mx-auto px-3 py-1.5 text-sm border border-neutral-700 rounded text-neutral-400 hover:bg-neutral-800 hover:text-neutral-300 bg-transparent transition-colors", children: [(0, jsx_runtime_1.jsx)(IconWallet, { className: "w-4 h-4 mr-2" }), t('connectWallet', 'Connect Wallet')] })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [walletList.length === 1 && ((0, jsx_runtime_1.jsxs)("div", { className: "mt-2 text-xs text-neutral-500 font-mono", children: [walletList[0].wallet_address.slice(0, 4), "...", walletList[0].wallet_address.slice(-4), walletList[0].is_primary && ((0, jsx_runtime_1.jsx)("span", { className: "inline-block text-[10px] border border-cyan-400/30 text-cyan-400 px-1.5 py-0 ml-2 rounded", children: t('primaryWallet', 'Primary') }))] })), walletsExpanded && walletList.length > 1 && ((0, jsx_runtime_1.jsx)("div", { className: "mt-4 space-y-2 border-t border-neutral-700 pt-4", children: walletList.map((w) => ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between p-2 bg-neutral-800 rounded hover:bg-neutral-700 transition-colors", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-xs font-mono text-neutral-400", children: [w.wallet_address.slice(0, 4), "...", w.wallet_address.slice(-4)] }), w.is_primary && ((0, jsx_runtime_1.jsx)("span", { className: "inline-block text-[10px] border border-cyan-400/30 text-cyan-400 px-1.5 py-0 rounded", children: t('primaryWallet', 'Primary') }))] }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-mono text-white", children: "MCD" })] }, w.wallet_address))) }))] }))] }), (0, jsx_runtime_1.jsx)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg hover:border-cyan-400/50 transition-colors", children: (0, jsx_runtime_1.jsxs)("div", { className: "p-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 mb-1", children: [(0, jsx_runtime_1.jsx)(IconTrendingUp, { className: "w-5 h-5 text-white" }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium text-neutral-300 tracking-wider", children: t('mcdMinting', 'MCD Minting') })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-neutral-400 text-sm mb-4", children: t('mintMccWithMcd', 'Consume MCD to mint MCC Token') }), (0, jsx_runtime_1.jsxs)("button", { onClick: () => handleNav('/mcc/mining'), className: "w-full flex items-center justify-center gap-2 h-10 rounded-md bg-cyan-700 hover:bg-cyan-600 transition-all text-white text-sm font-medium cursor-pointer", children: [(0, jsx_runtime_1.jsx)(IconCoins, { className: "w-4 h-4" }), t('useMcdToMintMcc', 'Mint MCC with MCD')] }), (0, jsx_runtime_1.jsx)("div", { className: "mt-3 p-3 bg-neutral-800 rounded", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-start gap-2 text-xs text-cyan-400/70", children: [(0, jsx_runtime_1.jsx)(IconAlertTriangle, { className: "w-3.5 h-3.5 mt-0.5 shrink-0 text-cyan-400" }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-1", children: [(0, jsx_runtime_1.jsx)("p", { children: "MCD mining requires Miner level or above" }), (0, jsx_runtime_1.jsx)("p", { children: "Mining price = Oracle price x 2, MCD companion yield included" })] })] }) })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg hover:border-cyan-400/50 transition-colors", children: (0, jsx_runtime_1.jsxs)("div", { className: "p-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 mb-1", children: [(0, jsx_runtime_1.jsx)(IconGift, { className: "w-5 h-5 text-white" }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium text-neutral-300 tracking-wider", children: t('ecoServices', 'Ecosystem Services') })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-neutral-400 text-sm mb-4", children: t('ecoServicesDesc', 'Use MCD to access ecosystem project services') }), (0, jsx_runtime_1.jsx)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: ECOSYSTEM_SERVICES.map((p) => ((0, jsx_runtime_1.jsxs)("a", { href: p.url, target: "_blank", rel: "noopener noreferrer", className: "block p-4 bg-neutral-800 rounded-lg hover:bg-neutral-700 transition-colors group", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3 mb-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-10 h-10 rounded-lg bg-cyan-400/20 flex items-center justify-center", children: (0, jsx_runtime_1.jsx)(p.Icon, { className: "w-5 h-5 text-cyan-400" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1 min-w-0", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "font-medium text-white text-sm", children: p.name }), (0, jsx_runtime_1.jsx)(IconExternalLink, { className: "w-3 h-3 text-neutral-600 opacity-0 group-hover:opacity-100 transition-opacity" })] }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-neutral-500", children: p.tagline })] }), (0, jsx_runtime_1.jsx)("span", { className: `text-[10px] ${p.statusColor}`, children: p.status })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-400 leading-relaxed", children: p.desc })] }, p.name))) })] }) }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-800 border border-neutral-700 rounded-lg p-1 inline-flex", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setActiveTab('daily'), className: `flex items-center px-4 py-2 text-sm rounded-md transition-colors ${activeTab === 'daily'
|
|
143
139
|
? 'bg-neutral-700 text-white'
|
|
@@ -6,7 +6,6 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const auth_react_1 = require("@microcosmmoney/auth-react");
|
|
8
8
|
const i18n_context_1 = require("../../i18n-context");
|
|
9
|
-
/* ─── Inline SVG Icons (lucide style, 24x24 viewBox) ─── */
|
|
10
9
|
const IconRefresh = ({ className = '' }) => ((0, jsx_runtime_1.jsxs)("svg", { className: className, width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("path", { d: "M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }), (0, jsx_runtime_1.jsx)("path", { d: "M3 3v5h5" }), (0, jsx_runtime_1.jsx)("path", { d: "M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16" }), (0, jsx_runtime_1.jsx)("path", { d: "M16 16h5v5" })] }));
|
|
11
10
|
const IconZap = ({ className = '' }) => ((0, jsx_runtime_1.jsx)("svg", { className: className, width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: (0, jsx_runtime_1.jsx)("path", { d: "M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z" }) }));
|
|
12
11
|
const IconTrendingUp = () => ((0, jsx_runtime_1.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("polyline", { points: "22 7 13.5 15.5 8.5 10.5 2 17" }), (0, jsx_runtime_1.jsx)("polyline", { points: "16 7 22 7 22 13" })] }));
|
|
@@ -19,7 +18,6 @@ const IconChevronDown = ({ className = '' }) => ((0, jsx_runtime_1.jsx)("svg", {
|
|
|
19
18
|
const IconChevronUp = ({ className = '' }) => ((0, jsx_runtime_1.jsx)("svg", { className: className, width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: (0, jsx_runtime_1.jsx)("path", { d: "m18 15-6-6-6 6" }) }));
|
|
20
19
|
const IconCheckCircle = () => ((0, jsx_runtime_1.jsxs)("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("path", { d: "M22 11.08V12a10 10 0 1 1-5.93-9.14" }), (0, jsx_runtime_1.jsx)("path", { d: "m9 11 3 3L22 4" })] }));
|
|
21
20
|
const IconAlertCircle = () => ((0, jsx_runtime_1.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("circle", { cx: "12", cy: "12", r: "10" }), (0, jsx_runtime_1.jsx)("line", { x1: "12", x2: "12", y1: "8", y2: "12" }), (0, jsx_runtime_1.jsx)("line", { x1: "12", x2: "12.01", y1: "16", y2: "16" })] }));
|
|
22
|
-
/* ─── Helpers ─── */
|
|
23
21
|
const fmt = (n, d = 2) => {
|
|
24
22
|
if (n === undefined || n === null || isNaN(n))
|
|
25
23
|
return '0.00';
|
|
@@ -33,7 +31,6 @@ const formatDateTime = (iso) => {
|
|
|
33
31
|
return '-';
|
|
34
32
|
return new Date(iso).toLocaleString('en-US', { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' });
|
|
35
33
|
};
|
|
36
|
-
/* ─── Component ─── */
|
|
37
34
|
function MicrocosmMiningPage({ basePath = '', onNavigate }) {
|
|
38
35
|
const t = (0, i18n_context_1.useTranslations)('miningDash');
|
|
39
36
|
const { data: stats, loading: statsLoading } = (0, auth_react_1.useMiningStats)();
|
|
@@ -95,14 +92,11 @@ function MicrocosmMiningPage({ basePath = '', onNavigate }) {
|
|
|
95
92
|
refreshRecords();
|
|
96
93
|
}
|
|
97
94
|
catch (err) {
|
|
98
|
-
// Error handled by hook
|
|
99
95
|
}
|
|
100
96
|
}, [startMining, primaryAddress, refreshRecords]);
|
|
101
97
|
const isLoading = mccStatsLoading && !mccStats;
|
|
102
98
|
if (isLoading) {
|
|
103
99
|
return ((0, jsx_runtime_1.jsxs)("div", { className: "max-w-7xl mx-auto p-6 space-y-6", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h1", { className: "text-2xl font-bold text-white tracking-wider", children: t('title', 'Mining') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400 mt-1", children: t('subtitle', 'MCC minting via X402 protocol') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-center py-12", children: [(0, jsx_runtime_1.jsx)(Spinner, { className: "mr-3" }), (0, jsx_runtime_1.jsx)("span", { className: "text-neutral-400 text-sm", children: t('loadingMintData', 'Loading mining data...') })] })] }));
|
|
104
100
|
}
|
|
105
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "max-w-7xl mx-auto p-6 space-y-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h1", { className: "text-2xl font-bold text-white tracking-wider", children: t('title', 'Mining') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400 mt-1", children: t('subtitle', 'MCC minting via X402 protocol') })] }), (0, jsx_runtime_1.jsxs)("button", { onClick: () => refreshRecords(), className: "inline-flex items-center gap-2 px-3 py-1.5 text-sm border border-neutral-700 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-300 bg-transparent rounded-md transition-colors", children: [(0, jsx_runtime_1.jsx)(IconRefresh, { className: mccStatsLoading ? 'animate-spin' : '' }), t('refresh', 'Refresh')] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "backdrop-blur-md bg-white/5 border border-white/10 rounded-xl p-6 blockchain-card", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col md:flex-row md:items-center md:justify-between gap-6 mb-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "space-y-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-xs bg-white/20 text-white px-2 py-0.5 rounded font-medium", children: t('x402Protocol', 'X402 Protocol') }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs bg-cyan-400/20 text-cyan-400 px-2 py-0.5 rounded font-medium", children: "Solana Mainnet" })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-[#5EEAD4] tracking-widest uppercase mb-1", children: "MINING_PRICE" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-baseline gap-2", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-3xl font-bold text-cyan-400 font-mono", children: ["1 MCC = ", miningPrice > 0 ? fmt(miningPrice, 4) : '--', " USD"] }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs bg-cyan-400/20 text-cyan-400 px-1.5 py-0.5 rounded", children: "base \u00D7 4" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-start gap-4 text-xs text-neutral-500", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1.5", children: [(0, jsx_runtime_1.jsx)(IconShield, { className: "w-3.5 h-3.5 text-neutral-500 flex-shrink-0" }), (0, jsx_runtime_1.jsx)("span", { children: t('stablecoinDirectDesc', 'Stablecoin direct payment') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1.5", children: [(0, jsx_runtime_1.jsx)(IconZap, { className: "w-3.5 h-3.5 text-neutral-500 flex-shrink-0" }), (0, jsx_runtime_1.jsx)("span", { children: t('instantMintDesc', 'Instant on-chain minting') })] })] })] }), (0, jsx_runtime_1.jsxs)("button", { onClick: handleMine, disabled: miningLoading || !primaryAddress, className: "inline-flex items-center justify-center gap-2 px-8 py-4 text-base font-medium bg-cyan-700 hover:bg-cyan-600 text-white rounded-md whitespace-nowrap flex-shrink-0 disabled:opacity-50 transition-colors", children: [(0, jsx_runtime_1.jsx)(IconZap, { className: "w-5 h-5" }), miningLoading ? t('processing', 'Processing...') : t('startMinting', 'Start Minting')] })] }), (0, jsx_runtime_1.jsx)("div", { className: "border-t border-neutral-700 pt-4 mb-4", children: (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-[#5EEAD4] tracking-widest uppercase uppercase mb-3", children: "MINING STATISTICS" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-4 mb-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "bg-white/5 border border-white/10 rounded-lg p-3 blockchain-sub-card", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [(0, jsx_runtime_1.jsx)(IconTrendingUp, {}), (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-[#5EEAD4] tracking-widest uppercase", children: "CURRENT EPOCH" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-2xl font-bold text-cyan-400 font-mono", children: ["#", currentEpochNum] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-xs text-neutral-500 mt-1", children: [fmtCompact(epochYield), " MCC / epoch"] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-white/5 border border-white/10 rounded-lg p-3 blockchain-sub-card", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [(0, jsx_runtime_1.jsx)(IconCoins, {}), (0, jsx_runtime_1.jsxs)("span", { className: "text-xs text-[#5EEAD4] tracking-widest uppercase", children: ["HALVING PHASE ", displayPhase] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-2xl font-bold text-white font-mono", children: [halvingRatio, ":1"] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-xs text-neutral-500 mt-1 tabular-nums", children: [fmtCompact(totalMinted), " / ", fmtCompact(nextHalving), " MCC"] }), (0, jsx_runtime_1.jsx)("div", { className: "mt-2 h-1.5 bg-neutral-900 rounded-full overflow-hidden", children: (0, jsx_runtime_1.jsx)("div", { className: "h-full bg-cyan-400 rounded-full transition-all", style: { width: `${Math.min(halvingProgress, 100)}%` } }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-white/5 border border-white/10 rounded-lg p-3 blockchain-sub-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2 mb-2", children: (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-[#5EEAD4] tracking-widest uppercase", children: "mining_rate" }) }), (0, jsx_runtime_1.jsx)("div", { className: "text-2xl font-bold text-cyan-400 font-mono", children: miningRate > 0 ? `${miningRate}:1` : '--' }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500 mt-1", children: "USD to MCC ratio" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-white/5 border border-white/10 rounded-lg p-3 blockchain-sub-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2 mb-2", children: (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-[#5EEAD4] tracking-widest uppercase", children: "MINING VAULT" }) }), (0, jsx_runtime_1.jsx)("div", { className: "text-2xl font-bold text-white font-mono", children: fmtCompact(miningVaultMcc) }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500 mt-1", children: "MCC available to mine" })] })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "backdrop-blur-md bg-white/5 border border-white/10 rounded-xl p-6 blockchain-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-between mb-3", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)(IconWallet, { className: "text-white" }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm text-neutral-300 tracking-wider font-medium", children: t('onChainBalance', 'On-Chain Balance') }), walletList.length > 0 && ((0, jsx_runtime_1.jsxs)("span", { className: "inline-flex items-center gap-1 text-xs bg-white/20 text-white px-1.5 py-0.5 rounded", children: [(0, jsx_runtime_1.jsx)(IconCheckCircle, {}), walletList.length, " ", t('walletsCount', 'wallets')] }))] }) }), (0, jsx_runtime_1.jsx)("p", { className: "text-neutral-500 text-xs mb-4", children: t('onChainBalanceDesc', 'Real-time on-chain MCC balance across all bound wallets') }), walletsLoading && walletList.length === 0 ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-center py-8", children: [(0, jsx_runtime_1.jsx)(Spinner, { className: "mr-2" }), (0, jsx_runtime_1.jsx)("span", { className: "text-neutral-400 text-sm", children: t('loadingOnChainBalance', 'Loading on-chain balance...') })] })) : walletList.length === 0 ? (
|
|
106
|
-
/* Fallback: show aggregate balance from useMCC */
|
|
107
|
-
(0, jsx_runtime_1.jsxs)("div", { className: "bg-white/5 border border-white/10 rounded-lg p-3 blockchain-sub-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-[#5EEAD4] tracking-widest uppercase mb-1 font-mono", children: "total_balance" }), (0, jsx_runtime_1.jsxs)("div", { className: "text-2xl font-bold font-mono text-white", children: [fmt(mccBalance, 3), " MCC"] }), primaryAddress && ((0, jsx_runtime_1.jsxs)("div", { className: "text-neutral-500 text-xs mt-1 font-mono", children: [primaryAddress.slice(0, 8), "...", primaryAddress.slice(-4)] }))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4 mb-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "bg-white/5 border border-white/10 rounded-lg p-3 blockchain-sub-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-[#5EEAD4] tracking-widest uppercase mb-1 font-mono", children: "total_on_chain" }), (0, jsx_runtime_1.jsxs)("div", { className: "text-2xl font-bold font-mono text-white", children: [fmt(totalBalance), " MCC"] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-neutral-500 text-xs mt-1", children: [walletList.length, " ", t('walletsTotal', 'wallets total')] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-white/5 border border-white/10 rounded-lg p-3 blockchain-sub-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-[#5EEAD4] tracking-widest uppercase mb-1 font-mono", children: "primary_wallet" }), (0, jsx_runtime_1.jsx)("div", { className: "text-2xl font-bold font-mono text-white", children: primaryWallet ? fmt(primaryWallet.mcc_balance ?? 0) : '--' }), (0, jsx_runtime_1.jsx)("div", { className: "text-neutral-500 text-xs mt-1 truncate font-mono", children: primaryAddress ? `${primaryAddress.slice(0, 6)}...${primaryAddress.slice(-4)}` : t('noPrimaryWallet', 'No primary wallet') })] })] }), (0, jsx_runtime_1.jsxs)("button", { onClick: () => setWalletsExpanded(!walletsExpanded), className: "flex items-center gap-2 text-xs text-neutral-400 hover:text-cyan-400 transition-colors mb-2", children: [walletsExpanded ? (0, jsx_runtime_1.jsx)(IconChevronUp, {}) : (0, jsx_runtime_1.jsx)(IconChevronDown, {}), walletsExpanded ? t('collapse', 'Collapse') : t('expand', 'Expand'), " (", walletList.length, ")"] }), walletsExpanded && ((0, jsx_runtime_1.jsx)("div", { className: "space-y-2", children: walletList.map((w) => ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between px-3 p-2 bg-neutral-800 rounded hover:bg-neutral-700 text-xs transition-colors", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 min-w-0", children: [(0, jsx_runtime_1.jsx)(IconWallet, { className: "w-3 h-3 text-neutral-500 flex-shrink-0" }), (0, jsx_runtime_1.jsxs)("a", { href: `https://solscan.io/account/${w.wallet_address}`, target: "_blank", rel: "noopener noreferrer", className: "text-neutral-300 hover:text-white truncate font-mono", children: [w.wallet_address.slice(0, 8), "...", w.wallet_address.slice(-6)] }), w.is_primary && ((0, jsx_runtime_1.jsx)("span", { className: "px-1.5 py-0.5 bg-cyan-400/20 text-cyan-400 rounded text-[10px] flex-shrink-0", children: t('primaryLabel', 'Primary') }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 flex-shrink-0 ml-4", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-white font-mono font-medium", children: [fmt(w.mcc_balance ?? 0), " MCC"] }), (0, jsx_runtime_1.jsx)("a", { href: `https://solscan.io/account/${w.wallet_address}`, target: "_blank", rel: "noopener noreferrer", className: "text-neutral-600 hover:text-neutral-400", children: (0, jsx_runtime_1.jsx)(IconExternalLink, {}) })] })] }, w.wallet_address))) }))] }))] }), (0, jsx_runtime_1.jsx)("div", { className: "backdrop-blur-md bg-white/5 border border-white/10 rounded-xl blockchain-card", children: (0, jsx_runtime_1.jsxs)("div", { className: "p-6", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setShowRecords(!showRecords), className: "w-full flex items-center justify-between group", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)(IconHistory, {}), (0, jsx_runtime_1.jsx)("span", { className: "text-sm text-neutral-300 tracking-wider font-medium", children: t('mintRecords', 'Mining Records') }), recordsTotal > 0 && ((0, jsx_runtime_1.jsxs)("span", { className: "text-xs bg-neutral-500/20 text-neutral-300 px-1.5 py-0.5 rounded", children: [recordsTotal, " ", t('records', 'records')] }))] }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-1 text-xs text-neutral-400 group-hover:text-cyan-400 transition-colors", children: showRecords ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [t('collapse', 'Collapse'), " ", (0, jsx_runtime_1.jsx)(IconChevronUp, {})] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [t('expand', 'Expand'), " ", (0, jsx_runtime_1.jsx)(IconChevronDown, {})] })) })] }), showRecords && ((0, jsx_runtime_1.jsxs)("div", { className: "mt-4 pt-4 border-t border-neutral-700", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-neutral-500 text-xs mb-4", children: t('allRecordsDesc', 'All x402 non-custodial minting transaction records') }), recordsLoading ? ((0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-center py-8", children: (0, jsx_runtime_1.jsx)(Spinner, {}) })) : records.length > 0 ? ((0, jsx_runtime_1.jsx)("div", { className: "overflow-x-auto", children: (0, jsx_runtime_1.jsxs)("table", { className: "w-full text-sm", children: [(0, jsx_runtime_1.jsx)("thead", { children: (0, jsx_runtime_1.jsxs)("tr", { className: "text-neutral-400 text-xs border-b border-neutral-700", children: [(0, jsx_runtime_1.jsx)("th", { className: "text-left py-2 font-normal", children: t('colTime', 'Time') }), (0, jsx_runtime_1.jsx)("th", { className: "text-right py-2 font-normal", children: t('payment', 'Paid') }), (0, jsx_runtime_1.jsx)("th", { className: "text-right py-2 font-normal", children: t('earnedMcc', 'Minted') }), (0, jsx_runtime_1.jsx)("th", { className: "text-right py-2 font-normal", children: t('colStatus', 'Status') })] }) }), (0, jsx_runtime_1.jsx)("tbody", { children: records.map((r, i) => ((0, jsx_runtime_1.jsxs)("tr", { className: "border-b border-neutral-800 hover:bg-neutral-800/50", children: [(0, jsx_runtime_1.jsx)("td", { className: "py-3 text-neutral-300 font-mono text-xs", children: formatDateTime(r.mined_at ?? r.created_at ?? r.timestamp) }), (0, jsx_runtime_1.jsxs)("td", { className: "py-3 text-right text-white font-mono", children: [fmt(r.paid_amount ?? r.payment_amount ?? r.stablecoin_amount ?? 0), " ", r.stablecoin ?? r.payment_type ?? 'USDC'] }), (0, jsx_runtime_1.jsxs)("td", { className: "py-3 text-right text-cyan-400 font-mono", children: ["+", fmt(r.mcc_amount ?? r.minted ?? 0), " MCC"] }), (0, jsx_runtime_1.jsx)("td", { className: "py-3 text-right", children: (0, jsx_runtime_1.jsx)("a", { href: r.tx_signature ? `https://solscan.io/tx/${r.tx_signature}` : undefined, target: "_blank", rel: "noopener noreferrer", className: "text-xs px-1.5 py-0.5 rounded bg-white/20 text-white hover:bg-cyan-400/30 hover:text-cyan-200 transition-colors", children: t('completed', 'confirmed') }) })] }, r.tx_signature ?? `${recordsPage}-${i}`))) })] }) })) : ((0, jsx_runtime_1.jsx)("div", { className: "text-center py-8 text-neutral-500 text-sm", children: t('noMintRecords', 'No mining records yet') })), recordsTotal > RECORDS_PAGE_SIZE && ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between mt-4 pt-4 border-t border-neutral-800 text-xs", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-neutral-500 font-mono", children: ["Page ", recordsPage, " / ", recordsTotalPages, " \u00B7 ", recordsTotal, " total"] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-2", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setRecordsPage(p => Math.max(1, p - 1)), disabled: recordsPage <= 1 || recordsLoading, className: "px-3 py-1 border border-neutral-700 text-neutral-400 hover:bg-neutral-800 hover:text-white rounded disabled:opacity-40 disabled:cursor-not-allowed transition-colors", children: ["\u2039 ", t('prevPage', 'Prev')] }), (0, jsx_runtime_1.jsxs)("button", { onClick: () => setRecordsPage(p => Math.min(recordsTotalPages, p + 1)), disabled: recordsPage >= recordsTotalPages || recordsLoading, className: "px-3 py-1 border border-neutral-700 text-neutral-400 hover:bg-neutral-800 hover:text-white rounded disabled:opacity-40 disabled:cursor-not-allowed transition-colors", children: [t('nextPage', 'Next'), " \u203A"] })] })] }))] }))] }) }), s?.pool_mcc_bought != null && ((0, jsx_runtime_1.jsxs)("div", { className: "backdrop-blur-md bg-white/5 border border-white/10 rounded-xl p-6 blockchain-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-[#5EEAD4] tracking-widest uppercase uppercase mb-3", children: "POOL STATUS" }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-2 md:grid-cols-3 gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "bg-white/5 border border-white/10 rounded-lg p-3 blockchain-sub-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-[10px] text-[#5EEAD4] tracking-widest uppercase font-mono", children: "total_market_made" }), (0, jsx_runtime_1.jsx)("div", { className: "text-lg font-bold text-white font-mono", children: fmt(s.pool_mcc_bought ?? 0) }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500 mt-1", children: "MCC bought via CPMM" })] }), s?.pool_usdc_balance != null && ((0, jsx_runtime_1.jsxs)("div", { className: "bg-white/5 border border-white/10 rounded-lg p-3 blockchain-sub-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-[10px] text-[#5EEAD4] tracking-widest uppercase font-mono", children: "stablecoin_pool" }), (0, jsx_runtime_1.jsxs)("div", { className: "text-lg font-bold text-white font-mono", children: ["$", fmt((s.pool_usdc_balance ?? 0) + (s.pool_usdt_balance ?? 0))] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-xs text-neutral-500 mt-1", children: ["USDT ", fmt(s.pool_usdt_balance ?? 0), " / USDC ", fmt(s.pool_usdc_balance ?? 0)] })] })), s?.pool_tvl != null && ((0, jsx_runtime_1.jsxs)("div", { className: "bg-white/5 border border-white/10 rounded-lg p-3 blockchain-sub-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-[10px] text-[#5EEAD4] tracking-widest uppercase font-mono", children: "tvl" }), (0, jsx_runtime_1.jsxs)("div", { className: "text-lg font-bold text-white font-mono", children: ["$", fmt(s.pool_tvl ?? 0)] }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500 mt-1", children: "Total value locked" })] }))] })] })), stats && ((0, jsx_runtime_1.jsxs)("div", { className: "backdrop-blur-md bg-white/5 border border-white/10 rounded-xl p-6 blockchain-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-[#5EEAD4] tracking-widest uppercase uppercase mb-4 font-mono", children: "MY_MINING_STATS" }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-2 lg:grid-cols-4 gap-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "bg-white/5 border border-white/10 rounded-lg p-3 blockchain-sub-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-[10px] text-[#5EEAD4] tracking-widest uppercase font-mono", children: "total_mined" }), (0, jsx_runtime_1.jsxs)("div", { className: "text-lg font-bold text-white font-mono", children: [fmt(stats.total_mined ?? 0), " MCC"] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-white/5 border border-white/10 rounded-lg p-3 blockchain-sub-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-[10px] text-[#5EEAD4] tracking-widest uppercase font-mono", children: "total_paid" }), (0, jsx_runtime_1.jsxs)("div", { className: "text-lg font-bold text-white font-mono", children: [fmt(stats.total_paid ?? 0), " USDC"] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-white/5 border border-white/10 rounded-lg p-3 blockchain-sub-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-[10px] text-[#5EEAD4] tracking-widest uppercase font-mono", children: "mining_count" }), (0, jsx_runtime_1.jsx)("div", { className: "text-lg font-bold text-white font-mono", children: stats.mining_count ?? 0 })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-white/5 border border-white/10 rounded-lg p-3 blockchain-sub-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-[10px] text-[#5EEAD4] tracking-widest uppercase font-mono", children: "active_days" }), (0, jsx_runtime_1.jsx)("div", { className: "text-lg font-bold text-white font-mono", children: stats.active_days_30d ?? 0 })] })] })] })), (0, jsx_runtime_1.jsx)("div", { className: "backdrop-blur-md bg-white/5 border border-white/10 rounded-xl p-6 blockchain-card", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-start gap-2 text-neutral-400 text-sm", children: [(0, jsx_runtime_1.jsx)(IconShield, { className: "w-4 h-4 text-white mt-0.5 flex-shrink-0" }), (0, jsx_runtime_1.jsx)("span", { children: t('securityNote', 'All transactions are executed on-chain via X402 protocol. Your private keys never leave your wallet. Microcosm uses non-custodial minting with atomic on-chain verification.') })] }) })] }));
|
|
101
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "max-w-7xl mx-auto p-6 space-y-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h1", { className: "text-2xl font-bold text-white tracking-wider", children: t('title', 'Mining') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400 mt-1", children: t('subtitle', 'MCC minting via X402 protocol') })] }), (0, jsx_runtime_1.jsxs)("button", { onClick: () => refreshRecords(), className: "inline-flex items-center gap-2 px-3 py-1.5 text-sm border border-neutral-700 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-300 bg-transparent rounded-md transition-colors", children: [(0, jsx_runtime_1.jsx)(IconRefresh, { className: mccStatsLoading ? 'animate-spin' : '' }), t('refresh', 'Refresh')] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "backdrop-blur-md bg-white/5 border border-white/10 rounded-xl p-6 blockchain-card", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col md:flex-row md:items-center md:justify-between gap-6 mb-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "space-y-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-xs bg-white/20 text-white px-2 py-0.5 rounded font-medium", children: t('x402Protocol', 'X402 Protocol') }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs bg-cyan-400/20 text-cyan-400 px-2 py-0.5 rounded font-medium", children: "Solana Mainnet" })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-[#5EEAD4] tracking-widest uppercase mb-1", children: "MINING_PRICE" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-baseline gap-2", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-3xl font-bold text-cyan-400 font-mono", children: ["1 MCC = ", miningPrice > 0 ? fmt(miningPrice, 4) : '--', " USD"] }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs bg-cyan-400/20 text-cyan-400 px-1.5 py-0.5 rounded", children: "base \u00D7 4" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-start gap-4 text-xs text-neutral-500", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1.5", children: [(0, jsx_runtime_1.jsx)(IconShield, { className: "w-3.5 h-3.5 text-neutral-500 flex-shrink-0" }), (0, jsx_runtime_1.jsx)("span", { children: t('stablecoinDirectDesc', 'Stablecoin direct payment') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1.5", children: [(0, jsx_runtime_1.jsx)(IconZap, { className: "w-3.5 h-3.5 text-neutral-500 flex-shrink-0" }), (0, jsx_runtime_1.jsx)("span", { children: t('instantMintDesc', 'Instant on-chain minting') })] })] })] }), (0, jsx_runtime_1.jsxs)("button", { onClick: handleMine, disabled: miningLoading || !primaryAddress, className: "inline-flex items-center justify-center gap-2 px-8 py-4 text-base font-medium bg-cyan-700 hover:bg-cyan-600 text-white rounded-md whitespace-nowrap flex-shrink-0 disabled:opacity-50 transition-colors", children: [(0, jsx_runtime_1.jsx)(IconZap, { className: "w-5 h-5" }), miningLoading ? t('processing', 'Processing...') : t('startMinting', 'Start Minting')] })] }), (0, jsx_runtime_1.jsx)("div", { className: "border-t border-neutral-700 pt-4 mb-4", children: (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-[#5EEAD4] tracking-widest uppercase uppercase mb-3", children: "MINING STATISTICS" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-4 mb-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "bg-white/5 border border-white/10 rounded-lg p-3 blockchain-sub-card", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [(0, jsx_runtime_1.jsx)(IconTrendingUp, {}), (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-[#5EEAD4] tracking-widest uppercase", children: "CURRENT EPOCH" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-2xl font-bold text-cyan-400 font-mono", children: ["#", currentEpochNum] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-xs text-neutral-500 mt-1", children: [fmtCompact(epochYield), " MCC / epoch"] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-white/5 border border-white/10 rounded-lg p-3 blockchain-sub-card", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [(0, jsx_runtime_1.jsx)(IconCoins, {}), (0, jsx_runtime_1.jsxs)("span", { className: "text-xs text-[#5EEAD4] tracking-widest uppercase", children: ["HALVING PHASE ", displayPhase] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-2xl font-bold text-white font-mono", children: [halvingRatio, ":1"] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-xs text-neutral-500 mt-1 tabular-nums", children: [fmtCompact(totalMinted), " / ", fmtCompact(nextHalving), " MCC"] }), (0, jsx_runtime_1.jsx)("div", { className: "mt-2 h-1.5 bg-neutral-900 rounded-full overflow-hidden", children: (0, jsx_runtime_1.jsx)("div", { className: "h-full bg-cyan-400 rounded-full transition-all", style: { width: `${Math.min(halvingProgress, 100)}%` } }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-white/5 border border-white/10 rounded-lg p-3 blockchain-sub-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2 mb-2", children: (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-[#5EEAD4] tracking-widest uppercase", children: "mining_rate" }) }), (0, jsx_runtime_1.jsx)("div", { className: "text-2xl font-bold text-cyan-400 font-mono", children: miningRate > 0 ? `${miningRate}:1` : '--' }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500 mt-1", children: "USD to MCC ratio" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-white/5 border border-white/10 rounded-lg p-3 blockchain-sub-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2 mb-2", children: (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-[#5EEAD4] tracking-widest uppercase", children: "MINING VAULT" }) }), (0, jsx_runtime_1.jsx)("div", { className: "text-2xl font-bold text-white font-mono", children: fmtCompact(miningVaultMcc) }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500 mt-1", children: "MCC available to mine" })] })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "backdrop-blur-md bg-white/5 border border-white/10 rounded-xl p-6 blockchain-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-between mb-3", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)(IconWallet, { className: "text-white" }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm text-neutral-300 tracking-wider font-medium", children: t('onChainBalance', 'On-Chain Balance') }), walletList.length > 0 && ((0, jsx_runtime_1.jsxs)("span", { className: "inline-flex items-center gap-1 text-xs bg-white/20 text-white px-1.5 py-0.5 rounded", children: [(0, jsx_runtime_1.jsx)(IconCheckCircle, {}), walletList.length, " ", t('walletsCount', 'wallets')] }))] }) }), (0, jsx_runtime_1.jsx)("p", { className: "text-neutral-500 text-xs mb-4", children: t('onChainBalanceDesc', 'Real-time on-chain MCC balance across all bound wallets') }), walletsLoading && walletList.length === 0 ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-center py-8", children: [(0, jsx_runtime_1.jsx)(Spinner, { className: "mr-2" }), (0, jsx_runtime_1.jsx)("span", { className: "text-neutral-400 text-sm", children: t('loadingOnChainBalance', 'Loading on-chain balance...') })] })) : walletList.length === 0 ? ((0, jsx_runtime_1.jsxs)("div", { className: "bg-white/5 border border-white/10 rounded-lg p-3 blockchain-sub-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-[#5EEAD4] tracking-widest uppercase mb-1 font-mono", children: "total_balance" }), (0, jsx_runtime_1.jsxs)("div", { className: "text-2xl font-bold font-mono text-white", children: [fmt(mccBalance, 3), " MCC"] }), primaryAddress && ((0, jsx_runtime_1.jsxs)("div", { className: "text-neutral-500 text-xs mt-1 font-mono", children: [primaryAddress.slice(0, 8), "...", primaryAddress.slice(-4)] }))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4 mb-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "bg-white/5 border border-white/10 rounded-lg p-3 blockchain-sub-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-[#5EEAD4] tracking-widest uppercase mb-1 font-mono", children: "total_on_chain" }), (0, jsx_runtime_1.jsxs)("div", { className: "text-2xl font-bold font-mono text-white", children: [fmt(totalBalance), " MCC"] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-neutral-500 text-xs mt-1", children: [walletList.length, " ", t('walletsTotal', 'wallets total')] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-white/5 border border-white/10 rounded-lg p-3 blockchain-sub-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-[#5EEAD4] tracking-widest uppercase mb-1 font-mono", children: "primary_wallet" }), (0, jsx_runtime_1.jsx)("div", { className: "text-2xl font-bold font-mono text-white", children: primaryWallet ? fmt(primaryWallet.mcc_balance ?? 0) : '--' }), (0, jsx_runtime_1.jsx)("div", { className: "text-neutral-500 text-xs mt-1 truncate font-mono", children: primaryAddress ? `${primaryAddress.slice(0, 6)}...${primaryAddress.slice(-4)}` : t('noPrimaryWallet', 'No primary wallet') })] })] }), (0, jsx_runtime_1.jsxs)("button", { onClick: () => setWalletsExpanded(!walletsExpanded), className: "flex items-center gap-2 text-xs text-neutral-400 hover:text-cyan-400 transition-colors mb-2", children: [walletsExpanded ? (0, jsx_runtime_1.jsx)(IconChevronUp, {}) : (0, jsx_runtime_1.jsx)(IconChevronDown, {}), walletsExpanded ? t('collapse', 'Collapse') : t('expand', 'Expand'), " (", walletList.length, ")"] }), walletsExpanded && ((0, jsx_runtime_1.jsx)("div", { className: "space-y-2", children: walletList.map((w) => ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between px-3 p-2 bg-neutral-800 rounded hover:bg-neutral-700 text-xs transition-colors", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 min-w-0", children: [(0, jsx_runtime_1.jsx)(IconWallet, { className: "w-3 h-3 text-neutral-500 flex-shrink-0" }), (0, jsx_runtime_1.jsxs)("a", { href: `https://solscan.io/account/${w.wallet_address}`, target: "_blank", rel: "noopener noreferrer", className: "text-neutral-300 hover:text-white truncate font-mono", children: [w.wallet_address.slice(0, 8), "...", w.wallet_address.slice(-6)] }), w.is_primary && ((0, jsx_runtime_1.jsx)("span", { className: "px-1.5 py-0.5 bg-cyan-400/20 text-cyan-400 rounded text-[10px] flex-shrink-0", children: t('primaryLabel', 'Primary') }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 flex-shrink-0 ml-4", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-white font-mono font-medium", children: [fmt(w.mcc_balance ?? 0), " MCC"] }), (0, jsx_runtime_1.jsx)("a", { href: `https://solscan.io/account/${w.wallet_address}`, target: "_blank", rel: "noopener noreferrer", className: "text-neutral-600 hover:text-neutral-400", children: (0, jsx_runtime_1.jsx)(IconExternalLink, {}) })] })] }, w.wallet_address))) }))] }))] }), (0, jsx_runtime_1.jsx)("div", { className: "backdrop-blur-md bg-white/5 border border-white/10 rounded-xl blockchain-card", children: (0, jsx_runtime_1.jsxs)("div", { className: "p-6", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setShowRecords(!showRecords), className: "w-full flex items-center justify-between group", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)(IconHistory, {}), (0, jsx_runtime_1.jsx)("span", { className: "text-sm text-neutral-300 tracking-wider font-medium", children: t('mintRecords', 'Mining Records') }), recordsTotal > 0 && ((0, jsx_runtime_1.jsxs)("span", { className: "text-xs bg-neutral-500/20 text-neutral-300 px-1.5 py-0.5 rounded", children: [recordsTotal, " ", t('records', 'records')] }))] }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-1 text-xs text-neutral-400 group-hover:text-cyan-400 transition-colors", children: showRecords ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [t('collapse', 'Collapse'), " ", (0, jsx_runtime_1.jsx)(IconChevronUp, {})] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [t('expand', 'Expand'), " ", (0, jsx_runtime_1.jsx)(IconChevronDown, {})] })) })] }), showRecords && ((0, jsx_runtime_1.jsxs)("div", { className: "mt-4 pt-4 border-t border-neutral-700", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-neutral-500 text-xs mb-4", children: t('allRecordsDesc', 'All x402 non-custodial minting transaction records') }), recordsLoading ? ((0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-center py-8", children: (0, jsx_runtime_1.jsx)(Spinner, {}) })) : records.length > 0 ? ((0, jsx_runtime_1.jsx)("div", { className: "overflow-x-auto", children: (0, jsx_runtime_1.jsxs)("table", { className: "w-full text-sm", children: [(0, jsx_runtime_1.jsx)("thead", { children: (0, jsx_runtime_1.jsxs)("tr", { className: "text-neutral-400 text-xs border-b border-neutral-700", children: [(0, jsx_runtime_1.jsx)("th", { className: "text-left py-2 font-normal", children: t('colTime', 'Time') }), (0, jsx_runtime_1.jsx)("th", { className: "text-right py-2 font-normal", children: t('payment', 'Paid') }), (0, jsx_runtime_1.jsx)("th", { className: "text-right py-2 font-normal", children: t('earnedMcc', 'Minted') }), (0, jsx_runtime_1.jsx)("th", { className: "text-right py-2 font-normal", children: t('colStatus', 'Status') })] }) }), (0, jsx_runtime_1.jsx)("tbody", { children: records.map((r, i) => ((0, jsx_runtime_1.jsxs)("tr", { className: "border-b border-neutral-800 hover:bg-neutral-800/50", children: [(0, jsx_runtime_1.jsx)("td", { className: "py-3 text-neutral-300 font-mono text-xs", children: formatDateTime(r.mined_at ?? r.created_at ?? r.timestamp) }), (0, jsx_runtime_1.jsxs)("td", { className: "py-3 text-right text-white font-mono", children: [fmt(r.paid_amount ?? r.payment_amount ?? r.stablecoin_amount ?? 0), " ", r.stablecoin ?? r.payment_type ?? 'USDC'] }), (0, jsx_runtime_1.jsxs)("td", { className: "py-3 text-right text-cyan-400 font-mono", children: ["+", fmt(r.mcc_amount ?? r.minted ?? 0), " MCC"] }), (0, jsx_runtime_1.jsx)("td", { className: "py-3 text-right", children: (0, jsx_runtime_1.jsx)("a", { href: r.tx_signature ? `https://solscan.io/tx/${r.tx_signature}` : undefined, target: "_blank", rel: "noopener noreferrer", className: "text-xs px-1.5 py-0.5 rounded bg-white/20 text-white hover:bg-cyan-400/30 hover:text-cyan-200 transition-colors", children: t('completed', 'confirmed') }) })] }, r.tx_signature ?? `${recordsPage}-${i}`))) })] }) })) : ((0, jsx_runtime_1.jsx)("div", { className: "text-center py-8 text-neutral-500 text-sm", children: t('noMintRecords', 'No mining records yet') })), recordsTotal > RECORDS_PAGE_SIZE && ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between mt-4 pt-4 border-t border-neutral-800 text-xs", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-neutral-500 font-mono", children: ["Page ", recordsPage, " / ", recordsTotalPages, " \u00B7 ", recordsTotal, " total"] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-2", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setRecordsPage(p => Math.max(1, p - 1)), disabled: recordsPage <= 1 || recordsLoading, className: "px-3 py-1 border border-neutral-700 text-neutral-400 hover:bg-neutral-800 hover:text-white rounded disabled:opacity-40 disabled:cursor-not-allowed transition-colors", children: ["\u2039 ", t('prevPage', 'Prev')] }), (0, jsx_runtime_1.jsxs)("button", { onClick: () => setRecordsPage(p => Math.min(recordsTotalPages, p + 1)), disabled: recordsPage >= recordsTotalPages || recordsLoading, className: "px-3 py-1 border border-neutral-700 text-neutral-400 hover:bg-neutral-800 hover:text-white rounded disabled:opacity-40 disabled:cursor-not-allowed transition-colors", children: [t('nextPage', 'Next'), " \u203A"] })] })] }))] }))] }) }), s?.pool_mcc_bought != null && ((0, jsx_runtime_1.jsxs)("div", { className: "backdrop-blur-md bg-white/5 border border-white/10 rounded-xl p-6 blockchain-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-[#5EEAD4] tracking-widest uppercase uppercase mb-3", children: "POOL STATUS" }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-2 md:grid-cols-3 gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "bg-white/5 border border-white/10 rounded-lg p-3 blockchain-sub-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-[10px] text-[#5EEAD4] tracking-widest uppercase font-mono", children: "total_market_made" }), (0, jsx_runtime_1.jsx)("div", { className: "text-lg font-bold text-white font-mono", children: fmt(s.pool_mcc_bought ?? 0) }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500 mt-1", children: "MCC bought via CPMM" })] }), s?.pool_usdc_balance != null && ((0, jsx_runtime_1.jsxs)("div", { className: "bg-white/5 border border-white/10 rounded-lg p-3 blockchain-sub-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-[10px] text-[#5EEAD4] tracking-widest uppercase font-mono", children: "stablecoin_pool" }), (0, jsx_runtime_1.jsxs)("div", { className: "text-lg font-bold text-white font-mono", children: ["$", fmt((s.pool_usdc_balance ?? 0) + (s.pool_usdt_balance ?? 0))] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-xs text-neutral-500 mt-1", children: ["USDT ", fmt(s.pool_usdt_balance ?? 0), " / USDC ", fmt(s.pool_usdc_balance ?? 0)] })] })), s?.pool_tvl != null && ((0, jsx_runtime_1.jsxs)("div", { className: "bg-white/5 border border-white/10 rounded-lg p-3 blockchain-sub-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-[10px] text-[#5EEAD4] tracking-widest uppercase font-mono", children: "tvl" }), (0, jsx_runtime_1.jsxs)("div", { className: "text-lg font-bold text-white font-mono", children: ["$", fmt(s.pool_tvl ?? 0)] }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500 mt-1", children: "Total value locked" })] }))] })] })), stats && ((0, jsx_runtime_1.jsxs)("div", { className: "backdrop-blur-md bg-white/5 border border-white/10 rounded-xl p-6 blockchain-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-[#5EEAD4] tracking-widest uppercase uppercase mb-4 font-mono", children: "MY_MINING_STATS" }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-2 lg:grid-cols-4 gap-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "bg-white/5 border border-white/10 rounded-lg p-3 blockchain-sub-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-[10px] text-[#5EEAD4] tracking-widest uppercase font-mono", children: "total_mined" }), (0, jsx_runtime_1.jsxs)("div", { className: "text-lg font-bold text-white font-mono", children: [fmt(stats.total_mined ?? 0), " MCC"] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-white/5 border border-white/10 rounded-lg p-3 blockchain-sub-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-[10px] text-[#5EEAD4] tracking-widest uppercase font-mono", children: "total_paid" }), (0, jsx_runtime_1.jsxs)("div", { className: "text-lg font-bold text-white font-mono", children: [fmt(stats.total_paid ?? 0), " USDC"] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-white/5 border border-white/10 rounded-lg p-3 blockchain-sub-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-[10px] text-[#5EEAD4] tracking-widest uppercase font-mono", children: "mining_count" }), (0, jsx_runtime_1.jsx)("div", { className: "text-lg font-bold text-white font-mono", children: stats.mining_count ?? 0 })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-white/5 border border-white/10 rounded-lg p-3 blockchain-sub-card", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-[10px] text-[#5EEAD4] tracking-widest uppercase font-mono", children: "active_days" }), (0, jsx_runtime_1.jsx)("div", { className: "text-lg font-bold text-white font-mono", children: stats.active_days_30d ?? 0 })] })] })] })), (0, jsx_runtime_1.jsx)("div", { className: "backdrop-blur-md bg-white/5 border border-white/10 rounded-xl p-6 blockchain-card", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-start gap-2 text-neutral-400 text-sm", children: [(0, jsx_runtime_1.jsx)(IconShield, { className: "w-4 h-4 text-white mt-0.5 flex-shrink-0" }), (0, jsx_runtime_1.jsx)("span", { children: t('securityNote', 'All transactions are executed on-chain via X402 protocol. Your private keys never leave your wallet. Microcosm uses non-custodial minting with atomic on-chain verification.') })] }) })] }));
|
|
108
102
|
}
|
|
@@ -5,7 +5,6 @@ exports.MicrocosmOrganizationPage = MicrocosmOrganizationPage;
|
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const auth_react_1 = require("@microcosmmoney/auth-react");
|
|
8
|
-
/* ── Inline SVG Icons (lucide-style, 20x20 for section headers, 20x20 for stat icons) ── */
|
|
9
8
|
const IconUsers = ({ size = 20, className = '' }) => ((0, jsx_runtime_1.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: className, children: [(0, jsx_runtime_1.jsx)("path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }), (0, jsx_runtime_1.jsx)("circle", { cx: "9", cy: "7", r: "4" }), (0, jsx_runtime_1.jsx)("path", { d: "M22 21v-2a4 4 0 0 0-3-3.87" }), (0, jsx_runtime_1.jsx)("path", { d: "M16 3.13a4 4 0 0 1 0 7.75" })] }));
|
|
10
9
|
const IconNetwork = ({ size = 20, className = '' }) => ((0, jsx_runtime_1.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: className, children: [(0, jsx_runtime_1.jsx)("rect", { x: "16", y: "16", width: "6", height: "6", rx: "1" }), (0, jsx_runtime_1.jsx)("rect", { x: "2", y: "16", width: "6", height: "6", rx: "1" }), (0, jsx_runtime_1.jsx)("rect", { x: "9", y: "2", width: "6", height: "6", rx: "1" }), (0, jsx_runtime_1.jsx)("path", { d: "M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3" }), (0, jsx_runtime_1.jsx)("path", { d: "M12 12V8" })] }));
|
|
11
10
|
const IconBuilding = ({ size = 20, className = '' }) => ((0, jsx_runtime_1.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: className, children: [(0, jsx_runtime_1.jsx)("rect", { width: "16", height: "20", x: "4", y: "2", rx: "2", ry: "2" }), (0, jsx_runtime_1.jsx)("path", { d: "M9 22v-4h6v4" }), (0, jsx_runtime_1.jsx)("path", { d: "M8 6h.01" }), (0, jsx_runtime_1.jsx)("path", { d: "M16 6h.01" }), (0, jsx_runtime_1.jsx)("path", { d: "M12 6h.01" }), (0, jsx_runtime_1.jsx)("path", { d: "M12 10h.01" }), (0, jsx_runtime_1.jsx)("path", { d: "M12 14h.01" }), (0, jsx_runtime_1.jsx)("path", { d: "M16 10h.01" }), (0, jsx_runtime_1.jsx)("path", { d: "M16 14h.01" }), (0, jsx_runtime_1.jsx)("path", { d: "M8 10h.01" }), (0, jsx_runtime_1.jsx)("path", { d: "M8 14h.01" })] }));
|
|
@@ -18,7 +17,6 @@ const IconCompass = ({ size = 20, className = '' }) => ((0, jsx_runtime_1.jsxs)(
|
|
|
18
17
|
const IconUserCheck = ({ size = 20, className = '' }) => ((0, jsx_runtime_1.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: className, children: [(0, jsx_runtime_1.jsx)("path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }), (0, jsx_runtime_1.jsx)("circle", { cx: "9", cy: "7", r: "4" }), (0, jsx_runtime_1.jsx)("polyline", { points: "16 11 18 13 22 9" })] }));
|
|
19
18
|
const IconUserX = ({ size = 20, className = '' }) => ((0, jsx_runtime_1.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: className, children: [(0, jsx_runtime_1.jsx)("path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }), (0, jsx_runtime_1.jsx)("circle", { cx: "9", cy: "7", r: "4" }), (0, jsx_runtime_1.jsx)("line", { x1: "17", x2: "22", y1: "8", y2: "13" }), (0, jsx_runtime_1.jsx)("line", { x1: "22", x2: "17", y1: "8", y2: "13" })] }));
|
|
20
19
|
const IconLayers = ({ size = 20, className = '' }) => ((0, jsx_runtime_1.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: className, children: [(0, jsx_runtime_1.jsx)("path", { d: "m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z" }), (0, jsx_runtime_1.jsx)("path", { d: "m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65" }), (0, jsx_runtime_1.jsx)("path", { d: "m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65" })] }));
|
|
21
|
-
/* ── Helpers ── */
|
|
22
20
|
const fmt = (n) => n.toLocaleString('en-US');
|
|
23
21
|
const formatMCD = (value) => {
|
|
24
22
|
if (value >= 1000000)
|
|
@@ -30,7 +28,6 @@ const formatMCD = (value) => {
|
|
|
30
28
|
function Spinner() {
|
|
31
29
|
return (0, jsx_runtime_1.jsx)("span", { className: "inline-block w-5 h-5 border-2 border-cyan-400 border-t-transparent rounded-full animate-spin" });
|
|
32
30
|
}
|
|
33
|
-
/* ── Flip Card (matching portal dashboard standard) ── */
|
|
34
31
|
function FlipCard({ front, back }) {
|
|
35
32
|
const [isFlipped, setIsFlipped] = (0, react_1.useState)(false);
|
|
36
33
|
return ((0, jsx_runtime_1.jsx)("div", { style: { perspective: '1500px' }, children: (0, jsx_runtime_1.jsxs)("div", { className: "relative w-full cursor-pointer", onClick: () => setIsFlipped(!isFlipped), style: {
|
|
@@ -46,25 +43,21 @@ function FlipCard({ front, back }) {
|
|
|
46
43
|
display: isFlipped ? undefined : 'none',
|
|
47
44
|
}, children: (0, jsx_runtime_1.jsx)("div", { className: "relative z-10 p-6", children: back }) })] }) }));
|
|
48
45
|
}
|
|
49
|
-
/* ── Main Component ── */
|
|
50
46
|
function MicrocosmOrganizationPage({ basePath = '', onNavigate }) {
|
|
51
47
|
const { data: summary, loading: summaryLoading } = (0, auth_react_1.useOrganizationSummary)();
|
|
52
48
|
const { data: userStats, loading: userStatsLoading } = (0, auth_react_1.useDashboardUserStats)();
|
|
53
49
|
const loading = summaryLoading || userStatsLoading;
|
|
54
50
|
const org = summary;
|
|
55
51
|
const us = userStats;
|
|
56
|
-
// User stats from dashboard API
|
|
57
52
|
const totalUsers = us?.total_users ?? org?.total_members ?? 0;
|
|
58
53
|
const miners = us?.by_level?.miner ?? 0;
|
|
59
54
|
const commanders = us?.by_level?.commander ?? 0;
|
|
60
55
|
const pioneers = us?.by_level?.pioneer ?? 0;
|
|
61
56
|
const unassigned = Math.max(0, totalUsers - miners - commanders - pioneers);
|
|
62
|
-
// Territory counts from org summary
|
|
63
57
|
const stationCount = org?.total_stations ?? 0;
|
|
64
58
|
const matrixCount = org?.total_matrices ?? 0;
|
|
65
59
|
const sectorCount = org?.total_sectors ?? 0;
|
|
66
60
|
const systemCount = org?.total_systems ?? 0;
|
|
67
|
-
// Vault
|
|
68
61
|
const totalVaultMCD = org?.total_vault_mcd ?? 0;
|
|
69
62
|
if (loading) {
|
|
70
63
|
return ((0, jsx_runtime_1.jsxs)("div", { className: "max-w-7xl mx-auto p-6 space-y-6", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h1", { className: "text-2xl font-bold text-white tracking-wider", children: "Organization" }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400 mt-1", children: "Ecosystem structure & territory management" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-center py-20", children: [(0, jsx_runtime_1.jsx)(Spinner, {}), (0, jsx_runtime_1.jsx)("span", { className: "ml-3 text-neutral-400 text-sm", children: "Loading organization data..." })] })] }));
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export interface MicrocosmQueueStatusPageProps {
|
|
2
2
|
basePath?: string;
|
|
3
3
|
onNavigate?: (path: string) => void;
|
|
4
|
-
isAdmin?: boolean;
|
|
5
4
|
}
|
|
6
|
-
export declare function MicrocosmQueueStatusPage({
|
|
5
|
+
export declare function MicrocosmQueueStatusPage({}?: MicrocosmQueueStatusPageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -14,12 +14,10 @@ const LEVEL_LABELS = {
|
|
|
14
14
|
warden: 'Warden',
|
|
15
15
|
admiral: 'Admiral',
|
|
16
16
|
};
|
|
17
|
-
function MicrocosmQueueStatusPage({
|
|
17
|
+
function MicrocosmQueueStatusPage({} = {}) {
|
|
18
18
|
const t = (0, i18n_context_1.useTranslations)('queueStatus');
|
|
19
19
|
const api = (0, auth_react_1.useMicrocosmApi)();
|
|
20
20
|
const [userQueue, setUserQueue] = (0, react_1.useState)(null);
|
|
21
|
-
const [adminQueue, setAdminQueue] = (0, react_1.useState)(null);
|
|
22
|
-
const [expansion, setExpansion] = (0, react_1.useState)(null);
|
|
23
21
|
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
24
22
|
const [submitting, setSubmitting] = (0, react_1.useState)(false);
|
|
25
23
|
const [showJoinConfirm, setShowJoinConfirm] = (0, react_1.useState)(false);
|
|
@@ -38,45 +36,7 @@ function MicrocosmQueueStatusPage({ isAdmin = false } = {}) {
|
|
|
38
36
|
finally {
|
|
39
37
|
setLoading(false);
|
|
40
38
|
}
|
|
41
|
-
|
|
42
|
-
try {
|
|
43
|
-
const adminRes = await api.get('/territories/queue/admin');
|
|
44
|
-
setAdminQueue(adminRes?.data ?? adminRes);
|
|
45
|
-
}
|
|
46
|
-
catch { }
|
|
47
|
-
try {
|
|
48
|
-
const expRes = await api.get('/territories/expansion/check');
|
|
49
|
-
setExpansion(expRes?.data ?? expRes);
|
|
50
|
-
}
|
|
51
|
-
catch { }
|
|
52
|
-
}
|
|
53
|
-
}, [api, isAdmin]);
|
|
54
|
-
const handleProcessQueue = async () => {
|
|
55
|
-
setSubmitting(true);
|
|
56
|
-
try {
|
|
57
|
-
await api.post('/territories/queue/process', { batch_size: 50 });
|
|
58
|
-
await loadStatus();
|
|
59
|
-
}
|
|
60
|
-
catch (e) {
|
|
61
|
-
setError(e instanceof Error ? e.message : 'Failed to process queue');
|
|
62
|
-
}
|
|
63
|
-
finally {
|
|
64
|
-
setSubmitting(false);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
const handleTriggerExpansion = async () => {
|
|
68
|
-
setSubmitting(true);
|
|
69
|
-
try {
|
|
70
|
-
await api.post('/territories/expansion/trigger', {});
|
|
71
|
-
await loadStatus();
|
|
72
|
-
}
|
|
73
|
-
catch (e) {
|
|
74
|
-
setError(e instanceof Error ? e.message : 'Failed to trigger expansion');
|
|
75
|
-
}
|
|
76
|
-
finally {
|
|
77
|
-
setSubmitting(false);
|
|
78
|
-
}
|
|
79
|
-
};
|
|
39
|
+
}, [api]);
|
|
80
40
|
(0, react_1.useEffect)(() => { loadStatus(); }, [loadStatus]);
|
|
81
41
|
const handleJoin = async () => {
|
|
82
42
|
setSubmitting(true);
|
|
@@ -111,5 +71,5 @@ function MicrocosmQueueStatusPage({ isAdmin = false } = {}) {
|
|
|
111
71
|
}
|
|
112
72
|
const level = userQueue?.user_type?.toLowerCase() || 'miner';
|
|
113
73
|
const levelLabel = LEVEL_LABELS[level] || 'Miner';
|
|
114
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "max-w-7xl mx-auto px-3 py-4 space-y-3 xs:px-4 xs:space-y-4 sm:px-6 sm:py-6 sm:space-y-6 font-mono", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h1", { className: "text-lg sm:text-2xl font-bold text-white tracking-wider", children: t('title', 'Territory Position Management') }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs sm:text-sm text-neutral-400", children: t('subtitle', 'Onboarding, queuing, and territory assignment management') })] }), (0, jsx_runtime_1.jsx)("button", { onClick: loadStatus, className: "px-3 py-1.5 text-xs border border-neutral-700 text-neutral-400 hover:bg-neutral-800 hover:text-white rounded transition-colors", children: t('refresh', 'Refresh') })] }), error && ((0, jsx_runtime_1.jsx)("div", { className: "p-3 bg-red-900/20 border border-red-800 rounded text-sm text-red-300", children: error })), (0, jsx_runtime_1.jsxs)(terminal_1.TerminalCard, { children: [(0, jsx_runtime_1.jsx)("div", { className: "p-4 bg-neutral-800 rounded mb-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-[#5EEAD4] tracking-widest uppercase", children: t('currentLevel', 'CURRENT LEVEL') }), (0, jsx_runtime_1.jsx)("div", { className: "text-lg font-bold text-cyan-300", children: levelLabel })] }), (0, jsx_runtime_1.jsxs)("span", { className: "px-3 py-1 bg-cyan-900/30 text-cyan-300 rounded border border-cyan-700 text-xs", children: ["Lv.", Object.keys(LEVEL_LABELS).indexOf(level) + 3] })] }) }), userQueue?.is_onboarded ? ((0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-950 rounded-lg p-6 border border-neutral-700", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between mb-4", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-lg font-semibold text-white", children: t('onboarded', 'Onboarded') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('onboardedTo', 'You have been onboarded to {station}', { station: userQueue.station_name || userQueue.territory_id || '' }) })] }), (0, jsx_runtime_1.jsx)("span", { className: "px-2 py-1 bg-white/20 text-white rounded text-xs", children: t('active', 'Active') })] }), (0, jsx_runtime_1.jsx)("div", { className: "grid grid-cols-1 gap-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-900 rounded-lg p-4 text-center", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-xl font-bold text-white", children: userQueue.territory_id }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('territoryId', 'Territory ID') })] }) })] })) : userQueue?.in_queue ? ((0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-950 rounded-lg p-6 border border-neutral-800", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between mb-4", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-lg font-semibold text-white", children: t('inQueue', 'In Queue') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('waitingAssignment', 'You are waiting for territory assignment') })] }), userQueue.status && ((0, jsx_runtime_1.jsx)("span", { className: "px-2 py-1 bg-cyan-900/30 text-cyan-300 rounded text-xs", children: userQueue.status }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-4 mb-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-3xl font-bold text-white", children: userQueue.position || '-' }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-400", children: t('queuePosition', 'Queue Position') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-3xl font-bold text-white", children: userQueue.estimated_wait_minutes || '-' }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-400", children: t('estimatedWait', 'Est. Wait (min)') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-sm font-semibold text-white truncate", children: userQueue.preferred_territory_id || t('autoAssign', 'Auto Assign') }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-400", children: t('preferredTerritory', 'Preferred Territory') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-sm font-semibold text-white", children: userQueue.joined_at ? new Date(userQueue.joined_at).toLocaleString() : '-' }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-400", children: t('joinTime', 'Join Time') })] })] }), (0, jsx_runtime_1.jsx)("button", { onClick: () => setShowCancelConfirm(true), disabled: submitting, className: "w-full py-2 bg-neutral-800 hover:bg-neutral-700 text-white rounded transition-colors disabled:opacity-50", children: t('cancelQueue', 'Cancel Queue') })] })) : ((0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-950 rounded-lg p-6 border border-neutral-800", children: [(0, jsx_runtime_1.jsxs)("div", { className: "mb-4", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-lg font-semibold text-white", children: t('notOnboarded', 'Not Onboarded') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('notOnboardedDesc', 'You have not been onboarded to any territory') })] }), (0, jsx_runtime_1.jsx)("button", { onClick: () => setShowJoinConfirm(true), disabled: submitting, className: "w-full py-2 bg-white/20 hover:bg-neutral-800 text-white border border-neutral-700 rounded transition-colors disabled:opacity-50", children: t('joinQueue', 'Join Queue') })] }))] }), isAdmin && adminQueue && ((0, jsx_runtime_1.jsxs)(terminal_1.TerminalCard, { title: t('queueManagement', 'Queue Management (Admin)'), children: [(0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-4 mb-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-950 rounded p-4 text-center border border-neutral-800", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-3xl font-bold text-white", children: adminQueue.pending_count ?? 0 }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-400 mt-1", children: t('pending', 'Pending') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-950 rounded p-4 text-center border border-neutral-800", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-3xl font-bold text-white", children: adminQueue.processing_count ?? 0 }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-400 mt-1", children: t('processing', 'Processing') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-950 rounded p-4 text-center border border-neutral-800", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-3xl font-bold text-white", children: adminQueue.total_in_queue ?? 0 }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-400 mt-1", children: t('totalInQueue', 'Total in Queue') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-950 rounded p-4 text-center border border-neutral-800", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-sm text-white", children: adminQueue.oldest_pending ? new Date(adminQueue.oldest_pending).toLocaleString() : '-' }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-400 mt-1", children: t('oldestPending', 'Oldest Pending') })] })] }), (0, jsx_runtime_1.jsx)("button", { onClick: handleProcessQueue, disabled: submitting, className: "w-full px-4 py-2 bg-cyan-700 hover:bg-cyan-600 text-white rounded text-sm disabled:opacity-50", children: submitting ? t('submitting', 'Processing...') : t('processQueue', 'Process Queue') })] })), isAdmin && expansion && ((0, jsx_runtime_1.jsx)(terminal_1.TerminalCard, { title: t('territoryExpansion', 'Territory Expansion (Admin)'), children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between mb-3", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-sm text-neutral-300", children: [t('needsExpansion', 'Needs Expansion'), ": ", expansion.needs_expansion ? 'YES' : 'NO'] }), expansion.reason && ((0, jsx_runtime_1.jsxs)("div", { className: "text-xs text-neutral-500 mt-1", children: ["Reason: ", expansion.reason] }))] }), (0, jsx_runtime_1.jsx)("button", { onClick: handleTriggerExpansion, disabled: submitting || !expansion.needs_expansion, className: "px-4 py-2 bg-red-900/30 text-red-300 border border-red-800 hover:bg-red-900/50 rounded text-sm disabled:opacity-50", children: submitting ? t('submitting', 'Processing...') : t('triggerExpansion', 'Trigger Expansion Manually') })] }) })), showJoinConfirm && ((0, jsx_runtime_1.jsx)("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4", onClick: () => setShowJoinConfirm(false), children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg w-full max-w-md p-6 space-y-4", onClick: e => e.stopPropagation(), children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-white font-medium", children: t('joinDialogTitle', 'Join Territory') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('joinDialogDesc', 'Choose to join a specific territory or auto-assign') }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-2", children: [(0, jsx_runtime_1.jsx)("button", { onClick: () => setShowJoinConfirm(false), className: "flex-1 px-3 py-2 border border-neutral-700 text-neutral-400 hover:bg-neutral-800 rounded text-sm", children: t('cancel', 'Cancel') }), (0, jsx_runtime_1.jsx)("button", { onClick: handleJoin, disabled: submitting, className: "flex-1 px-3 py-2 bg-cyan-700 hover:bg-cyan-600 text-white rounded text-sm disabled:opacity-50", children: submitting ? t('submitting', 'Processing...') : t('immediateJoin', 'Join Immediately') })] })] }) })), showCancelConfirm && ((0, jsx_runtime_1.jsx)("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4", onClick: () => setShowCancelConfirm(false), children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg w-full max-w-md p-6 space-y-4", onClick: e => e.stopPropagation(), children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-white font-medium", children: t('cancelQueueTitle', 'Cancel Queue') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('cancelQueueDesc', 'Are you sure you want to cancel queuing? You will need to rejoin the queue to get onboarded.') }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-2", children: [(0, jsx_runtime_1.jsx)("button", { onClick: () => setShowCancelConfirm(false), className: "flex-1 px-3 py-2 border border-neutral-700 text-neutral-400 hover:bg-neutral-800 rounded text-sm", children: t('goBack', 'Go Back') }), (0, jsx_runtime_1.jsx)("button", { onClick: handleCancel, disabled: submitting, className: "flex-1 px-3 py-2 bg-red-700 hover:bg-red-600 text-white rounded text-sm disabled:opacity-50", children: submitting ? t('submitting', 'Processing...') : t('confirmCancel', 'Confirm Cancel') })] })] }) }))] }));
|
|
74
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "max-w-7xl mx-auto px-3 py-4 space-y-3 xs:px-4 xs:space-y-4 sm:px-6 sm:py-6 sm:space-y-6 font-mono", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h1", { className: "text-lg sm:text-2xl font-bold text-white tracking-wider", children: t('title', 'Territory Position Management') }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs sm:text-sm text-neutral-400", children: t('subtitle', 'Onboarding, queuing, and territory assignment management') })] }), (0, jsx_runtime_1.jsx)("button", { onClick: loadStatus, className: "px-3 py-1.5 text-xs border border-neutral-700 text-neutral-400 hover:bg-neutral-800 hover:text-white rounded transition-colors", children: t('refresh', 'Refresh') })] }), error && ((0, jsx_runtime_1.jsx)("div", { className: "p-3 bg-red-900/20 border border-red-800 rounded text-sm text-red-300", children: error })), (0, jsx_runtime_1.jsxs)(terminal_1.TerminalCard, { children: [(0, jsx_runtime_1.jsx)("div", { className: "p-4 bg-neutral-800 rounded mb-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-[#5EEAD4] tracking-widest uppercase", children: t('currentLevel', 'CURRENT LEVEL') }), (0, jsx_runtime_1.jsx)("div", { className: "text-lg font-bold text-cyan-300", children: levelLabel })] }), (0, jsx_runtime_1.jsxs)("span", { className: "px-3 py-1 bg-cyan-900/30 text-cyan-300 rounded border border-cyan-700 text-xs", children: ["Lv.", Object.keys(LEVEL_LABELS).indexOf(level) + 3] })] }) }), userQueue?.is_onboarded ? ((0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-950 rounded-lg p-6 border border-neutral-700", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between mb-4", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-lg font-semibold text-white", children: t('onboarded', 'Onboarded') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('onboardedTo', 'You have been onboarded to {station}', { station: userQueue.station_name || userQueue.territory_id || '' }) })] }), (0, jsx_runtime_1.jsx)("span", { className: "px-2 py-1 bg-white/20 text-white rounded text-xs", children: t('active', 'Active') })] }), (0, jsx_runtime_1.jsx)("div", { className: "grid grid-cols-1 gap-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-900 rounded-lg p-4 text-center", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-xl font-bold text-white", children: userQueue.territory_id }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('territoryId', 'Territory ID') })] }) })] })) : userQueue?.in_queue ? ((0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-950 rounded-lg p-6 border border-neutral-800", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between mb-4", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-lg font-semibold text-white", children: t('inQueue', 'In Queue') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('waitingAssignment', 'You are waiting for territory assignment') })] }), userQueue.status && ((0, jsx_runtime_1.jsx)("span", { className: "px-2 py-1 bg-cyan-900/30 text-cyan-300 rounded text-xs", children: userQueue.status }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-4 mb-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-3xl font-bold text-white", children: userQueue.position || '-' }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-400", children: t('queuePosition', 'Queue Position') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-3xl font-bold text-white", children: userQueue.estimated_wait_minutes || '-' }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-400", children: t('estimatedWait', 'Est. Wait (min)') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-sm font-semibold text-white truncate", children: userQueue.preferred_territory_id || t('autoAssign', 'Auto Assign') }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-400", children: t('preferredTerritory', 'Preferred Territory') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-sm font-semibold text-white", children: userQueue.joined_at ? new Date(userQueue.joined_at).toLocaleString() : '-' }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-400", children: t('joinTime', 'Join Time') })] })] }), (0, jsx_runtime_1.jsx)("button", { onClick: () => setShowCancelConfirm(true), disabled: submitting, className: "w-full py-2 bg-neutral-800 hover:bg-neutral-700 text-white rounded transition-colors disabled:opacity-50", children: t('cancelQueue', 'Cancel Queue') })] })) : ((0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-950 rounded-lg p-6 border border-neutral-800", children: [(0, jsx_runtime_1.jsxs)("div", { className: "mb-4", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-lg font-semibold text-white", children: t('notOnboarded', 'Not Onboarded') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('notOnboardedDesc', 'You have not been onboarded to any territory') })] }), (0, jsx_runtime_1.jsx)("button", { onClick: () => setShowJoinConfirm(true), disabled: submitting, className: "w-full py-2 bg-white/20 hover:bg-neutral-800 text-white border border-neutral-700 rounded transition-colors disabled:opacity-50", children: t('joinQueue', 'Join Queue') })] }))] }), showJoinConfirm && ((0, jsx_runtime_1.jsx)("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4", onClick: () => setShowJoinConfirm(false), children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg w-full max-w-md p-6 space-y-4", onClick: e => e.stopPropagation(), children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-white font-medium", children: t('joinDialogTitle', 'Join Territory') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('joinDialogDesc', 'Choose to join a specific territory or auto-assign') }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-2", children: [(0, jsx_runtime_1.jsx)("button", { onClick: () => setShowJoinConfirm(false), className: "flex-1 px-3 py-2 border border-neutral-700 text-neutral-400 hover:bg-neutral-800 rounded text-sm", children: t('cancel', 'Cancel') }), (0, jsx_runtime_1.jsx)("button", { onClick: handleJoin, disabled: submitting, className: "flex-1 px-3 py-2 bg-cyan-700 hover:bg-cyan-600 text-white rounded text-sm disabled:opacity-50", children: submitting ? t('submitting', 'Processing...') : t('immediateJoin', 'Join Immediately') })] })] }) })), showCancelConfirm && ((0, jsx_runtime_1.jsx)("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4", onClick: () => setShowCancelConfirm(false), children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg w-full max-w-md p-6 space-y-4", onClick: e => e.stopPropagation(), children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-white font-medium", children: t('cancelQueueTitle', 'Cancel Queue') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('cancelQueueDesc', 'Are you sure you want to cancel queuing? You will need to rejoin the queue to get onboarded.') }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-2", children: [(0, jsx_runtime_1.jsx)("button", { onClick: () => setShowCancelConfirm(false), className: "flex-1 px-3 py-2 border border-neutral-700 text-neutral-400 hover:bg-neutral-800 rounded text-sm", children: t('goBack', 'Go Back') }), (0, jsx_runtime_1.jsx)("button", { onClick: handleCancel, disabled: submitting, className: "flex-1 px-3 py-2 bg-red-700 hover:bg-red-600 text-white rounded text-sm disabled:opacity-50", children: submitting ? t('submitting', 'Processing...') : t('confirmCancel', 'Confirm Cancel') })] })] }) }))] }));
|
|
115
75
|
}
|
|
@@ -2,6 +2,5 @@ export interface MicrocosmStationListPageProps {
|
|
|
2
2
|
basePath?: string;
|
|
3
3
|
onNavigate?: (path: string) => void;
|
|
4
4
|
currentUid?: string;
|
|
5
|
-
isAdmin?: boolean;
|
|
6
5
|
}
|
|
7
|
-
export declare function MicrocosmStationListPage({ currentUid
|
|
6
|
+
export declare function MicrocosmStationListPage({ currentUid }?: MicrocosmStationListPageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -38,7 +38,7 @@ const cropToSquare = (file, size) => {
|
|
|
38
38
|
};
|
|
39
39
|
const UNIT_LABELS = { station: 'Station', matrix: 'Matrix', sector: 'Sector', system: 'System' };
|
|
40
40
|
const MAGISTRATE_TITLES = { station: 'Commander', matrix: 'Pioneer', sector: 'Warden', system: 'Admiral' };
|
|
41
|
-
function MicrocosmStationListPage({ currentUid
|
|
41
|
+
function MicrocosmStationListPage({ currentUid } = {}) {
|
|
42
42
|
const t = (0, i18n_context_1.useTranslations)('stationList');
|
|
43
43
|
const api = (0, auth_react_1.useMicrocosmApi)();
|
|
44
44
|
const { getAccessToken } = (0, auth_react_1.useMicrocosmContext)();
|
|
@@ -164,18 +164,6 @@ function MicrocosmStationListPage({ currentUid, isAdmin = false } = {}) {
|
|
|
164
164
|
setUploadingImage(false);
|
|
165
165
|
}
|
|
166
166
|
};
|
|
167
|
-
const handleImageReview = async (unitId, status) => {
|
|
168
|
-
try {
|
|
169
|
-
await api.put(`/territories/${unitId}/image/review`, { status });
|
|
170
|
-
await loadUnits();
|
|
171
|
-
if (editingUnit && editingUnit.unit_id === unitId) {
|
|
172
|
-
setEditingUnit({ ...editingUnit, image_status: status });
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
catch (e) {
|
|
176
|
-
setError(e instanceof Error ? e.message : 'Review failed');
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
167
|
const handleEdit = async () => {
|
|
180
168
|
if (!editingUnit || !editFormData.unit_name.trim())
|
|
181
169
|
return;
|
|
@@ -212,7 +200,7 @@ function MicrocosmStationListPage({ currentUid, isAdmin = false } = {}) {
|
|
|
212
200
|
? 'bg-green-900/30 text-green-400'
|
|
213
201
|
: editingUnit.image_status === 'rejected'
|
|
214
202
|
? 'bg-red-900/30 text-red-400'
|
|
215
|
-
: 'bg-yellow-900/30 text-yellow-400'}`, children: editingUnit.image_status }))] })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-500 mt-2", children: t('imageHint', 'Max 2MB. Auto-cropped to square (512×512). JPG/PNG/WebP.') })] }),
|
|
203
|
+
: 'bg-yellow-900/30 text-yellow-400'}`, children: editingUnit.image_status }))] })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-500 mt-2", children: t('imageHint', 'Max 2MB. Auto-cropped to square (512×512). JPG/PNG/WebP.') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-2 pt-2", children: [(0, jsx_runtime_1.jsx)("button", { onClick: () => {
|
|
216
204
|
setEditingUnit(null);
|
|
217
205
|
setImageFile(null);
|
|
218
206
|
setImagePreview(null);
|
|
@@ -7,9 +7,6 @@ const react_1 = require("react");
|
|
|
7
7
|
const i18n_context_1 = require("../../i18n-context");
|
|
8
8
|
const auth_react_1 = require("@microcosmmoney/auth-react");
|
|
9
9
|
const recharts_1 = require("recharts");
|
|
10
|
-
/* ------------------------------------------------------------------ */
|
|
11
|
-
/* Inline SVG Icons (24x24 viewBox, stroke 2, round caps) */
|
|
12
|
-
/* ------------------------------------------------------------------ */
|
|
13
10
|
const IconBuilding2 = ({ className = '' }) => ((0, jsx_runtime_1.jsxs)("svg", { className: className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("path", { d: "M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z" }), (0, jsx_runtime_1.jsx)("path", { d: "M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2" }), (0, jsx_runtime_1.jsx)("path", { d: "M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2" }), (0, jsx_runtime_1.jsx)("path", { d: "M10 6h4" }), (0, jsx_runtime_1.jsx)("path", { d: "M10 10h4" }), (0, jsx_runtime_1.jsx)("path", { d: "M10 14h4" }), (0, jsx_runtime_1.jsx)("path", { d: "M10 18h4" })] }));
|
|
14
11
|
const IconGrid3x3 = ({ className = '' }) => ((0, jsx_runtime_1.jsxs)("svg", { className: className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }), (0, jsx_runtime_1.jsx)("path", { d: "M3 9h18" }), (0, jsx_runtime_1.jsx)("path", { d: "M3 15h18" }), (0, jsx_runtime_1.jsx)("path", { d: "M9 3v18" }), (0, jsx_runtime_1.jsx)("path", { d: "M15 3v18" })] }));
|
|
15
12
|
const IconMap = ({ className = '' }) => ((0, jsx_runtime_1.jsxs)("svg", { className: className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("path", { d: "M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z" }), (0, jsx_runtime_1.jsx)("path", { d: "M15 5.764v15" }), (0, jsx_runtime_1.jsx)("path", { d: "M9 3.236v15" })] }));
|
|
@@ -24,9 +21,6 @@ const IconCalendar = ({ className = '' }) => ((0, jsx_runtime_1.jsxs)("svg", { c
|
|
|
24
21
|
const IconImage = ({ className = '' }) => ((0, jsx_runtime_1.jsxs)("svg", { className: className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2" }), (0, jsx_runtime_1.jsx)("circle", { cx: "9", cy: "9", r: "2" }), (0, jsx_runtime_1.jsx)("path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" })] }));
|
|
25
22
|
const IconSettings = ({ className = '' }) => ((0, jsx_runtime_1.jsxs)("svg", { className: className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("path", { d: "M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" }), (0, jsx_runtime_1.jsx)("circle", { cx: "12", cy: "12", r: "3" })] }));
|
|
26
23
|
const IconEdit3 = ({ className = '' }) => ((0, jsx_runtime_1.jsxs)("svg", { className: className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("path", { d: "M12 20h9" }), (0, jsx_runtime_1.jsx)("path", { d: "M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.855z" })] }));
|
|
27
|
-
/* ------------------------------------------------------------------ */
|
|
28
|
-
/* Helpers */
|
|
29
|
-
/* ------------------------------------------------------------------ */
|
|
30
24
|
const fmt = (n) => n.toLocaleString('en-US');
|
|
31
25
|
const TECH_BONUS = {
|
|
32
26
|
station: 10,
|
|
@@ -59,18 +53,12 @@ const UNIT_TYPE_LABELS = [
|
|
|
59
53
|
{ key: 'sector', label: 'Sector' },
|
|
60
54
|
{ key: 'system', label: 'System' },
|
|
61
55
|
];
|
|
62
|
-
/* ------------------------------------------------------------------ */
|
|
63
|
-
/* Spinner / Skeleton */
|
|
64
|
-
/* ------------------------------------------------------------------ */
|
|
65
56
|
function Spinner() {
|
|
66
57
|
return (0, jsx_runtime_1.jsx)("span", { className: "inline-block w-5 h-5 border-2 border-cyan-400 border-t-transparent rounded-full animate-spin" });
|
|
67
58
|
}
|
|
68
59
|
function Skeleton({ className = '' }) {
|
|
69
60
|
return (0, jsx_runtime_1.jsx)("div", { className: `animate-pulse bg-neutral-800 rounded-lg ${className}` });
|
|
70
61
|
}
|
|
71
|
-
/* ------------------------------------------------------------------ */
|
|
72
|
-
/* Territory Card (list view) */
|
|
73
|
-
/* ------------------------------------------------------------------ */
|
|
74
62
|
function TerritoryCard({ unit, onClick }) {
|
|
75
63
|
const unitType = (unit.unit_type || 'station');
|
|
76
64
|
const techBonus = TECH_BONUS[unitType.toLowerCase()] ?? 0;
|
|
@@ -79,19 +67,12 @@ function TerritoryCard({ unit, onClick }) {
|
|
|
79
67
|
: 0;
|
|
80
68
|
return ((0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg hover:border-cyan-400/50 cursor-pointer transition-colors overflow-hidden", onClick: onClick, children: [(0, jsx_runtime_1.jsx)("div", { className: "aspect-[4/3] bg-neutral-800 relative flex items-center justify-center overflow-hidden", children: unit.image_url ? ((0, jsx_runtime_1.jsx)("img", { src: unit.image_url, alt: unit.unit_name, className: "w-full h-full object-cover" })) : ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center justify-center text-neutral-600", children: [getTypeIcon(unitType, 'w-10 h-10'), (0, jsx_runtime_1.jsx)("span", { className: "text-xs mt-2 capitalize", children: unitType })] })) }), (0, jsx_runtime_1.jsxs)("div", { className: "p-3 space-y-2", style: { backgroundColor: '#0a0e14' }, children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 flex-wrap", children: [(0, jsx_runtime_1.jsx)("span", { className: `border px-1.5 py-0.5 rounded text-xs capitalize ${getTypeBadgeColor(unitType)}`, children: unitType }), (0, jsx_runtime_1.jsxs)("span", { className: "text-xs text-yellow-400", children: [(0, jsx_runtime_1.jsx)(IconZap, { className: "w-3 h-3 inline-block -mt-0.5 mr-0.5" }), "+", techBonus, "%"] }), unit.short_id && ((0, jsx_runtime_1.jsx)("span", { className: "text-xs text-neutral-500 font-mono ml-auto", children: unit.short_id }))] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-white font-bold text-sm truncate", children: unit.unit_name }), unit.full_path && ((0, jsx_runtime_1.jsx)("p", { className: "text-neutral-500 text-xs font-mono truncate", children: unit.full_path }))] }), unit.description && ((0, jsx_runtime_1.jsx)("p", { className: "text-neutral-400 text-xs line-clamp-2", children: unit.description })), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-4 pt-2 border-t border-neutral-700/50 text-xs text-neutral-400", children: [(0, jsx_runtime_1.jsxs)("span", { className: "flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)(IconUsers, { className: "w-3.5 h-3.5" }), fmt(unit.member_count ?? 0)] }), (0, jsx_runtime_1.jsxs)("span", { className: "flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)(IconVault, { className: "w-3.5 h-3.5" }), fmt(Math.round(unit.vault_balance ?? 0)), " MCD"] }), (0, jsx_runtime_1.jsxs)("span", { className: "ml-auto", children: [occupancy, "%"] })] })] })] }));
|
|
81
69
|
}
|
|
82
|
-
/* ------------------------------------------------------------------ */
|
|
83
|
-
/* Detail View */
|
|
84
|
-
/* ------------------------------------------------------------------ */
|
|
85
|
-
/* ------------------------------------------------------------------ */
|
|
86
|
-
/* Income Chart (recharts LineChart) */
|
|
87
|
-
/* ------------------------------------------------------------------ */
|
|
88
70
|
function IncomeChart({ territoryId }) {
|
|
89
71
|
const { data: raw, loading } = (0, auth_react_1.useTerritoryIncome)(territoryId, '30d');
|
|
90
72
|
const uid = (0, react_1.useId)();
|
|
91
73
|
const chartData = (0, react_1.useMemo)(() => {
|
|
92
74
|
if (!raw)
|
|
93
75
|
return [];
|
|
94
|
-
// API may return { labels, datasets: { income, cumulative } } or array
|
|
95
76
|
if (Array.isArray(raw))
|
|
96
77
|
return raw;
|
|
97
78
|
if (raw.labels && raw.datasets) {
|
|
@@ -109,9 +90,6 @@ function IncomeChart({ territoryId }) {
|
|
|
109
90
|
return null;
|
|
110
91
|
return ((0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg hover:border-cyan-400/50 transition-colors p-6", children: [(0, jsx_runtime_1.jsxs)("h3", { className: "text-white font-semibold mb-4 flex items-center gap-2 text-sm", children: [(0, jsx_runtime_1.jsx)(IconZap, { className: "w-4 h-4 text-cyan-400" }), "Income Trend (30D)"] }), (0, jsx_runtime_1.jsx)("div", { className: "h-64", children: (0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: "100%", children: (0, jsx_runtime_1.jsxs)(recharts_1.LineChart, { data: chartData, margin: { top: 5, right: 10, left: 0, bottom: 5 }, children: [(0, jsx_runtime_1.jsx)(recharts_1.CartesianGrid, { strokeDasharray: "3 3", stroke: "#404040" }), (0, jsx_runtime_1.jsx)(recharts_1.XAxis, { dataKey: "date", tick: { fill: '#a3a3a3', fontSize: 11 }, axisLine: { stroke: '#525252' } }), (0, jsx_runtime_1.jsx)(recharts_1.YAxis, { tick: { fill: '#a3a3a3', fontSize: 11 }, axisLine: { stroke: '#525252' } }), (0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { contentStyle: { backgroundColor: '#171717', border: '1px solid #404040', borderRadius: '8px' }, labelStyle: { color: '#a3a3a3' }, itemStyle: { color: '#fff' } }), (0, jsx_runtime_1.jsx)(recharts_1.Line, { type: "monotone", dataKey: "income", name: "Daily Income", stroke: "#22d3ee", strokeWidth: 2, dot: false, activeDot: { r: 4 } }), (0, jsx_runtime_1.jsx)(recharts_1.Line, { type: "monotone", dataKey: "cumulative", name: "Cumulative", stroke: "#ffffff", strokeWidth: 2, dot: false, activeDot: { r: 4 } })] }) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex justify-center gap-6 mt-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-3 h-0.5 bg-cyan-400" }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-neutral-400", children: "Daily Income" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-3 h-0.5 bg-white" }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-neutral-400", children: "Cumulative" })] })] })] }));
|
|
111
92
|
}
|
|
112
|
-
/* ------------------------------------------------------------------ */
|
|
113
|
-
/* Member Ranking */
|
|
114
|
-
/* ------------------------------------------------------------------ */
|
|
115
93
|
const RANK_BADGE = { 1: 'bg-cyan-400/20 text-cyan-400', 2: 'bg-white/20 text-white', 3: 'bg-cyan-300/20 text-cyan-300' };
|
|
116
94
|
function MemberRanking({ territoryId }) {
|
|
117
95
|
const { data: raw, loading } = (0, auth_react_1.useTerritoryRanking)(territoryId, { page_size: 10 });
|
|
@@ -130,9 +108,6 @@ function MemberRanking({ territoryId }) {
|
|
|
130
108
|
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3 p-2 bg-neutral-800 rounded hover:bg-neutral-700 transition-colors", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-8 text-center", children: rank <= 3 ? ((0, jsx_runtime_1.jsxs)("span", { className: `inline-block px-1.5 py-0.5 rounded text-xs font-bold ${RANK_BADGE[rank] ?? ''}`, children: ["#", rank] })) : ((0, jsx_runtime_1.jsxs)("span", { className: "text-neutral-500 font-mono text-sm", children: ["#", rank] })) }), (0, jsx_runtime_1.jsx)("div", { className: "w-8 h-8 rounded-full bg-neutral-700 flex items-center justify-center text-xs text-white font-bold flex-shrink-0", children: name.slice(0, 2).toUpperCase() }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1 min-w-0", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-white text-sm truncate", children: name }), m.email && (0, jsx_runtime_1.jsx)("div", { className: "text-neutral-500 text-xs truncate", children: m.email })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-right flex-shrink-0", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-white font-mono font-medium text-sm", children: (m.contribution ?? 0).toLocaleString() }), (0, jsx_runtime_1.jsx)("span", { className: "text-neutral-500 text-xs ml-1", children: "MCD" })] })] }, m.user_id || idx));
|
|
131
109
|
}) })] }));
|
|
132
110
|
}
|
|
133
|
-
/* ------------------------------------------------------------------ */
|
|
134
|
-
/* KPI History Chart (recharts AreaChart) */
|
|
135
|
-
/* ------------------------------------------------------------------ */
|
|
136
111
|
function KPIHistoryChart({ territoryId }) {
|
|
137
112
|
const { data: raw, loading } = (0, auth_react_1.useTerritoryKPI)(territoryId);
|
|
138
113
|
const uid = (0, react_1.useId)();
|
|
@@ -151,9 +126,6 @@ function KPIHistoryChart({ territoryId }) {
|
|
|
151
126
|
const gradVolume = `kpi-volume-${uid}`;
|
|
152
127
|
return ((0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg hover:border-cyan-400/50 transition-colors p-6", children: [(0, jsx_runtime_1.jsxs)("h3", { className: "text-white font-semibold mb-4 flex items-center gap-2 text-sm", children: [(0, jsx_runtime_1.jsx)(IconEdit3, { className: "w-4 h-4 text-cyan-400" }), "KPI History"] }), (0, jsx_runtime_1.jsx)("div", { className: "h-64", children: (0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: "100%", children: (0, jsx_runtime_1.jsxs)(recharts_1.AreaChart, { data: chartData, margin: { top: 5, right: 10, left: 0, bottom: 5 }, children: [(0, jsx_runtime_1.jsxs)("defs", { children: [(0, jsx_runtime_1.jsxs)("linearGradient", { id: gradMember, x1: "0", y1: "0", x2: "0", y2: "1", children: [(0, jsx_runtime_1.jsx)("stop", { offset: "5%", stopColor: "#22d3ee", stopOpacity: 0.3 }), (0, jsx_runtime_1.jsx)("stop", { offset: "95%", stopColor: "#22d3ee", stopOpacity: 0 })] }), (0, jsx_runtime_1.jsxs)("linearGradient", { id: gradVolume, x1: "0", y1: "0", x2: "0", y2: "1", children: [(0, jsx_runtime_1.jsx)("stop", { offset: "5%", stopColor: "#ffffff", stopOpacity: 0.3 }), (0, jsx_runtime_1.jsx)("stop", { offset: "95%", stopColor: "#ffffff", stopOpacity: 0 })] })] }), (0, jsx_runtime_1.jsx)(recharts_1.CartesianGrid, { strokeDasharray: "3 3", stroke: "#404040" }), (0, jsx_runtime_1.jsx)(recharts_1.XAxis, { dataKey: "date", tick: { fill: '#a3a3a3', fontSize: 11 }, axisLine: { stroke: '#525252' } }), (0, jsx_runtime_1.jsx)(recharts_1.YAxis, { domain: [0, 100], tick: { fill: '#a3a3a3', fontSize: 11 }, axisLine: { stroke: '#525252' }, tickFormatter: (v) => `${v}%` }), (0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { contentStyle: { backgroundColor: '#171717', border: '1px solid #404040', borderRadius: '8px' }, labelStyle: { color: '#a3a3a3' }, formatter: (value) => [`${Number(value).toFixed(1)}%`, ''] }), (0, jsx_runtime_1.jsx)(recharts_1.Area, { type: "monotone", dataKey: "member_progress", name: "Member Progress", stroke: "#22d3ee", strokeWidth: 2, fill: `url(#${gradMember})` }), (0, jsx_runtime_1.jsx)(recharts_1.Area, { type: "monotone", dataKey: "volume_progress", name: "Volume Progress", stroke: "#ffffff", strokeWidth: 2, fill: `url(#${gradVolume})` })] }) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex justify-center gap-6 mt-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-3 h-3 rounded-full bg-cyan-400" }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-neutral-400", children: "Member Progress" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-3 h-3 rounded-full bg-white" }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-neutral-400", children: "Volume Progress" })] })] })] }));
|
|
153
128
|
}
|
|
154
|
-
/* ------------------------------------------------------------------ */
|
|
155
|
-
/* Edit Territory Dialog */
|
|
156
|
-
/* ------------------------------------------------------------------ */
|
|
157
129
|
function EditTerritoryDialog({ territory, open, onClose, onSaved }) {
|
|
158
130
|
const { update, loading: updating } = (0, auth_react_1.useTerritoryUpdate)();
|
|
159
131
|
const [name, setName] = (0, react_1.useState)(territory.unit_name);
|
|
@@ -178,9 +150,6 @@ function EditTerritoryDialog({ territory, open, onClose, onSaved }) {
|
|
|
178
150
|
return null;
|
|
179
151
|
return ((0, jsx_runtime_1.jsxs)("div", { className: "fixed inset-0 z-50 flex items-center justify-center", onClick: onClose, children: [(0, jsx_runtime_1.jsx)("div", { className: "fixed inset-0 bg-black/60" }), (0, jsx_runtime_1.jsxs)("div", { className: "relative bg-neutral-900 border border-neutral-700 rounded-lg w-full max-w-lg p-6 space-y-4 mx-4", onClick: (e) => e.stopPropagation(), children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-white font-bold text-lg", children: "Edit Territory" }), (0, jsx_runtime_1.jsxs)("p", { className: "text-neutral-500 text-xs font-mono mt-1", children: [territory.unit_type, " \u00B7 ", territory.full_path || territory.short_id || territory.unit_id] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-3", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("label", { className: "text-xs text-neutral-400 tracking-wider block mb-1", children: "unit_name *" }), (0, jsx_runtime_1.jsx)("input", { value: name, onChange: (e) => setName(e.target.value), className: "w-full bg-neutral-800 border border-neutral-700 text-white px-3 py-2 rounded text-sm focus:border-cyan-400/50 outline-none" })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("label", { className: "text-xs text-neutral-400 tracking-wider block mb-1", children: "description" }), (0, jsx_runtime_1.jsx)("textarea", { value: desc, onChange: (e) => setDesc(e.target.value), rows: 3, className: "w-full bg-neutral-800 border border-neutral-700 text-white px-3 py-2 rounded text-sm focus:border-cyan-400/50 outline-none resize-none" })] })] }), error && (0, jsx_runtime_1.jsx)("p", { className: "text-red-400 text-xs", children: error }), (0, jsx_runtime_1.jsxs)("div", { className: "flex justify-end gap-3 pt-2", children: [(0, jsx_runtime_1.jsx)("button", { onClick: onClose, disabled: updating, className: "px-4 py-2 text-sm text-neutral-400 border border-neutral-700 rounded hover:bg-neutral-800 transition-colors", children: "Cancel" }), (0, jsx_runtime_1.jsx)("button", { onClick: handleSave, disabled: updating, className: "px-4 py-2 text-sm text-white bg-cyan-700 hover:bg-cyan-600 rounded transition-colors disabled:opacity-50", children: updating ? 'Saving...' : 'Save' })] })] })] }));
|
|
180
152
|
}
|
|
181
|
-
/* ------------------------------------------------------------------ */
|
|
182
|
-
/* Detail View (full) */
|
|
183
|
-
/* ------------------------------------------------------------------ */
|
|
184
153
|
function TerritoryDetailView({ territoryId, territory, onBack }) {
|
|
185
154
|
const { data: detailedStats, loading: statsLoading } = (0, auth_react_1.useTerritoryDetailedStats)(territoryId);
|
|
186
155
|
const { data: members, loading: membersLoading } = (0, auth_react_1.useTerritoryMembers)(territoryId);
|
|
@@ -195,9 +164,6 @@ function TerritoryDetailView({ territoryId, territory, onBack }) {
|
|
|
195
164
|
const occupancy = maxCapacity > 0 ? Math.round((memberCount / maxCapacity) * 100) : 0;
|
|
196
165
|
return ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: onBack, className: "flex items-center gap-2 text-sm text-neutral-400 hover:text-white transition-colors bg-transparent border-none cursor-pointer", children: [(0, jsx_runtime_1.jsx)(IconArrowLeft, { className: "w-4 h-4" }), "Back to list"] }), territory && ((0, jsx_runtime_1.jsxs)("button", { onClick: () => setEditOpen(true), className: "flex items-center gap-1.5 px-3 py-1.5 text-sm text-white bg-cyan-700 hover:bg-cyan-600 rounded transition-colors", children: [(0, jsx_runtime_1.jsx)(IconEdit3, { className: "w-3.5 h-3.5" }), "Edit"] }))] }), (0, jsx_runtime_1.jsx)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg hover:border-cyan-400/50 transition-colors p-6", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-start gap-5", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-28 h-28 bg-neutral-800 rounded-lg flex items-center justify-center overflow-hidden flex-shrink-0", children: territory?.image_url ? ((0, jsx_runtime_1.jsx)("img", { src: territory.image_url, alt: territory.unit_name, className: "w-full h-full object-cover" })) : ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center text-neutral-600", children: [getTypeIcon(unitType, 'w-10 h-10'), (0, jsx_runtime_1.jsx)("span", { className: "text-[10px] mt-1 capitalize", children: unitType })] })) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1 min-w-0", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3 flex-wrap", children: [(0, jsx_runtime_1.jsx)("h2", { className: "text-xl font-bold text-white", children: territory?.unit_name ?? territoryId }), territory?.short_id && ((0, jsx_runtime_1.jsx)("span", { className: "text-sm text-neutral-400 font-mono bg-neutral-800 px-2 py-0.5 rounded", children: territory.short_id })), (0, jsx_runtime_1.jsx)("span", { className: `border px-1.5 py-0.5 rounded text-xs capitalize ${getTypeBadgeColor(unitType)}`, children: unitType }), occupancy >= 90 ? ((0, jsx_runtime_1.jsx)("span", { className: "text-xs bg-white/20 text-white px-1.5 py-0.5 rounded", children: "Qualified" })) : ((0, jsx_runtime_1.jsx)("span", { className: "text-xs bg-neutral-500/20 text-neutral-400 px-1.5 py-0.5 rounded", children: "Not Qualified" }))] }), territory?.manager_display_name && ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1.5 mt-2 text-xs text-emerald-400", children: [(0, jsx_runtime_1.jsx)(IconShield, { className: "w-3.5 h-3.5" }), "Magistrate: ", territory.manager_display_name] })), territory?.full_path && ((0, jsx_runtime_1.jsx)("p", { className: "text-neutral-500 text-sm font-mono mt-1", children: territory.full_path })), territory?.description && ((0, jsx_runtime_1.jsx)("p", { className: "text-neutral-400 text-sm mt-2", children: territory.description }))] })] }) }), statsLoading ? ((0, jsx_runtime_1.jsx)("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-4", children: [...Array(4)].map((_, i) => (0, jsx_runtime_1.jsx)(Skeleton, { className: "h-24" }, i)) })) : ((0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg hover:border-cyan-400/50 transition-colors p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [(0, jsx_runtime_1.jsx)(IconUsers, { className: "w-5 h-5 text-neutral-400" }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-neutral-400", children: "Members" })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-2xl font-bold text-white font-mono", children: fmt(memberCount) }), (0, jsx_runtime_1.jsxs)("p", { className: "text-xs text-neutral-500 mt-1", children: ["Capacity: ", (0, jsx_runtime_1.jsx)("span", { className: "font-mono", children: fmt(maxCapacity) })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg hover:border-cyan-400/50 transition-colors p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [(0, jsx_runtime_1.jsx)(IconVault, { className: "w-5 h-5 text-neutral-400" }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-neutral-400", children: "Vault Balance" })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-2xl font-bold text-white font-mono", children: fmt(Math.round(vaultBalance)) }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-500 mt-1", children: "MCD" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg hover:border-cyan-400/50 transition-colors p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [(0, jsx_runtime_1.jsx)(IconZap, { className: "w-5 h-5 text-yellow-400" }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-neutral-400", children: "Tech Bonus" })] }), (0, jsx_runtime_1.jsxs)("p", { className: "text-2xl font-bold text-white font-mono", children: ["+", stats?.tech_bonus ?? techBonus, "%"] }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-500 mt-1", children: "Mining output bonus" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg hover:border-cyan-400/50 transition-colors p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [(0, jsx_runtime_1.jsx)(IconSettings, { className: "w-5 h-5 text-neutral-400" }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-neutral-400", children: "Occupancy" })] }), (0, jsx_runtime_1.jsxs)("p", { className: "text-2xl font-bold text-white font-mono", children: [occupancy, "%"] }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-500 mt-1", children: "Members / Capacity" })] })] })), (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg hover:border-cyan-400/50 transition-colors p-6", children: [(0, jsx_runtime_1.jsxs)("h3", { className: "text-white font-semibold mb-4 flex items-center gap-2 text-sm", children: [(0, jsx_runtime_1.jsx)(IconEdit3, { className: "w-4 h-4 text-cyan-400" }), "KPI Progress"] }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between text-sm mb-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-neutral-400", children: "Members" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-white font-mono", children: [fmt(memberCount), " / ", fmt(maxCapacity)] })] }), (0, jsx_runtime_1.jsx)("div", { className: "h-2 bg-neutral-800 rounded-full overflow-hidden", children: (0, jsx_runtime_1.jsx)("div", { className: "h-full bg-cyan-400 rounded-full transition-all duration-500", style: { width: `${Math.min(occupancy, 100)}%` } }) }), (0, jsx_runtime_1.jsxs)("p", { className: "text-xs text-neutral-500 font-mono mt-1", children: [occupancy, "% filled"] })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between text-sm mb-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-neutral-400", children: "Vault Balance" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-white font-mono", children: [fmt(Math.round(vaultBalance)), " MCD"] })] }), (0, jsx_runtime_1.jsx)("div", { className: "h-2 bg-neutral-800 rounded-full overflow-hidden", children: (0, jsx_runtime_1.jsx)("div", { className: "h-full bg-cyan-400 rounded-full transition-all duration-500", style: { width: `${Math.min(vaultBalance > 0 ? Math.max(Math.log10(vaultBalance) * 10, 5) : 0, 100)}%` } }) }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-500 mt-1", children: "Current vault funds" })] })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg hover:border-cyan-400/50 transition-colors p-6", children: [(0, jsx_runtime_1.jsxs)("h3", { className: "text-white font-semibold mb-3 flex items-center gap-2 text-sm", children: [(0, jsx_runtime_1.jsx)(IconSettings, { className: "w-4 h-4 text-cyan-400" }), "Distribution Mechanism"] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-800 rounded p-4", children: [(0, jsx_runtime_1.jsx)("h4", { className: "text-white font-semibold text-sm mb-2", children: "Auto Distribution by Contribution" }), (0, jsx_runtime_1.jsx)("p", { className: "text-neutral-400 text-sm", children: "Vault MCD is distributed daily at 1% of balance, allocated to miners proportional to their mining activity." }), (0, jsx_runtime_1.jsx)("p", { className: "text-neutral-500 text-xs mt-2", children: "Distribution ratio: Miners 100% (by contribution)" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-6", children: [(0, jsx_runtime_1.jsx)(IncomeChart, { territoryId: territoryId }), (0, jsx_runtime_1.jsx)(MemberRanking, { territoryId: territoryId })] }), (0, jsx_runtime_1.jsx)(KPIHistoryChart, { territoryId: territoryId }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg hover:border-cyan-400/50 transition-colors", children: [(0, jsx_runtime_1.jsx)("div", { className: "p-4 border-b border-neutral-700/50", children: (0, jsx_runtime_1.jsxs)("h3", { className: "text-white font-semibold flex items-center gap-2 text-sm", children: [(0, jsx_runtime_1.jsx)(IconUsers, { className: "w-4 h-4 text-cyan-400" }), "Members (", memberList.length, ")"] }) }), (0, jsx_runtime_1.jsx)("div", { className: "overflow-x-auto", children: membersLoading ? ((0, jsx_runtime_1.jsx)("div", { className: "p-6 flex justify-center", children: (0, jsx_runtime_1.jsx)(Spinner, {}) })) : memberList.length === 0 ? ((0, jsx_runtime_1.jsx)("div", { className: "p-8 text-center text-neutral-500 text-sm", children: "No members found" })) : ((0, jsx_runtime_1.jsxs)("table", { className: "w-full text-sm", children: [(0, jsx_runtime_1.jsx)("thead", { children: (0, jsx_runtime_1.jsxs)("tr", { className: "border-b border-neutral-700/50", children: [(0, jsx_runtime_1.jsx)("th", { className: "text-left px-4 py-3 text-neutral-400 font-medium", children: "Name / UID" }), (0, jsx_runtime_1.jsx)("th", { className: "text-left px-4 py-3 text-neutral-400 font-medium", children: "Role" }), (0, jsx_runtime_1.jsx)("th", { className: "text-left px-4 py-3 text-neutral-400 font-medium", children: "Email" }), (0, jsx_runtime_1.jsx)("th", { className: "text-left px-4 py-3 text-neutral-400 font-medium", children: "Joined" })] }) }), (0, jsx_runtime_1.jsx)("tbody", { children: memberList.map((member, idx) => ((0, jsx_runtime_1.jsxs)("tr", { className: "border-b border-neutral-800/50 hover:bg-neutral-800/30", children: [(0, jsx_runtime_1.jsxs)("td", { className: "px-4 py-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-white", children: member.display_name || member.username || 'Unknown' }), (0, jsx_runtime_1.jsx)("div", { className: "text-neutral-500 text-xs font-mono", children: member.uid ? `${member.uid.slice(0, 12)}...` : '-' })] }), (0, jsx_runtime_1.jsx)("td", { className: "px-4 py-3", children: (0, jsx_runtime_1.jsx)("span", { className: "text-neutral-300 capitalize", children: member.role || member.level_name || 'Miner' }) }), (0, jsx_runtime_1.jsx)("td", { className: "px-4 py-3", children: (0, jsx_runtime_1.jsx)("span", { className: "text-neutral-400 font-mono text-xs", children: member.email ? (member.email.length > 20 ? member.email.slice(0, 20) + '...' : member.email) : '-' }) }), (0, jsx_runtime_1.jsx)("td", { className: "px-4 py-3", children: (0, jsx_runtime_1.jsxs)("span", { className: "text-neutral-400 flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)(IconCalendar, { className: "w-3 h-3" }), member.joined_at || member.created_at ? new Date(member.joined_at || member.created_at).toLocaleDateString() : '-'] }) })] }, member.uid || idx))) })] })) })] }), territory && ((0, jsx_runtime_1.jsx)(EditTerritoryDialog, { territory: territory, open: editOpen, onClose: () => setEditOpen(false), onSaved: () => { } }))] }));
|
|
197
166
|
}
|
|
198
|
-
/* ------------------------------------------------------------------ */
|
|
199
|
-
/* Main Component */
|
|
200
|
-
/* ------------------------------------------------------------------ */
|
|
201
167
|
function MicrocosmTerritoryPage({ basePath = '', onNavigate }) {
|
|
202
168
|
const t = (0, i18n_context_1.useTranslations)('territoryDash');
|
|
203
169
|
const [selectedId, setSelectedId] = (0, react_1.useState)(null);
|
|
@@ -207,7 +173,6 @@ function MicrocosmTerritoryPage({ basePath = '', onNavigate }) {
|
|
|
207
173
|
const { data: territories, loading: territoriesLoading } = (0, auth_react_1.useTerritories)(filterType === 'all' ? {} : { unitType: filterType });
|
|
208
174
|
const territoryList = Array.isArray(territories) ? territories : [];
|
|
209
175
|
const sum = summary;
|
|
210
|
-
// Client-side search filtering
|
|
211
176
|
const filteredTerritories = (0, react_1.useMemo)(() => {
|
|
212
177
|
if (!searchTerm.trim())
|
|
213
178
|
return territoryList;
|
|
@@ -217,16 +182,12 @@ function MicrocosmTerritoryPage({ basePath = '', onNavigate }) {
|
|
|
217
182
|
(t.short_id && t.short_id.toLowerCase().includes(q)) ||
|
|
218
183
|
(t.full_path && t.full_path.toLowerCase().includes(q)));
|
|
219
184
|
}, [territoryList, searchTerm]);
|
|
220
|
-
// Find selected territory object for detail view
|
|
221
185
|
const selectedTerritory = selectedId
|
|
222
186
|
? territoryList.find((t) => t.unit_id === selectedId)
|
|
223
187
|
: undefined;
|
|
224
|
-
/* -- Detail view -- */
|
|
225
188
|
if (selectedId) {
|
|
226
189
|
return ((0, jsx_runtime_1.jsx)(TerritoryDetailView, { territoryId: selectedId, territory: selectedTerritory, onBack: () => setSelectedId(null) }));
|
|
227
190
|
}
|
|
228
|
-
/* -- List view -- */
|
|
229
|
-
// Loading skeleton for initial load
|
|
230
191
|
if (summaryLoading && territoriesLoading) {
|
|
231
192
|
return ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-6", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-between", children: (0, jsx_runtime_1.jsx)(Skeleton, { className: "h-8 w-56" }) }), (0, jsx_runtime_1.jsx)("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-4", children: [...Array(4)].map((_, i) => (0, jsx_runtime_1.jsx)(Skeleton, { className: "h-24" }, i)) }), (0, jsx_runtime_1.jsx)(Skeleton, { className: "h-14" }), (0, jsx_runtime_1.jsx)("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4", children: [...Array(6)].map((_, i) => (0, jsx_runtime_1.jsx)(Skeleton, { className: "h-72" }, i)) })] }));
|
|
232
193
|
}
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.MicrocosmVotingPage = MicrocosmVotingPage;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const i18n_context_1 = require("../../i18n-context");
|
|
7
|
-
/* ── Inline SVG Icons (lucide style: 24x24, stroke 2, round caps) ── */
|
|
8
7
|
const VoteIcon = ({ className }) => ((0, jsx_runtime_1.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: className, children: [(0, jsx_runtime_1.jsx)("path", { d: "M20 11.08V8l-6-6H6a2 2 0 0 0-2 2v16c0 1.1.9 2 2 2h6" }), (0, jsx_runtime_1.jsx)("path", { d: "M14 2v6h6" }), (0, jsx_runtime_1.jsx)("path", { d: "M18 21l-3-3 3-3" }), (0, jsx_runtime_1.jsx)("path", { d: "M22 18h-6" })] }));
|
|
9
8
|
const SwordsIcon = ({ className }) => ((0, jsx_runtime_1.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: className, children: [(0, jsx_runtime_1.jsx)("polyline", { points: "14.5 17.5 3 6 3 3 6 3 17.5 14.5" }), (0, jsx_runtime_1.jsx)("line", { x1: "13", y1: "19", x2: "19", y2: "13" }), (0, jsx_runtime_1.jsx)("line", { x1: "16", y1: "16", x2: "20", y2: "20" }), (0, jsx_runtime_1.jsx)("line", { x1: "19", y1: "21", x2: "21", y2: "19" }), (0, jsx_runtime_1.jsx)("polyline", { points: "14.5 6.5 18 3 21 3 21 6 17.5 9.5" }), (0, jsx_runtime_1.jsx)("line", { x1: "5", y1: "14", x2: "9", y2: "18" }), (0, jsx_runtime_1.jsx)("line", { x1: "7", y1: "17", x2: "4", y2: "20" }), (0, jsx_runtime_1.jsx)("line", { x1: "3", y1: "19", x2: "5", y2: "21" })] }));
|
|
10
9
|
const HeartIcon = ({ className }) => ((0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: className, children: (0, jsx_runtime_1.jsx)("path", { d: "M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z" }) }));
|
|
@@ -7,10 +7,8 @@ const react_1 = require("react");
|
|
|
7
7
|
const auth_react_1 = require("@microcosmmoney/auth-react");
|
|
8
8
|
const mainstream_tokens_1 = require("../../config/mainstream-tokens");
|
|
9
9
|
const i18n_context_1 = require("../../i18n-context");
|
|
10
|
-
/* ── helpers ── */
|
|
11
10
|
const fmt = (n, d = 2) => n.toLocaleString('en-US', { minimumFractionDigits: d, maximumFractionDigits: d });
|
|
12
11
|
const fmtUSD = (n) => '$' + n.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
13
|
-
/* ── inline SVG icons (16-20px, stroke-based, matching lucide style) ── */
|
|
14
12
|
function IconWallet({ className = '' }) {
|
|
15
13
|
return ((0, jsx_runtime_1.jsxs)("svg", { className: className, width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("path", { d: "M21 12V7H5a2 2 0 0 1 0-4h14v4" }), (0, jsx_runtime_1.jsx)("path", { d: "M3 5v14a2 2 0 0 0 2 2h16v-5" }), (0, jsx_runtime_1.jsx)("path", { d: "M18 12a1 1 0 0 0 0 4h4v-4Z" })] }));
|
|
16
14
|
}
|
|
@@ -44,11 +42,9 @@ function IconExternalLink({ className = '' }) {
|
|
|
44
42
|
function IconAlertTriangle({ className = '' }) {
|
|
45
43
|
return ((0, jsx_runtime_1.jsxs)("svg", { className: className, width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" }), (0, jsx_runtime_1.jsx)("path", { d: "M12 9v4" }), (0, jsx_runtime_1.jsx)("path", { d: "M12 17h.01" })] }));
|
|
46
44
|
}
|
|
47
|
-
/* ── spinner ── */
|
|
48
45
|
function Spinner({ size = 'w-5 h-5' }) {
|
|
49
46
|
return (0, jsx_runtime_1.jsx)("span", { className: `inline-block ${size} border-2 border-cyan-400 border-t-transparent rounded-full animate-spin` });
|
|
50
47
|
}
|
|
51
|
-
/* ── lock period card ── */
|
|
52
48
|
function LockPeriodCard({ lock, hideBalance }) {
|
|
53
49
|
const [progress, setProgress] = (0, react_1.useState)(0);
|
|
54
50
|
(0, react_1.useEffect)(() => {
|
|
@@ -56,7 +52,6 @@ function LockPeriodCard({ lock, hideBalance }) {
|
|
|
56
52
|
const end = new Date(lock.lock_end).getTime();
|
|
57
53
|
const now = Date.now();
|
|
58
54
|
const p = Math.min(100, Math.max(0, ((now - start) / (end - start)) * 100));
|
|
59
|
-
// Animate in
|
|
60
55
|
const timer = setTimeout(() => setProgress(p), 50);
|
|
61
56
|
return () => clearTimeout(timer);
|
|
62
57
|
}, [lock.lock_start, lock.lock_end]);
|
|
@@ -69,7 +64,6 @@ function LockPeriodCard({ lock, hideBalance }) {
|
|
|
69
64
|
const fmtDT = (d) => d.toLocaleString('en-US', { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', hour12: false });
|
|
70
65
|
return ((0, jsx_runtime_1.jsxs)("div", { className: "p-4 bg-neutral-800 rounded border border-neutral-700", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between items-start mb-3", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-xs text-neutral-400 tracking-wider mb-1", children: ["reason: ", lock.reason] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-2xl font-bold text-white font-mono", children: [hideBalance ? '****' : fmt(lock.amount), " MCC"] })] }), (0, jsx_runtime_1.jsx)("span", { className: "text-[10px] bg-cyan-400/20 text-cyan-400 border border-cyan-400/30 px-2 py-0.5 rounded font-mono", children: "LOCKED" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-1 text-sm", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between text-neutral-400", children: [(0, jsx_runtime_1.jsx)("span", { children: "lock_start" }), (0, jsx_runtime_1.jsx)("span", { className: "text-white", children: fmtDT(start) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between text-neutral-400", children: [(0, jsx_runtime_1.jsx)("span", { children: "lock_end" }), (0, jsx_runtime_1.jsx)("span", { className: "text-white", children: fmtDT(end) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between font-bold mt-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-neutral-400", children: "remaining" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-cyan-400", children: [daysLeft, "d ", hoursLeft, "h"] })] })] }), (0, jsx_runtime_1.jsx)("div", { className: "mt-3", children: (0, jsx_runtime_1.jsx)("div", { className: "bg-neutral-700 rounded-full h-2 overflow-hidden", children: (0, jsx_runtime_1.jsx)("div", { className: "bg-cyan-400 h-2 rounded-full transition-all duration-700", style: { width: `${progress}%` } }) }) })] }));
|
|
71
66
|
}
|
|
72
|
-
/* ── token icon ── */
|
|
73
67
|
function TokenIcon({ symbol, color, logoURI }) {
|
|
74
68
|
const [err, setErr] = (0, react_1.useState)(false);
|
|
75
69
|
if (logoURI && !err) {
|
|
@@ -110,7 +104,6 @@ function MicrocosmWalletPage({ basePath = '', onNavigate }) {
|
|
|
110
104
|
const lockedAmount = activeLocks.reduce((s, l) => s + (l.amount || 0), 0);
|
|
111
105
|
const mask = (v) => (hideBalance ? '****' : v);
|
|
112
106
|
const resolvePath = (p) => (basePath ? `${basePath.replace(/\/$/, '')}${p}` : p);
|
|
113
|
-
/* ── build on-chain asset holdings from multiBalance ── */
|
|
114
107
|
const TOKEN_PRICES = {
|
|
115
108
|
SOL: 0,
|
|
116
109
|
MCC: price,
|
|
@@ -197,7 +190,6 @@ function MicrocosmWalletPage({ basePath = '', onNavigate }) {
|
|
|
197
190
|
const rawHoldings = isAllTab
|
|
198
191
|
? (walletList.length > 1 ? buildHoldings() : buildAggregatedHoldings())
|
|
199
192
|
: buildHoldings(activeTab);
|
|
200
|
-
// Only show assets >= $1 (matching portal)
|
|
201
193
|
const activeHoldings = rawHoldings.filter((h) => h.usdValue >= 1);
|
|
202
194
|
const activeUsdValue = isAllTab
|
|
203
195
|
? rawHoldings.reduce((s, h) => s + h.usdValue, 0)
|
|
@@ -211,7 +203,7 @@ function MicrocosmWalletPage({ basePath = '', onNavigate }) {
|
|
|
211
203
|
setIsRefreshing(false);
|
|
212
204
|
}
|
|
213
205
|
};
|
|
214
|
-
const anyError = false;
|
|
206
|
+
const anyError = false;
|
|
215
207
|
return ((0, jsx_runtime_1.jsxs)("div", { className: "max-w-7xl mx-auto p-6 space-y-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h1", { className: "text-2xl font-bold text-white tracking-wider", children: t('title', 'Wallet') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400 mt-1", children: t('subtitle', 'On-chain assets & balances') })] }), (0, jsx_runtime_1.jsxs)("button", { className: "flex items-center gap-2 px-3 py-1.5 text-sm border border-neutral-700 rounded text-neutral-400 hover:bg-neutral-800 hover:text-neutral-300 bg-transparent transition-colors disabled:opacity-50", onClick: handleRefresh, disabled: isRefreshing || multiLoading, children: [(0, jsx_runtime_1.jsx)(IconRefresh, { className: isRefreshing || multiLoading ? 'animate-spin' : '' }), t('refresh', 'Refresh')] })] }), (0, jsx_runtime_1.jsx)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg hover:border-cyan-400/50 transition-colors", children: (0, jsx_runtime_1.jsxs)("div", { className: "p-6", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-between mb-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 text-neutral-400 text-sm", children: [(0, jsx_runtime_1.jsx)(IconWallet, { className: "text-cyan-400" }), (0, jsx_runtime_1.jsx)("span", { children: isAllTab ? t('totalAssetValue', 'Total Asset Value') : t('walletAssetValue', 'Wallet Asset Value') }), (0, jsx_runtime_1.jsx)("button", { onClick: () => setHideBalance(!hideBalance), className: "hover:text-white transition-colors", children: hideBalance ? (0, jsx_runtime_1.jsx)(IconEyeOff, {}) : (0, jsx_runtime_1.jsx)(IconEye, {}) })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-baseline gap-2 mb-1", children: (0, jsx_runtime_1.jsx)("span", { className: "text-3xl font-bold text-white font-mono", children: hideBalance ? '****' : (activeUsdValue > 0 ? fmtUSD(activeUsdValue) : '--') }) }), (0, jsx_runtime_1.jsx)("div", { className: "text-neutral-500 text-xs", children: hideBalance ? '****' : t('aggregatedDesc', 'Aggregated from on-chain token balances') })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg transition-colors", children: (0, jsx_runtime_1.jsxs)("div", { className: "p-6", children: [walletList.length > 1 && ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1 mb-4 overflow-x-auto pb-1", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setActiveTab('all'), className: `px-3 py-1.5 text-xs rounded whitespace-nowrap transition-colors ${activeTab === 'all'
|
|
216
208
|
? 'bg-cyan-700 text-white'
|
|
217
209
|
: 'bg-neutral-800 text-neutral-400 hover:text-white hover:bg-neutral-700'}`, children: [t('overview', 'Overview'), " (", walletList.length, " ", t('wallets', 'wallets'), ")"] }), walletList.map((w) => ((0, jsx_runtime_1.jsxs)("button", { onClick: () => setActiveTab(w.wallet_address), className: `px-3 py-1.5 text-xs rounded whitespace-nowrap transition-colors flex items-center gap-1 ${activeTab === w.wallet_address
|
package/dist/menu-config.d.ts
CHANGED
|
@@ -17,12 +17,10 @@ export interface MicrocosmMenuGroup {
|
|
|
17
17
|
icon: LucideIcon;
|
|
18
18
|
items: MicrocosmMenuItem[];
|
|
19
19
|
}
|
|
20
|
-
/** Resolve localized title — falls back to `item.title` (English) */
|
|
21
20
|
export declare function getMenuTitle(item: {
|
|
22
21
|
title: string;
|
|
23
22
|
titles?: Partial<Record<MenuLocale, string>>;
|
|
24
23
|
}, locale?: MenuLocale): string;
|
|
25
|
-
/** Resolve localized description */
|
|
26
24
|
export declare function getMenuDescription(item: MicrocosmMenuItem, locale?: MenuLocale): string;
|
|
27
25
|
export declare const dashboardMenu: MicrocosmMenuGroup;
|
|
28
26
|
export declare const blockchainMenu: MicrocosmMenuGroup;
|
package/dist/menu-config.js
CHANGED
|
@@ -6,13 +6,11 @@ exports.getMenuDescription = getMenuDescription;
|
|
|
6
6
|
exports.getAllMenuItems = getAllMenuItems;
|
|
7
7
|
exports.resolveMenuPath = resolveMenuPath;
|
|
8
8
|
const lucide_react_1 = require("lucide-react");
|
|
9
|
-
/** Resolve localized title — falls back to `item.title` (English) */
|
|
10
9
|
function getMenuTitle(item, locale) {
|
|
11
10
|
if (!locale || !item.titles)
|
|
12
11
|
return item.title;
|
|
13
12
|
return item.titles[locale] ?? item.title;
|
|
14
13
|
}
|
|
15
|
-
/** Resolve localized description */
|
|
16
14
|
function getMenuDescription(item, locale) {
|
|
17
15
|
if (!locale || !item.descriptions)
|
|
18
16
|
return item.description ?? '';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microcosmmoney/portal-react",
|
|
3
|
-
"version": "3.12.
|
|
3
|
+
"version": "3.12.2",
|
|
4
4
|
"description": "Microcosm Portal UI components for React/Next.js",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"lucide-react": ">=0.300.0"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@microcosmmoney/auth-core": "^2.3.
|
|
22
|
-
"@microcosmmoney/auth-react": "^2.6.
|
|
21
|
+
"@microcosmmoney/auth-core": "^2.3.3",
|
|
22
|
+
"@microcosmmoney/auth-react": "^2.6.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/react": "^18.0.0",
|