diff --git a/app/components/ui/avatar.tsx b/app/components/ui/avatar.tsx new file mode 100644 index 0000000..4c31e38 --- /dev/null +++ b/app/components/ui/avatar.tsx @@ -0,0 +1,48 @@ +import * as React from "react" +import * as AvatarPrimitive from "@radix-ui/react-avatar" + +import { cn } from "#app/utils/misc.tsx" + +const Avatar = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +Avatar.displayName = AvatarPrimitive.Root.displayName + +const AvatarImage = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AvatarImage.displayName = AvatarPrimitive.Image.displayName + +const AvatarFallback = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName + +export { Avatar, AvatarImage, AvatarFallback } diff --git a/app/routes/bucnation.tsx b/app/routes/bucnation.tsx new file mode 100644 index 0000000..115f4d6 --- /dev/null +++ b/app/routes/bucnation.tsx @@ -0,0 +1,154 @@ +import type { HeadersFunction, LoaderFunctionArgs, ActionFunctionArgs } from "@remix-run/node"; +import { json } from '@remix-run/node'; +import { MetaFunction, useLoaderData, isRouteErrorResponse, useRouteError } from "@remix-run/react"; +import type { ShouldRevalidateFunction } from "@remix-run/react"; +import { Button } from "#app/components/ui/button"; +import { Card } from "#app/components/ui/card"; +import { Avatar, AvatarFallback, AvatarImage } from "#app/components/ui/avatar" + + +interface VCActivityType { + id: number + activeFlag: string + status: string + playerFirstName: string + playerLastName: string + playerPosition: string + playerWeightLbs: number + playerHeightInches: number + playerEligibilityYear: string +} + +export const meta: MetaFunction = ({ data }) => [ + + { title: data ? 'lucasb.dev | BucNation' : 'Error | lucasb.dev' }, + { + name: 'description', + content: `A page dedicated to East Tennessee State Basketball`, + }, + +]; + +export const headers: HeadersFunction = () => ( + { + // your headers here + } +); + +export const loader = async ({ request }: LoaderFunctionArgs) => { + const reqHeaders = { + Pb: "MV7mOE51zp9clOm7", + "User-Agent": + "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36", + }; + + const response = await fetch("https://api.verbalcommits.com/vc/schools/chart/etsu", { + headers: reqHeaders, + }); + const data = await response.json() as VCActivityType[]; + const filteredResults = data.filter((d) => d.status === 'ENROLLMENT'); + + return json({ roster: filteredResults }); +}; + +export const action = async ({ request }: ActionFunctionArgs) => { + return null; +}; + +const heightFromInches = (total: number) => { + const feet = Math.floor(total / 12); + const inches = total % 12; + return `${feet}'${inches}"`; +} + +export default function BucNation(){ + const data = useLoaderData(); + + /* const games = [ + { + opponent: "Los Angeles Lakers", + date: "October 18, 2023", + score: { + home: 112, + away: 104, + }, + image: "/opponent1.jpg", + }]; */ + + return ( +
+
+
+ ETSU Team Logo +

East Tennessee State Buccaneers Basketball

+
+
+ + +
+
+
+ {data.roster.map((r) => { + return ( + +
+ + + {r.playerFirstName[0].toUpperCase()}{r.playerLastName[0].toUpperCase()} + +
+

{r.playerFirstName} {r.playerLastName}

+

{r.playerPosition} | {heightFromInches(r.playerHeightInches)} | {r.playerWeightLbs} Lbs

+
+
+
+ ) + })} +
+ {/*

Schedule

+
+ {games.map((game, index) => ( + +
+
+
+ {`Opponent +
+

{game.opponent}

+

{game.date}

+
+
+
+
{game.score.home}
+
{game.score.away}
+
+
+
+
+ ))} +
*/} +
+ ); +} + +export function ErrorBoundary(){ + const error = useRouteError(); + if (isRouteErrorResponse(error)) { + return
+ } + return
+} + +export const shouldRevalidate: ShouldRevalidateFunction = () => { + return true; +}; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index b6bbfd1..37e7b2b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "@nasa-gcn/remix-seo": "2.0.0", "@paralleldrive/cuid2": "2.2.2", "@prisma/client": "5.13.0", + "@radix-ui/react-avatar": "1.0.4", "@radix-ui/react-checkbox": "1.0.4", "@radix-ui/react-dialog": "1.0.5", "@radix-ui/react-dropdown-menu": "2.0.6", @@ -2219,6 +2220,32 @@ } } }, + "node_modules/@radix-ui/react-avatar": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@radix-ui/react-avatar/-/react-avatar-1.0.4.tgz", + "integrity": "sha512-kVK2K7ZD3wwj3qhle0ElXhOjbezIgyl2hVvgwfIdexL3rN6zJmy5AqqIf+D31lxVppdzV8CjAfZ6PklkmInZLw==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/react-context": "1.0.1", + "@radix-ui/react-primitive": "1.0.3", + "@radix-ui/react-use-callback-ref": "1.0.1", + "@radix-ui/react-use-layout-effect": "1.0.1" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-checkbox": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@radix-ui/react-checkbox/-/react-checkbox-1.0.4.tgz", diff --git a/package.json b/package.json index e39f82f..404b4e3 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "@nasa-gcn/remix-seo": "2.0.0", "@paralleldrive/cuid2": "2.2.2", "@prisma/client": "5.13.0", + "@radix-ui/react-avatar": "1.0.4", "@radix-ui/react-checkbox": "1.0.4", "@radix-ui/react-dialog": "1.0.5", "@radix-ui/react-dropdown-menu": "2.0.6",