@microcosmmoney/portal-react 1.3.0 → 1.4.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/dashboard/assets-summary.d.ts +5 -0
- package/dist/components/dashboard/assets-summary.js +45 -0
- package/dist/components/dashboard/dashboard-overview.d.ts +7 -0
- package/dist/components/dashboard/dashboard-overview.js +16 -0
- package/dist/components/dashboard/lock-periods.d.ts +1 -0
- package/dist/components/dashboard/lock-periods.js +27 -0
- package/dist/components/dashboard/market-overview-bar.d.ts +1 -0
- package/dist/components/dashboard/market-overview-bar.js +30 -0
- package/dist/components/dashboard/mining-weight.d.ts +1 -0
- package/dist/components/dashboard/mining-weight.js +47 -0
- package/dist/components/dashboard/minting-stats.d.ts +1 -0
- package/dist/components/dashboard/minting-stats.js +13 -0
- package/dist/components/dashboard/price-chart.d.ts +1 -0
- package/dist/components/dashboard/price-chart.js +40 -0
- package/dist/components/dashboard/quick-actions.d.ts +5 -0
- package/dist/components/dashboard/quick-actions.js +22 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +17 -1
- package/package.json +9 -5
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// AI-generated · AI-managed · AI-maintained
|
|
3
|
+
'use client';
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.MicrocosmAssetsSummary = MicrocosmAssetsSummary;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const auth_react_1 = require("@microcosmmoney/auth-react");
|
|
8
|
+
const RANK_COLOR = {
|
|
9
|
+
Recruit: 'text-neutral-500',
|
|
10
|
+
Prospect: 'text-neutral-400',
|
|
11
|
+
Miner: 'text-cyan-300',
|
|
12
|
+
Commander: 'text-white',
|
|
13
|
+
Pioneer: 'text-cyan-400',
|
|
14
|
+
Warden: 'text-cyan-300',
|
|
15
|
+
Admiral: 'text-cyan-300',
|
|
16
|
+
};
|
|
17
|
+
const RANK_BG = {
|
|
18
|
+
Recruit: 'bg-neutral-800',
|
|
19
|
+
Prospect: 'bg-neutral-800',
|
|
20
|
+
Miner: 'bg-cyan-950/50',
|
|
21
|
+
Commander: 'bg-white/10',
|
|
22
|
+
Pioneer: 'bg-cyan-950/50',
|
|
23
|
+
Warden: 'bg-cyan-950/50',
|
|
24
|
+
Admiral: 'bg-cyan-950/50',
|
|
25
|
+
};
|
|
26
|
+
function MicrocosmAssetsSummary({ basePath = '', onNavigate }) {
|
|
27
|
+
const { balance: mccData, loading: mccLoading } = (0, auth_react_1.useMCC)(120000);
|
|
28
|
+
const { balance: mcdData, loading: mcdLoading } = (0, auth_react_1.useMCD)(120000);
|
|
29
|
+
const { data: levelData } = (0, auth_react_1.useUserLevel)();
|
|
30
|
+
const resolvePath = (p) => basePath ? `${basePath.replace(/\/$/, '')}${p}` : p;
|
|
31
|
+
const mccBalance = mccData?.balance ?? 0;
|
|
32
|
+
const mcdAmount = parseFloat(mcdData?.available_balance ?? '0');
|
|
33
|
+
const mcdReceived = parseFloat(mcdData?.total_balance ?? '0');
|
|
34
|
+
const mcdSpent = parseFloat(mcdData?.frozen_balance ?? '0');
|
|
35
|
+
const rank = levelData?.level ?? null;
|
|
36
|
+
const nextRank = null;
|
|
37
|
+
const progress = levelData?.upgrade_progress?.percentage ?? 0;
|
|
38
|
+
const requirementsMet = undefined;
|
|
39
|
+
const fmt = (n) => n.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg overflow-hidden h-full hover:border-cyan-400/50 transition-colors", children: (0, jsx_runtime_1.jsxs)("div", { className: "p-6 space-y-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "block group cursor-pointer", onClick: () => onNavigate?.(resolvePath('/mcc/wallet')), role: "button", tabIndex: 0, onKeyDown: (e) => e.key === 'Enter' && onNavigate?.(resolvePath('/mcc/wallet')), children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-neutral-400 text-[10px] font-mono tracking-wider mb-1", children: "MCC_BALANCE" }), (0, jsx_runtime_1.jsx)("div", { className: "text-2xl font-bold font-mono text-cyan-400", children: mccLoading
|
|
41
|
+
? (0, jsx_runtime_1.jsx)("span", { className: "inline-block w-5 h-5 border-2 border-cyan-400 border-t-transparent rounded-full animate-spin" })
|
|
42
|
+
: fmt(mccBalance) }), (0, jsx_runtime_1.jsx)("div", { className: "text-neutral-500 text-xs font-mono mt-1", children: "on-chain balance (API)" })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "h-px bg-neutral-700" }), (0, jsx_runtime_1.jsx)("div", { className: "block group cursor-pointer", onClick: () => onNavigate?.(resolvePath('/mcc/mcd')), role: "button", tabIndex: 0, onKeyDown: (e) => e.key === 'Enter' && onNavigate?.(resolvePath('/mcc/mcd')), children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-neutral-400 text-[10px] font-mono tracking-wider mb-1", children: "MCD_BALANCE" }), (0, jsx_runtime_1.jsx)("div", { className: "text-2xl font-bold font-mono text-cyan-400", children: mcdLoading
|
|
43
|
+
? (0, jsx_runtime_1.jsx)("span", { className: "inline-block w-5 h-5 border-2 border-cyan-400 border-t-transparent rounded-full animate-spin" })
|
|
44
|
+
: fmt(mcdAmount) }), (0, jsx_runtime_1.jsxs)("div", { className: "text-neutral-500 text-xs font-mono mt-1 space-x-3", children: [(0, jsx_runtime_1.jsxs)("span", { children: ["Income: ", (0, jsx_runtime_1.jsx)("span", { className: "text-white", children: fmt(mcdReceived) })] }), (0, jsx_runtime_1.jsxs)("span", { children: ["Spent: ", (0, jsx_runtime_1.jsx)("span", { className: "text-neutral-400", children: fmt(mcdSpent) })] })] })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "h-px bg-neutral-700" }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-neutral-400 text-[10px] font-mono tracking-wider mb-2", children: "USER_RANK" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3 mb-2", children: [(0, jsx_runtime_1.jsx)("span", { className: `px-2.5 py-1 rounded text-sm font-bold font-mono ${RANK_COLOR[rank ?? ''] ?? 'text-neutral-500'} ${RANK_BG[rank ?? ''] ?? 'bg-neutral-800'}`, children: rank || 'N/A' }), nextRank && ((0, jsx_runtime_1.jsxs)("span", { className: "text-neutral-500 text-xs font-mono", children: ["\u2192 ", nextRank] }))] }), nextRank && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between items-center mb-1.5 text-xs font-mono", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-neutral-500", children: "upgrade_progress" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-neutral-400", children: [progress.toFixed(1), "%"] })] }), (0, jsx_runtime_1.jsx)("div", { className: "w-full 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: `${Math.min(progress, 100)}%` } }) }), requirementsMet && ((0, jsx_runtime_1.jsx)("div", { className: "mt-2 space-y-1", children: Object.entries(requirementsMet).map(([req, met]) => ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 text-[11px] font-mono", children: [(0, jsx_runtime_1.jsx)("span", { className: met ? 'text-white' : 'text-neutral-600', children: met ? '[✓]' : '[ ]' }), (0, jsx_runtime_1.jsx)("span", { className: met ? 'text-neutral-400' : 'text-neutral-600', children: req.replace(/_/g, ' ') })] }, req))) }))] })), !nextRank && rank && ((0, jsx_runtime_1.jsx)("div", { className: "bg-black border border-cyan-400/30 rounded p-2 text-center", children: (0, jsx_runtime_1.jsx)("div", { className: "text-cyan-400 font-bold text-xs font-mono", children: "MAX LEVEL" }) }))] })] }) }));
|
|
45
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface MicrocosmDashboardOverviewProps {
|
|
2
|
+
basePath?: string;
|
|
3
|
+
onNavigate?: (path: string) => void;
|
|
4
|
+
showHeader?: boolean;
|
|
5
|
+
headerText?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function MicrocosmDashboardOverview({ basePath, onNavigate, showHeader, headerText, }: MicrocosmDashboardOverviewProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// AI-generated · AI-managed · AI-maintained
|
|
3
|
+
'use client';
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.MicrocosmDashboardOverview = MicrocosmDashboardOverview;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const market_overview_bar_1 = require("./market-overview-bar");
|
|
8
|
+
const quick_actions_1 = require("./quick-actions");
|
|
9
|
+
const assets_summary_1 = require("./assets-summary");
|
|
10
|
+
const price_chart_1 = require("./price-chart");
|
|
11
|
+
const minting_stats_1 = require("./minting-stats");
|
|
12
|
+
const mining_weight_1 = require("./mining-weight");
|
|
13
|
+
const lock_periods_1 = require("./lock-periods");
|
|
14
|
+
function MicrocosmDashboardOverview({ basePath = '', onNavigate, showHeader = true, headerText = 'SHARED NETWORK · SHARED FUTURE', }) {
|
|
15
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "max-w-7xl mx-auto font-mono p-6 space-y-6", children: [showHeader && ((0, jsx_runtime_1.jsx)("div", { className: "text-center", children: (0, jsx_runtime_1.jsx)("h1", { className: "text-2xl sm:text-3xl md:text-4xl lg:text-5xl font-bold tracking-tight text-transparent bg-clip-text bg-gradient-to-r from-cyan-400 to-cyan-200", children: headerText }) })), (0, jsx_runtime_1.jsx)(market_overview_bar_1.MicrocosmMarketBar, {}), (0, jsx_runtime_1.jsx)(quick_actions_1.MicrocosmQuickActions, { basePath: basePath, onNavigate: onNavigate }), (0, jsx_runtime_1.jsxs)("div", { className: "grid lg:grid-cols-2 gap-6", children: [(0, jsx_runtime_1.jsx)(assets_summary_1.MicrocosmAssetsSummary, { basePath: basePath, onNavigate: onNavigate }), (0, jsx_runtime_1.jsx)(price_chart_1.MicrocosmPriceChart, {})] }), (0, jsx_runtime_1.jsxs)("div", { className: "grid lg:grid-cols-2 gap-6", children: [(0, jsx_runtime_1.jsx)(minting_stats_1.MicrocosmMintingStats, {}), (0, jsx_runtime_1.jsx)(mining_weight_1.MicrocosmMiningWeight, {})] }), (0, jsx_runtime_1.jsx)(lock_periods_1.MicrocosmLockPeriods, {})] }));
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function MicrocosmLockPeriods(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// AI-generated · AI-managed · AI-maintained
|
|
3
|
+
'use client';
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.MicrocosmLockPeriods = MicrocosmLockPeriods;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const auth_react_1 = require("@microcosmmoney/auth-react");
|
|
8
|
+
function formatDateTime(dt) {
|
|
9
|
+
const d = new Date(dt);
|
|
10
|
+
return d.toLocaleDateString('en-US', { year: 'numeric', month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' });
|
|
11
|
+
}
|
|
12
|
+
function daysRemaining(endTime) {
|
|
13
|
+
const now = Date.now();
|
|
14
|
+
const end = new Date(endTime).getTime();
|
|
15
|
+
const diff = end - now;
|
|
16
|
+
if (diff <= 0)
|
|
17
|
+
return 'Expired';
|
|
18
|
+
const days = Math.ceil(diff / (1000 * 60 * 60 * 24));
|
|
19
|
+
return `${days}d`;
|
|
20
|
+
}
|
|
21
|
+
function MicrocosmLockPeriods() {
|
|
22
|
+
const { data } = (0, auth_react_1.useMCCLocks)();
|
|
23
|
+
const activeLocks = data?.filter((p) => p.status === 'locked') ?? [];
|
|
24
|
+
if (activeLocks.length === 0)
|
|
25
|
+
return null;
|
|
26
|
+
return ((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.jsx)("div", { className: "p-6", children: (0, jsx_runtime_1.jsx)("div", { className: "space-y-3", children: activeLocks.map((lock) => ((0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-800 rounded p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between items-start mb-2", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-neutral-400 text-xs font-mono tracking-wider", children: lock.reason }), (0, jsx_runtime_1.jsxs)("div", { className: "text-xl font-bold font-mono text-cyan-400 mt-1", children: [(lock.amount ?? 0).toLocaleString(), " MCC"] })] }), (0, jsx_runtime_1.jsx)("span", { className: "px-2 py-0.5 bg-cyan-400/20 text-cyan-400 text-xs font-mono rounded", children: "LOCKED" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-xs text-neutral-500 space-y-1 font-mono", children: [(0, jsx_runtime_1.jsxs)("div", { children: ["unlock_at: ", formatDateTime(lock.lock_end)] }), (0, jsx_runtime_1.jsxs)("div", { children: ["remaining: ", (0, jsx_runtime_1.jsx)("span", { className: "text-cyan-400", children: daysRemaining(lock.lock_end) })] })] })] }, lock.lock_id))) }) }) }));
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function MicrocosmMarketBar(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// AI-generated · AI-managed · AI-maintained
|
|
3
|
+
'use client';
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.MicrocosmMarketBar = MicrocosmMarketBar;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const auth_react_1 = require("@microcosmmoney/auth-react");
|
|
8
|
+
function formatCompact(value) {
|
|
9
|
+
if (value >= 1000000)
|
|
10
|
+
return `${(value / 1000000).toFixed(2)}M`;
|
|
11
|
+
if (value >= 1000)
|
|
12
|
+
return `${(value / 1000).toFixed(1)}K`;
|
|
13
|
+
return value.toFixed(2);
|
|
14
|
+
}
|
|
15
|
+
function MicrocosmMarketBar() {
|
|
16
|
+
const { data, loading } = (0, auth_react_1.useMarketData)();
|
|
17
|
+
if (loading || !data) {
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3 mb-6", children: Array.from({ length: 5 }).map((_, i) => ((0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg p-4 animate-pulse", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-3 bg-neutral-800 rounded w-16 mb-2" }), (0, jsx_runtime_1.jsx)("div", { className: "h-6 bg-neutral-800 rounded w-24" })] }, i))) }));
|
|
19
|
+
}
|
|
20
|
+
const priceChange24h = data.price_change_24h ?? 0;
|
|
21
|
+
const isPositive = priceChange24h >= 0;
|
|
22
|
+
const stats = [
|
|
23
|
+
{ label: 'MCC_PRICE', value: `$${(data.price_usd ?? 0).toFixed(4)}`, color: 'text-cyan-400' },
|
|
24
|
+
{ label: '24H_CHANGE', value: `${isPositive ? '+' : ''}${priceChange24h.toFixed(2)}%`, color: isPositive ? 'text-white' : 'text-red-400' },
|
|
25
|
+
{ label: '24H_VOLUME', value: `$${formatCompact(data.volume_24h ?? 0)}`, color: 'text-cyan-300' },
|
|
26
|
+
{ label: 'LIQUIDITY', value: `$${formatCompact(data.liquidity_usd ?? 0)}`, color: 'text-cyan-400' },
|
|
27
|
+
{ label: 'FDV', value: `$${formatCompact(data.fdv ?? 0)}`, color: 'text-white' },
|
|
28
|
+
];
|
|
29
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3 mb-6", children: stats.map((stat) => ((0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg p-4 hover:border-cyan-400/50 transition-colors", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-neutral-400 text-[10px] font-mono mb-1 tracking-wider", children: stat.label }), (0, jsx_runtime_1.jsx)("div", { className: `text-xl font-bold font-mono ${stat.color}`, children: stat.value })] }, stat.label))) }));
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function MicrocosmMiningWeight(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// AI-generated · AI-managed · AI-maintained
|
|
3
|
+
'use client';
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.MicrocosmMiningWeight = MicrocosmMiningWeight;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const auth_react_1 = require("@microcosmmoney/auth-react");
|
|
8
|
+
const auth_core_1 = require("@microcosmmoney/auth-core");
|
|
9
|
+
const RANK_LABELS = {
|
|
10
|
+
Recruit: 'Recruit',
|
|
11
|
+
Prospect: 'Prospect',
|
|
12
|
+
Miner: 'Miner',
|
|
13
|
+
Commander: 'Commander',
|
|
14
|
+
Pioneer: 'Pioneer',
|
|
15
|
+
Warden: 'Warden',
|
|
16
|
+
Admiral: 'Admiral',
|
|
17
|
+
};
|
|
18
|
+
const RANK_COLORS = {
|
|
19
|
+
Recruit: 'text-neutral-500',
|
|
20
|
+
Prospect: 'text-neutral-400',
|
|
21
|
+
Miner: 'text-cyan-300',
|
|
22
|
+
Commander: 'text-white',
|
|
23
|
+
Pioneer: 'text-cyan-400',
|
|
24
|
+
Warden: 'text-cyan-300',
|
|
25
|
+
Admiral: 'text-cyan-300',
|
|
26
|
+
};
|
|
27
|
+
function getCompanionYield(rank) {
|
|
28
|
+
if (!rank)
|
|
29
|
+
return [];
|
|
30
|
+
if (rank === auth_core_1.UserRank.RECRUIT || rank === auth_core_1.UserRank.PROSPECT) {
|
|
31
|
+
return [
|
|
32
|
+
{ label: 'Team', share: '100%', type: 'MCC' },
|
|
33
|
+
];
|
|
34
|
+
}
|
|
35
|
+
return [
|
|
36
|
+
{ label: 'Team', share: '10%', type: 'MCC' },
|
|
37
|
+
{ label: 'Magistrate', share: '10%', type: 'MCC' },
|
|
38
|
+
{ label: 'Station Vault', share: '30%', type: 'MCD' },
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
function MicrocosmMiningWeight() {
|
|
42
|
+
const { data, loading } = (0, auth_react_1.useUserLevel)();
|
|
43
|
+
const rank = data?.level ?? null;
|
|
44
|
+
const miningDays = data?.upgrade_progress?.current_days ?? 0;
|
|
45
|
+
const companionYield = getCompanionYield(rank);
|
|
46
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg h-full hover:border-cyan-400/50 transition-colors", children: (0, jsx_runtime_1.jsx)("div", { className: "p-6", children: loading ? ((0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-center py-12", children: (0, jsx_runtime_1.jsx)("span", { className: "inline-block w-5 h-5 border-2 border-cyan-400 border-t-transparent rounded-full animate-spin" }) })) : ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-3 gap-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-800 rounded p-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-neutral-400 text-xs font-mono tracking-wider mb-1", children: "level" }), (0, jsx_runtime_1.jsx)("div", { className: `text-sm font-bold font-mono ${RANK_COLORS[rank ?? ''] ?? 'text-neutral-500'}`, children: rank ? RANK_LABELS[rank] ?? rank : 'N/A' })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-800 rounded p-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-neutral-400 text-xs font-mono tracking-wider mb-1", children: "tech_tree" }), (0, jsx_runtime_1.jsx)("div", { className: "text-sm font-bold font-mono text-white", children: "-10%" }), (0, jsx_runtime_1.jsx)("div", { className: "text-[10px] text-neutral-500 font-mono", children: "mining discount" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-800 rounded p-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-neutral-400 text-xs font-mono tracking-wider mb-1", children: "mining_days" }), (0, jsx_runtime_1.jsx)("div", { className: "text-sm font-bold font-mono text-white", children: miningDays }), (0, jsx_runtime_1.jsx)("div", { className: "text-[10px] text-neutral-500 font-mono", children: "cumulative" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-800 rounded p-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-neutral-400 text-xs font-mono tracking-wider mb-3", children: "companion_yield" }), (0, jsx_runtime_1.jsx)("p", { className: "text-[10px] text-neutral-500 font-mono mb-3", children: "Each mining produces companion yield, auto-injected into territory ecosystem" }), (0, jsx_runtime_1.jsx)("div", { className: "space-y-2", children: companionYield.map((row) => ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between px-2 py-1.5 bg-neutral-900 rounded hover:bg-neutral-700 transition-colors", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-xs font-mono text-neutral-300", children: row.label }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-xs font-mono font-bold text-white", children: row.share }), (0, jsx_runtime_1.jsx)("span", { className: "text-[10px] font-mono px-1.5 py-0.5 rounded bg-cyan-400/20 text-cyan-400", children: row.type })] })] }, row.label))) }), rank && (rank === auth_core_1.UserRank.RECRUIT || rank === auth_core_1.UserRank.PROSPECT) && ((0, jsx_runtime_1.jsx)("div", { className: "mt-3 text-[10px] text-neutral-500 font-mono border-t border-neutral-700 pt-2", children: "Upgrade to Miner to unlock Magistrate + Station Vault distribution" }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-[10px] text-neutral-500 font-mono space-y-1", children: [(0, jsx_runtime_1.jsx)("div", { children: "Mining price = Oracle price \u00D7 2 (user receives 100% MCC)" }), (0, jsx_runtime_1.jsx)("div", { children: "Companion yield syncs 1:1 with user mining amount" })] })] })) }) }));
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function MicrocosmMintingStats(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// AI-generated · AI-managed · AI-maintained
|
|
3
|
+
'use client';
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.MicrocosmMintingStats = MicrocosmMintingStats;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const auth_react_1 = require("@microcosmmoney/auth-react");
|
|
8
|
+
function MicrocosmMintingStats() {
|
|
9
|
+
const { data, loading } = (0, auth_react_1.useMiningRatio)();
|
|
10
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg h-full hover:border-cyan-400/50 transition-colors", children: (0, jsx_runtime_1.jsx)("div", { className: "p-6", children: loading ? ((0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-center py-8", children: (0, jsx_runtime_1.jsx)("span", { className: "inline-block w-5 h-5 border-2 border-cyan-400 border-t-transparent rounded-full animate-spin" }) })) : data ? ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-800 rounded p-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-400 font-mono tracking-wider mb-1", children: "total_minted" }), (0, jsx_runtime_1.jsxs)("div", { className: "text-xl font-bold font-mono text-white", children: [(data.total_minted ?? 0).toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 }), " MCC"] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-800 rounded p-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-400 font-mono tracking-wider mb-1", children: "current_rate" }), (0, jsx_runtime_1.jsxs)("div", { className: "text-xl font-bold font-mono text-cyan-400", children: ["1:", (data.usdc_per_mcc ?? 0).toFixed(2)] })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-neutral-800 rounded p-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between items-center mb-2 text-sm font-mono", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-neutral-400", children: "next_halving" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-white", children: [(Math.ceil((data.total_minted ?? 0) / 100000000 + 1) * 100000000 - (data.total_minted ?? 0)).toLocaleString('en-US', { maximumFractionDigits: 0 }), " MCC"] })] }), (0, jsx_runtime_1.jsx)("div", { className: "w-full 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: {
|
|
11
|
+
width: `${((data.total_minted ?? 0) % 100000000) / 100000000 * 100}%`,
|
|
12
|
+
} }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between items-center mt-2 text-xs text-neutral-500 font-mono", children: [(0, jsx_runtime_1.jsxs)("span", { children: ["phase: ", data.current_stage ?? 1] }), (0, jsx_runtime_1.jsx)("span", { children: "threshold: 100M" })] })] })] })) : ((0, jsx_runtime_1.jsxs)("div", { className: "text-center py-8 text-neutral-500 font-mono", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-cyan-400", children: "warning:" }), " no minting data"] })) }) }));
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function MicrocosmPriceChart(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// AI-generated · AI-managed · AI-maintained
|
|
3
|
+
'use client';
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.MicrocosmPriceChart = MicrocosmPriceChart;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const auth_react_1 = require("@microcosmmoney/auth-react");
|
|
9
|
+
const recharts_1 = require("recharts");
|
|
10
|
+
const timeRanges = [
|
|
11
|
+
{ label: '1D', value: '1D' },
|
|
12
|
+
{ label: '7D', value: '7D' },
|
|
13
|
+
{ label: '30D', value: '30D' },
|
|
14
|
+
];
|
|
15
|
+
function MicrocosmPriceChart() {
|
|
16
|
+
const [range, setRange] = (0, react_1.useState)('7D');
|
|
17
|
+
const { data, loading } = (0, auth_react_1.usePriceHistory)(range);
|
|
18
|
+
const chartData = data?.map((item) => ({
|
|
19
|
+
time: item.timestamp * 1000,
|
|
20
|
+
price: item.close,
|
|
21
|
+
})) || [];
|
|
22
|
+
const prices = chartData.map((d) => d.price);
|
|
23
|
+
const minPrice = prices.length > 0 ? Math.min(...prices) * 0.995 : 0;
|
|
24
|
+
const maxPrice = prices.length > 0 ? Math.max(...prices) * 1.005 : 1;
|
|
25
|
+
const formatTime = (ts) => {
|
|
26
|
+
const d = new Date(ts);
|
|
27
|
+
if (range === '1D')
|
|
28
|
+
return d.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit', hour12: false });
|
|
29
|
+
return d.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
|
|
30
|
+
};
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "bg-neutral-900 border border-neutral-700 rounded-lg overflow-hidden h-full flex flex-col hover:border-cyan-400/50 transition-colors", children: (0, jsx_runtime_1.jsxs)("div", { className: "p-6 flex-1 flex flex-col", 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
|
|
32
|
+
? 'bg-cyan-700 text-white'
|
|
33
|
+
: 'text-neutral-500 hover:text-neutral-300'}`, children: tr.label }, tr.value))) }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex-1 min-h-[200px]", 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: "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: "mcPriceGradient", x1: "0", y1: "0", x2: "0", y2: "1", children: [(0, jsx_runtime_1.jsx)("stop", { offset: "5%", stopColor: "#22d3ee", stopOpacity: 0.3 }), (0, jsx_runtime_1.jsx)("stop", { offset: "95%", stopColor: "#22d3ee", stopOpacity: 0 })] }) }), (0, jsx_runtime_1.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: {
|
|
34
|
+
backgroundColor: '#171717',
|
|
35
|
+
border: '1px solid #404040',
|
|
36
|
+
borderRadius: '6px',
|
|
37
|
+
fontFamily: 'monospace',
|
|
38
|
+
fontSize: '11px',
|
|
39
|
+
}, 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: "#22d3ee", strokeWidth: 2, fill: "url(#mcPriceGradient)" })] }) })) })] }) }));
|
|
40
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// AI-generated · AI-managed · AI-maintained
|
|
3
|
+
'use client';
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.MicrocosmQuickActions = MicrocosmQuickActions;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const actions = [
|
|
8
|
+
{ label: 'Mining', path: '/mcc/mining', color: 'text-cyan-300 border-cyan-400/30 hover:bg-cyan-950/30' },
|
|
9
|
+
{ label: 'Reincarnation', path: '/mcc/reincarnation', color: 'text-white border-neutral-700 hover:bg-neutral-800' },
|
|
10
|
+
{ label: 'Jupiter Trade', href: 'https://jup.ag/swap/USDT-MCCpDtigJLYnfGe1fW5xrSA8AXo6AeAj8ECE7wVqP5e', color: 'text-cyan-300 border-cyan-400/30 hover:bg-cyan-950/30', external: true },
|
|
11
|
+
{ label: 'Market Data', path: '/market', color: 'text-white border-neutral-700 hover:bg-neutral-800' },
|
|
12
|
+
];
|
|
13
|
+
function MicrocosmQuickActions({ basePath = '', onNavigate }) {
|
|
14
|
+
const resolvePath = (p) => basePath ? `${basePath.replace(/\/$/, '')}${p}` : p;
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "mb-6", children: (0, jsx_runtime_1.jsx)("div", { className: "grid grid-cols-2 lg:grid-cols-4 gap-3", children: actions.map((action) => {
|
|
16
|
+
const content = ((0, jsx_runtime_1.jsx)("div", { className: `bg-neutral-900 border ${action.color} rounded-lg p-4 flex items-center gap-3 cursor-pointer active:scale-[0.98] transition-colors`, children: (0, jsx_runtime_1.jsx)("span", { className: "font-mono text-sm font-bold tracking-wider", children: action.label }) }));
|
|
17
|
+
if ('external' in action && action.external) {
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)("a", { href: action.href, target: "_blank", rel: "noopener noreferrer", children: content }, action.label));
|
|
19
|
+
}
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)("div", { onClick: () => onNavigate?.(resolvePath(action.path)), role: "button", tabIndex: 0, onKeyDown: (e) => e.key === 'Enter' && onNavigate?.(resolvePath(action.path)), children: content }, action.label));
|
|
21
|
+
}) }) }));
|
|
22
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -23,3 +23,14 @@ export { VoteResultBar } from './components/vote-result-bar';
|
|
|
23
23
|
export type { VoteOption, VoteResultBarProps } from './components/vote-result-bar';
|
|
24
24
|
export { KPIRadialChart } from './components/kpi-radial-chart';
|
|
25
25
|
export type { KPIRadialChartProps } from './components/kpi-radial-chart';
|
|
26
|
+
export { MicrocosmDashboardOverview } from './components/dashboard/dashboard-overview';
|
|
27
|
+
export type { MicrocosmDashboardOverviewProps } from './components/dashboard/dashboard-overview';
|
|
28
|
+
export { MicrocosmMarketBar } from './components/dashboard/market-overview-bar';
|
|
29
|
+
export { MicrocosmQuickActions } from './components/dashboard/quick-actions';
|
|
30
|
+
export type { MicrocosmQuickActionsProps } from './components/dashboard/quick-actions';
|
|
31
|
+
export { MicrocosmAssetsSummary } from './components/dashboard/assets-summary';
|
|
32
|
+
export type { MicrocosmAssetsSummaryProps } from './components/dashboard/assets-summary';
|
|
33
|
+
export { MicrocosmPriceChart } from './components/dashboard/price-chart';
|
|
34
|
+
export { MicrocosmMintingStats } from './components/dashboard/minting-stats';
|
|
35
|
+
export { MicrocosmMiningWeight } from './components/dashboard/mining-weight';
|
|
36
|
+
export { MicrocosmLockPeriods } from './components/dashboard/lock-periods';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KPIRadialChart = exports.VoteResultBar = exports.MiningProgressBar = exports.TerritoryCard = exports.TerminalTooltip = exports.TerminalInput = exports.TerminalCountdown = exports.TerminalDialog = exports.TerminalTabs = exports.TerminalTable = exports.TerminalProgress = exports.TerminalDataRow = exports.TerminalBadge = exports.TerminalEmpty = exports.TerminalError = exports.TerminalLoading = exports.TerminalPageHeader = exports.TerminalCommand = exports.StatBox = exports.TerminalCard = exports.resolveMenuPath = exports.getAllMenuItems = exports.microcosmMenuGroups = exports.dashboardMenu = exports.web3OsMenu = exports.blockchainMenu = exports.MicrocosmMenuSection = void 0;
|
|
3
|
+
exports.MicrocosmLockPeriods = exports.MicrocosmMiningWeight = exports.MicrocosmMintingStats = exports.MicrocosmPriceChart = exports.MicrocosmAssetsSummary = exports.MicrocosmQuickActions = exports.MicrocosmMarketBar = exports.MicrocosmDashboardOverview = exports.KPIRadialChart = exports.VoteResultBar = exports.MiningProgressBar = exports.TerritoryCard = exports.TerminalTooltip = exports.TerminalInput = exports.TerminalCountdown = exports.TerminalDialog = exports.TerminalTabs = exports.TerminalTable = exports.TerminalProgress = exports.TerminalDataRow = exports.TerminalBadge = exports.TerminalEmpty = exports.TerminalError = exports.TerminalLoading = exports.TerminalPageHeader = exports.TerminalCommand = exports.StatBox = exports.TerminalCard = exports.resolveMenuPath = exports.getAllMenuItems = exports.microcosmMenuGroups = exports.dashboardMenu = exports.web3OsMenu = exports.blockchainMenu = exports.MicrocosmMenuSection = void 0;
|
|
4
4
|
// AI-generated · AI-managed · AI-maintained
|
|
5
5
|
var menu_section_1 = require("./components/menu-section");
|
|
6
6
|
Object.defineProperty(exports, "MicrocosmMenuSection", { enumerable: true, get: function () { return menu_section_1.MicrocosmMenuSection; } });
|
|
@@ -42,3 +42,19 @@ var vote_result_bar_1 = require("./components/vote-result-bar");
|
|
|
42
42
|
Object.defineProperty(exports, "VoteResultBar", { enumerable: true, get: function () { return vote_result_bar_1.VoteResultBar; } });
|
|
43
43
|
var kpi_radial_chart_1 = require("./components/kpi-radial-chart");
|
|
44
44
|
Object.defineProperty(exports, "KPIRadialChart", { enumerable: true, get: function () { return kpi_radial_chart_1.KPIRadialChart; } });
|
|
45
|
+
var dashboard_overview_1 = require("./components/dashboard/dashboard-overview");
|
|
46
|
+
Object.defineProperty(exports, "MicrocosmDashboardOverview", { enumerable: true, get: function () { return dashboard_overview_1.MicrocosmDashboardOverview; } });
|
|
47
|
+
var market_overview_bar_1 = require("./components/dashboard/market-overview-bar");
|
|
48
|
+
Object.defineProperty(exports, "MicrocosmMarketBar", { enumerable: true, get: function () { return market_overview_bar_1.MicrocosmMarketBar; } });
|
|
49
|
+
var quick_actions_1 = require("./components/dashboard/quick-actions");
|
|
50
|
+
Object.defineProperty(exports, "MicrocosmQuickActions", { enumerable: true, get: function () { return quick_actions_1.MicrocosmQuickActions; } });
|
|
51
|
+
var assets_summary_1 = require("./components/dashboard/assets-summary");
|
|
52
|
+
Object.defineProperty(exports, "MicrocosmAssetsSummary", { enumerable: true, get: function () { return assets_summary_1.MicrocosmAssetsSummary; } });
|
|
53
|
+
var price_chart_1 = require("./components/dashboard/price-chart");
|
|
54
|
+
Object.defineProperty(exports, "MicrocosmPriceChart", { enumerable: true, get: function () { return price_chart_1.MicrocosmPriceChart; } });
|
|
55
|
+
var minting_stats_1 = require("./components/dashboard/minting-stats");
|
|
56
|
+
Object.defineProperty(exports, "MicrocosmMintingStats", { enumerable: true, get: function () { return minting_stats_1.MicrocosmMintingStats; } });
|
|
57
|
+
var mining_weight_1 = require("./components/dashboard/mining-weight");
|
|
58
|
+
Object.defineProperty(exports, "MicrocosmMiningWeight", { enumerable: true, get: function () { return mining_weight_1.MicrocosmMiningWeight; } });
|
|
59
|
+
var lock_periods_1 = require("./components/dashboard/lock-periods");
|
|
60
|
+
Object.defineProperty(exports, "MicrocosmLockPeriods", { enumerable: true, get: function () { return lock_periods_1.MicrocosmLockPeriods; } });
|
package/package.json
CHANGED
|
@@ -1,26 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microcosmmoney/portal-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Microcosm Portal UI components for React/Next.js",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
-
"files": [
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
8
10
|
"scripts": {
|
|
9
11
|
"build": "tsc",
|
|
10
12
|
"dev": "tsc --watch"
|
|
11
13
|
},
|
|
12
14
|
"peerDependencies": {
|
|
13
15
|
"react": ">=18.0.0",
|
|
14
|
-
"react-dom": ">=18.0.0"
|
|
16
|
+
"react-dom": ">=18.0.0",
|
|
17
|
+
"recharts": ">=2.0.0"
|
|
15
18
|
},
|
|
16
19
|
"dependencies": {
|
|
17
|
-
"@microcosmmoney/auth-core": "^1.
|
|
18
|
-
"@microcosmmoney/auth-react": "^1.
|
|
20
|
+
"@microcosmmoney/auth-core": "^1.4.0",
|
|
21
|
+
"@microcosmmoney/auth-react": "^1.4.0",
|
|
19
22
|
"lucide-react": ">=0.300.0"
|
|
20
23
|
},
|
|
21
24
|
"devDependencies": {
|
|
22
25
|
"@types/react": "^18.0.0",
|
|
23
26
|
"react": "^18.0.0",
|
|
27
|
+
"recharts": "^3.7.0",
|
|
24
28
|
"typescript": "^5.3.0"
|
|
25
29
|
},
|
|
26
30
|
"license": "MIT",
|