@microcosmmoney/portal-react 3.10.0 → 3.11.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 +11 -9
- package/dist/components/dashboard/assets-summary.js +5 -3
- package/dist/components/dashboard/dashboard-overview.js +5 -2
- package/dist/components/dashboard/ecosystem-stats.js +7 -5
- package/dist/components/dashboard/lock-periods.js +3 -1
- package/dist/components/dashboard/market-overview-bar.js +8 -6
- package/dist/components/dashboard/mcc-token-stats.js +7 -5
- package/dist/components/dashboard/mcd-stats.js +7 -5
- package/dist/components/dashboard/mining-weight.js +3 -1
- package/dist/components/dashboard/minting-stats.js +5 -3
- package/dist/components/dashboard/my-mining.js +9 -7
- package/dist/components/dashboard/price-chart.js +4 -2
- package/dist/components/fragment/fragment-page.js +3 -1
- package/dist/components/income/manager-income-page.js +5 -3
- package/dist/components/lending/lending-page.js +3 -1
- package/dist/components/mcd/mcd-page.js +7 -5
- package/dist/components/mining/mining-page.js +5 -3
- package/dist/components/profile/email-change-card.js +5 -3
- package/dist/components/profile/profile-page.js +10 -8
- package/dist/components/profile/two-factor-settings.js +6 -4
- package/dist/components/queue/queue-status-page.js +4 -2
- package/dist/components/reincarnation/reincarnation-page.js +6 -2
- package/dist/components/rewards/rewards-page.js +5 -3
- package/dist/components/stations/station-list-page.js +10 -8
- package/dist/components/territory/territory-page.js +5 -3
- package/dist/components/voting/voting-page.js +3 -1
- package/dist/components/wallet/wallet-page.js +9 -6
- package/dist/i18n-context.d.ts +11 -0
- package/dist/i18n-context.js +59 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6 -2
- package/package.json +1 -1
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.MicrocosmMyMining = MicrocosmMyMining;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const auth_react_1 = require("@microcosmmoney/auth-react");
|
|
7
|
+
const i18n_context_1 = require("../../i18n-context");
|
|
7
8
|
function MicrocosmMyMining({ detailsPath, onNavigate, accentColor }) {
|
|
9
|
+
const t = (0, i18n_context_1.useTranslations)('mccDashboard');
|
|
8
10
|
const { data, loading } = (0, auth_react_1.useMiningStats)();
|
|
9
11
|
const fmt = (v) => v.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
10
12
|
const formatDateTime = (iso) => {
|
|
@@ -14,12 +16,12 @@ function MicrocosmMyMining({ detailsPath, onNavigate, accentColor }) {
|
|
|
14
16
|
return d.toLocaleString('zh-CN', { timeZone: 'Asia/Shanghai' });
|
|
15
17
|
};
|
|
16
18
|
const items = data ? [
|
|
17
|
-
{ label: 'total_mined', value: fmt(data.total_mined ?? 0) },
|
|
18
|
-
{ label: 'total_paid', value: fmt(data.total_paid ?? 0) },
|
|
19
|
-
{ label: 'mining_count', value: `${data.mining_count ?? 0}` },
|
|
20
|
-
{ label: 'last_30d', value: fmt(data.last_30d_mined ?? 0) },
|
|
21
|
-
{ label: 'active_days', value: `${data.active_days_30d ?? 0}` },
|
|
22
|
-
{ label: 'last_mined', value: formatDateTime(data.last_mined_at) },
|
|
19
|
+
{ label: t('totalMined', 'total_mined'), value: fmt(data.total_mined ?? 0) },
|
|
20
|
+
{ label: t('totalPaid', 'total_paid'), value: fmt(data.total_paid ?? 0) },
|
|
21
|
+
{ label: t('miningCount', 'mining_count'), value: `${data.mining_count ?? 0}` },
|
|
22
|
+
{ label: t('last30d', 'last_30d'), value: fmt(data.last_30d_mined ?? 0) },
|
|
23
|
+
{ label: t('activeDays', 'active_days'), value: `${data.active_days_30d ?? 0}` },
|
|
24
|
+
{ label: t('lastMined', 'last_mined'), value: formatDateTime(data.last_mined_at) },
|
|
23
25
|
] : [];
|
|
24
26
|
const handleDetailsClick = () => {
|
|
25
27
|
if (onNavigate && detailsPath)
|
|
@@ -27,5 +29,5 @@ function MicrocosmMyMining({ detailsPath, onNavigate, accentColor }) {
|
|
|
27
29
|
};
|
|
28
30
|
const spinnerBorderColor = accentColor ? { borderColor: accentColor, borderTopColor: 'transparent' } : undefined;
|
|
29
31
|
const spinnerClass = accentColor ? 'inline-block w-5 h-5 border-2 rounded-full animate-spin' : 'inline-block w-5 h-5 border-2 border-cyan-400 border-t-transparent rounded-full animate-spin';
|
|
30
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: "backdrop-blur-md bg-white/5 border border-white/10 rounded-xl blockchain-card h-full", children: (0, jsx_runtime_1.jsxs)("div", { className: "p-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between mb-4", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-[#5EEAD4] text-xs font-mono tracking-widest uppercase", children:
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "backdrop-blur-md bg-white/5 border border-white/10 rounded-xl blockchain-card h-full", children: (0, jsx_runtime_1.jsxs)("div", { className: "p-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between mb-4", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-[#5EEAD4] text-xs font-mono tracking-widest uppercase", children: t('myMining', 'MY_MINING') }), detailsPath && ((0, jsx_runtime_1.jsxs)("button", { onClick: handleDetailsClick, className: accentColor ? 'text-xs text-neutral-500 font-mono' : 'text-xs text-neutral-500 hover:text-cyan-400 font-mono', style: accentColor ? { '--hover-color': accentColor } : undefined, children: [t('details', 'details'), " >"] }))] }), loading ? ((0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-center py-8", children: (0, jsx_runtime_1.jsx)("span", { className: spinnerClass, style: spinnerBorderColor }) })) : !data || (data.mining_count ?? 0) === 0 ? ((0, jsx_runtime_1.jsx)("div", { className: "text-center py-8 text-neutral-500 font-mono text-sm", children: t('noMiningRecords', 'no mining records') })) : ((0, jsx_runtime_1.jsx)("div", { className: "grid grid-cols-2 gap-3", children: items.map((s) => ((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)("span", { className: "text-[10px] text-[#5EEAD4] font-mono tracking-widest uppercase", children: s.label }), (0, jsx_runtime_1.jsx)("div", { className: "text-xl font-bold font-mono text-white", children: s.value })] }, s.label))) }))] }) }));
|
|
31
33
|
}
|
|
@@ -5,6 +5,7 @@ exports.MicrocosmPriceChart = MicrocosmPriceChart;
|
|
|
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
|
+
const i18n_context_1 = require("../../i18n-context");
|
|
8
9
|
const recharts_1 = require("recharts");
|
|
9
10
|
const timeRanges = [
|
|
10
11
|
{ label: '1D', value: '1D' },
|
|
@@ -12,6 +13,7 @@ const timeRanges = [
|
|
|
12
13
|
{ label: '30D', value: '30D' },
|
|
13
14
|
];
|
|
14
15
|
function MicrocosmPriceChart({ accentColor } = {}) {
|
|
16
|
+
const t = (0, i18n_context_1.useTranslations)('mccDashboard');
|
|
15
17
|
const [range, setRange] = (0, react_1.useState)('7D');
|
|
16
18
|
const { data, loading } = (0, auth_react_1.usePriceHistory)(range);
|
|
17
19
|
const gradientId = (0, react_1.useId)().replace(/:/g, '_') + '_mcPriceGradient';
|
|
@@ -35,11 +37,11 @@ function MicrocosmPriceChart({ accentColor } = {}) {
|
|
|
35
37
|
};
|
|
36
38
|
return ((0, jsx_runtime_1.jsx)("div", { className: "backdrop-blur-md bg-white/5 border border-white/10 rounded-xl overflow-hidden blockchain-card", 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.jsx)("div", { className: "flex gap-1 bg-black p-0.5 rounded", children: timeRanges.map((tr) => ((0, jsx_runtime_1.jsx)("button", { onClick: () => setRange(tr.value), className: `px-2.5 py-1 text-[10px] font-mono font-bold rounded transition-colors ${range === tr.value
|
|
37
39
|
? (accentColor ? 'text-white' : 'bg-cyan-700 text-white')
|
|
38
|
-
: 'text-neutral-500 hover:text-neutral-300'}`, style: range === tr.value && accentColor ? { backgroundColor: accentColor, opacity: 0.8 } : undefined, children: tr.label }, tr.value))) }) }), (0, jsx_runtime_1.jsx)("div", { className: "h-[360px]", children: loading ? ((0, jsx_runtime_1.jsx)("div", { className: "h-full bg-neutral-800 rounded animate-pulse" })) : chartData.length === 0 ? ((0, jsx_runtime_1.jsx)("div", { className: "h-full flex items-center justify-center text-neutral-500 font-mono text-sm", children:
|
|
40
|
+
: 'text-neutral-500 hover:text-neutral-300'}`, style: range === tr.value && accentColor ? { backgroundColor: accentColor, opacity: 0.8 } : undefined, children: tr.label }, tr.value))) }) }), (0, jsx_runtime_1.jsx)("div", { className: "h-[360px]", children: loading ? ((0, jsx_runtime_1.jsx)("div", { className: "h-full bg-neutral-800 rounded animate-pulse" })) : chartData.length === 0 ? ((0, jsx_runtime_1.jsx)("div", { className: "h-full flex items-center justify-center text-neutral-500 font-mono text-sm", children: t('noPriceData', 'No price data available') })) : ((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: 5, left: -15, bottom: 0 }, children: [(0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsxs)("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [(0, jsx_runtime_1.jsx)("stop", { offset: "5%", stopColor: ac, stopOpacity: 0.3 }), (0, jsx_runtime_1.jsx)("stop", { offset: "95%", stopColor: ac, stopOpacity: 0 })] }) }), (0, jsx_runtime_1.jsx)(recharts_1.CartesianGrid, { vertical: false, strokeDasharray: "3 3", stroke: "#404040" }), (0, jsx_runtime_1.jsx)(recharts_1.XAxis, { dataKey: "time", tick: { fill: '#737373', fontSize: 10, fontFamily: 'monospace' }, tickLine: false, axisLine: false, tickFormatter: formatTime }), (0, jsx_runtime_1.jsx)(recharts_1.YAxis, { tick: { fill: '#737373', fontSize: 10, fontFamily: 'monospace' }, tickLine: false, axisLine: false, tickFormatter: (v) => `$${v.toFixed(3)}`, domain: [minPrice, maxPrice] }), (0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { contentStyle: {
|
|
39
41
|
backgroundColor: '#171717',
|
|
40
42
|
border: '1px solid #404040',
|
|
41
43
|
borderRadius: '6px',
|
|
42
44
|
fontFamily: 'monospace',
|
|
43
45
|
fontSize: '11px',
|
|
44
|
-
}, labelFormatter: (ts) => new Date(ts).toLocaleString(), formatter: (value) => [`$${Number(value).toFixed(4)}`, 'Price'] }), (0, jsx_runtime_1.jsx)(recharts_1.Area, { type: "monotone", dataKey: "price", stroke: ac, strokeWidth: 2, fill: `url(#${gradientId})` })] }) })) })] }) }));
|
|
46
|
+
}, labelFormatter: (ts) => new Date(ts).toLocaleString(), formatter: (value) => [`$${Number(value).toFixed(4)}`, t('price', 'Price')] }), (0, jsx_runtime_1.jsx)(recharts_1.Area, { type: "monotone", dataKey: "price", stroke: ac, strokeWidth: 2, fill: `url(#${gradientId})` })] }) })) })] }) }));
|
|
45
47
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.MicrocosmFragmentPage = MicrocosmFragmentPage;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const i18n_context_1 = require("../../i18n-context");
|
|
6
7
|
function IconWallet({ className }) {
|
|
7
8
|
return ((0, jsx_runtime_1.jsxs)("svg", { className: className, fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", viewBox: "0 0 24 24", children: [(0, jsx_runtime_1.jsx)("path", { d: "M19 7V4a1 1 0 00-1-1H5a2 2 0 000 4h15a1 1 0 011 1v4h-3a2 2 0 000 4h3a1 1 0 001-1v-2a1 1 0 00-1-1" }), (0, jsx_runtime_1.jsx)("path", { d: "M3 5v14a2 2 0 002 2h15a1 1 0 001-1v-4" })] }));
|
|
8
9
|
}
|
|
@@ -16,5 +17,6 @@ function IconInfo({ className }) {
|
|
|
16
17
|
return ((0, jsx_runtime_1.jsxs)("svg", { className: className, fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", viewBox: "0 0 24 24", children: [(0, jsx_runtime_1.jsx)("circle", { cx: "12", cy: "12", r: "10" }), (0, jsx_runtime_1.jsx)("path", { d: "M12 16v-4" }), (0, jsx_runtime_1.jsx)("path", { d: "M12 8h.01" })] }));
|
|
17
18
|
}
|
|
18
19
|
function MicrocosmFragmentPage({ onNavigate }) {
|
|
19
|
-
|
|
20
|
+
const t = (0, i18n_context_1.useTranslations)('fragmentDash');
|
|
21
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "max-w-7xl mx-auto p-6 font-mono space-y-6", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h1", { className: "text-2xl font-bold text-white", children: t('title', 'NFT Fragmentation') }), (0, jsx_runtime_1.jsx)("p", { className: "text-neutral-400 text-sm mt-1", children: t('subtitle', 'Territory NFT fragmentation marketplace') })] }), (0, jsx_runtime_1.jsx)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg", children: (0, jsx_runtime_1.jsxs)("div", { className: "p-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 text-neutral-400 text-sm mb-4", children: [(0, jsx_runtime_1.jsx)(IconWallet, { className: "w-4 h-4" }), (0, jsx_runtime_1.jsx)("span", { children: t('myHoldings', 'My Fragment Holdings') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-center py-8 text-neutral-400", children: [(0, jsx_runtime_1.jsx)(IconPuzzle, { className: "w-12 h-12 mx-auto mb-2 opacity-50" }), (0, jsx_runtime_1.jsx)("p", { children: t('noHoldings', 'No fragment holdings') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm mt-1", children: t('noHoldingsHint', 'Purchase fragments to become a partial NFT owner') })] })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg", children: (0, jsx_runtime_1.jsxs)("div", { className: "p-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 text-neutral-400 text-sm mb-4", children: [(0, jsx_runtime_1.jsx)(IconImage, { className: "w-4 h-4" }), (0, jsx_runtime_1.jsx)("span", { children: t('fragmentVaults', 'Fragment Vaults') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-center py-8 text-neutral-400", children: [(0, jsx_runtime_1.jsx)(IconImage, { className: "w-12 h-12 mx-auto mb-2 opacity-50" }), (0, jsx_runtime_1.jsx)("p", { children: t('noVaults', 'No fragment vaults') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm mt-1", children: t('noVaultsHint', 'Check back later') })] })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg", children: (0, jsx_runtime_1.jsxs)("div", { className: "p-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 text-neutral-400 text-sm mb-4", children: [(0, jsx_runtime_1.jsx)(IconInfo, { className: "w-4 h-4" }), (0, jsx_runtime_1.jsx)("span", { children: t('protocolInfo', 'Protocol Info') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-4 text-sm", children: [(0, jsx_runtime_1.jsxs)("div", { className: "p-4 bg-neutral-800 rounded border border-neutral-700", children: [(0, jsx_runtime_1.jsx)("div", { className: "font-medium text-white mb-2", children: t('whatIsFragmentation', 'What is NFT Fragmentation?') }), (0, jsx_runtime_1.jsx)("p", { className: "text-neutral-400", children: t('fragmentationDesc', 'NFT fragmentation allows high-value territory NFTs to be split into multiple fragments, enabling more users to participate in investment. Each fragment represents partial ownership of the NFT.') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "p-4 bg-neutral-800 rounded border border-neutral-700", children: [(0, jsx_runtime_1.jsx)("div", { className: "font-medium text-white mb-2", children: t('fragmentRights', 'Fragment Rights') }), (0, jsx_runtime_1.jsxs)("ul", { className: "list-disc list-inside space-y-1 text-neutral-400", children: [(0, jsx_runtime_1.jsx)("li", { children: t('fragmentRight1', 'Share NFT revenue proportionally based on holdings') }), (0, jsx_runtime_1.jsx)("li", { children: t('fragmentRight2', 'Redeem original NFT with 100% fragment ownership') }), (0, jsx_runtime_1.jsx)("li", { children: t('fragmentRight3', 'Fragments can be freely traded on the market') })] })] })] })] }) })] }));
|
|
20
22
|
}
|
|
@@ -6,10 +6,12 @@ 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 terminal_1 = require("../terminal");
|
|
9
|
+
const i18n_context_1 = require("../../i18n-context");
|
|
9
10
|
const SHARE_RATIOS = { station: 0.16, matrix: 0.12, sector: 0.08, system: 0.04 };
|
|
10
11
|
const LEVEL_LABELS = { station: 'Station', matrix: 'Matrix', sector: 'Sector', system: 'System' };
|
|
11
12
|
const LEVEL_ROLES = { station: 'Commander', matrix: 'Pioneer', sector: 'Warden', system: 'Admiral' };
|
|
12
13
|
function MicrocosmManagerIncomePage({} = {}) {
|
|
14
|
+
const t = (0, i18n_context_1.useTranslations)('managerIncome');
|
|
13
15
|
const api = (0, auth_react_1.useMicrocosmApi)();
|
|
14
16
|
const [income, setIncome] = (0, react_1.useState)(null);
|
|
15
17
|
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
@@ -71,12 +73,12 @@ function MicrocosmManagerIncomePage({} = {}) {
|
|
|
71
73
|
}));
|
|
72
74
|
const maxIncome = Math.max(...levelIncomes.map(l => l.data?.total_income ? parseFloat(l.data.total_income) : 0)) || 1;
|
|
73
75
|
if (loading) {
|
|
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", { children: [(0, jsx_runtime_1.jsx)("h1", { className: "text-lg sm:text-2xl font-bold text-white tracking-wider", children:
|
|
76
|
+
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", { children: [(0, jsx_runtime_1.jsx)("h1", { className: "text-lg sm:text-2xl font-bold text-white tracking-wider", children: t('title', 'Manager Income') }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs sm:text-sm text-neutral-400", children: t('subtitle', 'View your MCC minting share income as a multi-level manager') })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-center py-20", children: (0, jsx_runtime_1.jsx)("span", { className: "text-neutral-400", children: t('loading', 'Loading income data...') }) })] }));
|
|
75
77
|
}
|
|
76
|
-
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:
|
|
78
|
+
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', 'Manager Income') }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs sm:text-sm text-neutral-400", children: t('subtitle', 'View your MCC minting share income as a multi-level manager') })] }), (0, jsx_runtime_1.jsx)("button", { onClick: handleRefresh, disabled: refreshing, 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 disabled:opacity-50", children: refreshing ? t('refreshing', 'Refreshing...') : t('refresh', 'Refresh') })] }), (0, jsx_runtime_1.jsx)(terminal_1.TerminalCard, { title: t('distributionRatio', 'Distribution Ratio (Companion Yield per Mining Event)'), children: (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-2 md:grid-cols-6 gap-2", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-center p-3 bg-neutral-800 rounded border border-neutral-700", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-lg font-bold text-white", children: "16%" }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500", children: t('commander', 'Commander') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-center p-3 bg-neutral-800 rounded border border-neutral-700", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-lg font-bold text-cyan-400", children: "12%" }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500", children: t('pioneer', 'Pioneer') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-center p-3 bg-neutral-800 rounded border border-neutral-700", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-lg font-bold text-cyan-400", children: "8%" }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500", children: t('warden', 'Warden') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-center p-3 bg-neutral-800 rounded border border-neutral-700", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-lg font-bold text-cyan-400", children: "4%" }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500", children: t('admiral', 'Admiral') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-center p-3 bg-neutral-800 rounded border border-neutral-700", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-lg font-bold text-cyan-400", children: "30%" }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500", children: t('lpReserve', 'LP Reserve') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-center p-3 bg-neutral-800 rounded border border-neutral-700", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-lg font-bold text-cyan-400", children: "30%" }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500", children: t('vaultMcd', 'Vault MCD') })] })] }) }), (0, jsx_runtime_1.jsx)(terminal_1.TerminalCard, { children: (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col md:flex-row gap-4 items-end", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex gap-2 flex-wrap", children: ['7d', '30d', '90d', 'all'].map(range => ((0, jsx_runtime_1.jsx)("button", { onClick: () => setDateRange(range), className: `px-3 py-1.5 text-sm rounded transition-colors ${dateRange === range ? 'bg-cyan-700 text-white' : 'bg-neutral-800 text-neutral-400 hover:bg-neutral-700 hover:text-white'}`, children: range === '7d' ? t('days7', '7 Days') : range === '30d' ? t('days30', '30 Days') : range === '90d' ? t('days90', '90 Days') : t('allTime', 'All Time') }, range))) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-2 items-end flex-1", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("label", { className: "text-neutral-400 text-xs tracking-wider block mb-1", children: t('startDate', 'Start Date') }), (0, jsx_runtime_1.jsx)("input", { type: "date", value: startDate, onChange: (e) => setStartDate(e.target.value), className: "bg-neutral-800 border border-neutral-600 text-white w-36 h-8 text-sm rounded px-2" })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("label", { className: "text-neutral-400 text-xs tracking-wider block mb-1", children: t('endDate', 'End Date') }), (0, jsx_runtime_1.jsx)("input", { type: "date", value: endDate, onChange: (e) => setEndDate(e.target.value), className: "bg-neutral-800 border border-neutral-600 text-white w-36 h-8 text-sm rounded px-2" })] }), (0, jsx_runtime_1.jsx)("button", { onClick: () => loadData(), 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 h-8", children: t('query', 'Query') })] })] }) }), (0, jsx_runtime_1.jsx)(terminal_1.TerminalCard, { children: (0, jsx_runtime_1.jsx)("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 mb-1", children: t('totalIncome', 'Total Income') }), (0, jsx_runtime_1.jsxs)("div", { className: "text-4xl font-bold text-white", children: [totalIncome.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }), (0, jsx_runtime_1.jsx)("span", { className: "text-lg text-neutral-500 ml-2", children: "MCC" })] })] }) }) }), (0, jsx_runtime_1.jsx)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: levelIncomes.map(({ level, data, share, role }) => {
|
|
77
79
|
const incomeAmount = data?.total_income ? parseFloat(data.total_income) : 0;
|
|
78
80
|
const recordCount = data?.record_count || 0;
|
|
79
81
|
const percentage = maxIncome > 0 ? (incomeAmount / maxIncome) * 100 : 0;
|
|
80
|
-
return ((0, jsx_runtime_1.jsxs)(terminal_1.TerminalCard, { 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)("div", { className: "text-white font-medium", children: LEVEL_LABELS[level] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-xs text-neutral-500", children: [role, " \u00B7 ", (share * 100).toFixed(0), "%"] })] }), (0, jsx_runtime_1.jsx)("span", { className: `px-2 py-1 rounded text-xs ${incomeAmount > 0 ? 'bg-white/20 text-white' : 'bg-neutral-800 text-neutral-500'}`, children: incomeAmount > 0 ? '
|
|
82
|
+
return ((0, jsx_runtime_1.jsxs)(terminal_1.TerminalCard, { 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)("div", { className: "text-white font-medium", children: LEVEL_LABELS[level] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-xs text-neutral-500", children: [role, " \u00B7 ", (share * 100).toFixed(0), "%"] })] }), (0, jsx_runtime_1.jsx)("span", { className: `px-2 py-1 rounded text-xs ${incomeAmount > 0 ? 'bg-white/20 text-white' : 'bg-neutral-800 text-neutral-500'}`, children: incomeAmount > 0 ? t('hasIncome', 'Has Income') : t('noIncome', 'None') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "mb-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between text-sm mb-1", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-neutral-400", children: t('cumulativeIncome', 'Cumulative Income') }), (0, jsx_runtime_1.jsxs)("span", { className: "text-white", children: [incomeAmount.toLocaleString(undefined, { minimumFractionDigits: 2 }), " MCC"] })] }), (0, jsx_runtime_1.jsx)("div", { className: "bg-neutral-800 rounded-full h-2", children: (0, jsx_runtime_1.jsx)("div", { className: "bg-cyan-400 h-2 rounded-full transition-all", style: { width: `${percentage}%` } }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-2 gap-4 pt-3 border-t border-neutral-700", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xl font-bold text-white", children: recordCount }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500", children: t('outputRecords', 'Output Records') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xl font-bold text-white", children: recordCount > 0 ? (incomeAmount / recordCount).toFixed(2) : '0.00' }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500", children: t('avgPerRecord', 'Average Per Record') })] })] })] }, level));
|
|
81
83
|
}) })] }));
|
|
82
84
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.MicrocosmLendingPage = MicrocosmLendingPage;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const i18n_context_1 = require("../../i18n-context");
|
|
6
7
|
function IconLandmark({ className }) {
|
|
7
8
|
return ((0, jsx_runtime_1.jsxs)("svg", { className: className, fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", viewBox: "0 0 24 24", children: [(0, jsx_runtime_1.jsx)("line", { x1: "3", y1: "22", x2: "21", y2: "22" }), (0, jsx_runtime_1.jsx)("line", { x1: "6", y1: "18", x2: "6", y2: "11" }), (0, jsx_runtime_1.jsx)("line", { x1: "10", y1: "18", x2: "10", y2: "11" }), (0, jsx_runtime_1.jsx)("line", { x1: "14", y1: "18", x2: "14", y2: "11" }), (0, jsx_runtime_1.jsx)("line", { x1: "18", y1: "18", x2: "18", y2: "11" }), (0, jsx_runtime_1.jsx)("polygon", { points: "12 2 20 7 4 7" })] }));
|
|
8
9
|
}
|
|
@@ -22,5 +23,6 @@ const COLLATERAL_TYPES = [
|
|
|
22
23
|
{ label: 'System', value: '2,500,000.00', description: 'System (10 Sectors)' },
|
|
23
24
|
];
|
|
24
25
|
function MicrocosmLendingPage({ onNavigate }) {
|
|
25
|
-
|
|
26
|
+
const t = (0, i18n_context_1.useTranslations)('lendingDash');
|
|
27
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "max-w-7xl mx-auto p-6 space-y-6 font-mono", 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', 'NFT Collateral Lending') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('subtitle', 'Borrow MCC using territory NFTs as collateral') })] }), (0, jsx_runtime_1.jsx)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg", children: (0, jsx_runtime_1.jsxs)("div", { className: "p-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 text-neutral-400 text-sm mb-4", children: [(0, jsx_runtime_1.jsx)(IconWallet, { className: "w-4 h-4" }), (0, jsx_runtime_1.jsx)("span", { className: "tracking-wider", children: t('myDeposits', 'My Deposits') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-center py-8 text-neutral-500", children: [(0, jsx_runtime_1.jsx)(IconWallet, { className: "w-12 h-12 mx-auto mb-2 opacity-50" }), (0, jsx_runtime_1.jsx)("p", { children: t('noDeposits', 'No deposits') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm mt-1", children: t('noDepositsHint', 'Deposit MCC to earn interest') })] })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg", children: (0, jsx_runtime_1.jsxs)("div", { className: "p-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 text-neutral-400 text-sm mb-4", children: [(0, jsx_runtime_1.jsx)(IconCreditCard, { className: "w-4 h-4" }), (0, jsx_runtime_1.jsx)("span", { className: "tracking-wider", children: t('myLoans', 'My Loans') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-center py-8 text-neutral-500", children: [(0, jsx_runtime_1.jsx)(IconCreditCard, { className: "w-12 h-12 mx-auto mb-2 opacity-50" }), (0, jsx_runtime_1.jsx)("p", { children: t('noLoans', 'No loans') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm mt-1", children: t('noLoansHint', 'Collateralize territory NFTs to borrow MCC') })] })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg", children: (0, jsx_runtime_1.jsxs)("div", { className: "p-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 text-neutral-400 text-sm mb-4", children: [(0, jsx_runtime_1.jsx)(IconInfo, { className: "w-4 h-4" }), (0, jsx_runtime_1.jsx)("span", { className: "tracking-wider", children: t('protocolInfo', 'Protocol Info') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-4 text-sm", children: [(0, jsx_runtime_1.jsxs)("div", { className: "p-4 bg-neutral-800 rounded", children: [(0, jsx_runtime_1.jsx)("div", { className: "font-medium text-white mb-2", children: t('loanRules', 'Loan Rules') }), (0, jsx_runtime_1.jsxs)("ul", { className: "list-disc list-inside space-y-1 text-neutral-400", children: [(0, jsx_runtime_1.jsx)("li", { children: t('loanRule2', 'Collateral: Territory NFTs (Station/Matrix/Sector/System)') }), (0, jsx_runtime_1.jsx)("li", { children: t('loanRule1', 'LTV (Loan-to-Value): Maximum 100%') }), (0, jsx_runtime_1.jsx)("li", { children: t('loanRule3', 'Loan Asset: MCC Token') }), (0, jsx_runtime_1.jsx)("li", { children: t('loanRule4', 'Repayment Cycle: 30 days') })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "p-4 bg-neutral-800 rounded", children: [(0, jsx_runtime_1.jsx)("div", { className: "font-medium text-white mb-2", children: t('liquidationRules', 'Liquidation Rules') }), (0, jsx_runtime_1.jsxs)("ul", { className: "list-disc list-inside space-y-1 text-neutral-400", children: [(0, jsx_runtime_1.jsx)("li", { children: t('liquidationRule1', '3 consecutive missed payments triggers liquidation') }), (0, jsx_runtime_1.jsx)("li", { children: t('liquidationRule2', 'Collateral NFT will be seized upon liquidation') }), (0, jsx_runtime_1.jsx)("li", { children: t('liquidationRule3', 'Loan is automatically closed after liquidation') })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "p-4 bg-neutral-800 rounded", children: [(0, jsx_runtime_1.jsx)("div", { className: "font-medium text-white mb-2", children: t('nftValuation', 'NFT Valuation') }), (0, jsx_runtime_1.jsx)("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-4 mt-2", children: COLLATERAL_TYPES.map(ct => ((0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-neutral-400 text-xs", children: ct.description }), (0, jsx_runtime_1.jsx)("div", { className: "text-white font-bold font-mono", children: ct.value }), (0, jsx_runtime_1.jsx)("div", { className: "text-neutral-500 text-xs", children: "MCC" })] }, ct.label))) })] })] })] }) })] }));
|
|
26
28
|
}
|
|
@@ -5,6 +5,7 @@ exports.MicrocosmMCDPage = MicrocosmMCDPage;
|
|
|
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
|
+
const i18n_context_1 = require("../../i18n-context");
|
|
8
9
|
/* ── Inline SVG Icons (lucide style, 24x24 default) ── */
|
|
9
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" })] }));
|
|
10
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" })] }));
|
|
@@ -100,6 +101,7 @@ const ECOSYSTEM_SERVICES = [
|
|
|
100
101
|
},
|
|
101
102
|
];
|
|
102
103
|
function MicrocosmMCDPage({ basePath = '', onNavigate }) {
|
|
104
|
+
const t = (0, i18n_context_1.useTranslations)('mcdDash');
|
|
103
105
|
const { balance: mcdData, loading: mcdLoading, refresh: refreshMCD } = (0, auth_react_1.useMCD)(60000);
|
|
104
106
|
const { data: rewards, loading: rewardsLoading, refresh: refreshRewards } = (0, auth_react_1.useMCDRewards)();
|
|
105
107
|
const { data: transactions, loading: txLoading, refresh: refreshTx } = (0, auth_react_1.useMCDTransactions)();
|
|
@@ -133,15 +135,15 @@ function MicrocosmMCDPage({ basePath = '', onNavigate }) {
|
|
|
133
135
|
};
|
|
134
136
|
/* ── Not logged in ── */
|
|
135
137
|
if (!mcdData && !mcdLoading) {
|
|
136
|
-
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:
|
|
138
|
+
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') })] }) }));
|
|
137
139
|
}
|
|
138
|
-
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:
|
|
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 (Helius RPC)') })] }), 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
|
|
139
141
|
? (0, jsx_runtime_1.jsx)(IconChevronUp, { className: "w-4 h-4 ml-1" })
|
|
140
|
-
: (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:
|
|
142
|
+
: (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'
|
|
141
143
|
? 'bg-neutral-700 text-white'
|
|
142
|
-
: 'text-neutral-400 hover:text-neutral-300'}`, children: [(0, jsx_runtime_1.jsx)(IconGift, { className: "w-4 h-4 mr-2" }),
|
|
144
|
+
: 'text-neutral-400 hover:text-neutral-300'}`, children: [(0, jsx_runtime_1.jsx)(IconGift, { className: "w-4 h-4 mr-2" }), t('dailyDistribution', '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'
|
|
143
145
|
? 'bg-neutral-700 text-white'
|
|
144
|
-
: 'text-neutral-400 hover:text-neutral-300'}`, children: [(0, jsx_runtime_1.jsx)(IconHistory, { className: "w-4 h-4 mr-2" }),
|
|
146
|
+
: 'text-neutral-400 hover:text-neutral-300'}`, children: [(0, jsx_runtime_1.jsx)(IconHistory, { className: "w-4 h-4 mr-2" }), t('transactionHistory', '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: t('dailyDistributionRecords', 'Daily Distribution Records') })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-neutral-400 text-sm mb-4", children: t('dailyDistributionDesc', 'MCD records auto-distributed daily from Station vault') }), 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: t('noDailyRecords', 'No daily distribution records') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm mt-2", children: t('noDailyRecordsHint', 'Daily MCD distribution begins after joining a Station') })] })) : ((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: t('distributionDate', 'Distribution Date') }), (0, jsx_runtime_1.jsx)("th", { className: "text-left py-3 text-xs font-medium text-neutral-400 tracking-wider", children: t('territoryId', 'Territory') }), (0, jsx_runtime_1.jsx)("th", { className: "text-right py-3 text-xs font-medium text-neutral-400 tracking-wider", children: t('amountLabel', 'Amount') }), (0, jsx_runtime_1.jsx)("th", { className: "text-right py-3 text-xs font-medium text-neutral-400 tracking-wider", children: t('claimTime', 'Claim Time') })] }) }), (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: t('transactionHistory', 'Transaction History') })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-neutral-400 text-sm mb-4", children: t('transactionHistoryDesc', 'Complete record of all MCD-related transactions') }), 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: t('noTransactions', 'No transaction records') })] })) : ((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: t('timeLabel', 'Time') }), (0, jsx_runtime_1.jsx)("th", { className: "text-left py-3 text-xs font-medium text-neutral-400 tracking-wider", children: t('typeLabel', 'Type') }), (0, jsx_runtime_1.jsx)("th", { className: "text-left py-3 text-xs font-medium text-neutral-400 tracking-wider", children: t('fromLabel', '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: t('toLabel', 'To') }), (0, jsx_runtime_1.jsx)("th", { className: "text-right py-3 text-xs font-medium text-neutral-400 tracking-wider", children: t('amountLabel', 'Amount') })] }) }), (0, jsx_runtime_1.jsx)("tbody", { children: txList.map((tx) => {
|
|
145
147
|
const isIncome = tx.tx_type === 'daily_distribution' || tx.tx_type === 'refund' || tx.tx_type === 'transfer';
|
|
146
148
|
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'
|
|
147
149
|
? `Station #${tx.from_account_id}`
|
|
@@ -5,6 +5,7 @@ exports.MicrocosmMiningPage = MicrocosmMiningPage;
|
|
|
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
|
+
const i18n_context_1 = require("../../i18n-context");
|
|
8
9
|
/* ─── Inline SVG Icons (lucide style, 24x24 viewBox) ─── */
|
|
9
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" })] }));
|
|
10
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" }) }));
|
|
@@ -34,6 +35,7 @@ const formatDateTime = (iso) => {
|
|
|
34
35
|
};
|
|
35
36
|
/* ─── Component ─── */
|
|
36
37
|
function MicrocosmMiningPage({ basePath = '', onNavigate }) {
|
|
38
|
+
const t = (0, i18n_context_1.useTranslations)('miningDash');
|
|
37
39
|
const { data: stats, loading: statsLoading } = (0, auth_react_1.useMiningStats)();
|
|
38
40
|
const [recordsPage, setRecordsPage] = (0, react_1.useState)(1);
|
|
39
41
|
const RECORDS_PAGE_SIZE = 10;
|
|
@@ -98,9 +100,9 @@ function MicrocosmMiningPage({ basePath = '', onNavigate }) {
|
|
|
98
100
|
}, [startMining, primaryAddress, refreshRecords]);
|
|
99
101
|
const isLoading = mccStatsLoading && !mccStats;
|
|
100
102
|
if (isLoading) {
|
|
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", { children: [(0, jsx_runtime_1.jsx)("h1", { className: "text-2xl font-bold text-white tracking-wider", children:
|
|
103
|
+
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...') })] })] }));
|
|
102
104
|
}
|
|
103
|
-
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:
|
|
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 ? (
|
|
104
106
|
/* Fallback: show aggregate balance from useMCC */
|
|
105
|
-
(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, " wallet", walletList.length !== 1 ? 's' : '', " 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)}` : '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://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: "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: "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, " 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.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: "confirmed" }) })] }, r.tx_signature ?? `${recordsPage}-${i}`))) })] }) })) : ((0, jsx_runtime_1.jsx)("div", { className: "text-center py-8 text-neutral-500 text-sm", children: "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.jsx)("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 Prev" }), (0, jsx_runtime_1.jsx)("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: "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: "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." })] }) })] }));
|
|
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.') })] }) })] }));
|
|
106
108
|
}
|
|
@@ -6,7 +6,9 @@ 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 terminal_1 = require("../terminal");
|
|
9
|
+
const i18n_context_1 = require("../../i18n-context");
|
|
9
10
|
function MicrocosmEmailChangeCard({ onSuccess } = {}) {
|
|
11
|
+
const t = (0, i18n_context_1.useTranslations)('profile');
|
|
10
12
|
const { requestEmailChange, verifyEmailChange, loading, error, clearError } = (0, auth_react_1.useEmailVerification)();
|
|
11
13
|
const [step, setStep] = (0, react_1.useState)('idle');
|
|
12
14
|
const [newEmail, setNewEmail] = (0, react_1.useState)('');
|
|
@@ -38,12 +40,12 @@ function MicrocosmEmailChangeCard({ onSuccess } = {}) {
|
|
|
38
40
|
catch { }
|
|
39
41
|
};
|
|
40
42
|
if (step === 'idle') {
|
|
41
|
-
return ((0, jsx_runtime_1.jsxs)(terminal_1.TerminalCard, { children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2 mb-3", children: (0, jsx_runtime_1.jsx)("span", { className: "text-sm text-neutral-300 font-medium tracking-wider", children:
|
|
43
|
+
return ((0, jsx_runtime_1.jsxs)(terminal_1.TerminalCard, { children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2 mb-3", children: (0, jsx_runtime_1.jsx)("span", { className: "text-sm text-neutral-300 font-medium tracking-wider", children: t('changeEmail', 'CHANGE EMAIL') }) }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-400 mb-3", children: t('changeEmailDesc', 'Update your email address. A verification code will be sent to the new email.') }), (0, jsx_runtime_1.jsx)("button", { onClick: () => setStep('form'), className: "px-3 py-1.5 border border-neutral-700 text-neutral-300 hover:bg-neutral-800 rounded text-xs", children: t('changeEmailBtn', 'Change Email') })] }));
|
|
42
44
|
}
|
|
43
|
-
return ((0, jsx_runtime_1.jsx)(terminal_1.TerminalCard, { children: (0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2", children: (0, jsx_runtime_1.jsx)("span", { className: "text-sm text-neutral-300 font-medium tracking-wider", children:
|
|
45
|
+
return ((0, jsx_runtime_1.jsx)(terminal_1.TerminalCard, { children: (0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2", children: (0, jsx_runtime_1.jsx)("span", { className: "text-sm text-neutral-300 font-medium tracking-wider", children: t('changeEmail', 'CHANGE EMAIL') }) }), error && ((0, jsx_runtime_1.jsx)("div", { className: "p-2 bg-red-900/20 border border-red-800 rounded text-xs text-red-300", children: error })), step === 'form' && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("input", { type: "email", value: newEmail, onChange: (e) => setNewEmail(e.target.value), placeholder: t('newEmailPlaceholder', 'New email address'), className: "w-full bg-neutral-800 border border-neutral-700 text-white p-2 rounded text-sm outline-none focus:border-cyan-500" }), (0, jsx_runtime_1.jsx)("input", { type: "password", value: password, onChange: (e) => setPassword(e.target.value), placeholder: t('currentPasswordPlaceholder', 'Current password'), className: "w-full bg-neutral-800 border border-neutral-700 text-white p-2 rounded text-sm outline-none focus:border-cyan-500" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-2", children: [(0, jsx_runtime_1.jsx)("button", { onClick: () => {
|
|
44
46
|
setStep('idle');
|
|
45
47
|
setNewEmail('');
|
|
46
48
|
setPassword('');
|
|
47
49
|
clearError();
|
|
48
|
-
}, className: "flex-1 px-3 py-1.5 text-neutral-500 hover:text-neutral-300 text-xs", children:
|
|
50
|
+
}, className: "flex-1 px-3 py-1.5 text-neutral-500 hover:text-neutral-300 text-xs", children: t('cancel', 'Cancel') }), (0, jsx_runtime_1.jsx)("button", { onClick: handleRequest, disabled: loading || !newEmail || !password, className: "flex-1 px-3 py-1.5 bg-cyan-700 hover:bg-cyan-600 text-white rounded text-xs disabled:opacity-50", children: loading ? t('sending', 'Sending...') : t('sendCode', 'Send Code') })] })] })), step === 'verify' && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("p", { className: "text-xs text-neutral-400", children: [t('enterCodeSentTo', 'Enter the 6-digit code sent to'), " ", (0, jsx_runtime_1.jsx)("span", { className: "text-cyan-400", children: newEmail })] }), (0, jsx_runtime_1.jsx)("input", { type: "text", value: code, onChange: (e) => setCode(e.target.value.replace(/\D/g, '').slice(0, 6)), placeholder: "000000", className: "w-full bg-neutral-800 border border-neutral-700 text-white p-2 rounded text-center text-lg font-mono tracking-[0.5em] outline-none focus:border-cyan-500", maxLength: 6 }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-2", children: [(0, jsx_runtime_1.jsx)("button", { onClick: () => { setStep('form'); setCode(''); clearError(); }, className: "flex-1 px-3 py-1.5 text-neutral-500 hover:text-neutral-300 text-xs", children: t('back', 'Back') }), (0, jsx_runtime_1.jsx)("button", { onClick: handleVerify, disabled: loading || code.length !== 6, className: "flex-1 px-3 py-1.5 bg-cyan-700 hover:bg-cyan-600 text-white rounded text-xs disabled:opacity-50", children: loading ? t('verifying', 'Verifying...') : t('verify', 'Verify') })] })] }))] }) }));
|
|
49
51
|
}
|