From 248f80d4b440e1823b4c824111736593e35a6a55 Mon Sep 17 00:00:00 2001 From: Adebesin Cell Date: Fri, 12 Jul 2024 06:09:28 +0100 Subject: [PATCH] fixes formatting --- src/app/page.tsx | 18 ++-- src/components/layouts/ClientProviders.tsx | 10 +- src/components/layouts/Iqtoken.tsx | 112 ++++++++++---------- src/components/layouts/ecosystem/Iqwiki.tsx | 86 +++++++-------- src/modules/alchemyFetch.ts | 40 +++---- src/modules/fetchCoinMarketData.ts | 54 +++++----- src/modules/getLockOverview.ts | 40 +++---- src/modules/getTVL.ts | 35 +++--- src/modules/helpers/numFormatter.ts | 2 +- 9 files changed, 200 insertions(+), 197 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index d917f69..0b5aa9e 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,22 +1,22 @@ -import Hero from '@/components/layouts/Hero'; -import Iqtoken from '@/components/layouts/Iqtoken'; -import BraindaoTeam from '@/components/layouts/braindao-team'; -import Ecosystem from '@/components/layouts/ecosystem'; -import { fetchCoinMarketData } from '@/modules/fetchCoinMarketData'; -import { getLockOverview } from '@/modules/getLockOverview'; -import { getTvl } from '@/modules/getTVL'; +import Hero from "@/components/layouts/Hero"; +import Iqtoken from "@/components/layouts/Iqtoken"; +import BraindaoTeam from "@/components/layouts/braindao-team"; +import Ecosystem from "@/components/layouts/ecosystem"; +import { fetchCoinMarketData } from "@/modules/fetchCoinMarketData"; +import { getLockOverview } from "@/modules/getLockOverview"; +import { getTvl } from "@/modules/getTVL"; export default async function Home() { const [tvl, marketData, lockOverview] = await Promise.all([ getTvl(), fetchCoinMarketData(), - getLockOverview() + getLockOverview(), ]); const { totalHiiqSupply } = lockOverview; return ( -
+
{ return ( - + {children} ); diff --git a/src/components/layouts/Iqtoken.tsx b/src/components/layouts/Iqtoken.tsx index e094d33..7f34648 100644 --- a/src/components/layouts/Iqtoken.tsx +++ b/src/components/layouts/Iqtoken.tsx @@ -1,16 +1,16 @@ -'use client'; +"use client"; -import { numFormatter } from '@/modules/helpers/numFormatter'; -import { useTheme } from 'next-themes'; -import Image from 'next/image'; -import React, { useEffect, useState } from 'react'; -import InViewAnimateBottom from '../transitions/InViewAnimateBottom'; +import { numFormatter } from "@/modules/helpers/numFormatter"; +import { useTheme } from "next-themes"; +import Image from "next/image"; +import React, { useEffect, useState } from "react"; +import InViewAnimateBottom from "../transitions/InViewAnimateBottom"; export const StatsPointers = ({ title, content, className, - headerSize + headerSize, }: { title: string; content: string; @@ -18,17 +18,17 @@ export const StatsPointers = ({ headerSize?: string; }) => { return ( - -
+ +

{title}

- {content} + {content}
@@ -40,7 +40,7 @@ export const TokenBrief = ({ description, description2, buttonText, - action + action, }: { title: string; description: string; @@ -49,19 +49,19 @@ export const TokenBrief = ({ action: string; }) => { return ( -
+
-

+

{title}

-
+
-

+

{description}

{description2 && ( -

+

{description2}

)} @@ -69,9 +69,9 @@ export const TokenBrief = ({ {buttonText} @@ -84,7 +84,7 @@ export const TokenBrief = ({ const Iqtoken = ({ marketData, tvl, - totalHiiqSupply + totalHiiqSupply, }: { totalHiiqSupply: number; tvl: number; @@ -92,91 +92,91 @@ const Iqtoken = ({ marketData: { [x: string]: any } | null; }) => { const { theme } = useTheme(); - const [appTheme, setAppTheme] = useState(''); + const [appTheme, setAppTheme] = useState(""); useEffect(() => { - setAppTheme(theme ?? ''); + setAppTheme(theme ?? ""); }, [theme]); let imageUrl: string | undefined = undefined; - if (appTheme === 'light') { - imageUrl = '/images/aboutus.png'; + if (appTheme === "light") { + imageUrl = "/images/aboutus.png"; } - if (appTheme === 'dark') { - imageUrl = '/images/aboutus-dark.png'; + if (appTheme === "dark") { + imageUrl = "/images/aboutus-dark.png"; } return (
-
+
-
-
- +
+
+ {imageUrl && ( )}
-
+
-

+

HiIQ

-

+

HiIQ, launched to incentivize long-term engagement and governance participation, allows users to lock up IQ tokens, increasing HiIQ balance for voting power and earning IQ token rewards, with 3 million tokens generated daily.

-
-
-
+
+
+
-
+
diff --git a/src/components/layouts/ecosystem/Iqwiki.tsx b/src/components/layouts/ecosystem/Iqwiki.tsx index 727b748..3441b6d 100644 --- a/src/components/layouts/ecosystem/Iqwiki.tsx +++ b/src/components/layouts/ecosystem/Iqwiki.tsx @@ -1,95 +1,95 @@ -'use client'; +"use client"; -import InViewAnimateBottom from '@/components/transitions/InViewAnimateBottom'; -import { useTheme } from 'next-themes'; -import Image from 'next/image'; -import React, { useEffect, useState } from 'react'; -import { TokenBrief } from '../Iqtoken'; +import InViewAnimateBottom from "@/components/transitions/InViewAnimateBottom"; +import { useTheme } from "next-themes"; +import Image from "next/image"; +import React, { useEffect, useState } from "react"; +import { TokenBrief } from "../Iqtoken"; const Iqwiki = () => { const { theme } = useTheme(); - const [appTheme, setAppTheme] = useState(''); + const [appTheme, setAppTheme] = useState(""); useEffect(() => { - setAppTheme(theme ?? ''); + setAppTheme(theme ?? ""); }, [theme]); let imageUrl: string | undefined = undefined; let imageUrl2: string | undefined = undefined; let imageUrl3: string | undefined = undefined; - if (appTheme === 'light') { - imageUrl = '/images/iqwiki-widget-new.png'; - imageUrl2 = '/images/wiki-rank.png'; - imageUrl3 = '/images/wiki-homepage.png'; + if (appTheme === "light") { + imageUrl = "/images/iqwiki-widget-new.png"; + imageUrl2 = "/images/wiki-rank.png"; + imageUrl3 = "/images/wiki-homepage.png"; } - if (appTheme === 'dark') { - imageUrl = '/images/iqwiki-widget-new-dark.png'; - imageUrl2 = '/images/wiki-rank-dark.png'; - imageUrl3 = '/images/wiki-homepage-dark.png'; + if (appTheme === "dark") { + imageUrl = "/images/iqwiki-widget-new-dark.png"; + imageUrl2 = "/images/wiki-rank-dark.png"; + imageUrl3 = "/images/wiki-homepage-dark.png"; } return ( -
+
-
-
-

+

+
+

Explore a diverse range of wikis designed to guide you through the - realms of{' '} - + realms of{" "} + cryptocurrency and blockchain.

-
-
+
+
{imageUrl3 && ( )}
-
-
+
+
{imageUrl && ( )}
-
-
+
+
{imageUrl2 && ( )}
-
- +
+ Integrations: -
-
-
-
+
+
+
+
diff --git a/src/modules/alchemyFetch.ts b/src/modules/alchemyFetch.ts index fe8f817..8d883e3 100644 --- a/src/modules/alchemyFetch.ts +++ b/src/modules/alchemyFetch.ts @@ -5,25 +5,25 @@ export const WEI_TO_ETHER_DIVISOR = 10e17; // biome-ignore lint/suspicious/noExplicitAny: export const alchemyFetch = async (method: string, params: any[]) => { - const response = await fetch( - `https://eth-mainnet.alchemyapi.io/v2/${config.alchemyApiKey}`, - { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ - jsonrpc: "2.0", - id: 1, - method: method, - params: params, - }), - }, - ); + const response = await fetch( + `https://eth-mainnet.alchemyapi.io/v2/${config.alchemyApiKey}`, + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + jsonrpc: "2.0", + id: 1, + method: method, + params: params, + }), + } + ); - const data = await response.json(); - if (data.error) { - throw new Error(data.error.message); - } - return data.result; + const data = await response.json(); + if (data.error) { + throw new Error(data.error.message); + } + return data.result; }; diff --git a/src/modules/fetchCoinMarketData.ts b/src/modules/fetchCoinMarketData.ts index b19602a..33273e6 100644 --- a/src/modules/fetchCoinMarketData.ts +++ b/src/modules/fetchCoinMarketData.ts @@ -1,37 +1,37 @@ import config from "@/config"; export const formatNumber = new Intl.NumberFormat("en", { - notation: "compact", + notation: "compact", }).format; export const fetchCoinMarketData = async (tokenName = "IQ") => { - try { - const response = await fetch( - `https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest?symbol=${tokenName}`, - { - headers: { - "X-CMC_PRO_API_KEY": config.cmcApiKey, - }, - }, - ); + try { + const response = await fetch( + `https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest?symbol=${tokenName}`, + { + headers: { + "X-CMC_PRO_API_KEY": config.cmcApiKey, + }, + } + ); - if (!response.ok) { - throw new Error("Network response was not ok"); - } + if (!response.ok) { + throw new Error("Network response was not ok"); + } - const data = await response.json(); - const tokenDetails = data.data[tokenName]; - const circulatingSupply = tokenDetails.circulating_supply; - const marketCap = tokenDetails.quote.USD.market_cap; - const volume = tokenDetails.quote.USD.volume_24h; + const data = await response.json(); + const tokenDetails = data.data[tokenName]; + const circulatingSupply = tokenDetails.circulating_supply; + const marketCap = tokenDetails.quote.USD.market_cap; + const volume = tokenDetails.quote.USD.volume_24h; - return { - circulatingSupply, - marketCap, - volume, - }; - } catch (error) { - console.error("Error fetching data:", error); - return null; - } + return { + circulatingSupply, + marketCap, + volume, + }; + } catch (error) { + console.error("Error fetching data:", error); + return null; + } }; diff --git a/src/modules/getLockOverview.ts b/src/modules/getLockOverview.ts index d391ed8..a9fc29c 100644 --- a/src/modules/getLockOverview.ts +++ b/src/modules/getLockOverview.ts @@ -2,29 +2,29 @@ import config from "@/config"; import { HEX_BASE, WEI_TO_ETHER_DIVISOR, alchemyFetch } from "./alchemyFetch"; const getTotalHiiqSupply = async () => { - try { - const data = await alchemyFetch("eth_call", [ - { - to: config.hiiqAddress, - data: "0x18160ddd", - }, - "latest", - ]); + try { + const data = await alchemyFetch("eth_call", [ + { + to: config.hiiqAddress, + data: "0x18160ddd", + }, + "latest", + ]); - const totalHiiq = Number.parseInt(data, HEX_BASE) / WEI_TO_ETHER_DIVISOR; - return totalHiiq; - } catch (error) { - console.error("🚨 Error getting total hiIQ supply", error); - throw new Error("🚨 Error getting total hiIQ supply"); - } + const totalHiiq = Number.parseInt(data, HEX_BASE) / WEI_TO_ETHER_DIVISOR; + return totalHiiq; + } catch (error) { + console.error("🚨 Error getting total hiIQ supply", error); + throw new Error("🚨 Error getting total hiIQ supply"); + } }; export const getLockOverview = async () => { - const totalHiiqSupply = await getTotalHiiqSupply(); + const totalHiiqSupply = await getTotalHiiqSupply(); - return { - totalSupplyError: totalHiiqSupply === 0, - isFetchingTotalSupply: false, - totalHiiqSupply, - }; + return { + totalSupplyError: totalHiiqSupply === 0, + isFetchingTotalSupply: false, + totalHiiqSupply, + }; }; diff --git a/src/modules/getTVL.ts b/src/modules/getTVL.ts index f92a991..19083e9 100644 --- a/src/modules/getTVL.ts +++ b/src/modules/getTVL.ts @@ -2,21 +2,24 @@ import config from "@/config"; import { HEX_BASE, WEI_TO_ETHER_DIVISOR, alchemyFetch } from "./alchemyFetch"; export const getTvl = async () => { - try { - const data = await alchemyFetch("eth_call", [ - { - from: "0x0000000000000000000000000000000000000000", - to: config.iqAddress, - data: `0x70a08231000000000000000000000000${config.hiiqAddress.replace("0x", "")}`, - }, - "latest", - ]); + try { + const data = await alchemyFetch("eth_call", [ + { + from: "0x0000000000000000000000000000000000000000", + to: config.iqAddress, + data: `0x70a08231000000000000000000000000${config.hiiqAddress.replace( + "0x", + "" + )}`, + }, + "latest", + ]); - let tvl = Number.parseInt(data, HEX_BASE); - tvl = tvl / WEI_TO_ETHER_DIVISOR; - return Math.floor(tvl); - } catch (error) { - console.error("🚨 Error getting TVL", error); - throw new Error("🚨 Error getting TVL"); - } + let tvl = Number.parseInt(data, HEX_BASE); + tvl = tvl / WEI_TO_ETHER_DIVISOR; + return Math.floor(tvl); + } catch (error) { + console.error("🚨 Error getting TVL", error); + throw new Error("🚨 Error getting TVL"); + } }; diff --git a/src/modules/helpers/numFormatter.ts b/src/modules/helpers/numFormatter.ts index e2d0105..3611582 100644 --- a/src/modules/helpers/numFormatter.ts +++ b/src/modules/helpers/numFormatter.ts @@ -1,3 +1,3 @@ export const numFormatter = Intl.NumberFormat("en", { - notation: "compact", + notation: "compact", }).format;