From 57dc09d0590a99fa3862c6586866e067a1fbf848 Mon Sep 17 00:00:00 2001 From: ArtemkaDev <87724011+ArtemkaDev@users.noreply.github.com> Date: Fri, 22 Nov 2024 22:11:40 +0000 Subject: [PATCH] header --- messages/en.json | 8 +- messages/ru.json | 24 +- messages/ua.json | 24 +- .../navigation/DesktopNavigation.tsx | 215 +++++++++++------- src/components/navigation/desktop.module.css | 31 +-- tailwind.config.ts | 5 +- 6 files changed, 195 insertions(+), 112 deletions(-) diff --git a/messages/en.json b/messages/en.json index 13acbdb..4439530 100644 --- a/messages/en.json +++ b/messages/en.json @@ -11,7 +11,8 @@ "connectWallet": "Connect Wallet", "connected": "Connected", "addNetwork": "Add APLO Network", - "addToken": "Add APLO Token", + "addAploToken": "Add APLO Token", + "addGaploToken": "Add APLO Token", "error": "Error", "success": "Success", @@ -24,7 +25,10 @@ "wrongNetwork": "Wrong network selected. Please switch to APLO Network", "networkError": "Network error occurred", "connectionError": "Connection error occurred", - "copySuccess": "Copied to clipboard" + "copySuccess": "Copied to clipboard", + + "crypto": "Crypto", + "aboutAplo": "About APLO" }, "Footer": { diff --git a/messages/ru.json b/messages/ru.json index dbabeb6..97571b0 100644 --- a/messages/ru.json +++ b/messages/ru.json @@ -6,7 +6,29 @@ "about": "О нас", "roadmap": "Дорожная карта", "userGuides": "Руководства пользователя", - "donate": "Донат" + "donate": "Донат", + "start-mining": "Начать майнинг криптовалюты APLO", + "connectWallet": "Подключить кошелек", + "connected": "Подключено", + "addNetwork": "Добавить сеть APLO", + "addAploToken": "Добавить токен APLO", + "addGaploToken": "Добавить токен APLO", + + "error": "Ошибка", + "success": "Успешно", + "metamaskNotInstalled": "MetaMask не установлен", + "walletConnected": "Кошелек успешно подключен", + "networkAdded": "Сеть APLO успешно добавлена", + "networkSwitched": "Переключено на сеть APLO", + "tokenAdded": "Токен APLO успешно добавлен", + "switchNetworkFirst": "Пожалуйста, сначала переключитесь на сеть APLO", + "wrongNetwork": "Выбрана неверная сеть. Пожалуйста, переключитесь на сеть APLO", + "networkError": "Произошла ошибка сети", + "connectionError": "Произошла ошибка подключения", + "copySuccess": "Скопировано в буфер обмена", + + "crypto": "Крипто", + "aboutAplo": "О APLO" }, "Footer": { "privateDecentralized": "Приватная, децентрализованная", diff --git a/messages/ua.json b/messages/ua.json index 3a71835..38d2253 100644 --- a/messages/ua.json +++ b/messages/ua.json @@ -6,7 +6,29 @@ "about": "Про нас", "roadmap": "Дорожня карта", "userGuides": "Керівництва користувача", - "donate": "Донат" + "donate": "Донат", + "start-mining": "Почати майнінг криптовалюти APLO", + "connectWallet": "Підключити гаманець", + "connected": "Підключено", + "addNetwork": "Додати мережу APLO", + "addAploToken": "Додати токен APLO", + "addGaploToken": "Додати токен APLO", + + "error": "Помилка", + "success": "Успішно", + "metamaskNotInstalled": "MetaMask не встановлено", + "walletConnected": "Гаманець успішно підключено", + "networkAdded": "Мережу APLO успішно додано", + "networkSwitched": "Переключено на мережу APLO", + "tokenAdded": "Токен APLO успішно додано", + "switchNetworkFirst": "Будь ласка, спочатку переключіться на мережу APLO", + "wrongNetwork": "Обрано неправильну мережу. Будь ласка, переключіться на мережу APLO", + "networkError": "Сталася помилка мережі", + "connectionError": "Сталася помилка підключення", + "copySuccess": "Скопійовано до буферу обміну", + + "crypto": "Крипто", + "aboutAplo": "Про APLO" }, "Footer": { "privateDecentralized": "Приватна, децентралізована", diff --git a/src/components/navigation/DesktopNavigation.tsx b/src/components/navigation/DesktopNavigation.tsx index 30b16c2..b438ab4 100644 --- a/src/components/navigation/DesktopNavigation.tsx +++ b/src/components/navigation/DesktopNavigation.tsx @@ -17,6 +17,8 @@ import { navigationMenuTriggerStyle, } from "@/components/ui/navigation-menu"; import { useToast } from "@/hooks/use-toast"; +import React from "react"; +import { PickaxeIcon, HandCoinsIcon } from "lucide-react"; declare global { interface Window { @@ -35,12 +37,6 @@ const APLO_NETWORK = { }, }; -const APLO_TOKEN = { - address: "0x0000000000000000000000000000000000001235", - symbol: "APLO", - decimals: 18, -}; - export default function DesktopNavigation() { const t = useTranslations("Menu"); const pathname = usePathname(); @@ -70,7 +66,7 @@ export default function DesktopNavigation() { const getCurrentChainId = async () => { try { - const chainId = await window.ethereum.request({ + const chainId = await window.ethereum.request({ method: 'eth_chainId' }); return chainId; @@ -78,25 +74,25 @@ export default function DesktopNavigation() { return null; } }; - + const switchToAploNetwork = async () => { try { if (!window.ethereum) return false; - + const currentChainId = await getCurrentChainId(); if (currentChainId === APLO_NETWORK.chainId) return true; - + await window.ethereum.request({ method: "wallet_switchEthereumChain", params: [{ chainId: APLO_NETWORK.chainId }], }); - + toast({ - title: t("success"), + title: t("success"), description: t("networkSwitched"), }); return true; - + } catch (err: unknown) { // Error code 4902 means the chain hasn't been added yet if ((err as any).code === 4902) { @@ -121,17 +117,17 @@ export default function DesktopNavigation() { const error = err as Error; toast({ variant: "destructive", - title: t("error"), + title: t("error"), description: error.message, }); return false; } }; - - const addAploToken = async () => { + + const addToken = async (contractId: string, name: string) => { try { if (!window.ethereum) return; - + // Verify and switch to Aplo network first const switched = await switchToAploNetwork(); if (!switched) { @@ -142,7 +138,7 @@ export default function DesktopNavigation() { }); return; } - + // Double check we're on the right network const currentChainId = await getCurrentChainId(); if (currentChainId !== APLO_NETWORK.chainId) { @@ -153,18 +149,22 @@ export default function DesktopNavigation() { }); return; } - + await window.ethereum.request({ method: "wallet_watchAsset", params: { type: "ERC20", - options: APLO_TOKEN, + options: { + address: contractId, + symbol: name, + decimals: 18, + }, }, }); - + toast({ title: t("success"), - description: t("tokenAdded"), + description: t("tokenAdded"), }); } catch (err: unknown) { const error = err as Error; @@ -185,16 +185,16 @@ export default function DesktopNavigation() { }} >
AploCoin logo
- Crypto + {t('crypto')} -
    +
      + +
    • + + + +
      + {t("mining")} +
      +

      + {t("start-mining")} +

      +
      +
      +
    • +
    • @@ -226,68 +244,121 @@ export default function DesktopNavigation() {
    • - -
    • +
    • - { addToken("0x0000000000000000000000000000000000001234", "GAPLO") }} className={cn( - "block border border-input bg-background shadow-sm select-none space-y-1 rounded-md p-3 leading-none no-underline outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground" + "h-auto w-full block select-none space-y-1 rounded-md p-3 leading-none no-underline outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground text-left" )} >
      - {t("mining")} + {t('addGaploToken')}
      -

      - {t("start-mining")} +

      + TEST

      - +
    • +
    - - - {t("whatIsAplo")} - - - - - - - {t("faq")} - - - + {t('aboutAplo')} + +
      +
    • + + + +
      + {t("whatIsAplo")} +
      +

      + TEST +

      +
      +
      +
    • + + + + + - - - - {t("about")} - - + + + + + + + + + + + +
    +
    + - - - - - {t("userGuides")} - - -
diff --git a/src/components/navigation/desktop.module.css b/src/components/navigation/desktop.module.css index ccfce11..e62abee 100644 --- a/src/components/navigation/desktop.module.css +++ b/src/components/navigation/desktop.module.css @@ -1,11 +1,4 @@ -.menu-container { - min-height: 6.83vh; - margin-top: 8.49vh; - margin-bottom: 1.56vh; - box-shadow: 0px 2px 4px 0px rgba(50, 50, 93, 0.1); - background: hsl(var(--secondary)); - padding: 0px 2.01vw; -} + .logo { height: auto; @@ -15,25 +8,3 @@ } -.url-button{ - color: hsl(var(--foreground)); - font-size: clamp(10px, 1.25vw, 64px); - font-weight: 500; - letter-spacing: 0%; - text-align: center; - margin-right: clamp(8px, 2.77vw, 50px); -} - -.en-lang .url-button { - font-size: clamp(10px, 1.25vw, 64px); -} - -.ru-lang .url-button { - font-size: clamp(9px, 0.95vw, 64px); - margin-right: clamp(8px, 2vw, 50px); -} - -.ua-lang .url-button { - font-size: clamp(9px, 0.95vw, 64px); - margin-right: clamp(8px, 2vw, 50px); -} \ No newline at end of file diff --git a/tailwind.config.ts b/tailwind.config.ts index 012d031..3bedc25 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -69,7 +69,10 @@ const config: Config = { border: 'hsl(var(--sidebar-border))', ring: 'hsl(var(--sidebar-ring))' } - } + }, + boxShadow: { + 'custom': '0px 2px 4px 0px rgba(50, 50, 93, 0.1)', + }, } }, plugins: [require("tailwindcss-animate")],