@microcosmmoney/portal-react 3.12.8 → 3.13.1
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/index.d.ts +22 -0
- package/dist/index.js +48 -1
- package/dist/main-portal/components/auctions/AuctionsPage.d.ts +1 -0
- package/dist/main-portal/components/auctions/AuctionsPage.js +218 -0
- package/dist/main-portal/components/data/asset-stats.d.ts +1 -0
- package/dist/main-portal/components/data/asset-stats.js +33 -0
- package/dist/main-portal/components/data/charts/MCCSupplyChart.d.ts +7 -0
- package/dist/main-portal/components/data/charts/MCCSupplyChart.js +27 -0
- package/dist/main-portal/components/data/charts/MiningTrendChart.d.ts +7 -0
- package/dist/main-portal/components/data/charts/MiningTrendChart.js +39 -0
- package/dist/main-portal/components/data/charts/PriceChart.d.ts +5 -0
- package/dist/main-portal/components/data/charts/PriceChart.js +99 -0
- package/dist/main-portal/components/data/charts/TeamWalletChart.d.ts +7 -0
- package/dist/main-portal/components/data/charts/TeamWalletChart.js +33 -0
- package/dist/main-portal/components/data/charts/TerritoryProgressChart.d.ts +7 -0
- package/dist/main-portal/components/data/charts/TerritoryProgressChart.js +35 -0
- package/dist/main-portal/components/data/charts/UserLevelPieChart.d.ts +7 -0
- package/dist/main-portal/components/data/charts/UserLevelPieChart.js +34 -0
- package/dist/main-portal/components/data/charts/index.d.ts +5 -0
- package/dist/main-portal/components/data/charts/index.js +14 -0
- package/dist/main-portal/components/data/data-hero.d.ts +1 -0
- package/dist/main-portal/components/data/data-hero.js +81 -0
- package/dist/main-portal/components/data/mining-history-stats.d.ts +1 -0
- package/dist/main-portal/components/data/mining-history-stats.js +44 -0
- package/dist/main-portal/components/data/team-wallet-stats.d.ts +1 -0
- package/dist/main-portal/components/data/team-wallet-stats.js +34 -0
- package/dist/main-portal/components/data/territory-stats.d.ts +1 -0
- package/dist/main-portal/components/data/territory-stats.js +48 -0
- package/dist/main-portal/components/data/user-level-stats.d.ts +1 -0
- package/dist/main-portal/components/data/user-level-stats.js +36 -0
- package/dist/main-portal/components/fragment/FragmentPage.d.ts +1 -0
- package/dist/main-portal/components/fragment/FragmentPage.js +13 -0
- package/dist/main-portal/components/income/ManagerIncomePage.d.ts +1 -0
- package/dist/main-portal/components/income/ManagerIncomePage.js +147 -0
- package/dist/main-portal/components/layout/AppSidebar.d.ts +3 -0
- package/dist/main-portal/components/layout/AppSidebar.js +88 -0
- package/dist/main-portal/components/layout/DashboardHeader.d.ts +1 -0
- package/dist/main-portal/components/layout/DashboardHeader.js +121 -0
- package/dist/main-portal/components/layout/LocaleSwitcher.d.ts +1 -0
- package/dist/main-portal/components/layout/LocaleSwitcher.js +30 -0
- package/dist/main-portal/components/layout/MainFooter.d.ts +2 -0
- package/dist/main-portal/components/layout/MainFooter.js +50 -0
- package/dist/main-portal/components/layout/ShadcnNavbar.d.ts +1 -0
- package/dist/main-portal/components/layout/ShadcnNavbar.js +155 -0
- package/dist/main-portal/components/layout/TerminalSidebar.d.ts +1 -0
- package/dist/main-portal/components/layout/TerminalSidebar.js +110 -0
- package/dist/main-portal/components/lending/LendingPage.d.ts +1 -0
- package/dist/main-portal/components/lending/LendingPage.js +20 -0
- package/dist/main-portal/components/mcd/MCDPage.d.ts +1 -0
- package/dist/main-portal/components/mcd/MCDPage.js +125 -0
- package/dist/main-portal/components/messages/MessagesPage.d.ts +1 -0
- package/dist/main-portal/components/messages/MessagesPage.js +13 -0
- package/dist/main-portal/components/mining/MiningDistributionHistory.d.ts +11 -0
- package/dist/main-portal/components/mining/MiningDistributionHistory.js +84 -0
- package/dist/main-portal/components/mining/MiningModal.d.ts +12 -0
- package/dist/main-portal/components/mining/MiningModal.js +302 -0
- package/dist/main-portal/components/mining/MiningPage.d.ts +1 -0
- package/dist/main-portal/components/mining/MiningPage.js +237 -0
- package/dist/main-portal/components/mining/index.d.ts +1 -0
- package/dist/main-portal/components/mining/index.js +6 -0
- package/dist/main-portal/components/notifications/NotificationsPage.d.ts +1 -0
- package/dist/main-portal/components/notifications/NotificationsPage.js +13 -0
- package/dist/main-portal/components/organization/OrganizationPage.d.ts +1 -0
- package/dist/main-portal/components/organization/OrganizationPage.js +235 -0
- package/dist/main-portal/components/organization/connection-line.d.ts +12 -0
- package/dist/main-portal/components/organization/connection-line.js +38 -0
- package/dist/main-portal/components/organization/diagram-node.d.ts +17 -0
- package/dist/main-portal/components/organization/diagram-node.js +105 -0
- package/dist/main-portal/components/organization/system-panel.d.ts +11 -0
- package/dist/main-portal/components/organization/system-panel.js +72 -0
- package/dist/main-portal/components/profile/EmailChangeCard.d.ts +1 -0
- package/dist/main-portal/components/profile/EmailChangeCard.js +58 -0
- package/dist/main-portal/components/profile/ProfilePage.d.ts +1 -0
- package/dist/main-portal/components/profile/ProfilePage.js +263 -0
- package/dist/main-portal/components/profile/TwoFactorSettings.d.ts +1 -0
- package/dist/main-portal/components/profile/TwoFactorSettings.js +99 -0
- package/dist/main-portal/components/providers/ClientProviders.d.ts +6 -0
- package/dist/main-portal/components/providers/ClientProviders.js +17 -0
- package/dist/main-portal/components/providers/SolanaWalletProvider.d.ts +7 -0
- package/dist/main-portal/components/providers/SolanaWalletProvider.js +17 -0
- package/dist/main-portal/components/providers/theme-provider.d.ts +5 -0
- package/dist/main-portal/components/providers/theme-provider.js +10 -0
- package/dist/main-portal/components/queue/QueueStatusPage.d.ts +1 -0
- package/dist/main-portal/components/queue/QueueStatusPage.js +245 -0
- package/dist/main-portal/components/reincarnation/ReincarnationPage.d.ts +1 -0
- package/dist/main-portal/components/reincarnation/ReincarnationPage.js +87 -0
- package/dist/main-portal/components/resources/mcc-stats-section.d.ts +1 -0
- package/dist/main-portal/components/resources/mcc-stats-section.js +199 -0
- package/dist/main-portal/components/resources/mcd-stats-section.d.ts +1 -0
- package/dist/main-portal/components/resources/mcd-stats-section.js +76 -0
- package/dist/main-portal/components/resources/minting-entry-section.d.ts +1 -0
- package/dist/main-portal/components/resources/minting-entry-section.js +70 -0
- package/dist/main-portal/components/resources/public-mining-modal.d.ts +7 -0
- package/dist/main-portal/components/resources/public-mining-modal.js +239 -0
- package/dist/main-portal/components/resources/recycle-pool-section.d.ts +1 -0
- package/dist/main-portal/components/resources/recycle-pool-section.js +82 -0
- package/dist/main-portal/components/resources/registration-prompt.d.ts +8 -0
- package/dist/main-portal/components/resources/registration-prompt.js +13 -0
- package/dist/main-portal/components/rewards/RewardsPage.d.ts +1 -0
- package/dist/main-portal/components/rewards/RewardsPage.js +149 -0
- package/dist/main-portal/components/security/domain-verification-bar.d.ts +1 -0
- package/dist/main-portal/components/security/domain-verification-bar.js +32 -0
- package/dist/main-portal/components/stations/StationDetailPage.d.ts +5 -0
- package/dist/main-portal/components/stations/StationDetailPage.js +232 -0
- package/dist/main-portal/components/stations/StationIncomeChart.d.ts +11 -0
- package/dist/main-portal/components/stations/StationIncomeChart.js +57 -0
- package/dist/main-portal/components/stations/StationKPIHistory.d.ts +1 -0
- package/dist/main-portal/components/stations/StationKPIHistory.js +7 -0
- package/dist/main-portal/components/stations/StationListPage.d.ts +1 -0
- package/dist/main-portal/components/stations/StationListPage.js +341 -0
- package/dist/main-portal/components/stations/StationMemberRanking.d.ts +13 -0
- package/dist/main-portal/components/stations/StationMemberRanking.js +64 -0
- package/dist/main-portal/components/stations/StationSummaryCards.d.ts +13 -0
- package/dist/main-portal/components/stations/StationSummaryCards.js +30 -0
- package/dist/main-portal/components/stations/StationsPage.d.ts +1 -0
- package/dist/main-portal/components/stations/StationsPage.js +239 -0
- package/dist/main-portal/components/territory/TerritoryNFTBrowser.d.ts +1 -0
- package/dist/main-portal/components/territory/TerritoryNFTBrowser.js +147 -0
- package/dist/main-portal/components/ui/accordion.d.ts +7 -0
- package/dist/main-portal/components/ui/accordion.js +57 -0
- package/dist/main-portal/components/ui/alert-dialog.d.ts +14 -0
- package/dist/main-portal/components/ui/alert-dialog.js +85 -0
- package/dist/main-portal/components/ui/alert.d.ts +9 -0
- package/dist/main-portal/components/ui/alert.js +28 -0
- package/dist/main-portal/components/ui/aspect-ratio.d.ts +3 -0
- package/dist/main-portal/components/ui/aspect-ratio.js +43 -0
- package/dist/main-portal/components/ui/avatar.d.ts +6 -0
- package/dist/main-portal/components/ui/avatar.js +52 -0
- package/dist/main-portal/components/ui/badge.d.ts +9 -0
- package/dist/main-portal/components/ui/badge.js +26 -0
- package/dist/main-portal/components/ui/breadcrumb.d.ts +11 -0
- package/dist/main-portal/components/ui/breadcrumb.js +35 -0
- package/dist/main-portal/components/ui/button-group.d.ts +11 -0
- package/dist/main-portal/components/ui/button-group.js +34 -0
- package/dist/main-portal/components/ui/button.d.ts +10 -0
- package/dist/main-portal/components/ui/button.js +35 -0
- package/dist/main-portal/components/ui/calendar.d.ts +8 -0
- package/dist/main-portal/components/ui/calendar.js +111 -0
- package/dist/main-portal/components/ui/card.d.ts +17 -0
- package/dist/main-portal/components/ui/card.js +41 -0
- package/dist/main-portal/components/ui/carousel.d.ts +19 -0
- package/dist/main-portal/components/ui/carousel.js +134 -0
- package/dist/main-portal/components/ui/chart.d.ts +40 -0
- package/dist/main-portal/components/ui/chart.js +168 -0
- package/dist/main-portal/components/ui/checkbox.d.ts +4 -0
- package/dist/main-portal/components/ui/checkbox.js +45 -0
- package/dist/main-portal/components/ui/collapsible.d.ts +5 -0
- package/dist/main-portal/components/ui/collapsible.js +51 -0
- package/dist/main-portal/components/ui/command.d.ts +18 -0
- package/dist/main-portal/components/ui/command.js +45 -0
- package/dist/main-portal/components/ui/context-menu.d.ts +25 -0
- package/dist/main-portal/components/ui/context-menu.js +101 -0
- package/dist/main-portal/components/ui/dialog.d.ts +15 -0
- package/dist/main-portal/components/ui/dialog.js +81 -0
- package/dist/main-portal/components/ui/drawer.d.ts +13 -0
- package/dist/main-portal/components/ui/drawer.js +47 -0
- package/dist/main-portal/components/ui/dropdown-menu.d.ts +25 -0
- package/dist/main-portal/components/ui/dropdown-menu.js +101 -0
- package/dist/main-portal/components/ui/empty.d.ts +11 -0
- package/dist/main-portal/components/ui/empty.js +41 -0
- package/dist/main-portal/components/ui/field.d.ts +24 -0
- package/dist/main-portal/components/ui/field.js +85 -0
- package/dist/main-portal/components/ui/form.d.ts +24 -0
- package/dist/main-portal/components/ui/form.js +103 -0
- package/dist/main-portal/components/ui/hover-avatar.d.ts +10 -0
- package/dist/main-portal/components/ui/hover-avatar.js +70 -0
- package/dist/main-portal/components/ui/hover-card.d.ts +6 -0
- package/dist/main-portal/components/ui/hover-card.js +52 -0
- package/dist/main-portal/components/ui/input-group.d.ts +15 -0
- package/dist/main-portal/components/ui/input-group.js +65 -0
- package/dist/main-portal/components/ui/input-otp.d.ts +11 -0
- package/dist/main-portal/components/ui/input-otp.js +60 -0
- package/dist/main-portal/components/ui/input.d.ts +3 -0
- package/dist/main-portal/components/ui/input.js +8 -0
- package/dist/main-portal/components/ui/item.d.ts +23 -0
- package/dist/main-portal/components/ui/item.js +77 -0
- package/dist/main-portal/components/ui/kbd.d.ts +3 -0
- package/dist/main-portal/components/ui/kbd.js +13 -0
- package/dist/main-portal/components/ui/label.d.ts +4 -0
- package/dist/main-portal/components/ui/label.js +44 -0
- package/dist/main-portal/components/ui/menubar.d.ts +26 -0
- package/dist/main-portal/components/ui/menubar.js +105 -0
- package/dist/main-portal/components/ui/navigation-menu.d.ts +14 -0
- package/dist/main-portal/components/ui/navigation-menu.js +75 -0
- package/dist/main-portal/components/ui/pagination.d.ts +13 -0
- package/dist/main-portal/components/ui/pagination.js +37 -0
- package/dist/main-portal/components/ui/popover.d.ts +7 -0
- package/dist/main-portal/components/ui/popover.js +56 -0
- package/dist/main-portal/components/ui/progress.d.ts +4 -0
- package/dist/main-portal/components/ui/progress.js +44 -0
- package/dist/main-portal/components/ui/radio-group.d.ts +5 -0
- package/dist/main-portal/components/ui/radio-group.js +49 -0
- package/dist/main-portal/components/ui/resizable.d.ts +8 -0
- package/dist/main-portal/components/ui/resizable.js +53 -0
- package/dist/main-portal/components/ui/scroll-area.d.ts +5 -0
- package/dist/main-portal/components/ui/scroll-area.js +50 -0
- package/dist/main-portal/components/ui/select.d.ts +15 -0
- package/dist/main-portal/components/ui/select.js +83 -0
- package/dist/main-portal/components/ui/separator.d.ts +4 -0
- package/dist/main-portal/components/ui/separator.js +44 -0
- package/dist/main-portal/components/ui/sheet.d.ts +13 -0
- package/dist/main-portal/components/ui/sheet.js +83 -0
- package/dist/main-portal/components/ui/sidebar.d.ts +69 -0
- package/dist/main-portal/components/ui/sidebar.js +258 -0
- package/dist/main-portal/components/ui/skeleton.d.ts +2 -0
- package/dist/main-portal/components/ui/skeleton.js +9 -0
- package/dist/main-portal/components/ui/slider.d.ts +4 -0
- package/dist/main-portal/components/ui/slider.js +50 -0
- package/dist/main-portal/components/ui/sonner.d.ts +3 -0
- package/dist/main-portal/components/ui/sonner.js +17 -0
- package/dist/main-portal/components/ui/spinner.d.ts +2 -0
- package/dist/main-portal/components/ui/spinner.js +10 -0
- package/dist/main-portal/components/ui/switch.d.ts +4 -0
- package/dist/main-portal/components/ui/switch.js +44 -0
- package/dist/main-portal/components/ui/table.d.ts +10 -0
- package/dist/main-portal/components/ui/table.js +38 -0
- package/dist/main-portal/components/ui/tabs.d.ts +7 -0
- package/dist/main-portal/components/ui/tabs.js +53 -0
- package/dist/main-portal/components/ui/terminal.d.ts +49 -0
- package/dist/main-portal/components/ui/terminal.js +56 -0
- package/dist/main-portal/components/ui/textarea.d.ts +3 -0
- package/dist/main-portal/components/ui/textarea.js +8 -0
- package/dist/main-portal/components/ui/time-remaining.d.ts +54 -0
- package/dist/main-portal/components/ui/time-remaining.js +223 -0
- package/dist/main-portal/components/ui/toast.d.ts +15 -0
- package/dist/main-portal/components/ui/toast.js +77 -0
- package/dist/main-portal/components/ui/toaster.d.ts +1 -0
- package/dist/main-portal/components/ui/toaster.js +14 -0
- package/dist/main-portal/components/ui/toggle-group.d.ts +7 -0
- package/dist/main-portal/components/ui/toggle-group.js +58 -0
- package/dist/main-portal/components/ui/toggle.d.ts +9 -0
- package/dist/main-portal/components/ui/toggle.js +64 -0
- package/dist/main-portal/components/ui/tooltip.d.ts +7 -0
- package/dist/main-portal/components/ui/tooltip.js +56 -0
- package/dist/main-portal/components/ui/use-mobile.d.ts +1 -0
- package/dist/main-portal/components/ui/use-mobile.js +53 -0
- package/dist/main-portal/components/voting/VotingPage.d.ts +1 -0
- package/dist/main-portal/components/voting/VotingPage.js +14 -0
- package/dist/main-portal/components/wallet/MCCHistory.d.ts +9 -0
- package/dist/main-portal/components/wallet/MCCHistory.js +100 -0
- package/dist/main-portal/components/wallet/WalletManagement.d.ts +5 -0
- package/dist/main-portal/components/wallet/WalletManagement.js +144 -0
- package/dist/main-portal/components/wallet/WalletPage.d.ts +1 -0
- package/dist/main-portal/components/wallet/WalletPage.js +130 -0
- package/dist/main-portal/config/menu-config.d.ts +22 -0
- package/dist/main-portal/config/menu-config.js +167 -0
- package/dist/main-portal/contexts/MCCPriceContext.d.ts +38 -0
- package/dist/main-portal/contexts/MCCPriceContext.js +70 -0
- package/dist/main-portal/contexts/WalletContext.d.ts +48 -0
- package/dist/main-portal/contexts/WalletContext.js +94 -0
- package/dist/main-portal/hooks/index.d.ts +4 -0
- package/dist/main-portal/hooks/index.js +11 -0
- package/dist/main-portal/hooks/use-breakpoint.d.ts +45 -0
- package/dist/main-portal/hooks/use-breakpoint.js +91 -0
- package/dist/main-portal/hooks/use-mobile.d.ts +1 -0
- package/dist/main-portal/hooks/use-mobile.js +55 -0
- package/dist/main-portal/hooks/use-toast.d.ts +44 -0
- package/dist/main-portal/hooks/use-toast.js +164 -0
- package/dist/main-portal/hooks/useAuth.d.ts +30 -0
- package/dist/main-portal/hooks/useAuth.js +136 -0
- package/dist/main-portal/hooks/useMCC.d.ts +26 -0
- package/dist/main-portal/hooks/useMCC.js +148 -0
- package/dist/main-portal/hooks/useMCD.d.ts +17 -0
- package/dist/main-portal/hooks/useMCD.js +114 -0
- package/dist/main-portal/hooks/useMultiWalletBalance.d.ts +31 -0
- package/dist/main-portal/hooks/useMultiWalletBalance.js +65 -0
- package/dist/main-portal/hooks/useSolanaBalance.d.ts +21 -0
- package/dist/main-portal/hooks/useSolanaBalance.js +58 -0
- package/dist/main-portal/hooks/useSpeechRecognition.d.ts +6 -0
- package/dist/main-portal/hooks/useSpeechRecognition.js +82 -0
- package/dist/main-portal/hooks/useStats.d.ts +131 -0
- package/dist/main-portal/hooks/useStats.js +161 -0
- package/dist/main-portal/hooks/useStrategies.d.ts +134 -0
- package/dist/main-portal/hooks/useStrategies.js +28 -0
- package/dist/main-portal/hooks/useUserRank.d.ts +16 -0
- package/dist/main-portal/hooks/useUserRank.js +61 -0
- package/dist/main-portal/hooks/useWalletTokenBalances.d.ts +29 -0
- package/dist/main-portal/hooks/useWalletTokenBalances.js +106 -0
- package/dist/main-portal/i18n/navigation.d.ts +341 -0
- package/dist/main-portal/i18n/navigation.js +7 -0
- package/dist/main-portal/i18n/request.d.ts +2 -0
- package/dist/main-portal/i18n/request.js +47 -0
- package/dist/main-portal/i18n/routing.d.ts +18 -0
- package/dist/main-portal/i18n/routing.js +10 -0
- package/dist/main-portal/lib/ai-chat-config.d.ts +8 -0
- package/dist/main-portal/lib/ai-chat-config.js +144 -0
- package/dist/main-portal/lib/api/blockchain.d.ts +178 -0
- package/dist/main-portal/lib/api/blockchain.js +302 -0
- package/dist/main-portal/lib/api/core.d.ts +3 -0
- package/dist/main-portal/lib/api/core.js +47 -0
- package/dist/main-portal/lib/api/index.d.ts +9 -0
- package/dist/main-portal/lib/api/index.js +37 -0
- package/dist/main-portal/lib/api/services/ai.d.ts +139 -0
- package/dist/main-portal/lib/api/services/ai.js +214 -0
- package/dist/main-portal/lib/api/services/finance.d.ts +37 -0
- package/dist/main-portal/lib/api/services/finance.js +144 -0
- package/dist/main-portal/lib/api/services/index.d.ts +5 -0
- package/dist/main-portal/lib/api/services/index.js +21 -0
- package/dist/main-portal/lib/api/services/mining.d.ts +68 -0
- package/dist/main-portal/lib/api/services/mining.js +76 -0
- package/dist/main-portal/lib/api/services/organization.d.ts +161 -0
- package/dist/main-portal/lib/api/services/organization.js +139 -0
- package/dist/main-portal/lib/api/services/user.d.ts +90 -0
- package/dist/main-portal/lib/api/services/user.js +78 -0
- package/dist/main-portal/lib/api/services.d.ts +1 -0
- package/dist/main-portal/lib/api/services.js +17 -0
- package/dist/main-portal/lib/api-service.d.ts +1 -0
- package/dist/main-portal/lib/api-service.js +18 -0
- package/dist/main-portal/lib/auth-service.d.ts +65 -0
- package/dist/main-portal/lib/auth-service.js +382 -0
- package/dist/main-portal/lib/config/mainstream-tokens.d.ts +13 -0
- package/dist/main-portal/lib/config/mainstream-tokens.js +88 -0
- package/dist/main-portal/lib/docs-data.d.ts +36 -0
- package/dist/main-portal/lib/docs-data.js +108 -0
- package/dist/main-portal/lib/oauth-config.d.ts +12 -0
- package/dist/main-portal/lib/oauth-config.js +48 -0
- package/dist/main-portal/lib/order-id-generator.d.ts +19 -0
- package/dist/main-portal/lib/order-id-generator.js +97 -0
- package/dist/main-portal/lib/solana/reincarnation-client.d.ts +28 -0
- package/dist/main-portal/lib/solana/reincarnation-client.js +39 -0
- package/dist/main-portal/lib/solana/solana-pay.d.ts +31 -0
- package/dist/main-portal/lib/solana/solana-pay.js +85 -0
- package/dist/main-portal/lib/strategy/defaults.d.ts +2 -0
- package/dist/main-portal/lib/strategy/defaults.js +58 -0
- package/dist/main-portal/lib/strategy/index.d.ts +3 -0
- package/dist/main-portal/lib/strategy/index.js +20 -0
- package/dist/main-portal/lib/strategy/tooltips.d.ts +1 -0
- package/dist/main-portal/lib/strategy/tooltips.js +50 -0
- package/dist/main-portal/lib/strategy/types.d.ts +74 -0
- package/dist/main-portal/lib/strategy/types.js +2 -0
- package/dist/main-portal/lib/types/ai.types.d.ts +111 -0
- package/dist/main-portal/lib/types/ai.types.js +2 -0
- package/dist/main-portal/lib/types/api.d.ts +5 -0
- package/dist/main-portal/lib/types/api.js +21 -0
- package/dist/main-portal/lib/types/common.types.d.ts +168 -0
- package/dist/main-portal/lib/types/common.types.js +24 -0
- package/dist/main-portal/lib/types/finance.types.d.ts +267 -0
- package/dist/main-portal/lib/types/finance.types.js +2 -0
- package/dist/main-portal/lib/types/protocol.types.d.ts +216 -0
- package/dist/main-portal/lib/types/protocol.types.js +2 -0
- package/dist/main-portal/lib/types/user.types.d.ts +243 -0
- package/dist/main-portal/lib/types/user.types.js +12 -0
- package/dist/main-portal/lib/utils/territoryId.d.ts +75 -0
- package/dist/main-portal/lib/utils/territoryId.js +241 -0
- package/dist/main-portal/lib/utils.d.ts +4 -0
- package/dist/main-portal/lib/utils.js +24 -0
- package/dist/main-portal/lib/wallet-auth/api.d.ts +13 -0
- package/dist/main-portal/lib/wallet-auth/api.js +132 -0
- package/dist/main-portal/lib/wallet-auth/types.d.ts +87 -0
- package/dist/main-portal/lib/wallet-auth/types.js +58 -0
- package/package.json +55 -5
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface MCCHistoryProps {
|
|
2
|
+
userId: string | undefined;
|
|
3
|
+
showTitle?: boolean;
|
|
4
|
+
limit?: number;
|
|
5
|
+
defaultType?: string;
|
|
6
|
+
defaultExpanded?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export default function MCCHistory({ userId, showTitle, limit, defaultType, defaultExpanded }: MCCHistoryProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// AI-generated · AI-managed · AI-maintained
|
|
3
|
+
'use client';
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.default = MCCHistory;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const lucide_react_1 = require("lucide-react");
|
|
9
|
+
const card_1 = require("../ui/card");
|
|
10
|
+
const badge_1 = require("../ui/badge");
|
|
11
|
+
const api_service_1 = require("../../lib/api-service");
|
|
12
|
+
const time_remaining_1 = require("../ui/time-remaining");
|
|
13
|
+
const utils_1 = require("../../lib/utils");
|
|
14
|
+
const formatNumber = (num, decimals = 2) => num.toLocaleString('en-US', { minimumFractionDigits: decimals, maximumFractionDigits: decimals });
|
|
15
|
+
const dateFormatOptions = {
|
|
16
|
+
month: '2-digit',
|
|
17
|
+
day: '2-digit',
|
|
18
|
+
hour: '2-digit',
|
|
19
|
+
minute: '2-digit'
|
|
20
|
+
};
|
|
21
|
+
const getTypeIcon = (type, direction) => {
|
|
22
|
+
switch (type) {
|
|
23
|
+
case 'mining':
|
|
24
|
+
return (0, jsx_runtime_1.jsx)(lucide_react_1.Pickaxe, { className: "h-4 w-4 text-white" });
|
|
25
|
+
case 'reward':
|
|
26
|
+
return (0, jsx_runtime_1.jsx)(lucide_react_1.Gift, { className: "h-4 w-4 text-cyan-400" });
|
|
27
|
+
case 'lock':
|
|
28
|
+
return (0, jsx_runtime_1.jsx)(lucide_react_1.Lock, { className: "h-4 w-4 text-cyan-400" });
|
|
29
|
+
case 'unlock':
|
|
30
|
+
return (0, jsx_runtime_1.jsx)(lucide_react_1.Unlock, { className: "h-4 w-4 text-cyan-400" });
|
|
31
|
+
case 'reincarnation':
|
|
32
|
+
return (0, jsx_runtime_1.jsx)(lucide_react_1.RotateCcw, { className: "h-4 w-4 text-cyan-400" });
|
|
33
|
+
case 'transfer':
|
|
34
|
+
return direction === 'in'
|
|
35
|
+
? (0, jsx_runtime_1.jsx)(lucide_react_1.ArrowDownLeft, { className: "h-4 w-4 text-white" })
|
|
36
|
+
: (0, jsx_runtime_1.jsx)(lucide_react_1.ArrowUpRight, { className: "h-4 w-4 text-red-400" });
|
|
37
|
+
default:
|
|
38
|
+
return direction === 'in'
|
|
39
|
+
? (0, jsx_runtime_1.jsx)(lucide_react_1.ArrowDownLeft, { className: "h-4 w-4 text-white" })
|
|
40
|
+
: (0, jsx_runtime_1.jsx)(lucide_react_1.ArrowUpRight, { className: "h-4 w-4 text-red-400" });
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const getTypeLabel = (type) => {
|
|
44
|
+
const labels = {
|
|
45
|
+
mining: '铸造',
|
|
46
|
+
reincarnation: '做市',
|
|
47
|
+
transfer: '转账',
|
|
48
|
+
reward: '奖励',
|
|
49
|
+
lock: '锁定',
|
|
50
|
+
unlock: '解锁',
|
|
51
|
+
};
|
|
52
|
+
return labels[type] || type;
|
|
53
|
+
};
|
|
54
|
+
const getStatusBadge = (status) => {
|
|
55
|
+
switch (status) {
|
|
56
|
+
case 'confirmed':
|
|
57
|
+
case 'completed':
|
|
58
|
+
return (0, jsx_runtime_1.jsx)(badge_1.Badge, { className: "bg-white/20 text-white border border-white/30", children: "\u5DF2\u786E\u8BA4" });
|
|
59
|
+
case 'pending':
|
|
60
|
+
return (0, jsx_runtime_1.jsx)(badge_1.Badge, { className: "bg-cyan-400/20 text-cyan-400 border border-cyan-400/30", children: "\u5904\u7406\u4E2D" });
|
|
61
|
+
case 'failed':
|
|
62
|
+
return (0, jsx_runtime_1.jsx)(badge_1.Badge, { className: "bg-red-500/20 text-red-500 border border-red-500/30", children: "\u5931\u8D25" });
|
|
63
|
+
default:
|
|
64
|
+
return (0, jsx_runtime_1.jsx)(badge_1.Badge, { className: "bg-neutral-500/20 text-neutral-300 border border-neutral-500/30", children: status });
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
function MCCHistory({ userId, showTitle = true, limit = 20, defaultType = 'all', defaultExpanded = false }) {
|
|
68
|
+
const [history, setHistory] = (0, react_1.useState)([]);
|
|
69
|
+
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
70
|
+
const [filterType, setFilterType] = (0, react_1.useState)(defaultType);
|
|
71
|
+
const [expanded, setExpanded] = (0, react_1.useState)(defaultExpanded);
|
|
72
|
+
const fetchHistory = async () => {
|
|
73
|
+
if (!userId) {
|
|
74
|
+
setLoading(false);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
setLoading(true);
|
|
79
|
+
const res = await (0, api_service_1.getMCCHistory)(userId, { limit, type: filterType });
|
|
80
|
+
if (res.success && res.data) {
|
|
81
|
+
setHistory(res.data);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
catch (err) {
|
|
85
|
+
console.error('[MCCHistory] 获取历史失败:', err);
|
|
86
|
+
}
|
|
87
|
+
finally {
|
|
88
|
+
setLoading(false);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
(0, react_1.useEffect)(() => {
|
|
92
|
+
fetchHistory();
|
|
93
|
+
}, [userId, filterType]);
|
|
94
|
+
const summaryText = history.length > 0
|
|
95
|
+
? `MCC 交易历史 · 共 ${history.length} 笔 · 最近: ${new Date(history[0].created_at).toLocaleDateString('zh-CN')}`
|
|
96
|
+
: 'MCC 交易历史 · 暂无记录';
|
|
97
|
+
return ((0, jsx_runtime_1.jsxs)("div", { id: "mcc-history", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setExpanded(!expanded), className: "flex items-center gap-2 text-neutral-400 hover:text-neutral-300 text-sm transition-colors w-full justify-center py-2", children: [expanded ? (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronUp, { className: "w-4 h-4" }) : (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { className: "w-4 h-4" }), summaryText] }), expanded && ((0, jsx_runtime_1.jsx)(card_1.Card, { className: "bg-neutral-900 border-neutral-700 dash-card mt-2", children: (0, jsx_runtime_1.jsxs)(card_1.CardContent, { className: "p-6", 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)(lucide_react_1.Filter, { className: "h-4 w-4 text-neutral-400" }), (0, jsx_runtime_1.jsxs)("select", { value: filterType, onChange: (e) => setFilterType(e.target.value), className: "bg-neutral-800 border border-neutral-600 text-white text-xs rounded px-2 py-1.5 focus:outline-none focus:border-neutral-500", children: [(0, jsx_runtime_1.jsx)("option", { value: "all", children: "\u5168\u90E8\u8BB0\u5F55" }), (0, jsx_runtime_1.jsx)("option", { value: "mining", children: "\u94F8\u9020" }), (0, jsx_runtime_1.jsx)("option", { value: "reincarnation", children: "\u505A\u5E02" }), (0, jsx_runtime_1.jsx)("option", { value: "transfer", children: "\u8F6C\u8D26" }), (0, jsx_runtime_1.jsx)("option", { value: "reward", children: "\u5956\u52B1" }), (0, jsx_runtime_1.jsx)("option", { value: "lock", children: "\u9501\u5B9A" }), (0, jsx_runtime_1.jsx)("option", { value: "unlock", children: "\u89E3\u9501" })] })] }), (0, jsx_runtime_1.jsx)("button", { onClick: fetchHistory, disabled: loading, className: "text-neutral-400 hover:text-white transition-colors", children: (0, jsx_runtime_1.jsx)(lucide_react_1.RefreshCw, { className: (0, utils_1.cn)("w-4 h-4", loading && "animate-spin") }) })] }), loading ? ((0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-center py-8", children: (0, jsx_runtime_1.jsx)(lucide_react_1.RefreshCw, { className: "w-5 h-5 animate-spin text-neutral-500" }) })) : history.length === 0 ? ((0, jsx_runtime_1.jsxs)("div", { className: "text-center py-8 text-neutral-500", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.History, { className: "w-6 h-6 mx-auto mb-2 opacity-50" }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm", children: "\u6682\u65E0\u4EA4\u6613\u8BB0\u5F55" })] })) : ((0, jsx_runtime_1.jsx)("div", { className: "space-y-2", children: history.map((record) => ((0, jsx_runtime_1.jsx)("div", { className: "p-3 bg-neutral-800 border border-neutral-700 rounded hover:bg-neutral-700 transition-colors", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "p-1.5 rounded bg-neutral-700", children: getTypeIcon(record.type, record.direction) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-sm text-white", children: record.source_display || getTypeLabel(record.type) }), getStatusBadge(record.status)] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-xs text-neutral-500 mt-0.5", children: [(0, jsx_runtime_1.jsx)(time_remaining_1.FormattedDateCustom, { dateTime: record.created_at, options: dateFormatOptions }), record.memo && (0, jsx_runtime_1.jsx)("span", { className: "ml-2", children: record.memo })] })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-right", children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("text-sm font-bold font-mono", record.direction === 'in' ? 'text-white' : 'text-red-400'), children: [record.direction === 'in' ? '+' : '-', record.type === 'mining' && record.distribution_details?.user_mcc !== undefined
|
|
98
|
+
? formatNumber(record.distribution_details.user_mcc)
|
|
99
|
+
: formatNumber(record.amount), (0, jsx_runtime_1.jsx)("span", { className: "text-xs font-normal text-neutral-500 ml-1", children: "MCC" })] }), record.tx_hash && ((0, jsx_runtime_1.jsxs)("a", { href: `https://solscan.io/tx/${record.tx_hash}`, target: "_blank", rel: "noopener noreferrer", className: "inline-flex items-center gap-1 text-xs text-cyan-400 hover:text-cyan-300 mt-1", children: [(0, jsx_runtime_1.jsxs)("code", { className: "font-mono", children: [record.tx_hash.slice(0, 8), "..."] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ExternalLink, { className: "h-3 w-3" })] }))] })] }) }, record.id))) }))] }) }))] }));
|
|
100
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// AI-generated · AI-managed · AI-maintained
|
|
3
|
+
'use client';
|
|
4
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6
|
+
};
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.default = WalletManagement;
|
|
9
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
const lucide_react_1 = require("lucide-react");
|
|
12
|
+
const card_1 = require("../ui/card");
|
|
13
|
+
const badge_1 = require("../ui/badge");
|
|
14
|
+
const lucide_react_2 = require("lucide-react");
|
|
15
|
+
const button_1 = require("../ui/button");
|
|
16
|
+
const useAuth_1 = require("../../hooks/useAuth");
|
|
17
|
+
const auth_service_1 = require("../../lib/auth-service");
|
|
18
|
+
const utils_1 = require("../../lib/utils");
|
|
19
|
+
const api_1 = require("../../lib/wallet-auth/api");
|
|
20
|
+
const dialog_1 = require("../ui/dialog");
|
|
21
|
+
const public_mining_modal_1 = __importDefault(require("../resources/public-mining-modal"));
|
|
22
|
+
const next_intl_1 = require("next-intl");
|
|
23
|
+
const MIN_BIND_AMOUNT = 0.01;
|
|
24
|
+
const DEFAULT_BIND_AMOUNT = 0.1;
|
|
25
|
+
function WalletManagement({ className }) {
|
|
26
|
+
const { user } = (0, useAuth_1.useAuth)();
|
|
27
|
+
const t = (0, next_intl_1.useTranslations)('wallet');
|
|
28
|
+
const [wallets, setWallets] = (0, react_1.useState)([]);
|
|
29
|
+
const [primaryWallet, setPrimaryWalletAddress] = (0, react_1.useState)(null);
|
|
30
|
+
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
31
|
+
const [error, setError] = (0, react_1.useState)(null);
|
|
32
|
+
const [actionLoading, setActionLoading] = (0, react_1.useState)(null);
|
|
33
|
+
const [showMiningModal, setShowMiningModal] = (0, react_1.useState)(false);
|
|
34
|
+
const [showDeleteConfirm, setShowDeleteConfirm] = (0, react_1.useState)(null);
|
|
35
|
+
const [copiedAddress, setCopiedAddress] = (0, react_1.useState)(null);
|
|
36
|
+
const getToken = async () => {
|
|
37
|
+
try {
|
|
38
|
+
return await (0, auth_service_1.getCurrentUserToken)();
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const loadWallets = (0, react_1.useCallback)(async () => {
|
|
45
|
+
const token = await getToken();
|
|
46
|
+
if (!token) {
|
|
47
|
+
setLoading(false);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
try {
|
|
51
|
+
setLoading(true);
|
|
52
|
+
setError(null);
|
|
53
|
+
const response = await (0, api_1.listWallets)(token);
|
|
54
|
+
if (response.success && response.data) {
|
|
55
|
+
setWallets(response.data.wallets);
|
|
56
|
+
setPrimaryWalletAddress(response.data.primary_wallet);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
setError(response.error || 'Failed to load wallets');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch (e) {
|
|
63
|
+
setError(e instanceof Error ? e.message : 'Failed to load wallets');
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
setLoading(false);
|
|
67
|
+
}
|
|
68
|
+
}, []);
|
|
69
|
+
(0, react_1.useEffect)(() => {
|
|
70
|
+
if (user) {
|
|
71
|
+
loadWallets();
|
|
72
|
+
}
|
|
73
|
+
}, [user, loadWallets]);
|
|
74
|
+
(0, react_1.useEffect)(() => {
|
|
75
|
+
const handleVisibility = () => {
|
|
76
|
+
if (document.visibilityState === 'visible' && user) {
|
|
77
|
+
loadWallets();
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
document.addEventListener('visibilitychange', handleVisibility);
|
|
81
|
+
return () => document.removeEventListener('visibilitychange', handleVisibility);
|
|
82
|
+
}, [user, loadWallets]);
|
|
83
|
+
const handleCopy = async (address) => {
|
|
84
|
+
try {
|
|
85
|
+
await navigator.clipboard.writeText(address);
|
|
86
|
+
setCopiedAddress(address);
|
|
87
|
+
setTimeout(() => setCopiedAddress(null), 2000);
|
|
88
|
+
}
|
|
89
|
+
catch { }
|
|
90
|
+
};
|
|
91
|
+
const handleSetPrimary = async (walletAddress) => {
|
|
92
|
+
const token = await getToken();
|
|
93
|
+
if (!token)
|
|
94
|
+
return;
|
|
95
|
+
try {
|
|
96
|
+
setActionLoading(walletAddress);
|
|
97
|
+
const response = await (0, api_1.setPrimaryWallet)(walletAddress, token);
|
|
98
|
+
if (response.success) {
|
|
99
|
+
await loadWallets();
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
setError(response.error || 'Failed to set primary wallet');
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
catch (e) {
|
|
106
|
+
setError(e instanceof Error ? e.message : 'Failed to set primary wallet');
|
|
107
|
+
}
|
|
108
|
+
finally {
|
|
109
|
+
setActionLoading(null);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
const handleRemove = async (walletAddress) => {
|
|
113
|
+
const token = await getToken();
|
|
114
|
+
if (!token)
|
|
115
|
+
return;
|
|
116
|
+
try {
|
|
117
|
+
setActionLoading(walletAddress);
|
|
118
|
+
setShowDeleteConfirm(null);
|
|
119
|
+
const response = await (0, api_1.removeWallet)(walletAddress, token);
|
|
120
|
+
if (response.success) {
|
|
121
|
+
await loadWallets();
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
setError(response.error || 'Failed to remove wallet');
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
catch (e) {
|
|
128
|
+
setError(e instanceof Error ? e.message : 'Failed to remove wallet');
|
|
129
|
+
}
|
|
130
|
+
finally {
|
|
131
|
+
setActionLoading(null);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
const handleMiningSuccess = () => {
|
|
135
|
+
setShowMiningModal(false);
|
|
136
|
+
loadWallets();
|
|
137
|
+
};
|
|
138
|
+
if (loading) {
|
|
139
|
+
return ((0, jsx_runtime_1.jsx)(card_1.Card, { className: (0, utils_1.cn)("bg-neutral-900 border-neutral-700 dash-card", className), children: (0, jsx_runtime_1.jsx)(card_1.CardContent, { className: "p-6", children: (0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-center py-8", children: (0, jsx_runtime_1.jsx)(lucide_react_2.Loader2, { className: "w-5 h-5 animate-spin text-cyan-400" }) }) }) }));
|
|
140
|
+
}
|
|
141
|
+
return ((0, jsx_runtime_1.jsx)(card_1.Card, { className: (0, utils_1.cn)("bg-neutral-900 border-neutral-700 dash-card", className), children: (0, jsx_runtime_1.jsxs)(card_1.CardContent, { className: "p-6", 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)(lucide_react_1.Wallet, { className: "w-5 h-5 text-neutral-400" }), (0, jsx_runtime_1.jsx)("h3", { className: "text-white font-medium", children: t('title') }), (0, jsx_runtime_1.jsxs)("span", { className: "text-xs text-neutral-400", children: ["(", wallets.length, ")"] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(button_1.Button, { variant: "ghost", size: "sm", onClick: loadWallets, disabled: loading, className: "text-neutral-400 hover:text-white", children: (0, jsx_runtime_1.jsx)(lucide_react_1.RefreshCw, { className: (0, utils_1.cn)("w-4 h-4", loading && "animate-spin") }) }), (0, jsx_runtime_1.jsxs)(button_1.Button, { size: "sm", onClick: () => setShowMiningModal(true), className: "bg-cyan-700 hover:bg-cyan-600 text-white", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Pickaxe, { className: "w-4 h-4 mr-1" }), t('bindWallet')] })] })] }), error && ((0, jsx_runtime_1.jsxs)("div", { className: "mb-4 p-3 bg-red-500/20 border border-red-500/50 rounded flex items-start gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.AlertCircle, { className: "w-4 h-4 text-red-500 mt-0.5 flex-shrink-0" }), (0, jsx_runtime_1.jsx)("div", { className: "text-sm text-red-400", children: error }), (0, jsx_runtime_1.jsx)("button", { onClick: () => setError(null), className: "ml-auto text-red-400 hover:text-red-300", children: "\u00D7" })] })), wallets.length === 0 ? ((0, jsx_runtime_1.jsxs)("div", { className: "text-center py-8 text-neutral-400", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "w-12 h-12 mx-auto mb-3 opacity-50" }), (0, jsx_runtime_1.jsx)("p", { children: t('noWallets') }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm mt-2 text-neutral-500", children: t('bindHint') }), (0, jsx_runtime_1.jsxs)(button_1.Button, { size: "sm", onClick: () => setShowMiningModal(true), className: "mt-4 bg-cyan-700 hover:bg-cyan-600 text-white", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Pickaxe, { className: "w-4 h-4 mr-1" }), t('startMining')] })] })) : ((0, jsx_runtime_1.jsx)("div", { className: "space-y-3", children: wallets.map((wallet) => ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("p-4 rounded border transition-colors", wallet.is_primary
|
|
142
|
+
? "bg-cyan-400/10 border-cyan-400/30"
|
|
143
|
+
: "bg-neutral-800 border-neutral-700 hover:border-neutral-600"), children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-start justify-between", children: [(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 mb-1", children: [wallet.is_primary && ((0, jsx_runtime_1.jsx)(lucide_react_1.Star, { className: "w-4 h-4 text-cyan-400 fill-cyan-400" })), (0, jsx_runtime_1.jsx)("code", { className: "text-white font-mono text-sm truncate", children: wallet.wallet_address })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3 text-xs text-neutral-400", children: [(0, jsx_runtime_1.jsx)("span", { className: "capitalize", children: wallet.wallet_type }), wallet.is_primary && ((0, jsx_runtime_1.jsx)(badge_1.Badge, { className: "bg-white/20 text-white border-0 text-xs", children: t('primary') })), (0, jsx_runtime_1.jsx)("span", { children: new Date(wallet.created_at).toLocaleDateString() })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1 ml-2", children: [(0, jsx_runtime_1.jsx)(button_1.Button, { variant: "ghost", size: "sm", onClick: () => handleCopy(wallet.wallet_address), className: "text-neutral-400 hover:text-white h-8 w-8 p-0", children: copiedAddress === wallet.wallet_address ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Check, { className: "w-4 h-4 text-white" })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { className: "w-4 h-4" })) }), (0, jsx_runtime_1.jsx)("a", { href: `https://solscan.io/account/${wallet.wallet_address}`, target: "_blank", rel: "noopener noreferrer", className: "text-neutral-400 hover:text-white h-8 w-8 p-0 flex items-center justify-center", children: (0, jsx_runtime_1.jsx)(lucide_react_1.ExternalLink, { className: "w-4 h-4" }) }), !wallet.is_primary && ((0, jsx_runtime_1.jsx)(button_1.Button, { variant: "ghost", size: "sm", onClick: () => handleSetPrimary(wallet.wallet_address), disabled: actionLoading === wallet.wallet_address, className: "text-neutral-400 hover:text-cyan-400 h-8 w-8 p-0", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Star, { className: "w-4 h-4" }) })), (0, jsx_runtime_1.jsx)(button_1.Button, { variant: "ghost", size: "sm", onClick: () => setShowDeleteConfirm(wallet.wallet_address), disabled: actionLoading === wallet.wallet_address, className: "text-neutral-400 hover:text-red-400 h-8 w-8 p-0", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Trash2, { className: "w-4 h-4" }) })] })] }) }, wallet.wallet_address))) })), (0, jsx_runtime_1.jsx)(dialog_1.Dialog, { open: !!showDeleteConfirm, onOpenChange: () => setShowDeleteConfirm(null), children: (0, jsx_runtime_1.jsxs)(dialog_1.DialogContent, { className: "bg-neutral-900 border-neutral-700", children: [(0, jsx_runtime_1.jsxs)(dialog_1.DialogHeader, { children: [(0, jsx_runtime_1.jsx)(dialog_1.DialogTitle, { className: "text-white", children: t('deleteTitle') }), (0, jsx_runtime_1.jsx)(dialog_1.DialogDescription, { className: "text-neutral-400", children: t('deleteDesc') })] }), (0, jsx_runtime_1.jsx)("div", { className: "mt-2 p-3 bg-neutral-800 rounded border border-neutral-700", children: (0, jsx_runtime_1.jsx)("code", { className: "text-sm text-white font-mono break-all", children: showDeleteConfirm }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-3 mt-4", children: [(0, jsx_runtime_1.jsx)(button_1.Button, { variant: "outline", className: "flex-1 border-neutral-700 text-neutral-300 hover:bg-neutral-800", onClick: () => setShowDeleteConfirm(null), children: t('cancel') }), (0, jsx_runtime_1.jsx)(button_1.Button, { className: "flex-1 bg-red-600 hover:bg-red-500 text-white", onClick: () => showDeleteConfirm && handleRemove(showDeleteConfirm), children: t('confirmDelete') })] })] }) }), (0, jsx_runtime_1.jsx)(public_mining_modal_1.default, { isOpen: showMiningModal, onClose: () => setShowMiningModal(false), onSuccess: handleMiningSuccess })] }) }));
|
|
144
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function WalletPage(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// AI-generated · AI-managed · AI-maintained
|
|
3
|
+
'use client';
|
|
4
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(o, k2, desc);
|
|
11
|
+
}) : (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
}));
|
|
15
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
16
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
17
|
+
}) : function(o, v) {
|
|
18
|
+
o["default"] = v;
|
|
19
|
+
});
|
|
20
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
21
|
+
var ownKeys = function(o) {
|
|
22
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
23
|
+
var ar = [];
|
|
24
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
25
|
+
return ar;
|
|
26
|
+
};
|
|
27
|
+
return ownKeys(o);
|
|
28
|
+
};
|
|
29
|
+
return function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
})();
|
|
37
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
38
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
39
|
+
};
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.default = WalletPage;
|
|
42
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
43
|
+
const react_1 = __importStar(require("react"));
|
|
44
|
+
const navigation_1 = require("../../i18n/navigation");
|
|
45
|
+
const lucide_react_1 = require("lucide-react");
|
|
46
|
+
const card_1 = require("../ui/card");
|
|
47
|
+
const badge_1 = require("../ui/badge");
|
|
48
|
+
const button_1 = require("../ui/button");
|
|
49
|
+
const useAuth_1 = require("../../hooks/useAuth");
|
|
50
|
+
const WalletContext_1 = require("../../contexts/WalletContext");
|
|
51
|
+
const useWalletTokenBalances_1 = require("../../hooks/useWalletTokenBalances");
|
|
52
|
+
const utils_1 = require("../../lib/utils");
|
|
53
|
+
const MCCHistory_1 = __importDefault(require("./MCCHistory"));
|
|
54
|
+
const time_remaining_1 = require("../ui/time-remaining");
|
|
55
|
+
const next_intl_1 = require("next-intl");
|
|
56
|
+
const formatNumber = (num, decimals = 2) => num.toLocaleString('en-US', { minimumFractionDigits: decimals, maximumFractionDigits: decimals });
|
|
57
|
+
const formatUSD = (num) => '$' + num.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
58
|
+
function TokenIcon({ symbol, color, logoURI, className }) {
|
|
59
|
+
const [imgError, setImgError] = (0, react_1.useState)(false);
|
|
60
|
+
if (logoURI && !imgError) {
|
|
61
|
+
return ((0, jsx_runtime_1.jsx)("img", { src: logoURI, alt: symbol, className: (0, utils_1.cn)('w-10 h-10 rounded-full object-cover', className), onError: () => setImgError(true) }));
|
|
62
|
+
}
|
|
63
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)('w-10 h-10 rounded-full flex items-center justify-center text-white font-bold text-sm', color, className), children: symbol.slice(0, 2) }));
|
|
64
|
+
}
|
|
65
|
+
function LockPeriodCard({ lock }) {
|
|
66
|
+
const t = (0, next_intl_1.useTranslations)('walletDash');
|
|
67
|
+
const { progress, mounted } = (0, time_remaining_1.useLockProgressValue)(lock.lock_end, 14);
|
|
68
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "p-4 bg-neutral-800 rounded border border-neutral-700", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between items-start mb-3", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-xs text-neutral-400 tracking-wider mb-1", children: ["reason: ", lock.reason] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-2xl font-bold text-white font-mono", children: [formatNumber(lock.amount), " MCC"] })] }), (0, jsx_runtime_1.jsx)(badge_1.Badge, { className: "bg-cyan-400/20 text-cyan-400 border border-cyan-400/30", children: t('locked') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-1 text-sm", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between text-neutral-400", children: [(0, jsx_runtime_1.jsx)("span", { children: "lock_start" }), (0, jsx_runtime_1.jsx)(time_remaining_1.FormattedDateTime, { dateTime: lock.lock_start, className: "text-white" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between text-neutral-400", children: [(0, jsx_runtime_1.jsx)("span", { children: "lock_end" }), (0, jsx_runtime_1.jsx)(time_remaining_1.FormattedDateTime, { dateTime: lock.lock_end, className: "text-white" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between font-bold mt-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-neutral-400", children: "remaining" }), (0, jsx_runtime_1.jsx)(time_remaining_1.LockDaysHoursRemaining, { endTime: lock.lock_end, className: "text-cyan-400" })] })] }), (0, jsx_runtime_1.jsx)("div", { className: "mt-3", children: (0, jsx_runtime_1.jsx)("div", { className: "bg-neutral-800 rounded-full h-2 overflow-hidden", children: (0, jsx_runtime_1.jsx)("div", { className: "bg-cyan-400 h-2 rounded-full transition-all", style: { width: `${mounted ? progress : 0}%` } }) }) })] }));
|
|
69
|
+
}
|
|
70
|
+
function AssetList({ holdings, hideBalance, showWalletColumn, isLoading }) {
|
|
71
|
+
const t = (0, next_intl_1.useTranslations)('walletDash');
|
|
72
|
+
// 1. 加载中 → 进度条
|
|
73
|
+
if (isLoading) {
|
|
74
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "py-8 px-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-center gap-3", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "w-4 h-4 animate-spin text-cyan-400" }), (0, jsx_runtime_1.jsx)("span", { className: "text-neutral-500 text-sm", children: t('syncingOnChainData') })] }), (0, jsx_runtime_1.jsx)("div", { className: "mt-3 max-w-xs mx-auto", children: (0, jsx_runtime_1.jsx)("div", { className: "bg-neutral-800 rounded-full h-1.5 overflow-hidden", children: (0, jsx_runtime_1.jsx)("div", { className: "bg-cyan-400/60 h-1.5 rounded-full animate-pulse", style: { width: '60%' } }) }) })] }));
|
|
75
|
+
}
|
|
76
|
+
// 2. 加载完成但无资产 → 友好提示
|
|
77
|
+
if (holdings.length === 0) {
|
|
78
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "text-center py-8 text-neutral-500", children: (0, jsx_runtime_1.jsx)("p", { className: "text-sm", children: t('noValuedAssets') }) }));
|
|
79
|
+
}
|
|
80
|
+
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("gap-4 py-2 px-4 border-b border-neutral-700 text-xs font-medium text-neutral-400 tracking-wider grid", showWalletColumn ? "grid-cols-4" : "grid-cols-3"), children: [(0, jsx_runtime_1.jsx)("div", { children: t('token') }), showWalletColumn && (0, jsx_runtime_1.jsx)("div", { children: t('wallet') || 'Wallet' }), (0, jsx_runtime_1.jsx)("div", { className: "text-right", children: t('amount') }), (0, jsx_runtime_1.jsx)("div", { className: "text-right", children: t('valuation') })] }), (0, jsx_runtime_1.jsx)("div", { className: "divide-y divide-neutral-800", children: holdings.map((h, idx) => ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("gap-4 py-3 px-4 items-center hover:bg-neutral-700 transition-colors rounded grid", showWalletColumn ? "grid-cols-4" : "grid-cols-3"), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)(TokenIcon, { symbol: h.token.symbol, color: h.token.color, logoURI: h.token.logoURI }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-white font-medium text-sm", children: h.token.symbol }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500", children: h.token.name })] })] }), showWalletColumn && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("code", { className: "text-xs text-neutral-400 font-mono", children: h.walletShort }), h.isPrimary && (0, jsx_runtime_1.jsx)("span", { className: "ml-1 text-[10px] text-cyan-400", children: "Primary" })] })), (0, jsx_runtime_1.jsx)("div", { className: "text-right", children: (0, jsx_runtime_1.jsx)("div", { className: "text-white text-sm font-mono", children: hideBalance ? '****' : formatNumber(h.balance, h.balance < 1 ? 6 : 4) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "text-right", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-neutral-300 text-sm font-mono", children: hideBalance ? '****' : formatUSD(h.usdValue) }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500", children: formatUSD(h.price) })] })] }, `${h.token.mint}-${h.wallet || idx}`))) })] }));
|
|
81
|
+
}
|
|
82
|
+
function WalletPage() {
|
|
83
|
+
const t = (0, next_intl_1.useTranslations)('walletDash');
|
|
84
|
+
const { user, userInfo, loading: authLoading } = (0, useAuth_1.useAuth)();
|
|
85
|
+
const { totalBalance, lockPeriods, mcdAmount, mcdTotalReceived, mcdDailyRewards, loading, isRefreshing, error, refreshBalance, refreshMinting, refreshMCD } = (0, WalletContext_1.useWallet)();
|
|
86
|
+
const [activeTab, setActiveTab] = (0, react_1.useState)('all');
|
|
87
|
+
const [hideBalance, setHideBalance] = (0, react_1.useState)(false);
|
|
88
|
+
// 直接从 useAuth 缓存的 userInfo 获取钱包列表,不再重复调用 API
|
|
89
|
+
const wallets = react_1.default.useMemo(() => {
|
|
90
|
+
if (!userInfo)
|
|
91
|
+
return [];
|
|
92
|
+
if (userInfo.wallets && userInfo.wallets.length > 0) {
|
|
93
|
+
return userInfo.wallets;
|
|
94
|
+
}
|
|
95
|
+
if (userInfo.wallet_address) {
|
|
96
|
+
return [{ wallet_address: userInfo.wallet_address, is_primary: true }];
|
|
97
|
+
}
|
|
98
|
+
return [];
|
|
99
|
+
}, [userInfo]);
|
|
100
|
+
const tokenBalances = (0, useWalletTokenBalances_1.useWalletTokenBalances)(wallets);
|
|
101
|
+
const mccTotalBalance = tokenBalances.aggregated.find(h => h.token.symbol === 'MCC')?.balance || totalBalance;
|
|
102
|
+
const handleRefresh = () => {
|
|
103
|
+
refreshBalance();
|
|
104
|
+
refreshMinting();
|
|
105
|
+
refreshMCD();
|
|
106
|
+
tokenBalances.refresh();
|
|
107
|
+
};
|
|
108
|
+
// 多钱包时 "all" tab 用 flat 列表(带钱包标识),单钱包 tab 用 holdings
|
|
109
|
+
const isAllTab = activeTab === 'all';
|
|
110
|
+
const showWalletCol = isAllTab && wallets.length > 1;
|
|
111
|
+
const rawHoldings = isAllTab
|
|
112
|
+
? (wallets.length > 1 ? tokenBalances.flat : tokenBalances.aggregated)
|
|
113
|
+
: tokenBalances.wallets.find(w => w.wallet_address === activeTab)?.holdings || [];
|
|
114
|
+
// 只显示 ≥$1 的资产,低于 $1 不显示
|
|
115
|
+
const activeHoldings = rawHoldings.filter(h => h.usdValue >= 1);
|
|
116
|
+
const activeUsdValue = isAllTab
|
|
117
|
+
? tokenBalances.totalUsdValue
|
|
118
|
+
: tokenBalances.wallets.find(w => w.wallet_address === activeTab)?.totalUsdValue || 0;
|
|
119
|
+
// 不再全页阻塞,让页面框架先渲染,数据区域内联显示加载进度条
|
|
120
|
+
if (error) {
|
|
121
|
+
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", 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') }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs sm:text-sm text-neutral-400 mt-1", children: t('subtitle') })] }), (0, jsx_runtime_1.jsx)(card_1.Card, { className: "bg-red-500/10 border-red-500/20", children: (0, jsx_runtime_1.jsxs)(card_1.CardContent, { className: "p-3 sm:p-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 text-red-400 mb-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.AlertTriangle, { className: "w-5 h-5" }), (0, jsx_runtime_1.jsx)("span", { className: "font-medium", children: t('error') })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-neutral-400 text-sm", children: error }), (0, jsx_runtime_1.jsx)("p", { className: "text-neutral-500 text-xs mt-1", children: t('checkNetwork') })] }) }), (0, jsx_runtime_1.jsx)(button_1.Button, { variant: "outline", size: "sm", className: "border-neutral-700 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-300 bg-transparent", onClick: handleRefresh, children: t('retry') })] }));
|
|
122
|
+
}
|
|
123
|
+
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", 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') }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs sm:text-sm text-neutral-400 mt-1", children: t('subtitle') })] }), (0, jsx_runtime_1.jsxs)(button_1.Button, { variant: "outline", size: "sm", className: "border-neutral-700 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-300 bg-transparent", onClick: handleRefresh, disabled: isRefreshing || tokenBalances.loading, children: [(0, jsx_runtime_1.jsx)(lucide_react_1.RefreshCw, { className: (0, utils_1.cn)("w-4 h-4 mr-2", (isRefreshing || tokenBalances.loading) && "animate-spin") }), t('refresh')] })] }), (0, jsx_runtime_1.jsx)(card_1.Card, { className: "bg-neutral-900 border-neutral-700 hover:border-cyan-400/50 dash-card", children: (0, jsx_runtime_1.jsxs)(card_1.CardContent, { className: "p-3 sm:p-6", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-between mb-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 text-neutral-400 text-sm", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "w-4 h-4 text-cyan-400" }), (0, jsx_runtime_1.jsx)("span", { children: activeTab === 'all' ? t('totalAssetValue') : t('walletAssetValue') }), (0, jsx_runtime_1.jsx)("button", { onClick: () => setHideBalance(!hideBalance), className: "hover:text-white transition-colors", children: hideBalance ? (0, jsx_runtime_1.jsx)(lucide_react_1.EyeOff, { className: "w-4 h-4" }) : (0, jsx_runtime_1.jsx)(lucide_react_1.Eye, { className: "w-4 h-4" }) })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-baseline gap-2 mb-1", children: (0, jsx_runtime_1.jsx)("span", { className: "text-3xl font-bold text-white font-mono", children: hideBalance ? '****' : (activeUsdValue > 0 ? formatUSD(activeUsdValue) : '--') }) }), (0, jsx_runtime_1.jsx)("div", { className: "text-neutral-500 text-xs", children: hideBalance ? '****' : t('priceSource') })] }) }), (0, jsx_runtime_1.jsx)(card_1.Card, { className: "bg-neutral-900 border-neutral-700 dash-card", children: (0, jsx_runtime_1.jsxs)(card_1.CardContent, { className: "p-3 sm:p-6", children: [wallets.length > 1 && ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1 mb-4 overflow-x-auto pb-1", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setActiveTab('all'), className: (0, utils_1.cn)('px-3 py-1.5 text-xs rounded whitespace-nowrap transition-colors', activeTab === 'all'
|
|
124
|
+
? 'bg-cyan-700 text-white'
|
|
125
|
+
: 'bg-neutral-800 text-neutral-400 hover:text-white hover:bg-neutral-700'), children: [t('overview'), " (", wallets.length, " ", t('wallets'), ")"] }), wallets.map((w) => ((0, jsx_runtime_1.jsxs)("button", { onClick: () => setActiveTab(w.wallet_address), className: (0, utils_1.cn)('px-3 py-1.5 text-xs rounded whitespace-nowrap transition-colors flex items-center gap-1', activeTab === w.wallet_address
|
|
126
|
+
? 'bg-cyan-700 text-white'
|
|
127
|
+
: 'bg-neutral-800 text-neutral-400 hover:text-white hover:bg-neutral-700'), children: [(0, jsx_runtime_1.jsxs)("code", { className: "font-mono", children: [w.wallet_address.slice(0, 4), "...", w.wallet_address.slice(-4)] }), w.is_primary && (0, jsx_runtime_1.jsx)("span", { className: "text-cyan-400 text-[10px]", children: t('primary') })] }, w.wallet_address)))] })), (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)(lucide_react_1.CreditCard, { className: "w-4 h-4 text-cyan-400" }), (0, jsx_runtime_1.jsx)("span", { className: "tracking-wider", children: t('onChainAssets') }), tokenBalances.loading && (0, jsx_runtime_1.jsx)(lucide_react_1.RefreshCw, { className: "w-3 h-3 animate-spin" })] }), tokenBalances.loading ? ((0, jsx_runtime_1.jsx)("div", { className: "py-10", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center gap-3", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "w-6 h-6 animate-spin text-cyan-400" }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-neutral-400", children: t('syncingOnChainData') || '链上数据同步中...' }), (0, jsx_runtime_1.jsx)("div", { className: "w-48 h-1 bg-neutral-800 rounded-full overflow-hidden", children: (0, jsx_runtime_1.jsx)("div", { className: "h-full bg-cyan-400/60 rounded-full animate-pulse", style: { width: '60%' } }) })] }) })) : ((0, jsx_runtime_1.jsx)(AssetList, { holdings: activeHoldings, hideBalance: hideBalance, showWalletColumn: showWalletCol, isLoading: tokenBalances.loading })), (0, jsx_runtime_1.jsx)("div", { className: "mt-4 pt-3 border-t border-neutral-700 space-y-2", children: activeTab === 'all' ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-start gap-2 text-xs text-neutral-500", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Info, { className: "w-3 h-3 mt-0.5 shrink-0" }), (0, jsx_runtime_1.jsx)("span", { children: t('allWalletsNote', { count: wallets.length }) })] })) : ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-2", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 text-xs text-neutral-500", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Info, { className: "w-3 h-3 shrink-0" }), (0, jsx_runtime_1.jsxs)("span", { children: [t('currentWallet'), ":"] }), (0, jsx_runtime_1.jsx)("code", { className: "text-neutral-400 bg-neutral-800 px-2 py-0.5 rounded font-mono", children: activeTab }), wallets.find(w => w.wallet_address === activeTab)?.is_primary && ((0, jsx_runtime_1.jsx)("span", { className: "text-cyan-400 bg-cyan-400/20 px-1.5 py-0.5 rounded", children: t('primaryWallet') }))] }), (0, jsx_runtime_1.jsxs)("a", { href: `https://solscan.io/account/${activeTab}`, target: "_blank", rel: "noopener noreferrer", className: "text-cyan-400 hover:text-cyan-300 text-xs flex items-center gap-1", children: [t('viewOnSolscan'), " ", (0, jsx_runtime_1.jsx)(lucide_react_1.ExternalLink, { className: "w-3 h-3" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-start gap-2 text-xs text-neutral-500", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Info, { className: "w-3 h-3 mt-0.5 shrink-0" }), (0, jsx_runtime_1.jsx)("span", { children: t('singleWalletNote') })] })] })) })] }) }), (0, jsx_runtime_1.jsx)(card_1.Card, { className: "bg-neutral-900 border-neutral-700 hover:border-cyan-400/50 dash-card", children: (0, jsx_runtime_1.jsx)(card_1.CardContent, { className: "p-3 sm:p-6", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "p-4 bg-cyan-400/20 rounded-xl border border-cyan-400/30", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Wallet, { className: "h-8 w-8 text-cyan-400" }) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-400 tracking-wider mb-1", children: t('mccBalance') }), (0, jsx_runtime_1.jsx)("div", { className: "text-4xl font-bold text-white font-mono", children: hideBalance ? '****' : formatNumber(mccTotalBalance) }), (0, jsx_runtime_1.jsx)("div", { className: "text-sm text-neutral-500 mt-1", children: t('totalMccAllWallets') })] })] }), (0, jsx_runtime_1.jsxs)(navigation_1.Link, { href: "/mcc/mining", className: "flex items-center gap-2 px-4 py-2 bg-cyan-700 hover:bg-cyan-600 text-white rounded text-sm transition-colors", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.ExternalLink, { className: "h-4 w-4" }), t('mintingRecords')] })] }) }) }), (0, jsx_runtime_1.jsx)(card_1.Card, { className: "bg-neutral-900 border-neutral-700 hover:border-cyan-400/50 dash-card", children: (0, jsx_runtime_1.jsxs)(card_1.CardContent, { className: "p-3 sm: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)(lucide_react_1.Gift, { className: "w-4 h-4 text-cyan-400" }), (0, jsx_runtime_1.jsx)("span", { className: "tracking-wider", children: t('mcdPoints') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "p-4 bg-neutral-800 rounded border border-neutral-700", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.CreditCard, { className: "h-4 w-4 text-cyan-400" }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-neutral-400 tracking-wider", children: t('currentBalance') })] }), (0, jsx_runtime_1.jsx)("div", { className: "text-2xl font-bold text-cyan-400 font-mono", children: hideBalance ? '****' : formatNumber(mcdAmount, 6) }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500 mt-1", children: "MCD" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "p-4 bg-neutral-800 rounded border border-neutral-700", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.TrendingUp, { className: "h-4 w-4 text-neutral-400" }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-neutral-400 tracking-wider", children: t('totalReceived') })] }), (0, jsx_runtime_1.jsx)("div", { className: "text-2xl font-bold text-white font-mono", children: hideBalance ? '****' : formatNumber(mcdTotalReceived, 6) }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-500 mt-1", children: "MCD" })] })] }), (0, jsx_runtime_1.jsx)("div", { className: "mt-4 pt-3 border-t border-neutral-700 space-y-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-start gap-2 text-xs text-neutral-500", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Gift, { className: "w-3 h-3 mt-0.5 shrink-0" }), (0, jsx_runtime_1.jsxs)("span", { children: ["\u6700\u8FD1\u53D1\u653E: ", mcdDailyRewards.length > 0
|
|
128
|
+
? (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [hideBalance ? '****' : formatNumber(mcdDailyRewards[0].mcd_received, 6), " MCD (", (0, jsx_runtime_1.jsx)(time_remaining_1.FormattedDate, { dateTime: mcdDailyRewards[0].reward_date }), ")"] })
|
|
129
|
+
: t('noRecords'), ' · ', t('mcdDistributionNote')] })] }) })] }) }), lockPeriods.filter(p => p.status === 'locked').length > 0 && ((0, jsx_runtime_1.jsx)(card_1.Card, { className: "bg-neutral-900 border-neutral-700 dash-card", children: (0, jsx_runtime_1.jsxs)(card_1.CardContent, { className: "p-3 sm: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)(lucide_react_1.Lock, { className: "w-4 h-4" }), (0, jsx_runtime_1.jsx)("span", { className: "tracking-wider", children: t('lockPeriod14Days') })] }), (0, jsx_runtime_1.jsx)("div", { className: "space-y-3", children: lockPeriods.filter(p => p.status === 'locked').map((lock) => ((0, jsx_runtime_1.jsx)(LockPeriodCard, { lock: lock }, lock.lock_id))) })] }) })), (0, jsx_runtime_1.jsx)(MCCHistory_1.default, { userId: user?.uid, limit: 20 })] }));
|
|
130
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type LucideIcon } from "lucide-react";
|
|
2
|
+
import { UserRole } from "../hooks/useAuth";
|
|
3
|
+
export interface MenuItem {
|
|
4
|
+
titleKey: string;
|
|
5
|
+
href: string;
|
|
6
|
+
icon: LucideIcon;
|
|
7
|
+
roles: UserRole[];
|
|
8
|
+
children?: MenuItem[];
|
|
9
|
+
badge?: string | number;
|
|
10
|
+
isSection?: boolean;
|
|
11
|
+
descriptionKey?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const userMenuItems: MenuItem[];
|
|
14
|
+
export declare const agentMenuItems: MenuItem[];
|
|
15
|
+
export declare const adminMenuItems: MenuItem[];
|
|
16
|
+
export declare function filterMenuByRole(menuItems: MenuItem[], userRole: UserRole): MenuItem[];
|
|
17
|
+
export declare function getUserMenus(userRole: UserRole): {
|
|
18
|
+
userMenu: MenuItem[];
|
|
19
|
+
agentMenu: MenuItem[];
|
|
20
|
+
adminMenu: MenuItem[];
|
|
21
|
+
};
|
|
22
|
+
export declare function isMenuItemActive(itemHref: string, currentPath: string): boolean;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.adminMenuItems = exports.agentMenuItems = exports.userMenuItems = void 0;
|
|
4
|
+
exports.filterMenuByRole = filterMenuByRole;
|
|
5
|
+
exports.getUserMenus = getUserMenus;
|
|
6
|
+
exports.isMenuItemActive = isMenuItemActive;
|
|
7
|
+
// AI-generated · AI-managed · AI-maintained
|
|
8
|
+
const lucide_react_1 = require("lucide-react");
|
|
9
|
+
exports.userMenuItems = [
|
|
10
|
+
{
|
|
11
|
+
titleKey: "overview",
|
|
12
|
+
href: "/user-system/dashboard",
|
|
13
|
+
icon: lucide_react_1.LayoutDashboard,
|
|
14
|
+
roles: ["user", "agent", "admin"],
|
|
15
|
+
descriptionKey: "overviewDesc"
|
|
16
|
+
},
|
|
17
|
+
{ titleKey: "blockchainSection", href: "#blockchain", icon: lucide_react_1.Coins, roles: ["user", "agent", "admin"], isSection: true },
|
|
18
|
+
{
|
|
19
|
+
titleKey: "mint",
|
|
20
|
+
href: "/mcc/mining",
|
|
21
|
+
icon: lucide_react_1.Pickaxe,
|
|
22
|
+
roles: ["user", "agent", "admin"],
|
|
23
|
+
descriptionKey: "mintDesc"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
titleKey: "wallet",
|
|
27
|
+
href: "/mcc/wallet",
|
|
28
|
+
icon: lucide_react_1.Wallet,
|
|
29
|
+
roles: ["user", "agent", "admin"],
|
|
30
|
+
descriptionKey: "walletDesc"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
titleKey: "mcdCredits",
|
|
34
|
+
href: "/mcc/mcd",
|
|
35
|
+
icon: lucide_react_1.Ticket,
|
|
36
|
+
roles: ["user", "agent", "admin"],
|
|
37
|
+
descriptionKey: "mcdCreditsDesc"
|
|
38
|
+
},
|
|
39
|
+
{ titleKey: "web3osSection", href: "#web3os", icon: lucide_react_1.Users, roles: ["user", "agent", "admin"], isSection: true },
|
|
40
|
+
{
|
|
41
|
+
titleKey: "auctionMarket",
|
|
42
|
+
href: "/mcc/auctions",
|
|
43
|
+
icon: lucide_react_1.Gift,
|
|
44
|
+
roles: ["user", "agent", "admin"],
|
|
45
|
+
descriptionKey: "auctionMarketDesc"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
titleKey: "territoryManagement",
|
|
49
|
+
href: "/user-system/territory",
|
|
50
|
+
icon: lucide_react_1.Building2,
|
|
51
|
+
roles: ["user", "agent", "admin"],
|
|
52
|
+
descriptionKey: "territoryManagementDesc"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
titleKey: "nftFragments",
|
|
56
|
+
href: "/mcc/fragment",
|
|
57
|
+
icon: lucide_react_1.Puzzle,
|
|
58
|
+
roles: ["user", "agent", "admin"],
|
|
59
|
+
descriptionKey: "nftFragmentsDesc"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
titleKey: "lending",
|
|
63
|
+
href: "/mcc/lending",
|
|
64
|
+
icon: lucide_react_1.Landmark,
|
|
65
|
+
roles: ["user", "agent", "admin"],
|
|
66
|
+
descriptionKey: "lendingDesc"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
titleKey: "communityVoting",
|
|
70
|
+
href: "/mcc/voting",
|
|
71
|
+
icon: lucide_react_1.Vote,
|
|
72
|
+
roles: ["user", "agent", "admin"],
|
|
73
|
+
descriptionKey: "communityVotingDesc"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
titleKey: "orgStructure",
|
|
77
|
+
href: "/user-system/organization",
|
|
78
|
+
icon: lucide_react_1.Users,
|
|
79
|
+
roles: ["user", "agent", "admin"],
|
|
80
|
+
descriptionKey: "orgStructureDesc"
|
|
81
|
+
}
|
|
82
|
+
];
|
|
83
|
+
exports.agentMenuItems = [];
|
|
84
|
+
exports.adminMenuItems = [
|
|
85
|
+
{
|
|
86
|
+
titleKey: "systemAddresses",
|
|
87
|
+
href: "/admin/system-addresses",
|
|
88
|
+
icon: lucide_react_1.Server,
|
|
89
|
+
roles: ["admin"],
|
|
90
|
+
descriptionKey: "systemAddressesDesc"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
titleKey: "projectReview",
|
|
94
|
+
href: "/admin/project-applications",
|
|
95
|
+
icon: lucide_react_1.FileText,
|
|
96
|
+
roles: ["admin"],
|
|
97
|
+
descriptionKey: "projectReviewDesc"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
titleKey: "userManagement",
|
|
101
|
+
href: "/admin/members",
|
|
102
|
+
icon: lucide_react_1.UserCog,
|
|
103
|
+
roles: ["admin"],
|
|
104
|
+
descriptionKey: "userManagementDesc"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
titleKey: "alertCenter",
|
|
108
|
+
href: "/admin/alerts",
|
|
109
|
+
icon: lucide_react_1.Bell,
|
|
110
|
+
roles: ["admin"],
|
|
111
|
+
descriptionKey: "alertCenterDesc"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
titleKey: "simulationEngine",
|
|
115
|
+
href: "/admin/simulation",
|
|
116
|
+
icon: lucide_react_1.Bot,
|
|
117
|
+
roles: ["admin"],
|
|
118
|
+
descriptionKey: "simulationEngineDesc"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
titleKey: "mccHolders",
|
|
122
|
+
href: "/admin/mcc-holders",
|
|
123
|
+
icon: lucide_react_1.Eye,
|
|
124
|
+
roles: ["admin"],
|
|
125
|
+
descriptionKey: "mccHoldersDesc"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
titleKey: "aiManagement",
|
|
129
|
+
href: "/admin/ai-management",
|
|
130
|
+
icon: lucide_react_1.Bot,
|
|
131
|
+
roles: ["admin"],
|
|
132
|
+
descriptionKey: "aiManagementDesc"
|
|
133
|
+
}
|
|
134
|
+
];
|
|
135
|
+
function filterMenuByRole(menuItems, userRole) {
|
|
136
|
+
const roleHierarchy = {
|
|
137
|
+
admin: ["admin", "agent", "user"],
|
|
138
|
+
agent: ["agent", "user"],
|
|
139
|
+
user: ["user"]
|
|
140
|
+
};
|
|
141
|
+
const allowedRoles = roleHierarchy[userRole] || ["user"];
|
|
142
|
+
return menuItems
|
|
143
|
+
.filter(item => item.roles.some(role => allowedRoles.includes(role)))
|
|
144
|
+
.map(item => ({
|
|
145
|
+
...item,
|
|
146
|
+
children: item.children
|
|
147
|
+
? filterMenuByRole(item.children, userRole)
|
|
148
|
+
: undefined
|
|
149
|
+
}));
|
|
150
|
+
}
|
|
151
|
+
function getUserMenus(userRole) {
|
|
152
|
+
return {
|
|
153
|
+
userMenu: filterMenuByRole(exports.userMenuItems, userRole),
|
|
154
|
+
agentMenu: filterMenuByRole(exports.agentMenuItems, userRole),
|
|
155
|
+
adminMenu: filterMenuByRole(exports.adminMenuItems, userRole)
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function isMenuItemActive(itemHref, currentPath) {
|
|
159
|
+
// Strip locale prefix: /zh/mcc/mining → /mcc/mining
|
|
160
|
+
const stripped = currentPath.replace(/^\/(en|zh|ja|ko)(\/|$)/, '/');
|
|
161
|
+
const path = stripped || '/';
|
|
162
|
+
if (itemHref === '#' || itemHref.startsWith('#'))
|
|
163
|
+
return false;
|
|
164
|
+
if (itemHref === "/")
|
|
165
|
+
return path === "/";
|
|
166
|
+
return path.startsWith(itemHref);
|
|
167
|
+
}
|