diff --git a/src/app/(pages)/player/[...slug]/page.tsx b/src/app/(pages)/player/[...slug]/page.tsx index 8837dbe..6cae418 100644 --- a/src/app/(pages)/player/[...slug]/page.tsx +++ b/src/app/(pages)/player/[...slug]/page.tsx @@ -1,7 +1,7 @@ -import { scoresaberLeaderboard } from "@/app/common/leaderboard/impl/scoresaber"; -import { ScoreSort } from "@/app/common/leaderboard/sort"; -import { formatNumberWithCommas } from "@/app/common/number-utils"; -import PlayerData from "@/app/components/player/player-data"; +import { scoresaberFetcher } from "@/common/data-fetcher/impl/scoresaber"; +import { ScoreSort } from "@/common/data-fetcher/sort"; +import { formatNumberWithCommas } from "@/common/number-utils"; +import PlayerData from "@/components/player/player-data"; import { format } from "@formkit/tempo"; import { Metadata } from "next"; import { redirect } from "next/navigation"; @@ -14,7 +14,7 @@ type Props = { export async function generateMetadata({ params: { slug } }: Props): Promise { const id = slug[0]; // The players id - const player = await scoresaberLeaderboard.lookupPlayer(id, false); + const player = await scoresaberFetcher.lookupPlayer(id, false); if (player === undefined) { return { title: `Unknown Player`, @@ -42,7 +42,7 @@ export default async function Search({ params: { slug } }: Props) { const id = slug[0]; // The players id const sort: ScoreSort = (slug[1] as ScoreSort) || "recent"; // The sorting method const page = parseInt(slug[2]) || 1; // The page number - const player = await scoresaberLeaderboard.lookupPlayer(id, false); + const player = await scoresaberFetcher.lookupPlayer(id, false); if (player == undefined) { // Invalid player id diff --git a/src/app/(pages)/search/page.tsx b/src/app/(pages)/search/page.tsx index 858ae71..8d3905e 100644 --- a/src/app/(pages)/search/page.tsx +++ b/src/app/(pages)/search/page.tsx @@ -1,4 +1,4 @@ -import SearchPlayer from "@/app/components/input/search-player"; +import SearchPlayer from "@/components/input/search-player"; import { Metadata } from "next"; export const metadata: Metadata = { diff --git a/src/app/components/player/score.tsx b/src/app/components/player/score.tsx deleted file mode 100644 index 97206b7..0000000 --- a/src/app/components/player/score.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import ScoreSaberPlayerScore from "@/app/common/leaderboard/types/scoresaber/scoresaber-player-score"; -import { timeAgo } from "@/app/common/time-utils"; -import { GlobeAmericasIcon } from "@heroicons/react/24/solid"; -import Image from "next/image"; - -type Props = { - /** - * The score to display. - */ - playerScore: ScoreSaberPlayerScore; -}; - -export default function Score({ playerScore }: Props) { - const { score, leaderboard } = playerScore; - - return ( -
-
-
- -

#{score.rank}

-
-

{timeAgo(new Date(score.timeSet))}

-
-
- Song Artwork -
-
-

{leaderboard.songName}

-

{leaderboard.songAuthorName}

-

{leaderboard.levelAuthorName}

-
-
-
-
stats stuff
-
- ); -} diff --git a/src/app/components/ui/card.tsx b/src/app/components/ui/card.tsx deleted file mode 100644 index 76cca06..0000000 --- a/src/app/components/ui/card.tsx +++ /dev/null @@ -1,76 +0,0 @@ -import * as React from "react" - -import { cn } from "@/app/common/utils" - -const Card = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -
-)) -Card.displayName = "Card" - -const CardHeader = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -
-)) -CardHeader.displayName = "CardHeader" - -const CardTitle = React.forwardRef< - HTMLParagraphElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -

-)) -CardTitle.displayName = "CardTitle" - -const CardDescription = React.forwardRef< - HTMLParagraphElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -

-)) -CardDescription.displayName = "CardDescription" - -const CardContent = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -

-)) -CardContent.displayName = "CardContent" - -const CardFooter = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -
-)) -CardFooter.displayName = "CardFooter" - -export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } diff --git a/src/app/components/ui/form.tsx b/src/app/components/ui/form.tsx deleted file mode 100644 index 496cc79..0000000 --- a/src/app/components/ui/form.tsx +++ /dev/null @@ -1,178 +0,0 @@ -"use client" - -import * as React from "react" -import * as LabelPrimitive from "@radix-ui/react-label" -import { Slot } from "@radix-ui/react-slot" -import { - Controller, - ControllerProps, - FieldPath, - FieldValues, - FormProvider, - useFormContext, -} from "react-hook-form" - -import { cn } from "@/app/common/utils" -import { Label } from "@/app/components/ui/label" - -const Form = FormProvider - -type FormFieldContextValue< - TFieldValues extends FieldValues = FieldValues, - TName extends FieldPath = FieldPath -> = { - name: TName -} - -const FormFieldContext = React.createContext( - {} as FormFieldContextValue -) - -const FormField = < - TFieldValues extends FieldValues = FieldValues, - TName extends FieldPath = FieldPath ->({ - ...props -}: ControllerProps) => { - return ( - - - - ) -} - -const useFormField = () => { - const fieldContext = React.useContext(FormFieldContext) - const itemContext = React.useContext(FormItemContext) - const { getFieldState, formState } = useFormContext() - - const fieldState = getFieldState(fieldContext.name, formState) - - if (!fieldContext) { - throw new Error("useFormField should be used within ") - } - - const { id } = itemContext - - return { - id, - name: fieldContext.name, - formItemId: `${id}-form-item`, - formDescriptionId: `${id}-form-item-description`, - formMessageId: `${id}-form-item-message`, - ...fieldState, - } -} - -type FormItemContextValue = { - id: string -} - -const FormItemContext = React.createContext( - {} as FormItemContextValue -) - -const FormItem = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => { - const id = React.useId() - - return ( - -
- - ) -}) -FormItem.displayName = "FormItem" - -const FormLabel = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => { - const { error, formItemId } = useFormField() - - return ( -