@microcosmmoney/portal-react 3.12.7 → 3.13.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/mcd/mcd-page.js +3 -5
- package/dist/components/wallet/wallet-page.js +1 -1
- 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 +135 -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/useMarketData.d.ts +9 -0
- package/dist/main-portal/hooks/useMarketData.js +32 -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/usePriceHistory.d.ts +9 -0
- package/dist/main-portal/hooks/usePriceHistory.js +36 -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/analytics/hooks.d.ts +139 -0
- package/dist/main-portal/lib/analytics/hooks.js +277 -0
- package/dist/main-portal/lib/analytics/index.d.ts +2 -0
- package/dist/main-portal/lib/analytics/index.js +19 -0
- package/dist/main-portal/lib/analytics/types.d.ts +611 -0
- package/dist/main-portal/lib/analytics/types.js +2 -0
- package/dist/main-portal/lib/api/account.d.ts +39 -0
- package/dist/main-portal/lib/api/account.js +86 -0
- package/dist/main-portal/lib/api/admin.d.ts +78 -0
- package/dist/main-portal/lib/api/admin.js +195 -0
- package/dist/main-portal/lib/api/analytics.d.ts +217 -0
- package/dist/main-portal/lib/api/analytics.js +55 -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/dexscreener.d.ts +126 -0
- package/dist/main-portal/lib/api/dexscreener.js +139 -0
- package/dist/main-portal/lib/api/geckoterminal.d.ts +10 -0
- package/dist/main-portal/lib/api/geckoterminal.js +43 -0
- package/dist/main-portal/lib/api/index.d.ts +16 -0
- package/dist/main-portal/lib/api/index.js +230 -0
- package/dist/main-portal/lib/api/mcc-holders.d.ts +130 -0
- package/dist/main-portal/lib/api/mcc-holders.js +47 -0
- package/dist/main-portal/lib/api/org-service-proxy.d.ts +7 -0
- package/dist/main-portal/lib/api/org-service-proxy.js +55 -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/strategies.d.ts +101 -0
- package/dist/main-portal/lib/api/strategies.js +87 -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/exchanges/config.d.ts +34 -0
- package/dist/main-portal/lib/exchanges/config.js +185 -0
- package/dist/main-portal/lib/exchanges/hooks/index.d.ts +5 -0
- package/dist/main-portal/lib/exchanges/hooks/index.js +10 -0
- package/dist/main-portal/lib/exchanges/hooks/useBinanceData.d.ts +15 -0
- package/dist/main-portal/lib/exchanges/hooks/useBinanceData.js +216 -0
- package/dist/main-portal/lib/exchanges/hooks/useBinanceDialogs.d.ts +32 -0
- package/dist/main-portal/lib/exchanges/hooks/useBinanceDialogs.js +395 -0
- package/dist/main-portal/lib/exchanges/hooks/useUserExchanges.d.ts +15 -0
- package/dist/main-portal/lib/exchanges/hooks/useUserExchanges.js +51 -0
- package/dist/main-portal/lib/exchanges/index.d.ts +4 -0
- package/dist/main-portal/lib/exchanges/index.js +21 -0
- package/dist/main-portal/lib/exchanges/types.d.ts +102 -0
- package/dist/main-portal/lib/exchanges/types.js +2 -0
- package/dist/main-portal/lib/exchanges/utils.d.ts +1 -0
- package/dist/main-portal/lib/exchanges/utils.js +10 -0
- package/dist/main-portal/lib/gcp-secrets.d.ts +7 -0
- package/dist/main-portal/lib/gcp-secrets.js +45 -0
- package/dist/main-portal/lib/mockWallet.d.ts +130 -0
- package/dist/main-portal/lib/mockWallet.js +284 -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,239 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.default = PublicMiningModal;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const lucide_react_1 = require("lucide-react");
|
|
8
|
+
const qrcode_react_1 = require("qrcode.react");
|
|
9
|
+
const terminal_1 = require("../ui/terminal");
|
|
10
|
+
const api_1 = require("../../lib/api");
|
|
11
|
+
const wallet_adapter_react_1 = require("@solana/wallet-adapter-react");
|
|
12
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
13
|
+
const spl_token_1 = require("@solana/spl-token");
|
|
14
|
+
const solana_pay_1 = require("../../lib/solana/solana-pay");
|
|
15
|
+
const next_intl_1 = require("next-intl");
|
|
16
|
+
const STABLECOIN_MINTS = { usdc: new web3_js_1.PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), usdt: new web3_js_1.PublicKey("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB") };
|
|
17
|
+
const STABLECOIN_VAULTS = { usdc: new web3_js_1.PublicKey("5L8vPTvGH14keLq4R6CGGvSFksZFjb7bRPXarCwZbmUA"), usdt: new web3_js_1.PublicKey("BnHA9jSm88wzQS4c2nCgTXch1Byzc3FWn2G7Wgrvazy3") };
|
|
18
|
+
const SOLANA_RPC = process.env.NEXT_PUBLIC_HELIUS_RPC_URL || process.env.NEXT_PUBLIC_SOLANA_RPC_URL || "";
|
|
19
|
+
const COIN_INFO = { usdc: { symbol: 'USDC', name: 'USD Coin', icon: '💵' }, usdt: { symbol: 'USDT', name: 'Tether', icon: '💴' } };
|
|
20
|
+
function PublicMiningModal({ isOpen, onClose, onSuccess }) {
|
|
21
|
+
const t = (0, next_intl_1.useTranslations)("miningModal");
|
|
22
|
+
const { publicKey, sendTransaction, connected } = (0, wallet_adapter_react_1.useWallet)();
|
|
23
|
+
const [amount, setAmount] = (0, react_1.useState)("");
|
|
24
|
+
const [stablecoin, setStablecoin] = (0, react_1.useState)("usdc");
|
|
25
|
+
const [showDropdown, setShowDropdown] = (0, react_1.useState)(false);
|
|
26
|
+
const [step, setStep] = (0, react_1.useState)("input");
|
|
27
|
+
const [miningReq, setMiningReq] = (0, react_1.useState)(null);
|
|
28
|
+
const [ratioInfo, setRatioInfo] = (0, react_1.useState)(null);
|
|
29
|
+
const [txSig, setTxSig] = (0, react_1.useState)("");
|
|
30
|
+
const [error, setError] = (0, react_1.useState)("");
|
|
31
|
+
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
32
|
+
const [result, setResult] = (0, react_1.useState)(null);
|
|
33
|
+
const [balance, setBalance] = (0, react_1.useState)(null);
|
|
34
|
+
const [loadingBal, setLoadingBal] = (0, react_1.useState)(false);
|
|
35
|
+
const [qrPayer, setQrPayer] = (0, react_1.useState)("");
|
|
36
|
+
const [payUrl, setPayUrl] = (0, react_1.useState)("");
|
|
37
|
+
const [payRef, setPayRef] = (0, react_1.useState)(null);
|
|
38
|
+
const [monitoring, setMonitoring] = (0, react_1.useState)(false);
|
|
39
|
+
const abortRef = (0, react_1.useRef)(false);
|
|
40
|
+
const isMobile = typeof window !== "undefined" ? (0, solana_pay_1.isMobileDevice)() : false;
|
|
41
|
+
const ci = COIN_INFO[stablecoin];
|
|
42
|
+
const loadBalance = (0, react_1.useCallback)(async () => {
|
|
43
|
+
if (!publicKey || !connected) {
|
|
44
|
+
setBalance(null);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
setLoadingBal(true);
|
|
48
|
+
try {
|
|
49
|
+
const conn = new web3_js_1.Connection(SOLANA_RPC, "confirmed");
|
|
50
|
+
const ata = (0, spl_token_1.getAssociatedTokenAddressSync)(STABLECOIN_MINTS[stablecoin], publicKey);
|
|
51
|
+
const info = await conn.getAccountInfo(ata);
|
|
52
|
+
setBalance(info ? Number(info.data.readBigUInt64LE(64)) / 1000000 : 0);
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
setBalance(null);
|
|
56
|
+
}
|
|
57
|
+
finally {
|
|
58
|
+
setLoadingBal(false);
|
|
59
|
+
}
|
|
60
|
+
}, [publicKey, connected, stablecoin]);
|
|
61
|
+
(0, react_1.useEffect)(() => { if (isOpen) {
|
|
62
|
+
loadRatio();
|
|
63
|
+
loadBalance();
|
|
64
|
+
} }, [isOpen, loadBalance]);
|
|
65
|
+
(0, react_1.useEffect)(() => { if (isOpen && connected)
|
|
66
|
+
loadBalance(); }, [stablecoin, isOpen, connected, loadBalance]);
|
|
67
|
+
(0, react_1.useEffect)(() => { if (isOpen) {
|
|
68
|
+
setStep("input");
|
|
69
|
+
setAmount("");
|
|
70
|
+
setMiningReq(null);
|
|
71
|
+
setTxSig("");
|
|
72
|
+
setError("");
|
|
73
|
+
setResult(null);
|
|
74
|
+
setPayUrl("");
|
|
75
|
+
setPayRef(null);
|
|
76
|
+
setQrPayer("");
|
|
77
|
+
} }, [isOpen]);
|
|
78
|
+
(0, react_1.useEffect)(() => () => { abortRef.current = true; }, []);
|
|
79
|
+
const loadRatio = async () => { try {
|
|
80
|
+
const r = await (0, api_1.getMiningRatio)();
|
|
81
|
+
if (r.success && r.data)
|
|
82
|
+
setRatioInfo(r.data);
|
|
83
|
+
}
|
|
84
|
+
catch { } };
|
|
85
|
+
const pricing = (() => {
|
|
86
|
+
const qty = parseFloat(amount);
|
|
87
|
+
if (!qty || qty <= 0 || !ratioInfo)
|
|
88
|
+
return null;
|
|
89
|
+
const full = qty * ratioInfo.usdc_per_mcc * 4;
|
|
90
|
+
return { full, discounted: full, discount: 0 };
|
|
91
|
+
})();
|
|
92
|
+
const payAmt = miningReq ? ((miningReq.usd_amount_with_discount || miningReq.usdc_amount_with_discount) / 1000000).toFixed(2) : "0";
|
|
93
|
+
const resetState = () => { setStep("input"); setAmount(""); setMiningReq(null); setTxSig(""); setError(""); setResult(null); setPayUrl(""); setPayRef(null); setMonitoring(false); setQrPayer(""); };
|
|
94
|
+
const handleClose = () => { abortRef.current = true; const wasSuccess = step === "success"; resetState(); if (wasSuccess && onSuccess)
|
|
95
|
+
onSuccess(); onClose(); };
|
|
96
|
+
const confirmPayment = async (req, sig, wallet) => {
|
|
97
|
+
setLoading(true);
|
|
98
|
+
try {
|
|
99
|
+
const res = await (0, api_1.confirmPublicMiningPayment)({ wallet_address: wallet, tx_signature: sig, request_id: req.request_id, mcc_amount: req.mcc_amount, usd_amount: req.usd_amount_with_discount || req.usdc_amount_with_discount, stablecoin_type: stablecoin, token_type: 'mcc' });
|
|
100
|
+
if (!res.success || !res.data)
|
|
101
|
+
throw new Error(res.error || t("errorConfirmPayment"));
|
|
102
|
+
setResult(res.data);
|
|
103
|
+
setStep("success");
|
|
104
|
+
}
|
|
105
|
+
catch (e) {
|
|
106
|
+
setError(e instanceof Error ? e.message : t("errorConfirmPayment"));
|
|
107
|
+
setStep("error");
|
|
108
|
+
}
|
|
109
|
+
finally {
|
|
110
|
+
setLoading(false);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const startMonitor = async (ref, req) => {
|
|
114
|
+
setMonitoring(true);
|
|
115
|
+
abortRef.current = false;
|
|
116
|
+
try {
|
|
117
|
+
const conn = new web3_js_1.Connection(SOLANA_RPC, "confirmed");
|
|
118
|
+
const sig = await (0, solana_pay_1.findTransactionByReference)(conn, ref, { interval: 2500, timeout: 300000, commitment: "confirmed" });
|
|
119
|
+
if (abortRef.current)
|
|
120
|
+
return;
|
|
121
|
+
if (!sig) {
|
|
122
|
+
setError(t("errorPaymentTimeout"));
|
|
123
|
+
setStep("error");
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
setTxSig(sig);
|
|
127
|
+
const sender = await (0, solana_pay_1.extractSenderFromTransaction)(conn, sig);
|
|
128
|
+
if (!sender) {
|
|
129
|
+
setError(t("errorExtractPayerContact"));
|
|
130
|
+
setStep("error");
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
setQrPayer(sender);
|
|
134
|
+
setStep("confirming");
|
|
135
|
+
await confirmPayment(req, sig, sender);
|
|
136
|
+
}
|
|
137
|
+
catch (e) {
|
|
138
|
+
if (!abortRef.current) {
|
|
139
|
+
setError(e instanceof Error ? e.message : t("errorMonitorFailed"));
|
|
140
|
+
setStep("error");
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
finally {
|
|
144
|
+
setMonitoring(false);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
const handleSubmit = async () => {
|
|
148
|
+
const qty = parseFloat(amount);
|
|
149
|
+
if (!amount || qty <= 0) {
|
|
150
|
+
setError(t("errorInvalidAmountSymbol", { symbol: "MCC" }));
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
setLoading(true);
|
|
154
|
+
setError("");
|
|
155
|
+
try {
|
|
156
|
+
try {
|
|
157
|
+
const pf = await (0, api_1.getPublicMiningPreflight)();
|
|
158
|
+
if (pf.success && pf.data && !pf.data.ready) {
|
|
159
|
+
setError(pf.data.reason || "Mining system temporarily unavailable.");
|
|
160
|
+
setStep("error");
|
|
161
|
+
setLoading(false);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
catch { }
|
|
166
|
+
const res = await (0, api_1.createPublicMiningRequest)({ wallet_address: connected && publicKey ? publicKey.toBase58() : undefined, mcc_amount: qty * 1000000000, stablecoin_type: stablecoin, token_type: 'mcc' });
|
|
167
|
+
if (!res.success || !res.data)
|
|
168
|
+
throw new Error(res.error || t("errorCreateRequest"));
|
|
169
|
+
setMiningReq(res.data);
|
|
170
|
+
const { reference } = (0, solana_pay_1.createPaymentReference)();
|
|
171
|
+
setPayRef(reference);
|
|
172
|
+
const url = (0, solana_pay_1.createSolanaPayUrl)({ recipient: STABLECOIN_VAULTS[stablecoin], amount: res.data.usdc_amount_with_discount / 1000000, splToken: STABLECOIN_MINTS[stablecoin], reference, label: "Microcosm Mining", message: `Mine ${amount} MCC` });
|
|
173
|
+
setPayUrl(url);
|
|
174
|
+
if (isMobile) {
|
|
175
|
+
setStep("qrPayment");
|
|
176
|
+
startMonitor(reference, res.data);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
setStep("paymentMethod");
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
catch (e) {
|
|
183
|
+
setError(e instanceof Error ? e.message : t("errorMintRequest"));
|
|
184
|
+
setStep("error");
|
|
185
|
+
}
|
|
186
|
+
finally {
|
|
187
|
+
setLoading(false);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
const handleBrowserPay = () => {
|
|
191
|
+
if (!connected || !publicKey) {
|
|
192
|
+
setError(t("errorConnectWalletShort"));
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
if (pricing && balance !== null && balance < pricing.discounted) {
|
|
196
|
+
setError(t("errorBalanceInsufficient", { symbol: ci.symbol, required: pricing.discounted.toFixed(2), current: balance.toFixed(2), otherCoin: stablecoin === 'usdc' ? 'USDT' : 'USDC' }));
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
setStep("payment");
|
|
200
|
+
if (miningReq)
|
|
201
|
+
execTransfer(miningReq);
|
|
202
|
+
};
|
|
203
|
+
const execTransfer = async (req) => {
|
|
204
|
+
if (!publicKey || !sendTransaction)
|
|
205
|
+
throw new Error(t("errorWalletNotConnected"));
|
|
206
|
+
setLoading(true);
|
|
207
|
+
try {
|
|
208
|
+
const conn = new web3_js_1.Connection(SOLANA_RPC, "confirmed");
|
|
209
|
+
const tx = new web3_js_1.Transaction();
|
|
210
|
+
const raw = req.usd_amount_with_discount || req.usdc_amount_with_discount;
|
|
211
|
+
tx.add((0, spl_token_1.createTransferInstruction)((0, spl_token_1.getAssociatedTokenAddressSync)(STABLECOIN_MINTS[stablecoin], publicKey), STABLECOIN_VAULTS[stablecoin], publicKey, raw));
|
|
212
|
+
const { blockhash, lastValidBlockHeight } = await conn.getLatestBlockhash();
|
|
213
|
+
tx.recentBlockhash = blockhash;
|
|
214
|
+
tx.feePayer = publicKey;
|
|
215
|
+
const sig = await sendTransaction(tx, conn);
|
|
216
|
+
setTxSig(sig);
|
|
217
|
+
setStep("confirming");
|
|
218
|
+
await conn.confirmTransaction({ signature: sig, blockhash, lastValidBlockHeight }, 'finalized');
|
|
219
|
+
await confirmPayment(req, sig, publicKey.toBase58());
|
|
220
|
+
}
|
|
221
|
+
catch (e) {
|
|
222
|
+
setError(e instanceof Error ? e.message : t("errorTransferFailed", { symbol: ci.symbol }));
|
|
223
|
+
setStep("error");
|
|
224
|
+
throw e;
|
|
225
|
+
}
|
|
226
|
+
finally {
|
|
227
|
+
setLoading(false);
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
if (!isOpen)
|
|
231
|
+
return null;
|
|
232
|
+
const TxLink = ({ sig, label }) => ((0, jsx_runtime_1.jsxs)("a", { href: `https://solscan.io/tx/${sig}`, target: "_blank", rel: "noopener noreferrer", className: "inline-flex items-center gap-1 text-xs text-cyan-400 hover:underline", children: [label || `${sig.slice(0, 16)}...${sig.slice(-16)}`, " ", (0, jsx_runtime_1.jsx)(lucide_react_1.ExternalLink, { className: "w-3 h-3" })] }));
|
|
233
|
+
const ErrBox = () => error ? (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 p-3 rounded bg-red-500/20 border border-red-500/50 text-red-500 text-sm", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.AlertCircle, { className: "w-4 h-4" }), error] }) : null;
|
|
234
|
+
const OrderSummary = () => miningReq ? ((0, jsx_runtime_1.jsxs)("div", { className: "p-3 rounded bg-neutral-800 border border-neutral-700 space-y-2 text-sm", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-neutral-400", children: t("mintLabel") }), (0, jsx_runtime_1.jsxs)("span", { className: "font-bold text-white", children: [miningReq.mcc_amount / 1000000000, " MCC"] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-neutral-400", children: t("payLabel") }), (0, jsx_runtime_1.jsxs)("span", { className: "text-cyan-400 font-bold font-mono", children: [payAmt, " ", ci.symbol] })] })] })) : null;
|
|
235
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "fixed inset-0 z-50 flex items-end 2xs:items-center justify-center bg-black/50 backdrop-blur-sm font-mono", children: (0, jsx_runtime_1.jsx)("div", { className: "relative w-full max-w-2xl mx-0 2xs:mx-3 xs:mx-4 max-h-[95vh] 2xs:max-h-[90vh] overflow-y-auto rounded-t-2xl 2xs:rounded-xl", children: (0, jsx_runtime_1.jsxs)(terminal_1.TerminalCard, { filename: "mcc_minting.json", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between mb-4 2xs:mb-5 xs:mb-6", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h2", { className: "text-base 2xs:text-lg xs:text-xl font-bold text-white mb-1", children: t("publicTitle", { symbol: "MCC" }) }), (0, jsx_runtime_1.jsx)("p", { className: "text-[10px] 2xs:text-xs text-neutral-400 tracking-wider", children: t("publicSubtitleMcc") })] }), (0, jsx_runtime_1.jsx)("button", { onClick: handleClose, disabled: loading, className: "text-neutral-400 hover:text-white transition-colors p-1 min-w-[44px] min-h-[44px] flex items-center justify-center", children: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "w-5 h-5" }) })] }), step === "input" && ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-3 2xs:space-y-4", children: [ratioInfo && ((0, jsx_runtime_1.jsx)("div", { className: "p-2 2xs:p-3 rounded bg-neutral-800 border border-neutral-700", children: (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-3 gap-2 2xs:gap-4 text-xs 2xs:text-sm", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-[10px] 2xs:text-xs text-neutral-400 tracking-wider mb-1", children: t("currentPhase") }), (0, jsx_runtime_1.jsxs)("div", { className: "text-white font-bold font-mono", children: ["Phase ", ratioInfo.current_stage] })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-[10px] 2xs:text-xs text-neutral-400 tracking-wider mb-1 flex items-center gap-1", children: [t("techBonus"), (0, jsx_runtime_1.jsx)("span", { className: "cursor-help text-neutral-500 hover:text-cyan-400", title: t("techBonusTooltip"), children: "?" })] }), (0, jsx_runtime_1.jsx)("div", { className: "text-cyan-400 font-bold font-mono", children: "0%" })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-[10px] 2xs:text-xs text-neutral-400 tracking-wider mb-1", children: t("usdPerMcc") }), (0, jsx_runtime_1.jsx)("div", { className: "text-cyan-400 font-bold font-mono", children: (ratioInfo.usdc_per_mcc * 4).toFixed(4) })] })] }) })), (0, jsx_runtime_1.jsx)("div", { className: "p-3 2xs:p-4 rounded bg-cyan-400/20 border border-cyan-400/50", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-start gap-2 2xs:gap-3", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.AlertCircle, { className: "w-4 h-4 2xs:w-5 2xs:h-5 text-cyan-400 flex-shrink-0 mt-0.5" }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-cyan-400 font-bold text-xs 2xs:text-sm mb-1", children: t("solanaOnly") }), (0, jsx_runtime_1.jsx)("p", { className: "text-neutral-300 text-[10px] 2xs:text-xs leading-relaxed", children: t("solanaOnlyDescPublic") })] })] }) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("label", { className: "block text-xs text-neutral-400 tracking-wider mb-2", children: [t("paymentMethod"), " ", (0, jsx_runtime_1.jsxs)("span", { className: "text-neutral-500", children: ["(", t("paymentMethodHintPublic"), ")"] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "relative", children: [(0, jsx_runtime_1.jsxs)("button", { type: "button", onClick: () => setShowDropdown(!showDropdown), className: "w-full px-4 py-3 bg-neutral-800 border border-neutral-600 rounded text-white flex items-center justify-between hover:border-neutral-500 transition-colors", children: [(0, jsx_runtime_1.jsxs)("span", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("span", { children: ci.icon }), (0, jsx_runtime_1.jsx)("span", { children: ci.symbol }), (0, jsx_runtime_1.jsxs)("span", { className: "text-neutral-400 text-sm", children: ["(", ci.name, ")"] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDown, { className: `w-4 h-4 transition-transform ${showDropdown ? 'rotate-180' : ''}` })] }), showDropdown && ((0, jsx_runtime_1.jsx)("div", { className: "absolute z-10 w-full mt-1 bg-neutral-900 border border-neutral-700 rounded shadow-lg", children: Object.keys(COIN_INFO).map((t2) => ((0, jsx_runtime_1.jsxs)("button", { type: "button", onClick: () => { setStablecoin(t2); setShowDropdown(false); }, className: `w-full px-4 py-3 text-left flex items-center gap-2 hover:bg-neutral-800 transition-colors ${stablecoin === t2 ? 'bg-neutral-800 text-cyan-400' : 'text-white'}`, children: [(0, jsx_runtime_1.jsx)("span", { children: COIN_INFO[t2].icon }), (0, jsx_runtime_1.jsx)("span", { children: COIN_INFO[t2].symbol }), (0, jsx_runtime_1.jsxs)("span", { className: "text-neutral-400 text-sm", children: ["(", COIN_INFO[t2].name, ")"] })] }, t2))) }))] }), connected && (0, jsx_runtime_1.jsxs)("div", { className: "mt-2 flex items-center justify-between text-xs", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-neutral-400", children: t("stablecoinSettlement", { symbol: ci.symbol }) }), (0, jsx_runtime_1.jsx)("span", { className: `font-medium ${balance === null ? 'text-neutral-400' : balance === 0 ? 'text-red-400' : 'text-white'}`, children: loadingBal ? t("loading") : balance === null ? t("balanceUnknown") : t("balance", { amount: balance.toFixed(2), symbol: ci.symbol }) })] })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("label", { className: "block text-xs text-neutral-400 tracking-wider mb-2", children: t("mintAmountLabel", { symbol: "MCC" }) }), (0, jsx_runtime_1.jsx)("input", { type: "number", inputMode: "decimal", value: amount, onChange: (e) => setAmount(e.target.value), placeholder: t("inputPlaceholder", { symbol: "MCC" }), className: "w-full px-3 2xs:px-4 py-3 bg-neutral-800 border border-neutral-600 rounded text-white placeholder-neutral-400 focus:outline-none focus:border-cyan-400 text-base", min: "0", step: "0.01" })] }), pricing && ((0, jsx_runtime_1.jsxs)("div", { className: "p-4 rounded bg-white/10 border-neutral-700 border space-y-3", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-400 tracking-wider mb-2", children: t("estimatedPayment") }), (0, jsx_runtime_1.jsxs)("div", { className: "text-2xl font-bold text-cyan-400 font-mono", children: [pricing.discounted.toFixed(2), " USD"] }), pricing.discount > 0 && (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-400 mt-2", children: t("originalPricePublic", { amount: pricing.full.toFixed(2), bonus: String(pricing.discount) }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "pt-3 border-t border-neutral-700", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between items-center", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-xs text-neutral-400 tracking-wider", children: t("youWillReceive") }), (0, jsx_runtime_1.jsxs)("span", { className: "text-lg font-bold font-mono text-white", children: [parseFloat(amount).toFixed(4), " MCC"] })] }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-400 mt-1", children: t("tokenToPayerWallet", { symbol: "MCC" }) })] })] })), (0, jsx_runtime_1.jsx)(ErrBox, {}), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-2 2xs:gap-3", children: [(0, jsx_runtime_1.jsx)("button", { onClick: handleClose, className: "flex-1 px-3 2xs:px-4 py-3 border border-neutral-700 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-300 bg-transparent rounded transition-colors text-sm 2xs:text-base min-h-[44px]", children: t("cancel") }), (0, jsx_runtime_1.jsxs)("button", { onClick: handleSubmit, disabled: loading || !amount || parseFloat(amount) <= 0, className: "flex-1 px-3 2xs:px-4 py-3 bg-cyan-700 hover:bg-cyan-600 text-white rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2 text-sm 2xs:text-base min-h-[44px]", children: [loading && (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "w-4 h-4 animate-spin" }), loading ? t("processing") : t("confirmMintSymbol", { symbol: "MCC" })] })] })] })), step === "paymentMethod" && miningReq && ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)(OrderSummary, {}), (0, jsx_runtime_1.jsx)("div", { className: "p-3 rounded bg-cyan-500/10 border border-cyan-500/30 text-xs text-cyan-300", children: t("stablecoinReminder", { symbol: ci.symbol }) }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-400 tracking-wider uppercase mb-1", children: t("selectPaymentMethod") }), (0, jsx_runtime_1.jsx)("button", { onClick: () => { if (payRef && miningReq) {
|
|
236
|
+
setStep("qrPayment");
|
|
237
|
+
startMonitor(payRef, miningReq);
|
|
238
|
+
} }, className: "w-full p-4 rounded border-2 border-cyan-400/50 bg-cyan-400/5 hover:bg-cyan-400/10 hover:border-cyan-400/70 transition-all text-left group", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-12 h-12 rounded-lg bg-cyan-400/20 flex items-center justify-center flex-shrink-0", children: (0, jsx_runtime_1.jsx)(lucide_react_1.QrCode, { className: "w-6 h-6 text-cyan-400" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-white font-bold text-sm", children: t("mobileQrScan") }), (0, jsx_runtime_1.jsx)("span", { className: "px-1.5 py-0.5 rounded text-[10px] font-bold bg-cyan-400/20 text-cyan-400 tracking-wider", children: t("recommended") })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-neutral-400 text-xs mt-1", children: t("mobileQrDesc") })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.Smartphone, { className: "w-5 h-5 text-neutral-500 group-hover:text-cyan-400 transition-colors flex-shrink-0" })] }) }), (0, jsx_runtime_1.jsx)("button", { onClick: handleBrowserPay, disabled: !connected, className: "w-full p-4 rounded border border-neutral-700 bg-neutral-800/50 hover:bg-neutral-800 hover:border-neutral-600 transition-all text-left group disabled:opacity-40 disabled:cursor-not-allowed", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-12 h-12 rounded-lg bg-neutral-700/50 flex items-center justify-center flex-shrink-0", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Monitor, { className: "w-6 h-6 text-neutral-400" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-neutral-300 font-bold text-sm", children: t("browserExtension") }), (0, jsx_runtime_1.jsx)("p", { className: "text-neutral-500 text-xs mt-1", children: connected ? t("browserExtConnectedPublic") : t("browserExtNotConnectedPublic") })] })] }) }), (0, jsx_runtime_1.jsx)(ErrBox, {}), (0, jsx_runtime_1.jsxs)("button", { onClick: () => { setStep("input"); setError(""); }, className: "w-full px-4 py-2 text-neutral-400 hover:text-neutral-300 text-sm transition-colors", children: ["\u2190 ", t("goBack")] })] })), step === "qrPayment" && miningReq && payUrl && ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-3 2xs:space-y-4", children: [(0, jsx_runtime_1.jsx)(terminal_1.TerminalBadge, { variant: "info", children: t("waitingQrPayment") }), (0, jsx_runtime_1.jsx)(OrderSummary, {}), (0, jsx_runtime_1.jsxs)("div", { className: "p-2 2xs:p-3 rounded bg-amber-500/10 border border-amber-500/30", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 text-xs 2xs:text-sm", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Shield, { className: "w-4 h-4 text-amber-400 flex-shrink-0" }), (0, jsx_runtime_1.jsx)("span", { className: "text-amber-400 font-bold", children: t("confirmPayWithSymbol", { symbol: ci.symbol }) })] }), (0, jsx_runtime_1.jsxs)("p", { className: "text-neutral-400 text-[10px] 2xs:text-xs mt-1 ml-6", children: [t("insufficientBalance", { symbol: ci.symbol }), (0, jsx_runtime_1.jsx)("button", { onClick: () => { abortRef.current = true; setStep("input"); setMonitoring(false); }, className: "text-cyan-400 hover:underline ml-1", children: t("switchToken") })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center space-y-3 2xs:space-y-4", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-neutral-400 text-xs 2xs:text-sm text-center", children: t("scanQrToPayDesktop") }), (0, jsx_runtime_1.jsx)("div", { className: "bg-white p-3 2xs:p-4 xs:p-5 rounded-xl", children: (0, jsx_runtime_1.jsx)(qrcode_react_1.QRCodeSVG, { value: payUrl, size: 200, level: "H", includeMargin: false, className: "w-[160px] h-[160px] 2xs:w-[180px] 2xs:h-[180px] xs:w-[220px] xs:h-[220px] sm:w-[280px] sm:h-[280px]", imageSettings: { src: "/mcc-logo-40.png", x: undefined, y: undefined, height: 40, width: 40, excavate: true } }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 text-neutral-400 text-[10px] 2xs:text-xs", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "w-3 h-3 animate-spin" }), t("waitingQrScan")] })] }), monitoring && (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-center gap-2 text-cyan-400 text-xs 2xs:text-sm py-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "w-4 h-4 animate-spin" }), t("monitoringOnchain")] }), (0, jsx_runtime_1.jsxs)("button", { onClick: () => { abortRef.current = true; setStep(isMobile ? "input" : "paymentMethod"); setMonitoring(false); setError(""); }, className: "w-full px-4 py-2 text-neutral-400 hover:text-neutral-300 text-xs 2xs:text-sm transition-colors min-h-[44px]", children: ["\u2190 ", t("goBack")] })] })), step === "payment" && miningReq && ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)(terminal_1.TerminalBadge, { variant: "info", children: t("waitingPayment") }), (0, jsx_runtime_1.jsx)("div", { className: "p-3 rounded bg-neutral-800 border border-neutral-700 text-sm", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-neutral-400", children: t("payLabel") }), (0, jsx_runtime_1.jsxs)("span", { className: "text-cyan-400 font-bold font-mono", children: [payAmt, " ", ci.symbol] })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-center py-8", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "w-8 h-8 animate-spin text-cyan-400" }) }), (0, jsx_runtime_1.jsx)("p", { className: "text-center text-neutral-400 text-sm", children: t("processingTransferGeneric") })] })), step === "confirming" && txSig && ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)(terminal_1.TerminalBadge, { variant: "warning", children: t("verifying") }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-center py-8", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "w-8 h-8 animate-spin text-cyan-400" }) }), (0, jsx_runtime_1.jsx)("p", { className: "text-center text-neutral-400 text-sm mb-2", children: t("verifyingTransaction") }), (0, jsx_runtime_1.jsxs)("div", { className: "p-3 rounded bg-neutral-800 border border-neutral-700", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-400 tracking-wider mb-1", children: t("txSignature") }), (0, jsx_runtime_1.jsxs)("div", { className: "font-mono text-xs text-cyan-400 break-all", children: [txSig.slice(0, 16), "...", txSig.slice(-16)] }), (0, jsx_runtime_1.jsx)(TxLink, { sig: txSig, label: t("viewOnExplorer") })] })] })), step === "success" && result && ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-center py-8", children: (0, jsx_runtime_1.jsx)("div", { className: "w-16 h-16 rounded-full bg-white/10 flex items-center justify-center", children: (0, jsx_runtime_1.jsx)(lucide_react_1.CheckCircle2, { className: "w-8 h-8 text-white" }) }) }), (0, jsx_runtime_1.jsx)("h3", { className: "text-xl font-bold text-center text-white", children: t("mintSuccess") }), (0, jsx_runtime_1.jsxs)("div", { className: "p-4 rounded bg-white/10 border-neutral-700 border space-y-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-400 tracking-wider mb-1", children: t("youReceived") }), (0, jsx_runtime_1.jsxs)("div", { className: "text-3xl font-bold font-mono text-white", children: ["+", (result.mcc_distributed.user / 1000000000).toLocaleString(), " MCC"] }), qrPayer && (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-400 mt-2", children: t("sentToAddress", { address: `${qrPayer.slice(0, 8)}...${qrPayer.slice(-6)}` }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "pt-3 border-t border-neutral-700", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-400 tracking-wider mb-1", children: t("paymentTxGeneric") }), (0, jsx_runtime_1.jsx)(TxLink, { sig: txSig })] })] }), result.onchain_tx_signature && (0, jsx_runtime_1.jsxs)("div", { className: "p-4 rounded bg-neutral-800 border border-neutral-700 space-y-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-400 tracking-wider", children: t("onchainDistribution") }), (0, jsx_runtime_1.jsx)(TxLink, { sig: result.onchain_tx_signature })] }), (0, jsx_runtime_1.jsx)("div", { className: "p-3 rounded bg-cyan-400/20 border border-cyan-400/50 text-center", children: (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-cyan-400", children: t("registerHint") }) }), (0, jsx_runtime_1.jsx)("button", { onClick: handleClose, className: "w-full px-4 py-3 bg-cyan-700 hover:bg-cyan-600 text-white rounded transition-colors", children: t("done") })] })), step === "error" && ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-center py-8", children: (0, jsx_runtime_1.jsx)("div", { className: "w-16 h-16 rounded-full bg-red-500/20 flex items-center justify-center", children: (0, jsx_runtime_1.jsx)(lucide_react_1.AlertCircle, { className: "w-8 h-8 text-red-500" }) }) }), (0, jsx_runtime_1.jsx)("h3", { className: "text-xl font-bold text-center text-red-500", children: t("mintFailed") }), (0, jsx_runtime_1.jsx)("div", { className: "p-4 rounded bg-red-500/20 border border-red-500/50", children: (0, jsx_runtime_1.jsx)("p", { className: "text-red-500 text-sm whitespace-pre-line", children: error }) }), (0, jsx_runtime_1.jsx)("button", { onClick: handleClose, className: "w-full px-4 py-3 border border-neutral-700 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-300 bg-transparent rounded transition-colors", children: t("close") })] }))] }) }) }));
|
|
239
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function RecyclePoolSection(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// AI-generated · AI-managed · AI-maintained
|
|
3
|
+
"use client";
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.RecyclePoolSection = RecyclePoolSection;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const card_1 = require("../ui/card");
|
|
9
|
+
const lucide_react_1 = require("lucide-react");
|
|
10
|
+
const next_intl_1 = require("next-intl");
|
|
11
|
+
const MCCPriceContext_1 = require("../../contexts/MCCPriceContext");
|
|
12
|
+
const POOL_ADDRESS = "REDEh89TzpwCtoWQuuNPtxskrVoUDQgowR7e7sZpWj9";
|
|
13
|
+
function RecyclePoolSection() {
|
|
14
|
+
const t = (0, next_intl_1.useTranslations)("resources");
|
|
15
|
+
const ticker = (0, MCCPriceContext_1.useMCCPrice)();
|
|
16
|
+
const [stats, setStats] = (0, react_1.useState)({
|
|
17
|
+
poolBalance: 0,
|
|
18
|
+
totalInflow: 0,
|
|
19
|
+
totalMarketMade: 0,
|
|
20
|
+
marketMadeMcc: 0,
|
|
21
|
+
avgPrice30d: 0,
|
|
22
|
+
});
|
|
23
|
+
const [loadingStats, setLoadingStats] = (0, react_1.useState)(true);
|
|
24
|
+
const loadStats = async () => {
|
|
25
|
+
setLoadingStats(true);
|
|
26
|
+
try {
|
|
27
|
+
const [priceRes, poolRes] = await Promise.all([
|
|
28
|
+
fetch("/api/buyback/price").then(r => r.json()).catch(() => null),
|
|
29
|
+
fetch("/api/buyback/pool").then(r => r.json()).catch(() => null),
|
|
30
|
+
]);
|
|
31
|
+
const basePrice = Number(priceRes?.data?.base_price) || ticker.price || 0;
|
|
32
|
+
const usdcBal = Number(poolRes?.data?.usdc_balance) || 0;
|
|
33
|
+
const usdtBal = Number(poolRes?.data?.usdt_balance) || 0;
|
|
34
|
+
const totalBuyback = Number(poolRes?.data?.total_buyback) || 0;
|
|
35
|
+
const totalMccBought = Number(poolRes?.data?.total_mcc_bought) || 0;
|
|
36
|
+
setStats({
|
|
37
|
+
poolBalance: usdcBal + usdtBal,
|
|
38
|
+
totalInflow: (usdcBal + usdtBal) + totalBuyback,
|
|
39
|
+
totalMarketMade: totalBuyback,
|
|
40
|
+
marketMadeMcc: totalMccBought > 0 ? Math.round(totalMccBought) : 0,
|
|
41
|
+
avgPrice30d: basePrice,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
catch { }
|
|
45
|
+
finally {
|
|
46
|
+
setLoadingStats(false);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
(0, react_1.useEffect)(() => {
|
|
50
|
+
loadStats();
|
|
51
|
+
}, []);
|
|
52
|
+
const formatValue = (num) => {
|
|
53
|
+
if (num >= 1000000)
|
|
54
|
+
return `${(num / 1000000).toFixed(2)}M`;
|
|
55
|
+
if (num >= 1000)
|
|
56
|
+
return `${(num / 1000).toFixed(1)}K`;
|
|
57
|
+
return num.toFixed(2);
|
|
58
|
+
};
|
|
59
|
+
return ((0, jsx_runtime_1.jsx)("section", { id: "recycle", "aria-labelledby": "recycle-title", className: "bg-muted/30 py-20 md:py-24 px-4 sm:px-6", children: (0, jsx_runtime_1.jsxs)("div", { className: "max-w-[1400px] mx-auto", children: [(0, jsx_runtime_1.jsxs)("header", { className: "text-center mb-12 md:mb-16", children: [(0, jsx_runtime_1.jsx)("p", { className: "font-mono text-xs sm:text-sm uppercase tracking-widest text-[#5EEAD4] mb-3 md:mb-4", children: "MARKET MAKING" }), (0, jsx_runtime_1.jsx)("h2", { id: "recycle-title", className: "font-sans font-bold text-3xl sm:text-4xl md:text-5xl text-foreground mb-4 md:mb-5 text-balance", children: t("recycleTitle") }), (0, jsx_runtime_1.jsxs)("div", { className: "max-w-3xl mx-auto space-y-2", children: [(0, jsx_runtime_1.jsx)("p", { className: "font-mono text-sm sm:text-base text-foreground/60 text-balance", children: t("recycleDesc1") }), (0, jsx_runtime_1.jsx)("p", { className: "font-mono text-xs sm:text-sm text-foreground/40 text-balance", children: t("recycleDesc2") })] })] }), (0, jsx_runtime_1.jsx)("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-3 md:gap-4 mb-8", role: "list", "aria-label": t("recycleAriaLabel"), children: loadingStats ? ((0, jsx_runtime_1.jsx)("div", { className: "col-span-full flex items-center justify-center py-8", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "w-6 h-6 animate-spin text-[#5EEAD4]" }) })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(PoolStatCard, { label: t("stablecoinPool"), value: formatValue(stats.poolBalance), sub: "USDC+USDT", highlight: true }), (0, jsx_runtime_1.jsx)(PoolStatCard, { label: t("totalInflow"), value: formatValue(stats.totalInflow), sub: t("mintInjection") }), (0, jsx_runtime_1.jsx)(PoolStatCard, { label: t("totalMarketMade"), value: formatValue(stats.totalMarketMade), sub: t("stablecoinSpent"), highlightColor: "blue" }), (0, jsx_runtime_1.jsx)(PoolStatCard, { label: t("marketMadeMcc"), value: formatValue(stats.marketMadeMcc), sub: t("historicalTotal") }), (0, jsx_runtime_1.jsx)(PoolStatCard, { label: t("avg30dPrice"), value: stats.avgPrice30d.toFixed(2), sub: t("marketPriceLabel"), highlightColor: "blue" })] })) }), (0, jsx_runtime_1.jsx)("div", { className: "grid grid-cols-1 md:grid-cols-1 gap-4 md:gap-6 mb-8", children: (0, jsx_runtime_1.jsxs)(card_1.Card, { className: "bg-background/50 border-border/30 rounded-lg blockchain-card", children: [(0, jsx_runtime_1.jsxs)(card_1.CardHeader, { className: "p-4 sm:p-6", children: [(0, jsx_runtime_1.jsxs)(card_1.CardTitle, { className: "text-foreground flex items-center gap-2 text-lg", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Shield, { className: "w-5 h-5 text-[#5EEAD4]", "aria-hidden": "true" }), t("poolContractAddress")] }), (0, jsx_runtime_1.jsx)(card_1.CardDescription, { className: "text-foreground/60 text-sm", children: t("poolContractDesc") }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-wrap gap-2 mt-3", children: [(0, jsx_runtime_1.jsx)("span", { className: "inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md bg-[#5EEAD4]/10 border border-[#5EEAD4]/20 font-mono text-[10px] text-[#5EEAD4]", children: t("x402Protocol") }), (0, jsx_runtime_1.jsx)("span", { className: "inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md bg-[#5EBCD4]/10 border border-[#5EBCD4]/20 font-mono text-[10px] text-[#5EBCD4]", children: t("pdaSelfGoverning") }), (0, jsx_runtime_1.jsx)("span", { className: "inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md bg-foreground/5 border border-foreground/10 font-mono text-[10px] text-foreground/50", children: t("onchainVerifiable") })] })] }), (0, jsx_runtime_1.jsxs)(card_1.CardContent, { className: "space-y-4 p-4 sm:p-6 pt-0", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-muted/50 p-3 sm:p-4 rounded-lg", children: (0, jsx_runtime_1.jsx)("p", { className: "font-mono text-xs sm:text-sm text-foreground break-all select-all", children: POOL_ADDRESS }) }), (0, jsx_runtime_1.jsxs)("a", { href: `https://solscan.io/account/${POOL_ADDRESS}`, target: "_blank", rel: "noopener noreferrer", className: "inline-flex items-center gap-2 font-mono text-sm text-[#5EEAD4] hover:text-[#99F6E4] transition-colors duration-200 min-h-[44px] py-2", children: [t("viewOnSolana"), (0, jsx_runtime_1.jsx)(lucide_react_1.ExternalLink, { className: "w-4 h-4", "aria-hidden": "true" })] })] })] }) }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 md:gap-5", children: [(0, jsx_runtime_1.jsx)(FlowCard, { step: 1, icon: (0, jsx_runtime_1.jsx)(lucide_react_1.Ban, { className: "w-5 h-5" }), title: t("zeroAllocationGenesis"), description: t("zeroAllocationDesc"), color: "green" }), (0, jsx_runtime_1.jsx)(FlowCard, { step: 2, icon: (0, jsx_runtime_1.jsx)(lucide_react_1.ArrowDownRight, { className: "w-5 h-5" }), title: t("mintInjectionTitle"), description: t("mintInjectionDesc"), color: "blue" }), (0, jsx_runtime_1.jsx)(FlowCard, { step: 3, icon: (0, jsx_runtime_1.jsx)(lucide_react_1.ArrowUpRight, { className: "w-5 h-5" }), title: t("marketMakingSupport"), description: t("marketMakingSupportDesc"), color: "blue" }), (0, jsx_runtime_1.jsx)(FlowCard, { step: 4, icon: (0, jsx_runtime_1.jsx)(lucide_react_1.RotateCcw, { className: "w-5 h-5" }), title: t("cyclicalRecurrence"), description: t("cyclicalRecurrenceDesc"), color: "green" })] })] }) }));
|
|
60
|
+
}
|
|
61
|
+
function PoolStatCard({ label, value, sub, highlight = false, highlightColor, }) {
|
|
62
|
+
const colorClass = highlightColor === "blue"
|
|
63
|
+
? "text-[#5EBCD4]"
|
|
64
|
+
: highlight
|
|
65
|
+
? "text-[#5EEAD4]"
|
|
66
|
+
: "text-foreground";
|
|
67
|
+
return ((0, jsx_runtime_1.jsxs)("div", { role: "listitem", className: "border border-border/30 bg-background/50 rounded-lg p-4 transition-colors duration-200 hover:bg-background/70 hover:border-border/50", children: [(0, jsx_runtime_1.jsx)("p", { className: "font-mono text-[10px] sm:text-xs uppercase tracking-widest text-foreground/50 mb-1", children: label }), (0, jsx_runtime_1.jsx)("p", { className: `font-sans font-bold text-xl sm:text-2xl tabular-nums ${colorClass}`, children: value }), (0, jsx_runtime_1.jsx)("p", { className: "font-mono text-[10px] sm:text-xs text-foreground/40 mt-0.5 tabular-nums", children: sub })] }));
|
|
68
|
+
}
|
|
69
|
+
function FlowCard({ step, icon, title, description, color, }) {
|
|
70
|
+
const colorClasses = {
|
|
71
|
+
green: {
|
|
72
|
+
badge: "bg-[#5EEAD4]/15 text-[#5EEAD4] border-[#5EEAD4]/25",
|
|
73
|
+
icon: "text-[#5EEAD4]",
|
|
74
|
+
},
|
|
75
|
+
blue: {
|
|
76
|
+
badge: "bg-[#5EBCD4]/15 text-[#5EBCD4] border-[#5EBCD4]/25",
|
|
77
|
+
icon: "text-[#5EBCD4]",
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
const c = colorClasses[color];
|
|
81
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "border border-border/30 bg-background/50 rounded-lg p-5 blockchain-card", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3 mb-3", children: [(0, jsx_runtime_1.jsx)("div", { className: `w-8 h-8 rounded-full flex items-center justify-center border ${c.badge}`, children: (0, jsx_runtime_1.jsx)("span", { className: "font-mono text-sm font-bold", children: step }) }), (0, jsx_runtime_1.jsx)("span", { className: c.icon, "aria-hidden": "true", children: icon })] }), (0, jsx_runtime_1.jsx)("p", { className: "font-sans font-medium text-sm sm:text-base text-foreground mb-1.5", children: title }), (0, jsx_runtime_1.jsx)("p", { className: "font-mono text-[10px] sm:text-xs text-foreground/50 leading-relaxed", children: description })] }));
|
|
82
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface RegistrationPromptProps {
|
|
2
|
+
isOpen: boolean;
|
|
3
|
+
onClose: () => void;
|
|
4
|
+
onRegister: () => void;
|
|
5
|
+
onSkip: () => void;
|
|
6
|
+
}
|
|
7
|
+
export default function RegistrationPrompt({ isOpen, onClose, onRegister, onSkip, }: RegistrationPromptProps): import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
export {};
|
|
@@ -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.default = RegistrationPrompt;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const lucide_react_1 = require("lucide-react");
|
|
8
|
+
const terminal_1 = require("../ui/terminal");
|
|
9
|
+
function RegistrationPrompt({ isOpen, onClose, onRegister, onSkip, }) {
|
|
10
|
+
if (!isOpen)
|
|
11
|
+
return null;
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm font-mono", children: (0, jsx_runtime_1.jsx)("div", { className: "relative w-full max-w-lg mx-4", children: (0, jsx_runtime_1.jsxs)(terminal_1.TerminalCard, { filename: "registration_prompt.json", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between mb-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-10 h-10 rounded-full flex items-center justify-center bg-cyan-400/20 border border-cyan-400/50", children: (0, jsx_runtime_1.jsx)(lucide_react_1.UserPlus, { className: "w-5 h-5 text-cyan-400" }) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h2", { className: "text-lg font-bold text-white", children: "\u5EFA\u8BAE\u6CE8\u518C\u5E73\u53F0\u8D26\u53F7" }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-neutral-400 tracking-wider", children: "\u6CE8\u518C\u540E\u53EF\u89E3\u9501\u66F4\u591A\u529F\u80FD" })] })] }), (0, jsx_runtime_1.jsx)("button", { onClick: onClose, className: "text-neutral-400 hover:text-white transition-colors", children: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "w-5 h-5" }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-3 mb-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-start gap-3 p-3 rounded bg-neutral-800 border border-neutral-700", children: [(0, jsx_runtime_1.jsx)(terminal_1.TerminalBadge, { variant: "success", children: "1" }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-sm text-white font-medium", children: "\u5B8C\u6574\u94F8\u9020\u8BB0\u5F55\u4E0E\u7B49\u7EA7\u5347\u7EA7" }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-400 mt-0.5", children: "\u94F8\u9020 21 \u5929\u81EA\u52A8\u5347\u7EA7\u4E3A\u77FF\u5DE5\uFF0C\u89E3\u9501\u9886\u5730\u5F52\u5C5E" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-start gap-3 p-3 rounded bg-neutral-800 border border-neutral-700", children: [(0, jsx_runtime_1.jsx)(terminal_1.TerminalBadge, { variant: "success", children: "2" }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-sm text-white font-medium", children: "\u79D1\u6280\u52A0\u6210" }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-400 mt-0.5", children: "\u6700\u9AD8 100% \u4EA7\u51FA\u52A0\u6210\uFF0C\u5927\u5E45\u63D0\u5347\u6316\u77FF\u6536\u76CA" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-start gap-3 p-3 rounded bg-neutral-800 border border-neutral-700", children: [(0, jsx_runtime_1.jsx)(terminal_1.TerminalBadge, { variant: "success", children: "3" }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-sm text-white font-medium", children: "\u9886\u5730\u5F52\u5C5E\u4E0E\u751F\u6001\u6743\u76CA" }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs text-neutral-400 mt-0.5", children: "\u52A0\u5165\u7A7A\u95F4\u7AD9\uFF0C\u53C2\u4E0E\u91D1\u5E93\u5206\u914D\uFF0C\u83B7\u5F97 MCD \u6BCF\u65E5\u6536\u76CA" })] })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-3 mb-4", children: [(0, jsx_runtime_1.jsx)("button", { onClick: onSkip, className: "flex-1 px-4 py-3 border border-neutral-700 text-neutral-400 hover:bg-neutral-800 hover:text-neutral-300 bg-transparent rounded transition-colors text-sm", children: "\u8DF3\u8FC7\uFF0C\u76F4\u63A5\u94F8\u9020" }), (0, jsx_runtime_1.jsxs)("button", { onClick: onRegister, className: "flex-1 px-4 py-3 bg-cyan-700 hover:bg-cyan-600 text-white rounded transition-colors text-sm flex items-center justify-center gap-2", children: ["\u53BB\u6CE8\u518C/\u767B\u5F55 ", (0, jsx_runtime_1.jsx)(lucide_react_1.ArrowRight, { className: "w-4 h-4" })] })] }), (0, jsx_runtime_1.jsx)("div", { className: "text-center", children: (0, jsx_runtime_1.jsx)("p", { className: "text-[10px] text-neutral-500", children: "\u6570\u636E\u4E0D\u4F1A\u4E22\u5931 \u2014 \u6CE8\u518C\u540E\u7ED1\u5B9A\u540C\u4E00\u94B1\u5305\u5373\u53EF\u7EE7\u627F\u6240\u6709\u94F8\u9020\u8BB0\u5F55" }) })] }) }) }));
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function RewardsPage(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// AI-generated · AI-managed · AI-maintained
|
|
3
|
+
'use client';
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.default = RewardsPage;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const card_1 = require("../ui/card");
|
|
9
|
+
const button_1 = require("../ui/button");
|
|
10
|
+
const badge_1 = require("../ui/badge");
|
|
11
|
+
const input_1 = require("../ui/input");
|
|
12
|
+
const textarea_1 = require("../ui/textarea");
|
|
13
|
+
const dialog_1 = require("../ui/dialog");
|
|
14
|
+
const tabs_1 = require("../ui/tabs");
|
|
15
|
+
const table_1 = require("../ui/table");
|
|
16
|
+
const lucide_react_1 = require("lucide-react");
|
|
17
|
+
const sonner_1 = require("sonner");
|
|
18
|
+
const api_service_1 = require("../../lib/api-service");
|
|
19
|
+
const next_intl_1 = require("next-intl");
|
|
20
|
+
function RewardsPage() {
|
|
21
|
+
const t = (0, next_intl_1.useTranslations)('rewardsDash');
|
|
22
|
+
const [history, setHistory] = (0, react_1.useState)([]);
|
|
23
|
+
const [stats, setStats] = (0, react_1.useState)(null);
|
|
24
|
+
const [topRecipients, setTopRecipients] = (0, react_1.useState)([]);
|
|
25
|
+
const [topSenders, setTopSenders] = (0, react_1.useState)([]);
|
|
26
|
+
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
27
|
+
const [activeTab, setActiveTab] = (0, react_1.useState)('history');
|
|
28
|
+
const [showSendDialog, setShowSendDialog] = (0, react_1.useState)(false);
|
|
29
|
+
const [showBatchDialog, setShowBatchDialog] = (0, react_1.useState)(false);
|
|
30
|
+
const [singleReward, setSingleReward] = (0, react_1.useState)({
|
|
31
|
+
recipient_id: '',
|
|
32
|
+
amount: '',
|
|
33
|
+
reason: ''
|
|
34
|
+
});
|
|
35
|
+
const [batchRewards, setBatchRewards] = (0, react_1.useState)([
|
|
36
|
+
{ user_id: '', amount: '', reason: '' }
|
|
37
|
+
]);
|
|
38
|
+
(0, react_1.useEffect)(() => {
|
|
39
|
+
fetchData();
|
|
40
|
+
}, []);
|
|
41
|
+
const fetchData = async () => {
|
|
42
|
+
setLoading(true);
|
|
43
|
+
try {
|
|
44
|
+
try {
|
|
45
|
+
const historyRes = await api_service_1.apiService.get('/organization/rewards/history?limit=50');
|
|
46
|
+
if (historyRes.success) {
|
|
47
|
+
setHistory(Array.isArray(historyRes.rewards) ? historyRes.rewards : []);
|
|
48
|
+
setStats(historyRes.stats || null);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
console.warn('[Rewards] Failed to fetch reward history:', e);
|
|
53
|
+
setHistory([]);
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
const leaderboardRes = await api_service_1.apiService.get('/organization/rewards/leaderboard?period=month&limit=10');
|
|
57
|
+
if (leaderboardRes.success) {
|
|
58
|
+
setTopRecipients(Array.isArray(leaderboardRes.top_recipients) ? leaderboardRes.top_recipients : []);
|
|
59
|
+
setTopSenders(Array.isArray(leaderboardRes.top_senders) ? leaderboardRes.top_senders : []);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch (e) {
|
|
63
|
+
console.warn('[Rewards] Failed to fetch leaderboard:', e);
|
|
64
|
+
setTopRecipients([]);
|
|
65
|
+
setTopSenders([]);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
console.error('Failed to fetch rewards data:', error);
|
|
70
|
+
}
|
|
71
|
+
finally {
|
|
72
|
+
setLoading(false);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const handleSendReward = async () => {
|
|
76
|
+
if (!singleReward.recipient_id || !singleReward.amount) {
|
|
77
|
+
sonner_1.toast.error(t('fillRequired'));
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
const res = await api_service_1.apiService.post('/organization/rewards/send', {
|
|
82
|
+
recipient_id: singleReward.recipient_id,
|
|
83
|
+
amount: parseFloat(singleReward.amount),
|
|
84
|
+
reason: singleReward.reason
|
|
85
|
+
});
|
|
86
|
+
if (res.success) {
|
|
87
|
+
sonner_1.toast.success(t('sent', { amount: res.amount }));
|
|
88
|
+
setShowSendDialog(false);
|
|
89
|
+
setSingleReward({ recipient_id: '', amount: '', reason: '' });
|
|
90
|
+
fetchData();
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
sonner_1.toast.error(res.error || t('sendFailed'));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
sonner_1.toast.error(t('networkError'));
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const handleBatchReward = async () => {
|
|
101
|
+
const validRewards = batchRewards.filter(r => r.user_id && r.amount);
|
|
102
|
+
if (validRewards.length === 0) {
|
|
103
|
+
sonner_1.toast.error(t('addValidReward'));
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
try {
|
|
107
|
+
const res = await api_service_1.apiService.post('/organization/rewards/batch', {
|
|
108
|
+
rewards: validRewards.map(r => ({
|
|
109
|
+
user_id: r.user_id,
|
|
110
|
+
amount: parseFloat(r.amount),
|
|
111
|
+
reason: r.reason
|
|
112
|
+
}))
|
|
113
|
+
});
|
|
114
|
+
if (res.success) {
|
|
115
|
+
sonner_1.toast.success(t('batchComplete', { success: res.total_sent, failed: res.total_failed }));
|
|
116
|
+
setShowBatchDialog(false);
|
|
117
|
+
setBatchRewards([{ user_id: '', amount: '', reason: '' }]);
|
|
118
|
+
fetchData();
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
sonner_1.toast.error(res.error || t('sendFailed'));
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
sonner_1.toast.error(t('networkError'));
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
const addBatchRow = () => {
|
|
129
|
+
setBatchRewards([...batchRewards, { user_id: '', amount: '', reason: '' }]);
|
|
130
|
+
};
|
|
131
|
+
const removeBatchRow = (index) => {
|
|
132
|
+
setBatchRewards(batchRewards.filter((_, i) => i !== index));
|
|
133
|
+
};
|
|
134
|
+
const updateBatchRow = (index, field, value) => {
|
|
135
|
+
const updated = [...batchRewards];
|
|
136
|
+
updated[index] = { ...updated[index], [field]: value };
|
|
137
|
+
setBatchRewards(updated);
|
|
138
|
+
};
|
|
139
|
+
const formatDate = (dateStr) => {
|
|
140
|
+
return new Date(dateStr).toLocaleString('zh-CN', {
|
|
141
|
+
year: 'numeric',
|
|
142
|
+
month: '2-digit',
|
|
143
|
+
day: '2-digit',
|
|
144
|
+
hour: '2-digit',
|
|
145
|
+
minute: '2-digit'
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "max-w-7xl mx-auto font-mono space-y-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between items-center", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("h1", { className: "text-2xl font-bold flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Gift, { className: "h-6 w-6" }), t('title')] }), (0, jsx_runtime_1.jsx)("p", { className: "text-muted-foreground", children: t('subtitle') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-2", children: [(0, jsx_runtime_1.jsxs)(dialog_1.Dialog, { open: showSendDialog, onOpenChange: setShowSendDialog, children: [(0, jsx_runtime_1.jsx)(dialog_1.DialogTrigger, { asChild: true, children: (0, jsx_runtime_1.jsxs)(button_1.Button, { children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Send, { className: "h-4 w-4 mr-2" }), t('sendReward')] }) }), (0, jsx_runtime_1.jsxs)(dialog_1.DialogContent, { children: [(0, jsx_runtime_1.jsx)(dialog_1.DialogHeader, { children: (0, jsx_runtime_1.jsx)(dialog_1.DialogTitle, { children: t('sendSingleTitle') }) }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("label", { className: "text-sm font-medium", children: t('recipientId') }), (0, jsx_runtime_1.jsx)(input_1.Input, { value: singleReward.recipient_id, onChange: (e) => setSingleReward({ ...singleReward, recipient_id: e.target.value }), placeholder: t('recipientPlaceholder') })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("label", { className: "text-sm font-medium", children: t('rewardAmount') }), (0, jsx_runtime_1.jsx)(input_1.Input, { type: "number", value: singleReward.amount, onChange: (e) => setSingleReward({ ...singleReward, amount: e.target.value }), placeholder: t('amountPlaceholder'), min: 1, max: 10000 })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("label", { className: "text-sm font-medium", children: t('reasonLabel') }), (0, jsx_runtime_1.jsx)(textarea_1.Textarea, { value: singleReward.reason, onChange: (e) => setSingleReward({ ...singleReward, reason: e.target.value }), placeholder: t('reasonPlaceholder'), rows: 2 })] })] }), (0, jsx_runtime_1.jsxs)(dialog_1.DialogFooter, { children: [(0, jsx_runtime_1.jsx)(button_1.Button, { variant: "outline", onClick: () => setShowSendDialog(false), children: t('cancel') }), (0, jsx_runtime_1.jsx)(button_1.Button, { onClick: handleSendReward, children: t('send') })] })] })] }), (0, jsx_runtime_1.jsxs)(dialog_1.Dialog, { open: showBatchDialog, onOpenChange: setShowBatchDialog, children: [(0, jsx_runtime_1.jsx)(dialog_1.DialogTrigger, { asChild: true, children: (0, jsx_runtime_1.jsxs)(button_1.Button, { variant: "outline", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Users, { className: "h-4 w-4 mr-2" }), t('batchReward')] }) }), (0, jsx_runtime_1.jsxs)(dialog_1.DialogContent, { className: "max-w-2xl", children: [(0, jsx_runtime_1.jsx)(dialog_1.DialogHeader, { children: (0, jsx_runtime_1.jsx)(dialog_1.DialogTitle, { children: t('batchTitle') }) }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-4 max-h-96 overflow-y-auto", children: [batchRewards.map((reward, index) => ((0, jsx_runtime_1.jsxs)("div", { className: "flex gap-2 items-start", children: [(0, jsx_runtime_1.jsx)(input_1.Input, { value: reward.user_id, onChange: (e) => updateBatchRow(index, 'user_id', e.target.value), placeholder: t('userId'), className: "flex-1" }), (0, jsx_runtime_1.jsx)(input_1.Input, { type: "number", value: reward.amount, onChange: (e) => updateBatchRow(index, 'amount', e.target.value), placeholder: "MCC", className: "w-24" }), (0, jsx_runtime_1.jsx)(input_1.Input, { value: reward.reason, onChange: (e) => updateBatchRow(index, 'reason', e.target.value), placeholder: t('reason'), className: "flex-1" }), batchRewards.length > 1 && ((0, jsx_runtime_1.jsx)(button_1.Button, { variant: "ghost", size: "icon", onClick: () => removeBatchRow(index), children: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "h-4 w-4" }) }))] }, index))), (0, jsx_runtime_1.jsxs)(button_1.Button, { variant: "outline", onClick: addBatchRow, className: "w-full", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Plus, { className: "h-4 w-4 mr-2" }), t('addRow')] })] }), (0, jsx_runtime_1.jsxs)(dialog_1.DialogFooter, { children: [(0, jsx_runtime_1.jsx)(button_1.Button, { variant: "outline", onClick: () => setShowBatchDialog(false), children: t('cancel') }), (0, jsx_runtime_1.jsx)(button_1.Button, { onClick: handleBatchReward, children: t('batchSend') })] })] })] })] })] }), stats && ((0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-4", children: [(0, jsx_runtime_1.jsx)(card_1.Card, { children: (0, jsx_runtime_1.jsxs)(card_1.CardContent, { className: "pt-6 text-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-2xl font-bold text-white", children: Number(stats.total_received || 0).toFixed(2) }), (0, jsx_runtime_1.jsx)("div", { className: "text-sm text-muted-foreground", children: t('mccReceived') })] }) }), (0, jsx_runtime_1.jsx)(card_1.Card, { children: (0, jsx_runtime_1.jsxs)(card_1.CardContent, { className: "pt-6 text-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-2xl font-bold text-cyan-400", children: Number(stats.total_sent || 0).toFixed(2) }), (0, jsx_runtime_1.jsx)("div", { className: "text-sm text-muted-foreground", children: t('mccSent') })] }) }), (0, jsx_runtime_1.jsx)(card_1.Card, { children: (0, jsx_runtime_1.jsxs)(card_1.CardContent, { className: "pt-6 text-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-2xl font-bold", children: stats.receive_count }), (0, jsx_runtime_1.jsx)("div", { className: "text-sm text-muted-foreground", children: t('receiveCount') })] }) }), (0, jsx_runtime_1.jsx)(card_1.Card, { children: (0, jsx_runtime_1.jsxs)(card_1.CardContent, { className: "pt-6 text-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-2xl font-bold", children: stats.send_count }), (0, jsx_runtime_1.jsx)("div", { className: "text-sm text-muted-foreground", children: t('sendCount') })] }) })] })), (0, jsx_runtime_1.jsxs)(tabs_1.Tabs, { value: activeTab, onValueChange: setActiveTab, children: [(0, jsx_runtime_1.jsxs)(tabs_1.TabsList, { children: [(0, jsx_runtime_1.jsxs)(tabs_1.TabsTrigger, { value: "history", className: "flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.History, { className: "h-4 w-4" }), t('historyTab')] }), (0, jsx_runtime_1.jsxs)(tabs_1.TabsTrigger, { value: "leaderboard", className: "flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Trophy, { className: "h-4 w-4" }), t('leaderboardTab')] })] }), (0, jsx_runtime_1.jsx)(tabs_1.TabsContent, { value: "history", children: (0, jsx_runtime_1.jsxs)(card_1.Card, { children: [(0, jsx_runtime_1.jsxs)(card_1.CardHeader, { children: [(0, jsx_runtime_1.jsx)(card_1.CardTitle, { children: t('rewardHistory') }), (0, jsx_runtime_1.jsx)(card_1.CardDescription, { children: t('rewardHistoryDesc') })] }), (0, jsx_runtime_1.jsx)(card_1.CardContent, { children: loading ? ((0, jsx_runtime_1.jsx)("div", { className: "text-center py-8", children: t('loadingText') })) : history.length === 0 ? ((0, jsx_runtime_1.jsx)("div", { className: "text-center py-8 text-muted-foreground", children: t('noRecords') })) : ((0, jsx_runtime_1.jsxs)(table_1.Table, { children: [(0, jsx_runtime_1.jsx)(table_1.TableHeader, { children: (0, jsx_runtime_1.jsxs)(table_1.TableRow, { children: [(0, jsx_runtime_1.jsx)(table_1.TableHead, { children: t('time') }), (0, jsx_runtime_1.jsx)(table_1.TableHead, { children: t('sender') }), (0, jsx_runtime_1.jsx)(table_1.TableHead, { children: t('recipient') }), (0, jsx_runtime_1.jsx)(table_1.TableHead, { className: "text-right", children: t('amount') }), (0, jsx_runtime_1.jsx)(table_1.TableHead, { children: t('reason') })] }) }), (0, jsx_runtime_1.jsx)(table_1.TableBody, { children: history.map((record) => ((0, jsx_runtime_1.jsxs)(table_1.TableRow, { children: [(0, jsx_runtime_1.jsx)(table_1.TableCell, { className: "text-sm text-muted-foreground", children: formatDate(record.created_at) }), (0, jsx_runtime_1.jsx)(table_1.TableCell, { children: record.manager_email || record.manager_id }), (0, jsx_runtime_1.jsx)(table_1.TableCell, { children: record.recipient_email || record.recipient_id }), (0, jsx_runtime_1.jsx)(table_1.TableCell, { className: "text-right font-medium", children: (0, jsx_runtime_1.jsxs)("span", { className: "text-white", children: ["+", Number(record.amount || 0).toFixed(2), " MCC"] }) }), (0, jsx_runtime_1.jsx)(table_1.TableCell, { className: "text-sm text-muted-foreground", children: record.reason || '-' })] }, record.id))) })] })) })] }) }), (0, jsx_runtime_1.jsx)(tabs_1.TabsContent, { value: "leaderboard", children: (0, jsx_runtime_1.jsxs)("div", { className: "grid md:grid-cols-2 gap-6", children: [(0, jsx_runtime_1.jsxs)(card_1.Card, { children: [(0, jsx_runtime_1.jsx)(card_1.CardHeader, { children: (0, jsx_runtime_1.jsxs)(card_1.CardTitle, { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Trophy, { className: "h-5 w-5 text-cyan-400" }), t('topReceived')] }) }), (0, jsx_runtime_1.jsx)(card_1.CardContent, { children: topRecipients.length === 0 ? ((0, jsx_runtime_1.jsx)("div", { className: "text-center py-4 text-muted-foreground", children: t('noData') })) : ((0, jsx_runtime_1.jsx)("div", { className: "space-y-3", children: topRecipients.map((entry, index) => ((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)(badge_1.Badge, { variant: index < 3 ? 'default' : 'outline', children: index + 1 }), (0, jsx_runtime_1.jsx)("span", { className: "font-medium", children: entry.email || entry.user_id })] }), (0, jsx_runtime_1.jsxs)("span", { className: "text-white font-medium", children: [Number(entry.total_received || 0).toFixed(2), " MCC"] })] }, entry.user_id))) })) })] }), (0, jsx_runtime_1.jsxs)(card_1.Card, { children: [(0, jsx_runtime_1.jsx)(card_1.CardHeader, { children: (0, jsx_runtime_1.jsxs)(card_1.CardTitle, { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Gift, { className: "h-5 w-5 text-cyan-400" }), t('topSent')] }) }), (0, jsx_runtime_1.jsx)(card_1.CardContent, { children: topSenders.length === 0 ? ((0, jsx_runtime_1.jsx)("div", { className: "text-center py-4 text-muted-foreground", children: t('noData') })) : ((0, jsx_runtime_1.jsx)("div", { className: "space-y-3", children: topSenders.map((entry, index) => ((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)(badge_1.Badge, { variant: index < 3 ? 'default' : 'outline', children: index + 1 }), (0, jsx_runtime_1.jsx)("span", { className: "font-medium", children: entry.email || entry.user_id })] }), (0, jsx_runtime_1.jsxs)("span", { className: "text-cyan-400 font-medium", children: [Number(entry.total_sent || 0).toFixed(2), " MCC"] })] }, entry.user_id))) })) })] })] }) })] })] }));
|
|
149
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function DomainVerificationBar(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// AI-generated · AI-managed · AI-maintained
|
|
3
|
+
"use client";
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.DomainVerificationBar = DomainVerificationBar;
|
|
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 next_intl_1 = require("next-intl");
|
|
10
|
+
const TRUSTED_DOMAINS = [
|
|
11
|
+
"microcosm.money",
|
|
12
|
+
"m.microcosm.money",
|
|
13
|
+
"www.microcosm.money",
|
|
14
|
+
"localhost",
|
|
15
|
+
"127.0.0.1",
|
|
16
|
+
];
|
|
17
|
+
function DomainVerificationBar() {
|
|
18
|
+
const t = (0, next_intl_1.useTranslations)("security");
|
|
19
|
+
const [hostname, setHostname] = (0, react_1.useState)("");
|
|
20
|
+
const [isTrusted, setIsTrusted] = (0, react_1.useState)(true);
|
|
21
|
+
(0, react_1.useEffect)(() => {
|
|
22
|
+
const host = window.location.hostname;
|
|
23
|
+
setHostname(host);
|
|
24
|
+
setIsTrusted(TRUSTED_DOMAINS.some(d => host === d || host.endsWith("." + d)));
|
|
25
|
+
}, []);
|
|
26
|
+
if (!hostname)
|
|
27
|
+
return null;
|
|
28
|
+
if (!isTrusted) {
|
|
29
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "w-full bg-red-900/80 border-b border-red-500 px-4 py-2.5 flex items-center justify-center gap-2 z-50", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.ShieldAlert, { className: "w-4 h-4 text-red-300 shrink-0" }), (0, jsx_runtime_1.jsx)("span", { className: "text-red-100 text-xs sm:text-sm font-medium", children: t("dangerDomain", { domain: hostname }) })] }));
|
|
30
|
+
}
|
|
31
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "w-full bg-green-900/30 border-b border-green-500/30 px-4 py-1.5 flex items-center justify-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.ShieldCheck, { className: "w-3.5 h-3.5 text-green-400 shrink-0" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-green-300/80 text-[11px] sm:text-xs", children: [t("secureConnection"), " ", (0, jsx_runtime_1.jsx)("code", { className: "bg-green-900/40 px-1 rounded text-green-300 font-mono", children: hostname })] })] }));
|
|
32
|
+
}
|