@microcosmmoney/portal-react 2.3.4 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/auction/auction-page.js +118 -25
- package/dist/components/dashboard/assets-summary.d.ts +2 -1
- package/dist/components/dashboard/assets-summary.js +11 -6
- package/dist/components/dashboard/dashboard-overview.d.ts +2 -1
- package/dist/components/dashboard/dashboard-overview.js +11 -2
- package/dist/components/dashboard/ecosystem-stats.d.ts +4 -1
- package/dist/components/dashboard/ecosystem-stats.js +12 -9
- package/dist/components/dashboard/lock-periods.d.ts +4 -1
- package/dist/components/dashboard/lock-periods.js +2 -2
- package/dist/components/dashboard/market-overview-bar.d.ts +4 -1
- package/dist/components/dashboard/market-overview-bar.js +9 -6
- package/dist/components/dashboard/mcc-token-stats.d.ts +4 -1
- package/dist/components/dashboard/mcc-token-stats.js +12 -9
- package/dist/components/dashboard/mcd-stats.d.ts +4 -1
- package/dist/components/dashboard/mcd-stats.js +14 -11
- package/dist/components/dashboard/mining-weight.d.ts +4 -1
- package/dist/components/dashboard/mining-weight.js +10 -7
- package/dist/components/dashboard/minting-stats.d.ts +4 -1
- package/dist/components/dashboard/minting-stats.js +6 -3
- package/dist/components/dashboard/my-mining.d.ts +2 -1
- package/dist/components/dashboard/my-mining.js +4 -2
- package/dist/components/dashboard/price-chart.d.ts +4 -1
- package/dist/components/dashboard/price-chart.js +6 -4
- package/dist/components/dashboard/quick-actions.d.ts +2 -1
- package/dist/components/dashboard/quick-actions.js +52 -37
- package/dist/components/fragment/fragment-page.js +53 -9
- package/dist/components/lending/lending-page.js +124 -22
- package/dist/components/mcd/mcd-page.js +139 -18
- package/dist/components/mining/mining-page.js +46 -15
- package/dist/components/organization/organization-page.js +90 -22
- package/dist/components/territory/territory-page.js +126 -29
- package/dist/components/voting/voting-page.js +10 -10
- package/dist/components/wallet/wallet-page.js +186 -23
- package/dist/index.d.ts +8 -0
- package/package.json +4 -4
|
@@ -6,35 +6,156 @@ exports.MicrocosmMCDPage = MicrocosmMCDPage;
|
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
7
|
const react_1 = require("react");
|
|
8
8
|
const auth_react_1 = require("@microcosmmoney/auth-react");
|
|
9
|
+
/* ── Inline SVG Icons (lucide style, 24x24 default) ── */
|
|
10
|
+
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
|
+
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
|
+
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" })] }));
|
|
13
|
+
const IconCalendar = ({ 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", { width: "18", height: "18", x: "3", y: "4", rx: "2", ry: "2" }), (0, jsx_runtime_1.jsx)("line", { x1: "16", x2: "16", y1: "2", y2: "6" }), (0, jsx_runtime_1.jsx)("line", { x1: "8", x2: "8", y1: "2", y2: "6" }), (0, jsx_runtime_1.jsx)("line", { x1: "3", x2: "21", y1: "10", y2: "10" })] }));
|
|
14
|
+
const IconHistory = ({ 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)("path", { d: "M3 12a9 9 0 1 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: "M12 7v5l4 2" })] }));
|
|
15
|
+
const IconHelpCircle = ({ 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)("circle", { cx: "12", cy: "12", r: "10" }), (0, jsx_runtime_1.jsx)("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }), (0, jsx_runtime_1.jsx)("path", { d: "M12 17h.01" })] }));
|
|
16
|
+
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: "M21 21v-5h-5" })] }));
|
|
17
|
+
const IconChevronDown = ({ className = '' }) => ((0, jsx_runtime_1.jsx)("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: "m6 9 6 6 6-6" }) }));
|
|
18
|
+
const IconChevronUp = ({ className = '' }) => ((0, jsx_runtime_1.jsx)("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: "m18 15-6-6-6 6" }) }));
|
|
19
|
+
const IconArrowRight = ({ 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: "M5 12h14" }), (0, jsx_runtime_1.jsx)("path", { d: "m12 5 7 7-7 7" })] }));
|
|
20
|
+
const IconTrendingUp = ({ 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)("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" })] }));
|
|
21
|
+
const IconMessageSquare = ({ 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: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }) }));
|
|
22
|
+
const IconEye = ({ 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)("path", { d: "M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z" }), (0, jsx_runtime_1.jsx)("circle", { cx: "12", cy: "12", r: "3" })] }));
|
|
23
|
+
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
|
+
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
|
+
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 ── */
|
|
9
27
|
const fmt = (n, d = 2) => n.toLocaleString('en-US', { minimumFractionDigits: d, maximumFractionDigits: d });
|
|
28
|
+
function formatDate(dateStr) {
|
|
29
|
+
if (!dateStr)
|
|
30
|
+
return '-';
|
|
31
|
+
const date = new Date(dateStr);
|
|
32
|
+
return date.toLocaleDateString('zh-CN', {
|
|
33
|
+
year: 'numeric',
|
|
34
|
+
month: '2-digit',
|
|
35
|
+
day: '2-digit',
|
|
36
|
+
hour: '2-digit',
|
|
37
|
+
minute: '2-digit',
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function formatShortDate(dateStr) {
|
|
41
|
+
if (!dateStr)
|
|
42
|
+
return '-';
|
|
43
|
+
const date = new Date(dateStr);
|
|
44
|
+
return date.toLocaleDateString('zh-CN', {
|
|
45
|
+
month: '2-digit',
|
|
46
|
+
day: '2-digit',
|
|
47
|
+
});
|
|
48
|
+
}
|
|
10
49
|
function Spinner() {
|
|
11
|
-
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" });
|
|
50
|
+
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" }));
|
|
12
51
|
}
|
|
52
|
+
const TX_TYPE_COLORS = {
|
|
53
|
+
daily_distribution: 'bg-white/20 text-white border-transparent',
|
|
54
|
+
spend: 'bg-red-500/20 text-red-500 border-transparent',
|
|
55
|
+
transfer: 'bg-cyan-400/20 text-cyan-400 border-transparent',
|
|
56
|
+
refund: 'bg-cyan-400/20 text-cyan-400 border-transparent',
|
|
57
|
+
};
|
|
58
|
+
const TX_TYPE_NAMES = {
|
|
59
|
+
daily_distribution: 'Daily',
|
|
60
|
+
spend: 'Spend',
|
|
61
|
+
transfer: 'Transfer',
|
|
62
|
+
refund: 'Refund',
|
|
63
|
+
};
|
|
64
|
+
/* ── Ecosystem services ── */
|
|
65
|
+
const ECOSYSTEM_SERVICES = [
|
|
66
|
+
{
|
|
67
|
+
name: 'Double Helix',
|
|
68
|
+
tagline: 'Quantitative Trading',
|
|
69
|
+
desc: 'Automated quantitative trading strategies powered by AI',
|
|
70
|
+
Icon: IconTrendingUp,
|
|
71
|
+
status: 'Running',
|
|
72
|
+
statusColor: 'text-white',
|
|
73
|
+
url: 'https://doublehelix.money',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: 'xSocial',
|
|
77
|
+
tagline: 'AI Social Platform',
|
|
78
|
+
desc: 'AI-powered social media management and engagement',
|
|
79
|
+
Icon: IconMessageSquare,
|
|
80
|
+
status: 'Beta',
|
|
81
|
+
statusColor: 'text-cyan-400',
|
|
82
|
+
url: 'https://xsocial.cc',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'Event Horizon',
|
|
86
|
+
tagline: 'Prediction Market',
|
|
87
|
+
desc: 'Decentralized prediction markets for real-world events',
|
|
88
|
+
Icon: IconEye,
|
|
89
|
+
status: 'Dev',
|
|
90
|
+
statusColor: 'text-neutral-400',
|
|
91
|
+
url: 'https://poly.microcosm.money',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: 'GreenSwans',
|
|
95
|
+
tagline: 'Crypto Guardian',
|
|
96
|
+
desc: 'Climate finance and green asset management',
|
|
97
|
+
Icon: IconShield,
|
|
98
|
+
status: 'Dev',
|
|
99
|
+
statusColor: 'text-neutral-400',
|
|
100
|
+
url: 'https://greenswans.cc',
|
|
101
|
+
},
|
|
102
|
+
];
|
|
13
103
|
function MicrocosmMCDPage({ basePath = '', onNavigate }) {
|
|
14
|
-
const { balance: mcdData, loading: mcdLoading } = (0, auth_react_1.useMCD)(60000);
|
|
15
|
-
const { data: rewards, loading: rewardsLoading } = (0, auth_react_1.useMCDRewards)();
|
|
16
|
-
const { data: transactions, loading: txLoading } = (0, auth_react_1.useMCDTransactions)();
|
|
17
|
-
const { data: wallets } = (0, auth_react_1.useWallets)();
|
|
104
|
+
const { balance: mcdData, loading: mcdLoading, refresh: refreshMCD } = (0, auth_react_1.useMCD)(60000);
|
|
105
|
+
const { data: rewards, loading: rewardsLoading, refresh: refreshRewards } = (0, auth_react_1.useMCDRewards)();
|
|
106
|
+
const { data: transactions, loading: txLoading, refresh: refreshTx } = (0, auth_react_1.useMCDTransactions)();
|
|
107
|
+
const { data: wallets, loading: walletsLoading } = (0, auth_react_1.useWallets)();
|
|
18
108
|
const [activeTab, setActiveTab] = (0, react_1.useState)('daily');
|
|
19
109
|
const [showHelp, setShowHelp] = (0, react_1.useState)(false);
|
|
110
|
+
const [walletsExpanded, setWalletsExpanded] = (0, react_1.useState)(false);
|
|
111
|
+
const [refreshing, setRefreshing] = (0, react_1.useState)(false);
|
|
20
112
|
const mcdAmount = parseFloat(mcdData?.available_balance ?? '0');
|
|
21
113
|
const mcdReceived = parseFloat(mcdData?.total_balance ?? '0');
|
|
22
114
|
const mcdSpent = parseFloat(mcdData?.frozen_balance ?? '0');
|
|
23
115
|
const rewardsList = Array.isArray(rewards) ? rewards : [];
|
|
24
116
|
const txList = Array.isArray(transactions) ? transactions : [];
|
|
117
|
+
const walletList = Array.isArray(wallets) ? wallets : [];
|
|
25
118
|
const resolvePath = (p) => basePath ? `${basePath.replace(/\/$/, '')}${p}` : p;
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
119
|
+
const handleRefresh = async () => {
|
|
120
|
+
setRefreshing(true);
|
|
121
|
+
try {
|
|
122
|
+
await Promise.all([
|
|
123
|
+
refreshMCD(),
|
|
124
|
+
refreshRewards?.(),
|
|
125
|
+
refreshTx?.(),
|
|
126
|
+
]);
|
|
127
|
+
}
|
|
128
|
+
finally {
|
|
129
|
+
setRefreshing(false);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
const handleNav = (path) => {
|
|
133
|
+
onNavigate?.(resolvePath(path));
|
|
30
134
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
135
|
+
/* ── Not logged in ── */
|
|
136
|
+
if (!mcdData && !mcdLoading) {
|
|
137
|
+
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: "Please log in to view your MCD balance" })] }) }));
|
|
138
|
+
}
|
|
139
|
+
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: "MCD Points" }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400 mt-1", children: "Microcosm Dollar \u2014 ecosystem points" })] }), (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" }), "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" }), "Help"] }), (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' : ''}` }), "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: "How MCD Works" }), (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" }), "How to Get 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" }), "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" }), "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: "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, " wallets", walletsExpanded
|
|
140
|
+
? (0, jsx_runtime_1.jsx)(IconChevronUp, { className: "w-4 h-4 ml-1" })
|
|
141
|
+
: (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: "Loading on-chain balances..." })] })) : 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: "No wallet connected" }), (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" }), "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: "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: "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: "MCD Minting" })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-neutral-400 text-sm mb-4", children: "Use MCD to mint MCC tokens" }), (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" }), "Use MCD to Mint MCC"] }), (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: "Ecosystem Services" })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-neutral-400 text-sm mb-4", children: "Spend MCD across the Microcosm ecosystem" }), (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'
|
|
142
|
+
? 'bg-neutral-700 text-white'
|
|
143
|
+
: 'text-neutral-400 hover:text-neutral-300'}`, children: [(0, jsx_runtime_1.jsx)(IconGift, { className: "w-4 h-4 mr-2" }), "Daily Distribution"] }), (0, jsx_runtime_1.jsxs)("button", { onClick: () => setActiveTab('history'), className: `flex items-center px-4 py-2 text-sm rounded-md transition-colors ${activeTab === 'history'
|
|
144
|
+
? 'bg-neutral-700 text-white'
|
|
145
|
+
: 'text-neutral-400 hover:text-neutral-300'}`, children: [(0, jsx_runtime_1.jsx)(IconHistory, { className: "w-4 h-4 mr-2" }), "Transaction History"] })] }), activeTab === 'daily' && ((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)(IconCalendar, { className: "w-5 h-5 text-white" }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium text-neutral-300 tracking-wider", children: "Daily Distribution Records" })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-neutral-400 text-sm mb-4", children: "Daily MCD distribution from territory vaults" }), rewardsLoading ? ((0, jsx_runtime_1.jsx)("div", { className: "space-y-3", children: [...Array(5)].map((_, i) => ((0, jsx_runtime_1.jsx)("div", { className: "h-12 w-full bg-neutral-800 rounded animate-pulse" }, i))) })) : rewardsList.length === 0 ? ((0, jsx_runtime_1.jsxs)("div", { className: "text-center py-12 text-neutral-500", children: [(0, jsx_runtime_1.jsx)(IconGift, { className: "w-12 h-12 mx-auto mb-4 opacity-50" }), (0, jsx_runtime_1.jsx)("p", { children: "No distribution records" }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm mt-2", children: "Distribution happens daily at 00:15 UTC for eligible miners" })] })) : ((0, jsx_runtime_1.jsx)("div", { className: "overflow-x-auto", children: (0, jsx_runtime_1.jsxs)("table", { className: "w-full", children: [(0, jsx_runtime_1.jsx)("thead", { children: (0, jsx_runtime_1.jsxs)("tr", { className: "border-b border-neutral-800", children: [(0, jsx_runtime_1.jsx)("th", { className: "text-left py-3 text-xs font-medium text-neutral-400 tracking-wider", children: "Date" }), (0, jsx_runtime_1.jsx)("th", { className: "text-left py-3 text-xs font-medium text-neutral-400 tracking-wider", children: "Territory" }), (0, jsx_runtime_1.jsx)("th", { className: "text-right py-3 text-xs font-medium text-neutral-400 tracking-wider", children: "Amount" }), (0, jsx_runtime_1.jsx)("th", { className: "text-right py-3 text-xs font-medium text-neutral-400 tracking-wider", children: "Claimed" })] }) }), (0, jsx_runtime_1.jsx)("tbody", { children: rewardsList.map((reward) => ((0, jsx_runtime_1.jsxs)("tr", { className: "border-b border-neutral-800 hover:bg-neutral-800 transition-colors", children: [(0, jsx_runtime_1.jsx)("td", { className: "py-3 font-medium text-white font-mono", children: formatShortDate(reward.reward_date) }), (0, jsx_runtime_1.jsx)("td", { className: "py-3 text-neutral-400 font-mono", children: reward.territory_id || '-' }), (0, jsx_runtime_1.jsx)("td", { className: "py-3 text-right", children: (0, jsx_runtime_1.jsxs)("span", { className: "text-cyan-400 font-medium font-mono", children: ["+", (reward.mcd_received ?? 0).toLocaleString(), " MCD"] }) }), (0, jsx_runtime_1.jsx)("td", { className: "py-3 text-right text-neutral-500 text-sm font-mono", children: formatDate(reward.created_at) })] }, reward.id))) })] }) }))] }) })), activeTab === 'history' && ((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)(IconHistory, { className: "w-5 h-5 text-white" }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium text-neutral-300 tracking-wider", children: "Transaction History" })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-neutral-400 text-sm mb-4", children: "All MCD transactions for your account" }), txLoading ? ((0, jsx_runtime_1.jsx)("div", { className: "space-y-3", children: [...Array(5)].map((_, i) => ((0, jsx_runtime_1.jsx)("div", { className: "h-12 w-full bg-neutral-800 rounded animate-pulse" }, i))) })) : txList.length === 0 ? ((0, jsx_runtime_1.jsxs)("div", { className: "text-center py-12 text-neutral-500", children: [(0, jsx_runtime_1.jsx)(IconHistory, { className: "w-12 h-12 mx-auto mb-4 opacity-50" }), (0, jsx_runtime_1.jsx)("p", { children: "No transactions yet" })] })) : ((0, jsx_runtime_1.jsx)("div", { className: "overflow-x-auto", children: (0, jsx_runtime_1.jsxs)("table", { className: "w-full", children: [(0, jsx_runtime_1.jsx)("thead", { children: (0, jsx_runtime_1.jsxs)("tr", { className: "border-b border-neutral-800", children: [(0, jsx_runtime_1.jsx)("th", { className: "text-left py-3 text-xs font-medium text-neutral-400 tracking-wider", children: "Time" }), (0, jsx_runtime_1.jsx)("th", { className: "text-left py-3 text-xs font-medium text-neutral-400 tracking-wider", children: "Type" }), (0, jsx_runtime_1.jsx)("th", { className: "text-left py-3 text-xs font-medium text-neutral-400 tracking-wider", children: "From" }), (0, jsx_runtime_1.jsx)("th", { className: "text-left py-3 text-xs font-medium text-neutral-400 tracking-wider w-8" }), (0, jsx_runtime_1.jsx)("th", { className: "text-left py-3 text-xs font-medium text-neutral-400 tracking-wider", children: "To" }), (0, jsx_runtime_1.jsx)("th", { className: "text-right py-3 text-xs font-medium text-neutral-400 tracking-wider", children: "Amount" })] }) }), (0, jsx_runtime_1.jsx)("tbody", { children: txList.map((tx) => {
|
|
146
|
+
const isIncome = tx.tx_type === 'daily_distribution' || tx.tx_type === 'refund' || tx.tx_type === 'transfer';
|
|
147
|
+
return ((0, jsx_runtime_1.jsxs)("tr", { className: "border-b border-neutral-800 hover:bg-neutral-800 transition-colors", children: [(0, jsx_runtime_1.jsx)("td", { className: "py-3 text-neutral-500 text-sm font-mono", children: formatDate(tx.created_at) }), (0, jsx_runtime_1.jsx)("td", { className: "py-3", children: (0, jsx_runtime_1.jsx)("span", { className: `inline-block text-xs px-2 py-0.5 rounded border ${TX_TYPE_COLORS[tx.tx_type] || 'bg-neutral-500/20 text-neutral-300 border-transparent'}`, children: TX_TYPE_NAMES[tx.tx_type] || tx.tx_type }) }), (0, jsx_runtime_1.jsx)("td", { className: "py-3 text-neutral-400 text-sm font-mono", children: tx.from_account_type === 'station_vault'
|
|
148
|
+
? `Station #${tx.from_account_id}`
|
|
149
|
+
: tx.from_account_type === 'system'
|
|
150
|
+
? 'System'
|
|
151
|
+
: tx.from_account_id
|
|
152
|
+
? `User ${tx.from_account_id.slice(0, 8)}...`
|
|
153
|
+
: '-' }), (0, jsx_runtime_1.jsx)("td", { className: "py-3 text-neutral-600", children: (0, jsx_runtime_1.jsx)(IconArrowRight, { className: "w-4 h-4" }) }), (0, jsx_runtime_1.jsx)("td", { className: "py-3 text-neutral-400 text-sm font-mono", children: tx.to_account_type === 'station_vault'
|
|
154
|
+
? `Station #${tx.to_account_id}`
|
|
155
|
+
: tx.to_account_type === 'system'
|
|
156
|
+
? 'System'
|
|
157
|
+
: tx.to_account_id
|
|
158
|
+
? `User ${tx.to_account_id.slice(0, 8)}...`
|
|
159
|
+
: '-' }), (0, jsx_runtime_1.jsx)("td", { className: "py-3 text-right", children: (0, jsx_runtime_1.jsxs)("span", { className: `font-medium font-mono ${isIncome ? 'text-cyan-400' : 'text-red-400'}`, children: [isIncome ? '+' : '-', (tx.amount ?? 0).toLocaleString(), " MCD"] }) })] }, tx.id));
|
|
160
|
+
}) })] }) }))] }) }))] }));
|
|
40
161
|
}
|
|
@@ -6,20 +6,45 @@ exports.MicrocosmMiningPage = MicrocosmMiningPage;
|
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
7
|
const react_1 = require("react");
|
|
8
8
|
const auth_react_1 = require("@microcosmmoney/auth-react");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
/* ─── Inline SVG Icons (lucide style, 24x24 viewBox) ─── */
|
|
10
|
+
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
|
+
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
|
+
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" })] }));
|
|
13
|
+
const IconCoins = () => ((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: "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" })] }));
|
|
14
|
+
const IconShield = ({ className = '' }) => ((0, jsx_runtime_1.jsx)("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: "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" }) }));
|
|
15
|
+
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: "M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1" }), (0, jsx_runtime_1.jsx)("path", { d: "M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4" })] }));
|
|
16
|
+
const IconHistory = () => ((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)("path", { d: "M3 12a9 9 0 1 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: "M12 7v5l4 2" })] }));
|
|
17
|
+
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" })] }));
|
|
18
|
+
const IconChevronDown = ({ 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: "m6 9 6 6 6-6" }) }));
|
|
19
|
+
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
|
+
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
|
+
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
|
+
const fmt = (n, d = 2) => {
|
|
24
|
+
if (n === undefined || n === null || isNaN(n))
|
|
25
|
+
return '0.00';
|
|
26
|
+
return n.toLocaleString('en-US', { minimumFractionDigits: d, maximumFractionDigits: d });
|
|
27
|
+
};
|
|
28
|
+
function Spinner({ className = '' }) {
|
|
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 ${className}` });
|
|
12
30
|
}
|
|
31
|
+
const formatDateTime = (iso) => {
|
|
32
|
+
if (!iso)
|
|
33
|
+
return '-';
|
|
34
|
+
return new Date(iso).toLocaleString('en-US', { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' });
|
|
35
|
+
};
|
|
36
|
+
/* ─── Component ─── */
|
|
13
37
|
function MicrocosmMiningPage({ basePath = '', onNavigate }) {
|
|
14
38
|
const { data: stats, loading: statsLoading } = (0, auth_react_1.useMiningStats)();
|
|
15
39
|
const { data: recordsData, loading: recordsLoading, refresh: refreshRecords } = (0, auth_react_1.useMiningRecords)({ limit: 20 });
|
|
16
40
|
const records = Array.isArray(recordsData) ? recordsData : recordsData?.records ?? [];
|
|
17
|
-
const { data: mccStats } = (0, auth_react_1.useMCCStats)();
|
|
41
|
+
const { data: mccStats, loading: mccStatsLoading } = (0, auth_react_1.useMCCStats)();
|
|
18
42
|
const { data: marketData } = (0, auth_react_1.useMarketData)();
|
|
19
43
|
const { balance: mccData } = (0, auth_react_1.useMCC)(60000);
|
|
20
|
-
const { data: wallets } = (0, auth_react_1.useWallets)();
|
|
44
|
+
const { data: wallets, loading: walletsLoading } = (0, auth_react_1.useWallets)();
|
|
21
45
|
const { startMining, loading: miningLoading } = (0, auth_react_1.useMiningFlow)();
|
|
22
46
|
const [showRecords, setShowRecords] = (0, react_1.useState)(true);
|
|
47
|
+
const [walletsExpanded, setWalletsExpanded] = (0, react_1.useState)(false);
|
|
23
48
|
const price = marketData?.price_usd ?? 0;
|
|
24
49
|
const miningPrice = price > 0 ? price * 2 : 0;
|
|
25
50
|
const s = mccStats;
|
|
@@ -28,22 +53,28 @@ function MicrocosmMiningPage({ basePath = '', onNavigate }) {
|
|
|
28
53
|
const miningRate = s?.current_mining_rate ?? 0;
|
|
29
54
|
const nextHalving = s?.next_halving_at ?? 100000000;
|
|
30
55
|
const mccBalance = mccData?.balance ?? 0;
|
|
31
|
-
const
|
|
56
|
+
const walletList = Array.isArray(wallets) ? wallets : [];
|
|
57
|
+
const primaryWallet = walletList.find((w) => w.is_primary);
|
|
58
|
+
const primaryAddress = primaryWallet?.wallet_address ?? null;
|
|
59
|
+
const totalBalance = walletList.length > 0 ? walletList.reduce((sum, w) => sum + (w.mcc_balance ?? 0), 0) : mccBalance;
|
|
32
60
|
const handleMine = (0, react_1.useCallback)(async () => {
|
|
33
|
-
if (!
|
|
61
|
+
if (!primaryAddress)
|
|
34
62
|
return;
|
|
35
63
|
try {
|
|
36
|
-
await startMining({ amount: 1, wallet_address:
|
|
64
|
+
await startMining({ amount: 1, wallet_address: primaryAddress });
|
|
37
65
|
refreshRecords();
|
|
38
66
|
}
|
|
39
67
|
catch (err) {
|
|
40
68
|
// Error handled by hook
|
|
41
69
|
}
|
|
42
|
-
}, [startMining,
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
70
|
+
}, [startMining, primaryAddress, refreshRecords]);
|
|
71
|
+
const isLoading = mccStatsLoading && !mccStats;
|
|
72
|
+
if (isLoading) {
|
|
73
|
+
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: "Mining" }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400 mt-1", children: "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: "Loading mining data..." })] })] }));
|
|
74
|
+
}
|
|
75
|
+
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: "Mining" }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400 mt-1", children: "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' : '' }), "Refresh"] })] }), (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 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: "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-neutral-400 tracking-wider 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: "market x 2" })] })] }), (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: "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: "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 ? 'Processing...' : '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-neutral-400 tracking-wider 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-neutral-800 rounded p-3", 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-neutral-400 tracking-wider", children: "phase" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-2xl font-bold text-white font-mono", children: ["Phase ", currentPhase] }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500 mt-1", children: "Halving every 100M" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-800 rounded p-3", 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.jsx)("span", { className: "text-xs text-neutral-400 tracking-wider", children: "total_minted" })] }), (0, jsx_runtime_1.jsx)("div", { className: "text-2xl font-bold text-white font-mono", children: fmt(totalMinted) }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500 mt-1", children: "MCC minted to date" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-800 rounded p-3", 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-neutral-400 tracking-wider", 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-neutral-800 rounded p-3", 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-neutral-400 tracking-wider", children: "next_halving" }) }), (0, jsx_runtime_1.jsx)("div", { className: "text-2xl font-bold text-white font-mono", children: nextHalving > totalMinted ? fmt(nextHalving - totalMinted, 0) : 'N/A' }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500 mt-1", children: "MCC until next halving" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-1", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between items-center text-xs font-mono", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-neutral-500", children: ["Remaining: ", fmt(100000000 - (totalMinted % 100000000), 0), " MCC until next halving"] }), (0, jsx_runtime_1.jsxs)("span", { className: "text-white", children: [((totalMinted % 100000000) / 100000000 * 100).toFixed(1), "%"] })] }), (0, jsx_runtime_1.jsx)("div", { className: "bg-neutral-800 rounded-full h-2 overflow-hidden", children: (0, jsx_runtime_1.jsx)("div", { className: "h-2 rounded-full bg-cyan-400 transition-all", style: { width: `${((totalMinted % 100000000) / 100000000) * 100}%` } }) })] })] }), (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: "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: "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, " wallet", walletList.length !== 1 ? 's' : ''] }))] }) }), (0, jsx_runtime_1.jsx)("p", { className: "text-neutral-500 text-xs mb-4", children: "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: "Loading on-chain balance..." })] })) : walletList.length === 0 ? (
|
|
76
|
+
/* Fallback: show aggregate balance from useMCC */
|
|
77
|
+
(0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-800 rounded p-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-400 tracking-wider 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-neutral-800 rounded p-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-400 tracking-wider 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, " wallet", walletList.length !== 1 ? 's' : '', " total"] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-800 rounded p-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-400 tracking-wider 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)}` : '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 ? 'Collapse' : '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://explorer.solana.com/address/${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: "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://explorer.solana.com/address/${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: "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)("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: "Mining Records" }), records.length > 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: [records.length, " 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: ["Collapse ", (0, jsx_runtime_1.jsx)(IconChevronUp, {})] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["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: "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: "Time" }), (0, jsx_runtime_1.jsx)("th", { className: "text-right py-2 font-normal", children: "Paid" }), (0, jsx_runtime_1.jsx)("th", { className: "text-right py-2 font-normal", children: "Minted" }), (0, jsx_runtime_1.jsx)("th", { className: "text-right py-2 font-normal", children: "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.created_at || r.timestamp) }), (0, jsx_runtime_1.jsxs)("td", { className: "py-3 text-right text-white font-mono", children: [fmt(r.payment_amount ?? r.stablecoin_amount ?? r.usdc_amount ?? r.paid ?? 0), " ", 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)("span", { className: `text-xs px-1.5 py-0.5 rounded ${(r.status === 'completed' || r.status === 'confirmed')
|
|
78
|
+
? 'bg-white/20 text-white'
|
|
79
|
+
: 'bg-neutral-700 text-neutral-400'}`, children: r.status || 'confirmed' }) })] }, r.id ?? i))) })] }) })) : ((0, jsx_runtime_1.jsx)("div", { className: "text-center py-8 text-neutral-500 text-sm", children: "No mining records yet" }))] }))] }) }), s?.pool_mcc_bought != null && ((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-xs text-neutral-400 tracking-wider 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-neutral-800 rounded p-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-[10px] text-neutral-400 tracking-wider 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-neutral-800 rounded p-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-[10px] text-neutral-400 tracking-wider 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-neutral-800 rounded p-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-[10px] text-neutral-400 tracking-wider 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: "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-xs text-neutral-400 tracking-wider 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-neutral-800 rounded p-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-[10px] text-neutral-400 tracking-wider 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-neutral-800 rounded p-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-[10px] text-neutral-400 tracking-wider 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-neutral-800 rounded p-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-[10px] text-neutral-400 tracking-wider 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-neutral-800 rounded p-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-[10px] text-neutral-400 tracking-wider 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: "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-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: "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." })] }) })] }));
|
|
49
80
|
}
|