Skip to content

Commit

Permalink
POOF
Browse files Browse the repository at this point in the history
  • Loading branch information
day-mon committed Aug 12, 2024
1 parent 3557d4d commit 1c1a709
Show file tree
Hide file tree
Showing 7 changed files with 391 additions and 89 deletions.
34 changes: 30 additions & 4 deletions ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "module",
"description": "Web UI for Accuribet",
"dependencies": {
"@kobalte/core": "^0.12.6",
"@kobalte/core": "^0.13.4",
"@solidjs/router": "^0.10.9",
"axios": "^1.6.8",
"class-variance-authority": "^0.7.0",
Expand Down
5 changes: 4 additions & 1 deletion ui/src/components/display-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ import { DialogModal } from "~/components/dialog-modal.tsx";

const logos = import.meta.glob("../assets/teams/*.svg", { eager: true });

const getLogo = (team: string) => {
export const getLogo = (team: string) => {
// if team is not all lower make it lower
if (team !== team.toLowerCase()) team = team.toLowerCase()

let strIndex = `../assets/teams/${team}.svg`;
// @ts-ignore
return logos[strIndex].default;
Expand Down
19 changes: 19 additions & 0 deletions ui/src/components/ui/label.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { Component, ComponentProps } from "solid-js"
import { splitProps } from "solid-js"

import { cn } from "~/lib/utils"

const Label: Component<ComponentProps<"label">> = (props) => {
const [local, others] = splitProps(props, ["class"])
return (
<label
class={cn(
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
local.class
)}
{...others}
/>
)
}

export { Label }
73 changes: 73 additions & 0 deletions ui/src/components/ui/radio-group.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import type { JSX, ValidComponent } from "solid-js"
import { splitProps } from "solid-js"

import type { PolymorphicProps } from "@kobalte/core/polymorphic"
import * as RadioGroupPrimitive from "@kobalte/core/radio-group"

import { cn } from "~/lib/utils"

type RadioGroupRootProps<T extends ValidComponent = "div"> =
RadioGroupPrimitive.RadioGroupRootProps<T> & { class?: string | undefined }

const RadioGroup = <T extends ValidComponent = "div">(
props: PolymorphicProps<T, RadioGroupRootProps<T>>
) => {
const [local, others] = splitProps(props as RadioGroupRootProps, ["class"])
return <RadioGroupPrimitive.Root class={cn("grid gap-2", local.class)} {...others} />
}

type RadioGroupItemProps<T extends ValidComponent = "div"> =
RadioGroupPrimitive.RadioGroupItemProps<T> & {
class?: string | undefined
children?: JSX.Element
}

const RadioGroupItem = <T extends ValidComponent = "div">(
props: PolymorphicProps<T, RadioGroupItemProps<T>>
) => {
const [local, others] = splitProps(props as RadioGroupItemProps, ["class", "children"])
return (
<RadioGroupPrimitive.Item class={cn("flex items-center space-x-2", local.class)} {...others}>
<RadioGroupPrimitive.ItemInput />
<RadioGroupPrimitive.ItemControl class="aspect-square size-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50">
<RadioGroupPrimitive.ItemIndicator class="flex h-full items-center justify-center ">
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="size-2.5 fill-current text-current"
>
<path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" />
</svg>
</RadioGroupPrimitive.ItemIndicator>
</RadioGroupPrimitive.ItemControl>
{local.children}
</RadioGroupPrimitive.Item>
)
}

type RadioGroupLabelProps<T extends ValidComponent = "label"> =
RadioGroupPrimitive.RadioGroupLabelProps<T> & {
class?: string | undefined
}

const RadioGroupItemLabel = <T extends ValidComponent = "label">(
props: PolymorphicProps<T, RadioGroupLabelProps<T>>
) => {
const [local, others] = splitProps(props as RadioGroupLabelProps, ["class"])
return (
<RadioGroupPrimitive.ItemLabel
class={cn(
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
local.class
)}
{...others}
/>
)
}

export { RadioGroup, RadioGroupItem, RadioGroupItemLabel }
72 changes: 72 additions & 0 deletions ui/src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@


export const TEAM_NAME_ABBRV_MAP: Record<string, string> = {
'Atlanta Hawks': 'ATL',
'Brooklyn Nets': 'BKN',
'Boston Celtics': 'BOS',
'Charlotte Hornets': 'CHA',
'Chicago Bulls': 'CHI',
'Cleveland Cavaliers': 'CLE',
'Dallas Mavericks': 'DAL',
'Denver Nuggets': 'DEN',
'Detroit Pistons': 'DET',
'Golden State Warriors': 'GSW',
'Houston Rockets': 'HOU',
'Indiana Pacers': 'IND',
'Los Angeles Clippers': 'LAC',
'Los Angeles Lakers': 'LAL',
'Memphis Grizzlies': 'MEM',
'Miami Heat': 'MIA',
'Milwaukee Bucks': 'MIL',
'Minnesota Timberwolves': 'MIN',
'New Orleans Pelicans': 'NOP',
'New York Knicks': 'NYK',
'Oklahoma City Thunder': 'OKC',
'Orlando Magic': 'ORL',
'Philadelphia 76ers': 'PHI',
'Phoenix Suns': 'PHX',
'Portland Trail Blazers': 'POR',
'Sacramento Kings': 'SAC',
'San Antonio Spurs': 'SAS',
'Toronto Raptors': 'TOR',
'Utah Jazz': 'UTA',
'Washington Wizards': 'WAS',
};
interface LocationData {
name: string;
city: string;
state: string;

}
export const LOCATION_DATA: Record<string, LocationData> = {
"ATL": {"name": "State Farm Arena", "city": "Atlanta", "state": "GA"},
"BOS": {"name": "TD Garden", "city": "Boston", "state": "MA"},
"BRK": {"name": "Barclays Center", "city": "Brooklyn", "state": "NY"},
"CHA": {"name": "Spectrum Center", "city": "Charlotte", "state": "NC"},
"CHI": {"name": "United Center", "city": "Chicago", "state": "IL"},
"CLE": {"name": "Rocket Mortgage FieldHouse", "city": "Cleveland", "state": "OH"},
"DAL": {"name": "American Airlines Center", "city": "Dallas", "state": "TX"},
"DEN": {"name": "Ball Arena", "city": "Denver", "state": "CO"},
"DET": {"name": "Little Caesars Arena", "city": "Detroit", "state": "MI"},
"GSW": {"name": "Chase Center", "city": "San Francisco", "state": "CA"},
"HOU": {"name": "Toyota Center", "city": "Houston", "state": "TX"},
"IND": {"name": "Gainbridge Fieldhouse", "city": "Indianapolis", "state": "IN"},
"LAC": {"name": "Crypto.com Arena", "city": "Los Angeles", "state": "CA"},
"LAL": {"name": "Crypto.com Arena", "city": "Los Angeles", "state": "CA"},
"MEM": {"name": "FedExForum", "city": "Memphis", "state": "TN"},
"MIA": {"name": "FTX Arena", "city": "Miami", "state": "FL"},
"MIL": {"name": "Fiserv Forum", "city": "Milwaukee", "state": "WI"},
"MIN": {"name": "Target Center", "city": "Minneapolis", "state": "MN"},
"NOP": {"name": "Smoothie King Center", "city": "New Orleans", "state": "LA"},
"NYK": {"name": "Madison Square Garden", "city": "New York", "state": "NY"},
"OKC": {"name": "Paycom Center", "city": "Oklahoma City", "state": "OK"},
"ORL": {"name": "Amway Center", "city": "Orlando", "state": "FL"},
"PHI": {"name": "Wells Fargo Center", "city": "Philadelphia", "state": "PA"},
"PHX": {"name": "Footprint Center", "city": "Phoenix", "state": "AZ"},
"POR": {"name": "Moda Center", "city": "Portland", "state": "OR"},
"SAC": {"name": "Golden 1 Center", "city": "Sacramento", "state": "CA"},
"SAS": {"name": "AT&T Center", "city": "San Antonio", "state": "TX"},
"TOR": {"name": "Scotiabank Arena", "city": "Toronto", "state": "ON"},
"UTA": {"name": "Vivint Arena", "city": "Salt Lake City", "state": "UT"},
"WAS": {"name": "Capital One Arena", "city": "Washington D.C.", "state": "DC"},
}
Loading

0 comments on commit 1c1a709

Please sign in to comment.