From f63a2f63832e6b05808026b618e3b625cfa78e06 Mon Sep 17 00:00:00 2001 From: "Damon L. Montague Jr." Date: Sat, 27 Apr 2024 23:00:57 -0400 Subject: [PATCH] update ui a little bit --- ui/src/client/api.ts | 15 ++++++++++++ ui/src/components/display-card.tsx | 6 ++++- ui/src/pages/History.tsx | 38 ++++++++++++++++++++++++++---- ui/src/pages/Home.tsx | 13 +++++----- 4 files changed, 60 insertions(+), 12 deletions(-) diff --git a/ui/src/client/api.ts b/ui/src/client/api.ts index c68f676..e3426fd 100644 --- a/ui/src/client/api.ts +++ b/ui/src/client/api.ts @@ -30,6 +30,21 @@ export class AccuribetAPI { } + async getPredictedGames( + date: string, + model: string + ) { + const res = await this.client.get('/model/history', { + params: { + date, + model + } + }) + return res.data; + + } + + async predict( model: string ) { diff --git a/ui/src/components/display-card.tsx b/ui/src/components/display-card.tsx index 30d1a27..73e5592 100644 --- a/ui/src/components/display-card.tsx +++ b/ui/src/components/display-card.tsx @@ -32,6 +32,7 @@ import { } from "~/components/ui/table"; import { isLive, timeUntilGame } from "~/lib/utils.ts"; import { Prediction } from "~/model/prediction.ts"; +import { AnimationDiv } from '~/components/animated-div.tsx'; const logos = import.meta.glob("../assets/teams/*.svg", { eager: true }); @@ -167,6 +168,7 @@ export const TeamInfo: Component = (props: ITeamInfoProps) => { props.prediction.prediction === `${props.team.city} ${props.team.name}` } > + = (props: ITeamInfoProps) => { > Projected Winner + @@ -316,6 +319,7 @@ export const DemoCard: Component = (props: IDisplayCard) => { {props.game.home_team.name} {props.game.home_team.score.points} + - @@ -370,7 +374,7 @@ export const DemoCard: Component = (props: IDisplayCard) => { onOpenChange={setInjuryReportOpen} preventScroll={true} > - + Injury Report diff --git a/ui/src/pages/History.tsx b/ui/src/pages/History.tsx index e6b96b3..f38e28b 100644 --- a/ui/src/pages/History.tsx +++ b/ui/src/pages/History.tsx @@ -1,5 +1,5 @@ import { AccuribetAPI } from '~/client/api.ts'; -import { createResource, Match, Switch } from 'solid-js'; +import { createResource, createSignal, For, Match, Show, Switch } from 'solid-js'; import { AnimationDiv } from '~/components/animated-div.tsx'; import { Loading } from '~/components/loading.tsx'; @@ -8,11 +8,20 @@ async function fetchHistory() { return await instance.getDates(); } +async function fetchHistoryForModelOnDate(model: string, date: string) { + const instance = AccuribetAPI.getInstance(); + return await instance.getPredictedGames(date, model); + +} export function History() { const [dates] = createResource(fetchHistory); + const [selectedModel, setSelectedModel] = createSignal('') + const [selectedDate, setSelectedDate] = createSignal('') + + return ( @@ -24,9 +33,30 @@ export function History() {

Error fetching dates

-
-

History

-
+ + + I would like to see the history of the + + model + + + + + +
diff --git a/ui/src/pages/Home.tsx b/ui/src/pages/Home.tsx index a4d0d66..0dbf56e 100644 --- a/ui/src/pages/Home.tsx +++ b/ui/src/pages/Home.tsx @@ -1,6 +1,7 @@ import { Link } from "~/components/link.tsx"; import { Motion } from "solid-motionone"; import { Button } from "~/components/ui/button.tsx"; +import { AiFillGithub } from 'solid-icons/ai'; export const Home = () => { return ( @@ -70,10 +71,10 @@ export const Home = () => {
  • - 80%+ Accuracy + 60%+ Accuracy

    - Our machine learning models have an average accuracy of over 80% on NBA + Our machine learning models have an average accuracy of over 60% on NBA game predictions.

    @@ -126,11 +127,9 @@ export const Home = () => { © {new Date().getFullYear()} Accuribet. All rights reserved.