+
+ className="absolute cursor-pointer right-4 top-4 md:hidden"
+ >
@@ -200,8 +198,9 @@ export function ConfirmationModal(Props: ConfirmationModalProp) {
setModalScene("confirm");
}, 1000);
}}
- className="flex-1 h-12 cursor-pointer border rounded-md ">
- Close
+ className="flex-1 h-12 cursor-pointer rounded-md bg-yellow-400 hover:bg-yellow-500 text-black"
+ >
+ View wallet
{
@@ -209,8 +208,9 @@ export function ConfirmationModal(Props: ConfirmationModalProp) {
setModalScene("confirm");
}, 1000);
}}
- className="flex-1 h-12 cursor-pointer rounded-md bg-yellow-400 hover:bg-yellow-500 text-black">
- View wallet
+ className="flex-1 h-12 cursor-pointer border rounded-md max-sm:hidden"
+ >
+ Close
diff --git a/hooks/useConversion.tsx b/hooks/useConversion.tsx
index b75765d..63edab3 100644
--- a/hooks/useConversion.tsx
+++ b/hooks/useConversion.tsx
@@ -6,10 +6,17 @@ import type { ConversionState, ConversionData, Currency } from "@/types/index";
export const currencies: Currency[] = [
{ code: "NGN", name: "Nigerian Naira", icon: "₦", price: 1 },
{ code: "USDC", name: "USD Coin", icon: "$", price: 1600 },
- { code: "BTC", name: "Bitcoin", icon: "₿", price: 65000000 },
- { code: "XRP", name: "Ripple", icon: "X", price: 800 },
+ { code: "USDT", name: "Tether", icon: "₮", price: 1600 },
+ { code: "BNB", name: "Binance Coin", icon: "BNB", price: 800 },
{ code: "ETH", name: "Ethereum", icon: "Ξ", price: 3200000 },
];
+
+export const currencyImages: Record
= {
+ USDC: "/usdc.svg",
+ USDT: "/usdt.svg",
+ BNB: "/bnb.svg",
+ ETH: "/eth.svg",
+};
// type CurrencyCode = "USD" | "EUR" | "GBP" | "JPY" | "NGN" | "BTC" | "ETH";
// type PriceMap = Record>;
@@ -99,13 +106,14 @@ export function useConversion() {
const [showTokenSelector, setShowTokenSelector] = useState(false);
const [selectorType, setSelectorType] = useState<"from" | "to">("from");
+ console.log(selectorType);
// Static prices in USD
const TOKEN_PRICES = {
NGN: 0.00065, // 1 NGN = $0.00065
USDC: 1, // 1 USDC = $1
- BTC: 65000, // 1 BTC = $65,000
+ USDT: 1, // 1 USDT = $1
+ BNB: 800, // 1 BNB = $800
ETH: 3500, // 1 ETH = $3,500
- XRP: 0.5, // 1 XRP = $0.5
};
const handleAmountChange = useCallback(
@@ -139,11 +147,11 @@ export function useConversion() {
setConversionData((prev) => ({
...prev,
fromAmount: convertedAmount.toLocaleString(undefined, {
- maximumFractionDigits: 6,
+ maximumFractionDigits: 2,
minimumFractionDigits: 0,
}),
toAmount: value, // Keep the formatted input value
- exchangeRate: (fromPrice / toPrice).toFixed(8),
+ exchangeRate: (fromPrice / toPrice).toFixed(2),
}));
}
},
@@ -172,11 +180,11 @@ export function useConversion() {
toAmount: ((fromAmount * fromPrice) / toPrice).toLocaleString(
undefined,
{
- maximumFractionDigits: 6,
+ maximumFractionDigits: 2,
minimumFractionDigits: 0,
}
),
- exchangeRate: (fromPrice / toPrice).toFixed(6),
+ exchangeRate: (fromPrice / toPrice).toFixed(2),
};
});
},
@@ -233,6 +241,7 @@ export function useConversion() {
console.log(conversionState);
return {
+ selectorType,
conversionData,
conversionState,
showTokenSelector,
diff --git a/public/usdt.svg b/public/usdt.svg
new file mode 100644
index 0000000..9c2e10f
--- /dev/null
+++ b/public/usdt.svg
@@ -0,0 +1,9 @@
+