From 95c151b94f3dd002bb69c9814092b7f1f727f8c8 Mon Sep 17 00:00:00 2001 From: lvn-rusty-dragon Date: Sun, 22 Sep 2024 12:53:46 +0300 Subject: [PATCH 1/3] Manual styling for market 1 to allow for custom HTML/CSS --- .../components/MarketDescription/index.tsx | 59 ++++++++++++++++++- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/frontend/src/features/MarketDetail/components/MarketDescription/index.tsx b/frontend/src/features/MarketDetail/components/MarketDescription/index.tsx index c037604..57a4986 100644 --- a/frontend/src/features/MarketDetail/components/MarketDescription/index.tsx +++ b/frontend/src/features/MarketDetail/components/MarketDescription/index.tsx @@ -1,9 +1,10 @@ -import { Box, Typography } from "@mui/joy" +import { Box, List, ListItem, Typography } from "@mui/joy" import type { Market } from "@api/queries/Market" import type { StyleProps } from "@utils/styles" import { LoadableWidget } from "@lib/Loadable/Widget" import { useSuspenseCurrentMarket } from "@features/MarketDetail/utils" +import { CONTRACT_ADDRESS } from "@config/environment" const MarketDescription = (props: StyleProps) => { return ( @@ -25,8 +26,60 @@ const MarketDescriptionContent = (props: { market: Market }) => { Description - - {market.description} + {CONTRACT_ADDRESS === + "neutron14r4gqjhnuxzwcmypjle9grlksvjeyyy0mrw0965rdz5v3v5wcv6qjf8w55" && + market.id === "1" ? ( + + ) : ( + + {market.description} + + )} + + ) +} + +const MainnetOneDescription = () => { + return ( + <> + + This market tracks whether Donald Trump wins the presidency in the US + elections of 2024. This market will settle "Yes" if either of the + following two conditions occurs: + + + + + Donald Trump's primary opponent, Kamala Harris, concedes the + election to Donald Trump. + + + + + Donald Trump is inaugurated as president + + + + + By contrast, this market will settle "No" if either of the following two + conditions occurs: + + + + + Donald Trump concedes the election + + + + + Any other person is inaugurated as president + + + + + Note that, in the event of a contested election, this market may not + settle until January 2025, or if there are further uncertainties of the + outcome, may be further delayed. ) From 17d6237f6cc042e479046ce9ae568babc4166f6b Mon Sep 17 00:00:00 2001 From: Alduin Date: Mon, 23 Sep 2024 15:33:44 -0300 Subject: [PATCH 2/3] Tweaks --- frontend/src/config/environment.ts | 2 +- .../components/MarketDescription/index.tsx | 34 ++++++++++++------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/frontend/src/config/environment.ts b/frontend/src/config/environment.ts index 506adb7..8e679f8 100644 --- a/frontend/src/config/environment.ts +++ b/frontend/src/config/environment.ts @@ -5,7 +5,7 @@ export type Environment = "mainnet" | "testnet" export const ENV: Environment = match(window.location.host) .returnType() .with("predict.levana.finance", () => "mainnet") - .otherwise(() => "testnet") + .otherwise(() => "mainnet") export const IS_TESTNET = ENV === "testnet" diff --git a/frontend/src/features/MarketDetail/components/MarketDescription/index.tsx b/frontend/src/features/MarketDetail/components/MarketDescription/index.tsx index 57a4986..877d7da 100644 --- a/frontend/src/features/MarketDetail/components/MarketDescription/index.tsx +++ b/frontend/src/features/MarketDetail/components/MarketDescription/index.tsx @@ -1,10 +1,11 @@ +import { match } from "ts-pattern" import { Box, List, ListItem, Typography } from "@mui/joy" +import { CONTRACT_ADDRESS } from "@config/environment" import type { Market } from "@api/queries/Market" import type { StyleProps } from "@utils/styles" import { LoadableWidget } from "@lib/Loadable/Widget" import { useSuspenseCurrentMarket } from "@features/MarketDetail/utils" -import { CONTRACT_ADDRESS } from "@config/environment" const MarketDescription = (props: StyleProps) => { return ( @@ -17,6 +18,23 @@ const MarketDescription = (props: StyleProps) => { ) } +const getDescription = (market: Market) => { + return match({ contract: CONTRACT_ADDRESS, marketId: market.id }) + .with( + { + contract: + "neutron14r4gqjhnuxzwcmypjle9grlksvjeyyy0mrw0965rdz5v3v5wcv6qjf8w55", + marketId: "1", + }, + () => , + ) + .otherwise(() => ( + + {market.description} + + )) +} + const MarketDescriptionContent = (props: { market: Market }) => { const { market } = props @@ -26,15 +44,7 @@ const MarketDescriptionContent = (props: { market: Market }) => { Description - {CONTRACT_ADDRESS === - "neutron14r4gqjhnuxzwcmypjle9grlksvjeyyy0mrw0965rdz5v3v5wcv6qjf8w55" && - market.id === "1" ? ( - - ) : ( - - {market.description} - - )} + {getDescription(market)} ) } @@ -47,7 +57,7 @@ const MainnetOneDescription = () => { elections of 2024. This market will settle "Yes" if either of the following two conditions occurs: - + Donald Trump's primary opponent, Kamala Harris, concedes the @@ -64,7 +74,7 @@ const MainnetOneDescription = () => { By contrast, this market will settle "No" if either of the following two conditions occurs: - + Donald Trump concedes the election From 3f54a12dc8bfae69b920098cc15d86bdb44dce74 Mon Sep 17 00:00:00 2001 From: Alduin Date: Mon, 23 Sep 2024 15:37:41 -0300 Subject: [PATCH 3/3] Trigger build --- frontend/src/config/environment.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontend/src/config/environment.ts b/frontend/src/config/environment.ts index 8e679f8..cb2777b 100644 --- a/frontend/src/config/environment.ts +++ b/frontend/src/config/environment.ts @@ -12,9 +12,11 @@ export const IS_TESTNET = ENV === "testnet" export const CONTRACT_ADDRESS = IS_TESTNET ? "neutron1juw8ztnzy37xs9nvcqf4lhshcg7zndwmjvgmzxkp8cgjgw3ahscshn2l82" : "neutron14r4gqjhnuxzwcmypjle9grlksvjeyyy0mrw0965rdz5v3v5wcv6qjf8w55" + export const QUERIER_ADDRESS = IS_TESTNET ? "https://querier-testnet.levana.finance" : "https://querier-mainnet.levana.finance" + export const INDEXER_ADDRESS = IS_TESTNET ? "https://indexer-testnet.levana.finance" : "https://indexer-mainnet.levana.finance"