Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
lvn-alduin committed Sep 23, 2024
1 parent 95c151b commit 17d6237
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion frontend/src/config/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ 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"

Expand Down
Original file line number Diff line number Diff line change
@@ -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 (
Expand All @@ -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",
},
() => <MainnetOneDescription />,
)
.otherwise(() => (
<Typography level="body-md" whiteSpace="pre-wrap">
{market.description}
</Typography>
))
}

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

Expand All @@ -26,15 +44,7 @@ const MarketDescriptionContent = (props: { market: Market }) => {
Description
</Typography>

{CONTRACT_ADDRESS ===
"neutron14r4gqjhnuxzwcmypjle9grlksvjeyyy0mrw0965rdz5v3v5wcv6qjf8w55" &&
market.id === "1" ? (
<MainnetOneDescription />
) : (
<Typography level="body-md" whiteSpace="pre-line">
{market.description}
</Typography>
)}
{getDescription(market)}
</>
)
}
Expand All @@ -47,7 +57,7 @@ const MainnetOneDescription = () => {
elections of 2024. This market will settle "Yes" if either of the
following two conditions occurs:
</Typography>
<List>
<List marker="circle">
<ListItem>
<Typography level="body-md">
Donald Trump's primary opponent, Kamala Harris, concedes the
Expand All @@ -64,7 +74,7 @@ const MainnetOneDescription = () => {
By contrast, this market will settle "No" if either of the following two
conditions occurs:
</Typography>
<List>
<List marker="circle">
<ListItem>
<Typography level="body-md">
Donald Trump concedes the election
Expand Down

0 comments on commit 17d6237

Please sign in to comment.