Skip to content

Commit f877d62

Browse files
committed
over/under card almost done
1 parent 5dbbff7 commit f877d62

2 files changed

Lines changed: 134 additions & 2 deletions

File tree

frontend/src/components/Landing/OddsCard.tsx

Lines changed: 95 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Box, Button, Flex, Image, Text } from "@chakra-ui/react"
33
import { useColorModeValue } from "@/components/ui/color-mode"
44

55
type MarketKey = "home" | "draw" | "away"
6+
type OverUnderKey = "over" | "under"
67

78
interface BookInfo {
89
name: string
@@ -24,6 +25,16 @@ export interface OddsCardProps {
2425
onSelect?: (market: MarketKey) => void
2526
}
2627

28+
export interface OverUnderOddsCardProps {
29+
homeTeam: string
30+
awayTeam: string
31+
marketLabel?: string
32+
line?: string
33+
over: Market
34+
under: Market
35+
onSelect?: (market: OverUnderKey) => void
36+
}
37+
2738
interface OddsPillProps extends Market {
2839
label: string
2940
onSelect?: () => void
@@ -118,7 +129,7 @@ export function OddsCard({
118129

119130
return (
120131
<Box
121-
borderWidth="4px"
132+
borderWidth="1px"
122133
borderRadius="2xl"
123134
borderColor={borderColor}
124135
bg={wrapperBg}
@@ -183,4 +194,87 @@ export function OddsCard({
183194
)
184195
}
185196

197+
export function OverUnderOddsCard({
198+
homeTeam,
199+
awayTeam,
200+
marketLabel = "Total",
201+
line,
202+
over,
203+
under,
204+
onSelect,
205+
}: OverUnderOddsCardProps) {
206+
const wrapperBg = useColorModeValue("gray.50", "gray.800")
207+
const borderColor = useColorModeValue("gray.200", "gray.600")
208+
209+
return (
210+
<Box
211+
borderWidth="1px"
212+
borderRadius="2xl"
213+
borderColor={borderColor}
214+
bg={wrapperBg}
215+
px={10}
216+
py={50}
217+
w="full"
218+
maxW="5xl"
219+
>
220+
<Flex
221+
direction={{ base: "column", sm: "row" }}
222+
justify="space-between"
223+
align={{ base: "stretch", sm: "center" }}
224+
gap={6}
225+
>
226+
<Flex
227+
direction={{ base: "column", md: "row" }}
228+
align="center"
229+
justify="center"
230+
gap={4}
231+
minW={{ base: "full", md: "sm" }}
232+
>
233+
<Text
234+
fontSize="2xl"
235+
fontWeight="semibold"
236+
textAlign={{ base: "center", md: "right" }}
237+
lineHeight="short"
238+
>
239+
{homeTeam}
240+
</Text>
241+
<Box
242+
px={3}
243+
py={1}
244+
borderRadius="full"
245+
bg="teal.600"
246+
color="white"
247+
fontWeight="bold"
248+
fontSize="sm"
249+
>
250+
VS
251+
</Box>
252+
<Text
253+
fontSize="2xl"
254+
fontWeight="semibold"
255+
textAlign={{ base: "center", md: "left" }}
256+
lineHeight="short"
257+
>
258+
{awayTeam}
259+
</Text>
260+
</Flex>
261+
<Flex direction="column" align="center" justify="center" w="full" maxW="2xl" gap={4}>
262+
<Text fontSize="sm" fontWeight="medium" color="teal.600" textTransform="uppercase">
263+
{marketLabel}
264+
</Text>
265+
{line && (
266+
<Text fontSize="3xl" fontWeight="semibold" color="fg.default">
267+
{line}
268+
</Text>
269+
)}
270+
<Flex justify="space-evenly" align="center" gap={10} w="full">
271+
<MarketColumn title="OVER" market={over} onSelect={() => onSelect?.("over")} />
272+
<MarketColumn title="UNDER" market={under} onSelect={() => onSelect?.("under")} />
273+
</Flex>
274+
</Flex>
275+
</Flex>
276+
</Box>
277+
)
278+
}
279+
186280
export default OddsCard

frontend/src/routes/landing.tsx

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Box, Button, Container, Flex, Heading, Text } from "@chakra-ui/react"
22
import { Link as RouterLink, createFileRoute } from "@tanstack/react-router"
33

44
import { isLoggedIn } from "@/hooks/useAuth"
5-
import { OddsCard } from "@/components/Landing/OddsCard"
5+
import { OddsCard, OverUnderOddsCard } from "@/components/Landing/OddsCard"
66
import { ColorModeButton } from "@/components/ui/color-mode"
77
import useCustomToast from "@/hooks/useCustomToast"
88

@@ -41,6 +41,27 @@ function LandingPage() {
4141
},
4242
}
4343

44+
const totalsMarket = {
45+
homeTeam: "Real Betis",
46+
awayTeam: "Sevilla FC",
47+
marketLabel: "Total Goals",
48+
line: "2.5",
49+
over: {
50+
value: "-105",
51+
book: {
52+
name: "FanDuel",
53+
logoUrl: "https://dummyimage.com/64x18/eeeeee/333333&text=FanDuel",
54+
},
55+
},
56+
under: {
57+
value: "-110",
58+
book: {
59+
name: "DraftKings",
60+
logoUrl: "https://dummyimage.com/64x18/eeeeee/333333&text=DraftKings",
61+
},
62+
},
63+
}
64+
4465
return (
4566
<Container
4667
maxW="6xl"
@@ -114,6 +135,23 @@ function LandingPage() {
114135
}
115136
/>
116137
</Flex>
138+
139+
<Flex direction="column" gap={6}>
140+
<Heading as="h2" size="lg">
141+
Totals, made simple
142+
</Heading>
143+
<Text color="fg.muted">
144+
Surface edges on totals with streamlined over/under comparisons across your books.
145+
</Text>
146+
<OverUnderOddsCard
147+
{...totalsMarket}
148+
onSelect={(market) =>
149+
showSuccessToast(
150+
`Selected ${market.toUpperCase()} option on the featured totals market.`,
151+
)
152+
}
153+
/>
154+
</Flex>
117155
</Container>
118156
)
119157
}

0 commit comments

Comments
 (0)