feat(admin): refactor admin console to focus on superadmin tier, graduation and dispute governance
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import { useWeb3 } from '../context/Web3Context';
|
||||
import { Wallet, TrendingUp, Compass, PieChart, ShieldAlert, CheckCircle2 } from 'lucide-react';
|
||||
import { Wallet, TrendingUp, Compass, PieChart, PlusCircle, Droplet, ShieldAlert } from 'lucide-react';
|
||||
|
||||
interface NavbarProps {
|
||||
activeTab: string;
|
||||
@@ -8,12 +8,31 @@ interface NavbarProps {
|
||||
}
|
||||
|
||||
export const WebNavbar: React.FC<NavbarProps> = ({ activeTab, setActiveTab }) => {
|
||||
const { account, wusdBalance, isCorrectNetwork, connectWallet, switchNetwork } = useWeb3();
|
||||
const { account, wusdBalance, isCorrectNetwork, connectWallet, switchNetwork, refreshBalance, getCollateralContract } = useWeb3();
|
||||
const [faucetLoading, setFaucetLoading] = useState(false);
|
||||
|
||||
const handleQuickFaucet = async () => {
|
||||
if (!account) return;
|
||||
try {
|
||||
setFaucetLoading(true);
|
||||
const collateral = getCollateralContract();
|
||||
if (!collateral) return;
|
||||
const tx = await collateral.mint(account, "100000000000000000000000000"); // 100M WUSD
|
||||
await tx.wait();
|
||||
refreshBalance();
|
||||
alert('🎉 成功领取 100,000,000 WUSD 测试金!');
|
||||
} catch (e: any) {
|
||||
alert('领水失败: ' + (e.message || e));
|
||||
} finally {
|
||||
setFaucetLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const navs = [
|
||||
{ id: 'explore', label: '🔥 市场探索', icon: Compass },
|
||||
{ id: 'trade', label: '⚡ 交易终端', icon: TrendingUp },
|
||||
{ id: 'portfolio', label: '💼 我的持仓与账本', icon: PieChart },
|
||||
{ id: 'create', label: '🚀 创建市场', icon: PlusCircle },
|
||||
{ id: 'portfolio', label: '💼 持仓与金库', icon: PieChart },
|
||||
];
|
||||
|
||||
return (
|
||||
@@ -30,7 +49,7 @@ export const WebNavbar: React.FC<NavbarProps> = ({ activeTab, setActiveTab }) =>
|
||||
WTFX
|
||||
</span>
|
||||
<span className="text-[10px] font-mono font-bold px-1.5 py-0.5 rounded bg-gradient-to-r from-cyan-500/20 to-purple-500/20 text-cyan-300 border border-cyan-500/30">
|
||||
POWER LDA
|
||||
TESTNET
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -43,7 +62,7 @@ export const WebNavbar: React.FC<NavbarProps> = ({ activeTab, setActiveTab }) =>
|
||||
<button
|
||||
key={item.id}
|
||||
onClick={() => setActiveTab(item.id)}
|
||||
className={`flex items-center space-x-2 px-4 py-2 rounded-xl text-sm font-semibold transition-all ${
|
||||
className={`flex items-center space-x-2 px-3.5 py-2 rounded-xl text-xs sm:text-sm font-semibold transition-all ${
|
||||
isActive
|
||||
? 'bg-slate-800/80 text-white shadow-sm border border-slate-700/80'
|
||||
: 'text-slate-400 hover:text-slate-200 hover:bg-slate-800/40'
|
||||
@@ -57,17 +76,28 @@ export const WebNavbar: React.FC<NavbarProps> = ({ activeTab, setActiveTab }) =>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
{/* Right Section / Wallet Status */}
|
||||
<div className="flex items-center space-x-4">
|
||||
{/* Right Section / Faucet & Wallet */}
|
||||
<div className="flex items-center space-x-3">
|
||||
{account && (
|
||||
<button
|
||||
onClick={handleQuickFaucet}
|
||||
disabled={faucetLoading}
|
||||
className="flex items-center space-x-1.5 px-3 py-1.5 bg-cyan-950/60 hover:bg-cyan-900/60 text-cyan-400 border border-cyan-800/50 rounded-xl text-xs font-bold transition-colors"
|
||||
>
|
||||
<Droplet className="w-3.5 h-3.5" />
|
||||
<span>{faucetLoading ? '领水中...' : '全民领水 1 亿'}</span>
|
||||
</button>
|
||||
)}
|
||||
|
||||
{account ? (
|
||||
<div className="flex items-center space-x-3">
|
||||
{!isCorrectNetwork ? (
|
||||
<button
|
||||
onClick={switchNetwork}
|
||||
className="flex items-center space-x-1.5 bg-amber-500/10 text-amber-400 border border-amber-500/30 px-3 py-1.5 rounded-lg text-xs font-medium hover:bg-amber-500/20 transition-colors"
|
||||
className="flex items-center space-x-1.5 bg-amber-500/10 text-amber-400 border border-amber-500/30 px-3 py-1.5 rounded-lg text-xs font-medium hover:bg-amber-500/20"
|
||||
>
|
||||
<ShieldAlert className="w-4 h-4" />
|
||||
<span>切换 Robinhood 测试网</span>
|
||||
<span>切换测试网</span>
|
||||
</button>
|
||||
) : (
|
||||
<div className="hidden sm:flex items-center space-x-2 bg-slate-900/80 border border-slate-800 px-3 py-1.5 rounded-xl">
|
||||
|
||||
Reference in New Issue
Block a user