From e0ada9b54c37c887ed1a76964b394d3aca26a521 Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Fri, 13 Dec 2024 21:22:50 +0100 Subject: [PATCH 1/9] Add market metadata on market page --- .../src/components/FormattedNumber.tsx | 2 +- .../components/main-info/BondingProgress.tsx | 68 +++++++------------ .../components/main-info/MainInfo.tsx | 38 ++++++++--- .../svg/icons/BondingCurveArrow.tsx | 16 +++++ 4 files changed, 72 insertions(+), 52 deletions(-) create mode 100644 src/typescript/frontend/src/components/svg/icons/BondingCurveArrow.tsx diff --git a/src/typescript/frontend/src/components/FormattedNumber.tsx b/src/typescript/frontend/src/components/FormattedNumber.tsx index d7ff246aa..5538b1f0c 100644 --- a/src/typescript/frontend/src/components/FormattedNumber.tsx +++ b/src/typescript/frontend/src/components/FormattedNumber.tsx @@ -75,7 +75,7 @@ export const FormattedNumber = ({ const num = nominalize ? toNominal(value as bigint) : Number(value); const format = style === "fixed" || Math.abs(num) >= 1 - ? { maximumFractionDigits: decimals } + ? { maximumFractionDigits: decimals, minimumFractionDigits: style === "fixed" ? decimals : undefined } : { maximumSignificantDigits: decimals }; const formatter = new Intl.NumberFormat("en-US", format); return formatter.format(num); diff --git a/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/BondingProgress.tsx b/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/BondingProgress.tsx index c017e5254..e5a90baf4 100644 --- a/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/BondingProgress.tsx +++ b/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/BondingProgress.tsx @@ -3,19 +3,16 @@ import React, { useEffect, useState } from "react"; import { translationFunction } from "context/language-context"; import { type MainInfoProps } from "../../types"; import { useEventStore } from "context/event-store-context"; -import { motion } from "framer-motion"; import { getBondingCurveProgress } from "@sdk/utils/bonding-curve"; -import Button from "components/button"; -import Link from "next/link"; -import { ROUTES } from "router/routes"; -import { useThemeContext } from "context"; import { FormattedNumber } from "components/FormattedNumber"; +import BondingCurveArrow from "@icons/BondingCurveArrow"; +import { emoji } from "utils"; +import { Emoji } from "utils/emoji"; -const statsTextClasses = "uppercase ellipses font-forma text-[24px]"; +const statsTextClasses = "uppercase ellipses font-forma"; const BondingProgress = ({ data }: MainInfoProps) => { const { t } = translationFunction(); - const { theme } = useThemeContext(); const marketEmojis = data.symbolEmojis; const stateEvents = useEventStore((s) => s.getMarket(marketEmojis)?.stateEvents ?? []); @@ -32,52 +29,39 @@ const BondingProgress = ({ data }: MainInfoProps) => { } }, [stateEvents]); + console.log(bondingProgress) + return ( -
-
-
+
+
+
+
+ +
+ 15 ? "econiaBlue" : "darkGray"}/> + 30 ? "econiaBlue" : "darkGray"}/> + 45 ? "econiaBlue" : "darkGray"}/> + 60 ? "econiaBlue" : "darkGray"}/> + 75 ? "econiaBlue" : "darkGray"}/> + 90 ? "econiaBlue" : "darkGray"}/> + = 100 ? "econiaBlue" : "darkGray"}/> +
+
+
+
{t("Bonding progress:")}
- {bondingProgress >= 100 ? ( - e.emoji).join("") }, - }} - > - - - ) : ( -
- -
- )}
); }; diff --git a/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/MainInfo.tsx b/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/MainInfo.tsx index 2fd4d88b4..3f7561d22 100644 --- a/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/MainInfo.tsx +++ b/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/MainInfo.tsx @@ -15,6 +15,7 @@ import { emoji } from "utils"; import { motion } from "framer-motion"; import { truncateAddress } from "@sdk/utils"; import { FormattedNumber } from "components/FormattedNumber"; +import Button from "components/button"; const statsTextClasses = "uppercase ellipses font-forma text-[24px]"; @@ -52,6 +53,8 @@ const MainInfo = ({ data }: MainInfoProps) => { const [copied, setCopied] = useState(false); + const borderStyle = "border-solid border-[1px] border-dark-gray rounded-[3px] p-[1em]"; + return (
{ }} >
-
+
-
+ {/*
{ > -
+
*/}
{t("Market Cap:")}
@@ -142,9 +147,24 @@ const MainInfo = ({ data }: MainInfoProps) => {
-
- +
+
+
+ + + + +
+
diff --git a/src/typescript/frontend/src/components/svg/icons/BondingCurveArrow.tsx b/src/typescript/frontend/src/components/svg/icons/BondingCurveArrow.tsx new file mode 100644 index 000000000..b801dbb27 --- /dev/null +++ b/src/typescript/frontend/src/components/svg/icons/BondingCurveArrow.tsx @@ -0,0 +1,16 @@ +"use client"; + +import React from "react"; +import Svg from "components/svg/Svg"; +import { type SvgProps } from "../types"; +import { darkColors } from "theme"; + +const Icon: React.FC = ({ color = "darkGray", ...props }) => { + return ( + + + + ); +}; + +export default Icon; From 867f816620e8c88feb61b428c86b78fcf6f4e666 Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Mon, 16 Dec 2024 14:57:21 +0100 Subject: [PATCH 2/9] Add contract interaction --- .../frontend/src/components/button/index.tsx | 26 +++- .../components/main-info/MainInfo.tsx | 114 ++++++++++++------ .../src/components/svg/icons/Planet.tsx | 15 ++- .../src/components/svg/icons/Telegram.tsx | 19 +++ .../svg/icons/TelegramOutlineIcon.tsx | 19 +++ 5 files changed, 153 insertions(+), 40 deletions(-) create mode 100644 src/typescript/frontend/src/components/svg/icons/Telegram.tsx create mode 100644 src/typescript/frontend/src/components/svg/icons/TelegramOutlineIcon.tsx diff --git a/src/typescript/frontend/src/components/button/index.tsx b/src/typescript/frontend/src/components/button/index.tsx index e36dfe26f..970cbd128 100644 --- a/src/typescript/frontend/src/components/button/index.tsx +++ b/src/typescript/frontend/src/components/button/index.tsx @@ -56,7 +56,31 @@ const Button = ({ })} {!isScramble ? ( - `{ ${children} }` + + + {"{ "} + + {children} + + {" }"} + + ) : ( React.ReactNode}) => { + const button = + ; + return link ? {button} : button; +}; + const MainInfo = ({ data }: MainInfoProps) => { const { t } = translationFunction(); const { theme } = useThemeContext(); @@ -44,7 +58,7 @@ const MainInfo = ({ data }: MainInfoProps) => { } }, [stateEvents]); - const { isMobile } = useMatchBreakpoints(); + const { isMobile, isTablet } = useMatchBreakpoints(); const explorerLink = toExplorerLink({ linkType: "coin", @@ -55,6 +69,56 @@ const MainInfo = ({ data }: MainInfoProps) => { const borderStyle = "border-solid border-[1px] border-dark-gray rounded-[3px] p-[1em]"; + const [marketProperties, setMarketProperties] = useState>(); + + const { aptos } = useAptos(); + + useEffect(() => { + MarketProperties.submit({ + aptos, + market: data.marketAddress, + }) + .then((r) => r.vec.at(0) ?? null) + .then((r) => { + if (r) { + const newFields = new Map(); + (r as { data: { key: string; value: string }[] }).data.forEach(({ key, value }) => { + newFields.set(key, value); + }); + setMarketProperties(newFields); + } + }) + .catch((e) => console.error("Could not get market metadata.", e)); + /* eslint-disable react-hooks/exhaustive-deps */ + }, [data.marketAddress]); + + const dexscreenerButton = + ; + + const telegramButton = + } + />; + + const twitterButton = + } + />; + + const websiteButton = + } + />; + return (
{
{ - {/*
- - {truncateAddress(data.marketView.metadata.marketAddress)} - - { - navigator.clipboard.writeText(data.marketView.metadata.marketAddress); - if (!copied) { - setCopied(true); - setTimeout(() => setCopied(false), 3000); - } - }} - > - - -
*/}
{
-
- - - - - + whileTap={{scaleX: 0.96, scaleY: 0.98}} + transition={{ ease: "linear", duration: 0.05 }} + > + + {dexscreenerButton} + {twitterButton} + {telegramButton} + {websiteButton}
diff --git a/src/typescript/frontend/src/components/svg/icons/Planet.tsx b/src/typescript/frontend/src/components/svg/icons/Planet.tsx index b709359d2..a1a5863ef 100644 --- a/src/typescript/frontend/src/components/svg/icons/Planet.tsx +++ b/src/typescript/frontend/src/components/svg/icons/Planet.tsx @@ -1,13 +1,18 @@ +"use client"; + import React from "react"; -import { type SVGProps } from "react"; +import { SvgProps } from "../types"; +import Svg from "../Svg"; +import { useThemeContext } from "context"; -const Planet = (props: SVGProps) => { +const Planet: React.FC = ({ color = "econiaBlue", ...props }) => { + const { theme } = useThemeContext(); return ( - + @@ -15,7 +20,7 @@ const Planet = (props: SVGProps) => { - + ); }; diff --git a/src/typescript/frontend/src/components/svg/icons/Telegram.tsx b/src/typescript/frontend/src/components/svg/icons/Telegram.tsx new file mode 100644 index 000000000..f13678a8e --- /dev/null +++ b/src/typescript/frontend/src/components/svg/icons/Telegram.tsx @@ -0,0 +1,19 @@ +import React from "react"; +import Svg from "components/svg/Svg"; +import { type SvgProps } from "../types"; +import { useThemeContext } from "context/theme-context"; + +const Icon: React.FC = ({ color = "black", ...props }) => { + const { theme } = useThemeContext(); + return ( + + + + + ); +}; + +export default Icon; diff --git a/src/typescript/frontend/src/components/svg/icons/TelegramOutlineIcon.tsx b/src/typescript/frontend/src/components/svg/icons/TelegramOutlineIcon.tsx new file mode 100644 index 000000000..3aa99291b --- /dev/null +++ b/src/typescript/frontend/src/components/svg/icons/TelegramOutlineIcon.tsx @@ -0,0 +1,19 @@ +import React from "react"; +import Svg from "components/svg/Svg"; +import { type SvgProps } from "../types"; +import { useThemeContext } from "context/theme-context"; + +const Icon: React.FC = ({ color = "black", ...props }) => { + const { theme } = useThemeContext(); + return ( + + + + + ); +}; + +export default Icon; From dae7d3b9d169a3603af8d4b9924adb999ea9e224 Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Mon, 16 Dec 2024 14:57:35 +0100 Subject: [PATCH 3/9] Run format --- .../src/components/FormattedNumber.tsx | 5 +- .../frontend/src/components/button/index.tsx | 4 +- .../components/main-info/BondingProgress.tsx | 45 ++++++++--- .../components/main-info/MainInfo.tsx | 75 +++++++++++-------- .../svg/icons/BondingCurveArrow.tsx | 5 +- 5 files changed, 87 insertions(+), 47 deletions(-) diff --git a/src/typescript/frontend/src/components/FormattedNumber.tsx b/src/typescript/frontend/src/components/FormattedNumber.tsx index 5538b1f0c..369bce203 100644 --- a/src/typescript/frontend/src/components/FormattedNumber.tsx +++ b/src/typescript/frontend/src/components/FormattedNumber.tsx @@ -75,7 +75,10 @@ export const FormattedNumber = ({ const num = nominalize ? toNominal(value as bigint) : Number(value); const format = style === "fixed" || Math.abs(num) >= 1 - ? { maximumFractionDigits: decimals, minimumFractionDigits: style === "fixed" ? decimals : undefined } + ? { + maximumFractionDigits: decimals, + minimumFractionDigits: style === "fixed" ? decimals : undefined, + } : { maximumSignificantDigits: decimals }; const formatter = new Intl.NumberFormat("en-US", format); return formatter.format(num); diff --git a/src/typescript/frontend/src/components/button/index.tsx b/src/typescript/frontend/src/components/button/index.tsx index 970cbd128..665faf521 100644 --- a/src/typescript/frontend/src/components/button/index.tsx +++ b/src/typescript/frontend/src/components/button/index.tsx @@ -71,7 +71,9 @@ const Button = ({ textTransform="uppercase" fontSize={scale === "sm" ? "20px" : "24px"} className="flex flex-row" - >{children} + > + {children} + { } }, [stateEvents]); - console.log(bondingProgress) + console.log(bondingProgress); return (
-
-
- -
- 15 ? "econiaBlue" : "darkGray"}/> - 30 ? "econiaBlue" : "darkGray"}/> - 45 ? "econiaBlue" : "darkGray"}/> - 60 ? "econiaBlue" : "darkGray"}/> - 75 ? "econiaBlue" : "darkGray"}/> - 90 ? "econiaBlue" : "darkGray"}/> - = 100 ? "econiaBlue" : "darkGray"}/> +
+
+ +
+ 15 ? "econiaBlue" : "darkGray"} + /> + 30 ? "econiaBlue" : "darkGray"} + /> + 45 ? "econiaBlue" : "darkGray"} + /> + 60 ? "econiaBlue" : "darkGray"} + /> + 75 ? "econiaBlue" : "darkGray"} + /> + 90 ? "econiaBlue" : "darkGray"} + /> + = 100 ? "econiaBlue" : "darkGray"} + />
diff --git a/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/MainInfo.tsx b/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/MainInfo.tsx index 53b289c86..a27235be6 100644 --- a/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/MainInfo.tsx +++ b/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/MainInfo.tsx @@ -22,14 +22,23 @@ import { Colors } from "theme/types"; const statsTextClasses = "uppercase ellipses font-forma text-[24px]"; -const LinkButton = ({name, link, icon}: {name: string, link: string | undefined, icon?: (color: keyof Colors) => React.ReactNode}) => { - const button = +const LinkButton = ({ + name, + link, + icon, +}: { + name: string; + link: string | undefined; + icon?: (color: keyof Colors) => React.ReactNode; +}) => { + const button = ( ; + + ); return link ? {button} : button; }; @@ -69,7 +78,7 @@ const MainInfo = ({ data }: MainInfoProps) => { const borderStyle = "border-solid border-[1px] border-dark-gray rounded-[3px] p-[1em]"; - const [marketProperties, setMarketProperties] = useState>(); + const [marketProperties, setMarketProperties] = useState>(); const { aptos } = useAptos(); @@ -92,32 +101,35 @@ const MainInfo = ({ data }: MainInfoProps) => { /* eslint-disable react-hooks/exhaustive-deps */ }, [data.marketAddress]); - const dexscreenerButton = - ; + const dexscreenerButton = ; - const telegramButton = + const telegramButton = ( } - />; + icon={(color) => ( + + )} + /> + ); - const twitterButton = + const twitterButton = ( } - />; + icon={(color) => ( + + )} + /> + ); - const websiteButton = + const websiteButton = ( } - />; + /> + ); return (
{
-
+
{t("Market Cap:")}
@@ -188,23 +198,24 @@ const MainInfo = ({ data }: MainInfoProps) => {
-
-
+
{ - navigator.clipboard.writeText(data.marketView.metadata.marketAddress); - if (!copied) { - setCopied(true); - setTimeout(() => setCopied(false), 3000); - } - }} - whileTap={{scaleX: 0.96, scaleY: 0.98}} + onClick={() => { + navigator.clipboard.writeText(data.marketView.metadata.marketAddress); + if (!copied) { + setCopied(true); + setTimeout(() => setCopied(false), 3000); + } + }} + whileTap={{ scaleX: 0.96, scaleY: 0.98 }} transition={{ ease: "linear", duration: 0.05 }} > - + + {dexscreenerButton} {twitterButton} {telegramButton} diff --git a/src/typescript/frontend/src/components/svg/icons/BondingCurveArrow.tsx b/src/typescript/frontend/src/components/svg/icons/BondingCurveArrow.tsx index b801dbb27..3dac57e93 100644 --- a/src/typescript/frontend/src/components/svg/icons/BondingCurveArrow.tsx +++ b/src/typescript/frontend/src/components/svg/icons/BondingCurveArrow.tsx @@ -8,7 +8,10 @@ import { darkColors } from "theme"; const Icon: React.FC = ({ color = "darkGray", ...props }) => { return ( - + ); }; From eca887e8a25be321b20f19fc5ca4695d9811105b Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Mon, 16 Dec 2024 15:10:54 +0100 Subject: [PATCH 4/9] Fix lints --- .../pages/emojicoin/components/main-info/BondingProgress.tsx | 2 -- .../pages/emojicoin/components/main-info/MainInfo.tsx | 4 ++-- src/typescript/frontend/src/components/svg/icons/Planet.tsx | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/BondingProgress.tsx b/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/BondingProgress.tsx index 0080e006e..7c900126b 100644 --- a/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/BondingProgress.tsx +++ b/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/BondingProgress.tsx @@ -29,8 +29,6 @@ const BondingProgress = ({ data }: MainInfoProps) => { } }, [stateEvents]); - console.log(bondingProgress); - return (
diff --git a/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/MainInfo.tsx b/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/MainInfo.tsx index a27235be6..e5b809f34 100644 --- a/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/MainInfo.tsx +++ b/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/MainInfo.tsx @@ -18,7 +18,7 @@ import TelegramOutlineIcon from "@icons/TelegramOutlineIcon"; import { motion } from "framer-motion"; import { MarketProperties } from "@/contract-apis"; import { useAptos } from "context/wallet-context/AptosContextProvider"; -import { Colors } from "theme/types"; +import type { Colors } from "theme/types"; const statsTextClasses = "uppercase ellipses font-forma text-[24px]"; @@ -34,7 +34,7 @@ const LinkButton = ({ const button = ( diff --git a/src/typescript/frontend/src/components/svg/icons/Planet.tsx b/src/typescript/frontend/src/components/svg/icons/Planet.tsx index a1a5863ef..3f942b43c 100644 --- a/src/typescript/frontend/src/components/svg/icons/Planet.tsx +++ b/src/typescript/frontend/src/components/svg/icons/Planet.tsx @@ -1,7 +1,7 @@ "use client"; import React from "react"; -import { SvgProps } from "../types"; +import type { SvgProps } from "../types"; import Svg from "../Svg"; import { useThemeContext } from "context"; From 8518aace3754c89ea2d686da4ebc09a01612c965 Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Tue, 17 Dec 2024 14:43:50 +0100 Subject: [PATCH 5/9] Fix submittion and open links in new tabs --- .../pages/emojicoin/components/main-info/MainInfo.tsx | 8 +++++++- .../src/components/pages/metadata/MetadataPage.tsx | 11 ++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/MainInfo.tsx b/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/MainInfo.tsx index e5b809f34..c26ad921c 100644 --- a/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/MainInfo.tsx +++ b/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/MainInfo.tsx @@ -39,7 +39,13 @@ const LinkButton = ({
); - return link ? {button} : button; + return link ? ( + + {button} + + ) : ( + button + ); }; const MainInfo = ({ data }: MainInfoProps) => { diff --git a/src/typescript/frontend/src/components/pages/metadata/MetadataPage.tsx b/src/typescript/frontend/src/components/pages/metadata/MetadataPage.tsx index 773b60728..eedee1997 100644 --- a/src/typescript/frontend/src/components/pages/metadata/MetadataPage.tsx +++ b/src/typescript/frontend/src/components/pages/metadata/MetadataPage.tsx @@ -244,15 +244,16 @@ const MetadataPage = () => { if (!isSubmitEnabled) { return; } - const filledFields = fields.entries().filter(([_, value]) => value !== ""); - const builderLambda = () => - SetMarketProperties.builder({ + const filledFields = Array.from(fields.entries().filter(([_, value]) => value !== "")); + const builderLambda = () => { + return SetMarketProperties.builder({ aptosConfig: aptos.config, admin: account!.address, market: marketAddress, - keys: Array.from(filledFields.map(([key, _]) => key)), - values: Array.from(filledFields.map(([_, value]) => value)), + keys: filledFields.map(([key, _]) => key), + values: filledFields.map(([_, value]) => value), }); + }; const res = await submit(builderLambda); if (!res || res.error) { console.error(res); From 41cc4499af4f6efb5f3334018739bf2a4d216b2a Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Tue, 17 Dec 2024 16:28:20 +0100 Subject: [PATCH 6/9] Fix centering on bonding progress bar --- .../components/main-info/BondingProgress.tsx | 36 ++++++++++++++++--- src/typescript/frontend/src/utils/emoji.tsx | 14 ++++++-- 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/BondingProgress.tsx b/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/BondingProgress.tsx index 7c900126b..7945e936c 100644 --- a/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/BondingProgress.tsx +++ b/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/BondingProgress.tsx @@ -31,11 +31,39 @@ const BondingProgress = ({ data }: MainInfoProps) => { return (
-
+ {/* + 3.26 is calculated like this: + + The aspect ratio of a bonding curve arrow is 115/30 aka 23/6. + + There are 7 of them. + + So the aspect ratio of the container element is 115/30*7 aka 161/6. + + We know that the rocket emoji's width and height is 175% of the container height. + + We want to add padding to the container to include the half part of the rocket emoji that overflows on the left, in order to properly center the container within its container. + + The padding should be 50% of the rocket's width, but we cannot use the rocket width as a unit in CSS. + + But we know that the rocket width is 175% of the container height. + + But we cannot specify the left padding in height percentage, but only in width percentage. + + But we know that the container's width is 161/6 times the container's height. + + So we can do 100 / (161/6) * 1.75 / 2 which gives us ~3.26. + + Who knew CSS could be this hard... + */} +
-
- -
+ 15 ? "econiaBlue" : "darkGray"} diff --git a/src/typescript/frontend/src/utils/emoji.tsx b/src/typescript/frontend/src/utils/emoji.tsx index 29b0ae280..797a95635 100644 --- a/src/typescript/frontend/src/utils/emoji.tsx +++ b/src/typescript/frontend/src/utils/emoji.tsx @@ -10,6 +10,7 @@ declare global { size?: string; native?: string; key?: string; + set?: string; }; } } @@ -17,19 +18,28 @@ declare global { export const Emoji = ({ emojis, + set = undefined, + size = undefined, ...props }: Omit, HTMLSpanElement>, "children"> & { emojis: AnyEmojiData[] | string; + set?: string; + size?: string; }) => { let data: React.ReactNode[] = []; if (typeof emojis === "string") { const emojisInString = getEmojisInString(emojis); data = emojisInString.map((e, i) => ( - + )); } else { data = emojis.map((e, i) => ( - + )); } return {data}; From a1e8d2e2544c79ce2bd679f37395a9cbd0160e19 Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Wed, 18 Dec 2024 14:53:28 +0100 Subject: [PATCH 7/9] Address PR comments --- cfg/cspell-frontend-dictionary.txt | 1 + .../pages/emojicoin/components/main-info/MainInfo.tsx | 10 ++-------- .../src/components/pages/metadata/MetadataPage.tsx | 2 +- .../emojicoin_dot_fun/contract-apis/market-metadata.ts | 2 +- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/cfg/cspell-frontend-dictionary.txt b/cfg/cspell-frontend-dictionary.txt index d105d041e..dcaf19d61 100644 --- a/cfg/cspell-frontend-dictionary.txt +++ b/cfg/cspell-frontend-dictionary.txt @@ -54,3 +54,4 @@ testid ADBEEF bytea nominalize +dexscreener diff --git a/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/MainInfo.tsx b/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/MainInfo.tsx index c26ad921c..d53509d9a 100644 --- a/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/MainInfo.tsx +++ b/src/typescript/frontend/src/components/pages/emojicoin/components/main-info/MainInfo.tsx @@ -80,8 +80,6 @@ const MainInfo = ({ data }: MainInfoProps) => { value: `${data.marketView.metadata.marketAddress}::coin_factory::Emojicoin`, }); - const [copied, setCopied] = useState(false); - const borderStyle = "border-solid border-[1px] border-dark-gray rounded-[3px] p-[1em]"; const [marketProperties, setMarketProperties] = useState>(); @@ -89,7 +87,7 @@ const MainInfo = ({ data }: MainInfoProps) => { const { aptos } = useAptos(); useEffect(() => { - MarketProperties.submit({ + MarketProperties.view({ aptos, market: data.marketAddress, }) @@ -210,16 +208,12 @@ const MainInfo = ({ data }: MainInfoProps) => { { navigator.clipboard.writeText(data.marketView.metadata.marketAddress); - if (!copied) { - setCopied(true); - setTimeout(() => setCopied(false), 3000); - } }} whileTap={{ scaleX: 0.96, scaleY: 0.98 }} transition={{ ease: "linear", duration: 0.05 }} > {dexscreenerButton} diff --git a/src/typescript/frontend/src/components/pages/metadata/MetadataPage.tsx b/src/typescript/frontend/src/components/pages/metadata/MetadataPage.tsx index eedee1997..46491ee73 100644 --- a/src/typescript/frontend/src/components/pages/metadata/MetadataPage.tsx +++ b/src/typescript/frontend/src/components/pages/metadata/MetadataPage.tsx @@ -133,7 +133,7 @@ const MetadataPage = () => { if (pasted) { return; } - MarketProperties.submit({ + MarketProperties.view({ aptos, market: marketAddress, }) diff --git a/src/typescript/sdk/src/emojicoin_dot_fun/contract-apis/market-metadata.ts b/src/typescript/sdk/src/emojicoin_dot_fun/contract-apis/market-metadata.ts index 3b5a31631..a199c72aa 100644 --- a/src/typescript/sdk/src/emojicoin_dot_fun/contract-apis/market-metadata.ts +++ b/src/typescript/sdk/src/emojicoin_dot_fun/contract-apis/market-metadata.ts @@ -565,7 +565,7 @@ export class MarketProperties extends ViewFunctionPayloadBuilder<[Option Date: Wed, 18 Dec 2024 18:28:56 -0800 Subject: [PATCH 8/9] Use default params instead of nullish coalesce --- src/typescript/frontend/src/utils/emoji.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/typescript/frontend/src/utils/emoji.tsx b/src/typescript/frontend/src/utils/emoji.tsx index 797a95635..502348226 100644 --- a/src/typescript/frontend/src/utils/emoji.tsx +++ b/src/typescript/frontend/src/utils/emoji.tsx @@ -19,7 +19,7 @@ declare global { export const Emoji = ({ emojis, set = undefined, - size = undefined, + size = "1em", ...props }: Omit, HTMLSpanElement>, "children"> & { emojis: AnyEmojiData[] | string; @@ -32,14 +32,14 @@ export const Emoji = ({ data = emojisInString.map((e, i) => ( )); } else { data = emojis.map((e, i) => ( - + )); } return {data}; From 48d4db51a0d15862f0003526eec63c3b984973c8 Mon Sep 17 00:00:00 2001 From: Matt <90358481+xbtmatt@users.noreply.github.com> Date: Wed, 18 Dec 2024 18:44:14 -0800 Subject: [PATCH 9/9] Format --- src/typescript/frontend/src/utils/emoji.tsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/typescript/frontend/src/utils/emoji.tsx b/src/typescript/frontend/src/utils/emoji.tsx index 502348226..64a91d8b3 100644 --- a/src/typescript/frontend/src/utils/emoji.tsx +++ b/src/typescript/frontend/src/utils/emoji.tsx @@ -30,12 +30,7 @@ export const Emoji = ({ if (typeof emojis === "string") { const emojisInString = getEmojisInString(emojis); data = emojisInString.map((e, i) => ( - + )); } else { data = emojis.map((e, i) => (