feat: integrate HeroUI component library

Implemented HeroUI migration plan with the following changes:

Stage 0: Environment Setup
- Installed @heroui/react@2.8.7, @heroui/theme@2.4.26, framer-motion@12.29.2
- Configured Tailwind with HeroUI plugin
- Added HeroUI content paths to Tailwind config

Stage 1: Provider Architecture
- Created Providers.tsx wrapper combining HeroUIProvider and AppProvider
- Updated app/layout.tsx to use new Providers component
- Preserved all AppContext functionality (theme, language, translations)

Stage 2: Component Migrations
- TabNavigation: Migrated to HeroUI Tabs with keyboard navigation support
- TopBar: Migrated buttons to HeroUI Button components
- LanguageSwitch: Migrated to HeroUI Dropdown for better UX
- ThemeSwitch: Migrated to HeroUI Button (isIconOnly variant)
- MintSwapPanel: Migrated to HeroUI Tabs and Button components

Benefits:
- Enhanced accessibility with ARIA attributes and keyboard navigation
- Smooth animations and transitions via Framer Motion
- Consistent component API across the application
- Maintained all existing design tokens and color system
- Preserved dark mode functionality

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-30 03:49:53 +00:00
parent 098a91f2ac
commit 9e0dd1d278
27 changed files with 11184 additions and 7928 deletions

View File

@@ -1,199 +1,184 @@
"use client";
import { useState } from "react";
import Image from "next/image";
import { useApp } from "@/contexts/AppContext";
export default function MintSwapPanel() {
const { t } = useApp();
const [activeMode, setActiveMode] = useState<"mint" | "swap">("mint");
const [activeAction, setActiveAction] = useState<"deposit" | "withdraw">("deposit");
return (
<div className="bg-bg-surface dark:bg-gray-800 rounded-3xl border border-border-gray dark:border-gray-700 flex flex-col">
{/* Mint/Swap Tabs */}
<div className="flex border-b border-border-gray dark:border-gray-700">
<button
onClick={() => setActiveMode("mint")}
className={`flex-1 h-[53px] flex items-center justify-center text-body-small font-bold rounded-tl-3xl transition-colors ${
activeMode === "mint"
? "bg-bg-subtle dark:bg-gray-700 border-b-2 border-text-primary dark:border-blue-500 text-[#0f172b] dark:text-white"
: "text-text-tertiary dark:text-gray-400"
}`}
>
{t("mintSwap.mint")}
</button>
<button
onClick={() => setActiveMode("swap")}
className={`flex-1 h-[53px] flex items-center justify-center text-body-small font-bold transition-colors ${
activeMode === "swap"
? "bg-bg-subtle dark:bg-gray-700 border-b-2 border-text-primary dark:border-blue-500 text-[#0f172b] dark:text-white"
: "text-text-tertiary dark:text-gray-400"
}`}
>
{t("mintSwap.swap")}
</button>
</div>
{/* Content */}
<div className="flex flex-col gap-6 p-6">
{/* Deposit/Withdraw Toggle */}
<div className="bg-[#f9fafb] dark:bg-gray-700 rounded-xl p-1 flex gap-0">
<button
onClick={() => setActiveAction("deposit")}
className={`flex-1 h-8 px-4 rounded-lg text-body-small transition-all ${
activeAction === "deposit"
? "bg-bg-surface dark:bg-gray-600 font-bold text-text-primary dark:text-white shadow-sm"
: "font-medium text-text-tertiary dark:text-gray-400"
}`}
>
{t("mintSwap.deposit")}
</button>
<button
onClick={() => setActiveAction("withdraw")}
className={`flex-1 h-8 px-4 rounded-lg text-body-small transition-all ${
activeAction === "withdraw"
? "bg-bg-surface dark:bg-gray-600 font-bold text-text-primary dark:text-white shadow-sm"
: "font-medium text-text-tertiary dark:text-gray-400"
}`}
>
{t("mintSwap.withdraw")}
</button>
</div>
{/* Input Area */}
<div className="flex flex-col gap-2">
<div className="bg-bg-subtle dark:bg-gray-700 rounded-xl border border-border-gray dark:border-gray-600 p-4 flex flex-col gap-3">
{/* Label and Balance */}
<div className="flex items-center justify-between">
<span className="text-caption-tiny font-medium text-[#4b5563] dark:text-gray-400">
{t("mintSwap.deposit")}
</span>
<div className="flex items-center gap-1">
<Image src="/icon7.svg" alt="" width={12} height={12} />
<span className="text-caption-tiny font-medium text-[#4b5563] dark:text-gray-400">
{t("mintSwap.balance")}: $12,500.00
</span>
<button className="rounded-full px-3 h-[22px] text-[10px] font-medium bg-[#e5e7eb] dark:bg-gray-600 text-[#111827] dark:text-white">
{t("mintSwap.max")}
</button>
</div>
</div>
{/* Input Row */}
<div className="flex items-center justify-between">
<button className="bg-bg-surface dark:bg-gray-600 rounded-full border border-border-normal dark:border-gray-500 px-2 h-[46px] flex items-center gap-2">
<Image
src="/usd-coin-usdc-logo-10.svg"
alt="USDC"
width={32}
height={32}
/>
<span className="text-body-default font-bold text-text-primary dark:text-white">USDC</span>
</button>
<div className="flex flex-col items-end">
<span className="text-heading-h3 font-bold text-[#d1d5db] dark:text-gray-500">
0.00
</span>
<span className="text-caption-tiny font-regular text-text-tertiary dark:text-gray-400">--</span>
</div>
</div>
</div>
</div>
{/* Estimated Returns */}
<div className="bg-bg-subtle dark:bg-gray-700 rounded-xl border border-border-gray dark:border-gray-600 p-4 flex flex-col gap-2">
<div className="flex items-center justify-between h-5">
<span className="text-body-small font-bold text-[#4b5563] dark:text-gray-300">
{t("mintSwap.estimatedReturns")}
</span>
</div>
<div className="flex items-center justify-between h-5">
<span className="text-body-small font-regular text-text-tertiary dark:text-gray-400">
{t("mintSwap.estAPY")}
</span>
<span className="text-body-small font-bold text-[#ff6900] dark:text-orange-400">
22%
</span>
</div>
<div className="flex items-center justify-between h-5">
<span className="text-body-small font-regular text-text-tertiary dark:text-gray-400">
{t("mintSwap.estReturns")}
</span>
<span className="text-body-small font-bold text-[#10b981] dark:text-green-400">
~ $0.50
</span>
</div>
</div>
{/* Transaction Summary */}
<div className="bg-bg-subtle dark:bg-gray-700 rounded-xl border border-border-gray dark:border-gray-600 p-4 flex flex-col gap-2">
<div className="flex items-center justify-between h-5">
<span className="text-body-small font-bold text-[#4b5563] dark:text-gray-300">
{t("mintSwap.transactionSummary")}
</span>
</div>
<div className="flex items-center justify-between h-5">
<span className="text-body-small font-regular text-text-tertiary dark:text-gray-400">
{t("mintSwap.youGet")}
</span>
<span className="text-body-small font-bold text-[#10b981] dark:text-green-400">
9852.21 GYUS
</span>
</div>
<div className="flex items-center justify-between h-5">
<span className="text-body-small font-regular text-text-tertiary dark:text-gray-400">
{t("mintSwap.salesPrice")}
</span>
<span className="text-body-small font-bold text-text-primary dark:text-white">$1.04 USDC</span>
</div>
<div className="flex items-center justify-between h-5">
<span className="text-body-small font-regular text-text-tertiary dark:text-gray-400">
{t("mintSwap.fee")}
</span>
<span className="text-body-small font-bold text-[#dc2626] dark:text-red-400">
-$50 (0.5%)
</span>
</div>
<div className="flex items-center justify-between h-5">
<span className="text-body-small font-regular text-text-tertiary dark:text-gray-400">
{t("mintSwap.gas")}
</span>
<span className="text-body-small font-bold text-[#dc2626] dark:text-red-400">
-$0.09
</span>
</div>
</div>
{/* Submit Button */}
<button
className="rounded-xl h-12 flex items-center justify-center gap-2 bg-[#9ca1af] dark:bg-gray-600"
disabled
>
<span className="text-lg font-bold text-white leading-7">
{t("mintSwap.approveDeposit")}
</span>
<Image src="/icon8.svg" alt="" width={20} height={20} />
</button>
{/* Terms */}
<div className="flex flex-col gap-0 text-center">
<div className="text-caption-tiny font-regular">
<span className="text-[#9ca1af] dark:text-gray-400">
{t("mintSwap.termsText")}{" "}
</span>
<span className="text-[#10b981] dark:text-green-400">
{t("mintSwap.termsOfService")}
</span>
<span className="text-[#9ca1af] dark:text-gray-400">
{" "}{t("mintSwap.and")}
</span>
</div>
<span className="text-caption-tiny font-regular text-[#10b981] dark:text-green-400">
{t("mintSwap.privacyPolicy")}
</span>
</div>
</div>
</div>
);
}
"use client";
import { useState } from "react";
import Image from "next/image";
import { useApp } from "@/contexts/AppContext";
import { Tabs, Tab, Button } from "@heroui/react";
export default function MintSwapPanel() {
const { t } = useApp();
const [activeMode, setActiveMode] = useState<"mint" | "swap">("mint");
const [activeAction, setActiveAction] = useState<"deposit" | "withdraw">("deposit");
return (
<div className="bg-bg-surface dark:bg-gray-800 rounded-3xl border border-border-gray dark:border-gray-700 flex flex-col overflow-hidden">
{/* Mint/Swap Tabs */}
<Tabs
selectedKey={activeMode}
onSelectionChange={(key) => setActiveMode(key as "mint" | "swap")}
variant="underlined"
classNames={{
base: "w-full",
tabList: "w-full gap-0 p-0 rounded-none border-b border-border-gray dark:border-gray-700",
cursor: "bg-text-primary dark:bg-blue-500 h-[2px]",
tab: "h-[53px] flex-1 rounded-none data-[selected=true]:bg-bg-subtle dark:data-[selected=true]:bg-gray-700",
tabContent: "text-body-small font-bold text-text-tertiary dark:text-gray-400 group-data-[selected=true]:text-[#0f172b] dark:group-data-[selected=true]:text-white",
}}
>
<Tab key="mint" title={t("mintSwap.mint")} />
<Tab key="swap" title={t("mintSwap.swap")} />
</Tabs>
{/* Content */}
<div className="flex flex-col gap-6 p-6">
{/* Deposit/Withdraw Toggle */}
<Tabs
selectedKey={activeAction}
onSelectionChange={(key) => setActiveAction(key as "deposit" | "withdraw")}
variant="solid"
classNames={{
base: "w-full",
tabList: "bg-[#f9fafb] dark:bg-gray-700 rounded-xl p-1 gap-0 w-full",
cursor: "bg-bg-surface dark:bg-gray-600 shadow-sm",
tab: "h-8 px-4",
tabContent: "text-body-small font-medium text-text-tertiary dark:text-gray-400 group-data-[selected=true]:font-bold group-data-[selected=true]:text-text-primary dark:group-data-[selected=true]:text-white",
}}
>
<Tab key="deposit" title={t("mintSwap.deposit")} />
<Tab key="withdraw" title={t("mintSwap.withdraw")} />
</Tabs>
{/* Input Area */}
<div className="flex flex-col gap-2">
<div className="bg-bg-subtle dark:bg-gray-700 rounded-xl border border-border-gray dark:border-gray-600 p-4 flex flex-col gap-3">
{/* Label and Balance */}
<div className="flex items-center justify-between">
<span className="text-caption-tiny font-medium text-[#4b5563] dark:text-gray-400">
{t("mintSwap.deposit")}
</span>
<div className="flex items-center gap-1">
<Image src="/icon7.svg" alt="" width={12} height={12} />
<span className="text-caption-tiny font-medium text-[#4b5563] dark:text-gray-400">
{t("mintSwap.balance")}: $12,500.00
</span>
<button className="rounded-full px-3 h-[22px] text-[10px] font-medium bg-[#e5e7eb] dark:bg-gray-600 text-[#111827] dark:text-white">
{t("mintSwap.max")}
</button>
</div>
</div>
{/* Input Row */}
<div className="flex items-center justify-between">
<button className="bg-bg-surface dark:bg-gray-600 rounded-full border border-border-normal dark:border-gray-500 px-2 h-[46px] flex items-center gap-2">
<Image
src="/usd-coin-usdc-logo-10.svg"
alt="USDC"
width={32}
height={32}
/>
<span className="text-body-default font-bold text-text-primary dark:text-white">USDC</span>
</button>
<div className="flex flex-col items-end">
<span className="text-heading-h3 font-bold text-[#d1d5db] dark:text-gray-500">
0.00
</span>
<span className="text-caption-tiny font-regular text-text-tertiary dark:text-gray-400">--</span>
</div>
</div>
</div>
</div>
{/* Estimated Returns */}
<div className="bg-bg-subtle dark:bg-gray-700 rounded-xl border border-border-gray dark:border-gray-600 p-4 flex flex-col gap-2">
<div className="flex items-center justify-between h-5">
<span className="text-body-small font-bold text-[#4b5563] dark:text-gray-300">
{t("mintSwap.estimatedReturns")}
</span>
</div>
<div className="flex items-center justify-between h-5">
<span className="text-body-small font-regular text-text-tertiary dark:text-gray-400">
{t("mintSwap.estAPY")}
</span>
<span className="text-body-small font-bold text-[#ff6900] dark:text-orange-400">
22%
</span>
</div>
<div className="flex items-center justify-between h-5">
<span className="text-body-small font-regular text-text-tertiary dark:text-gray-400">
{t("mintSwap.estReturns")}
</span>
<span className="text-body-small font-bold text-[#10b981] dark:text-green-400">
~ $0.50
</span>
</div>
</div>
{/* Transaction Summary */}
<div className="bg-bg-subtle dark:bg-gray-700 rounded-xl border border-border-gray dark:border-gray-600 p-4 flex flex-col gap-2">
<div className="flex items-center justify-between h-5">
<span className="text-body-small font-bold text-[#4b5563] dark:text-gray-300">
{t("mintSwap.transactionSummary")}
</span>
</div>
<div className="flex items-center justify-between h-5">
<span className="text-body-small font-regular text-text-tertiary dark:text-gray-400">
{t("mintSwap.youGet")}
</span>
<span className="text-body-small font-bold text-[#10b981] dark:text-green-400">
9852.21 GYUS
</span>
</div>
<div className="flex items-center justify-between h-5">
<span className="text-body-small font-regular text-text-tertiary dark:text-gray-400">
{t("mintSwap.salesPrice")}
</span>
<span className="text-body-small font-bold text-text-primary dark:text-white">$1.04 USDC</span>
</div>
<div className="flex items-center justify-between h-5">
<span className="text-body-small font-regular text-text-tertiary dark:text-gray-400">
{t("mintSwap.fee")}
</span>
<span className="text-body-small font-bold text-[#dc2626] dark:text-red-400">
-$50 (0.5%)
</span>
</div>
<div className="flex items-center justify-between h-5">
<span className="text-body-small font-regular text-text-tertiary dark:text-gray-400">
{t("mintSwap.gas")}
</span>
<span className="text-body-small font-bold text-[#dc2626] dark:text-red-400">
-$0.09
</span>
</div>
</div>
{/* Submit Button */}
<Button
isDisabled
className="rounded-xl h-12 bg-[#9ca1af] dark:bg-gray-600 text-lg font-bold text-white"
endContent={<Image src="/icon8.svg" alt="" width={20} height={20} />}
>
{t("mintSwap.approveDeposit")}
</Button>
{/* Terms */}
<div className="flex flex-col gap-0 text-center">
<div className="text-caption-tiny font-regular">
<span className="text-[#9ca1af] dark:text-gray-400">
{t("mintSwap.termsText")}{" "}
</span>
<span className="text-[#10b981] dark:text-green-400">
{t("mintSwap.termsOfService")}
</span>
<span className="text-[#9ca1af] dark:text-gray-400">
{" "}{t("mintSwap.and")}
</span>
</div>
<span className="text-caption-tiny font-regular text-[#10b981] dark:text-green-400">
{t("mintSwap.privacyPolicy")}
</span>
</div>
</div>
</div>
);
}