Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manual styling for market 1 to allow for custom HTML/CSS #41

Merged
merged 3 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion frontend/src/config/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ export type Environment = "mainnet" | "testnet"
export const ENV: Environment = match(window.location.host)
.returnType<Environment>()
.with("predict.levana.finance", () => "mainnet")
.otherwise(() => "testnet")
.otherwise(() => "mainnet")

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"
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Box, Typography } from "@mui/joy"
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"
Expand All @@ -16,6 +18,23 @@ const MarketDescription = (props: StyleProps) => {
)
}

const getDescription = (market: Market) => {
return match({ contract: CONTRACT_ADDRESS, marketId: market.id })
.with(
{
contract:
"neutron14r4gqjhnuxzwcmypjle9grlksvjeyyy0mrw0965rdz5v3v5wcv6qjf8w55",
marketId: "1",
},
() => <MainnetOneDescription />,
)
.otherwise(() => (
<Typography level="body-md" whiteSpace="pre-wrap">
{market.description}
</Typography>
))
}

const MarketDescriptionContent = (props: { market: Market }) => {
const { market } = props

Expand All @@ -25,8 +44,52 @@ const MarketDescriptionContent = (props: { market: Market }) => {
Description
</Typography>

<Typography level="body-md" whiteSpace="pre-line">
{market.description}
{getDescription(market)}
</>
)
}

const MainnetOneDescription = () => {
return (
<>
<Typography level="body-md">
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:
</Typography>
<List marker="circle">
<ListItem>
<Typography level="body-md">
Donald Trump's primary opponent, Kamala Harris, concedes the
election to Donald Trump.
</Typography>
</ListItem>
<ListItem>
<Typography level="body-md">
Donald Trump is inaugurated as president
</Typography>
</ListItem>
</List>
<Typography level="body-md">
By contrast, this market will settle "No" if either of the following two
conditions occurs:
</Typography>
<List marker="circle">
<ListItem>
<Typography level="body-md">
Donald Trump concedes the election
</Typography>
</ListItem>
<ListItem>
<Typography level="body-md">
Any other person is inaugurated as president
</Typography>
</ListItem>
</List>
<Typography level="body-md">
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.
</Typography>
</>
)
Expand Down
Loading