diff --git a/frontend/src/components/ui/alert.tsx b/frontend/src/components/ui/alert.tsx new file mode 100644 index 0000000..5afd41d --- /dev/null +++ b/frontend/src/components/ui/alert.tsx @@ -0,0 +1,59 @@ +import * as React from "react" +import { cva, type VariantProps } from "class-variance-authority" + +import { cn } from "@/lib/utils" + +const alertVariants = cva( + "relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7", + { + variants: { + variant: { + default: "bg-background text-foreground", + destructive: + "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive", + }, + }, + defaultVariants: { + variant: "default", + }, + } +) + +const Alert = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes & VariantProps +>(({ className, variant, ...props }, ref) => ( +
+)) +Alert.displayName = "Alert" + +const AlertTitle = React.forwardRef< + HTMLParagraphElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)) +AlertTitle.displayName = "AlertTitle" + +const AlertDescription = React.forwardRef< + HTMLParagraphElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)) +AlertDescription.displayName = "AlertDescription" + +export { Alert, AlertTitle, AlertDescription } diff --git a/frontend/src/pages/Games/GamesPage.tsx b/frontend/src/pages/Games/GamesPage.tsx index 60882c5..5127252 100644 --- a/frontend/src/pages/Games/GamesPage.tsx +++ b/frontend/src/pages/Games/GamesPage.tsx @@ -1,8 +1,11 @@ import { GetGames } from '$app' import { useApi } from '@/common/api' -import { useAppContext } from '@/common/app_context' -import { cn } from '@/common/utils' import { LoadingContainer } from '@/components/Loader/LoadingContainer' +import { FaFileCircleExclamation } from 'react-icons/fa6' +import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert' +import { HtmlProps } from '@/common/types' +import { Link } from 'react-router-dom' +import { FaGamepad } from 'react-icons/fa6' function useGames() { return useApi(GetGames, ['games'], { @@ -12,29 +15,54 @@ function useGames() { } export function GamesPage() { - const { meta } = useAppContext() const { data, isFetching } = useGames() - console.debug('GamesPage', meta) return ( -
-

Games

- -
- - {data.games?.map((dir) => ( -
-

{dir.name}

-
- ))} -
+
+
+

Games

-
- Meta - -
{JSON.stringify(meta, null, 2)}
-
-
+
+ + + Only Showing Some Games + + This list only shows games that have been downloaded on this machine before, and not all + of them might contain data. + + + +
+ + {data.games?.map((dir) => ( + + ))} + +
+
) } + +function ListItem({ + children, + label, + to, + ...rest +}: HtmlProps<'div'> & { + label: React.ReactNode + to: string +}) { + return ( + +
+ + {label} +
+ {children ?
    {children}
: null} + + ) +} diff --git a/frontend/src/pages/Screenshots/ScreenshotsGamePage.tsx b/frontend/src/pages/Screenshots/ScreenshotsGamePage.tsx index 4777b1c..2edfbd2 100644 --- a/frontend/src/pages/Screenshots/ScreenshotsGamePage.tsx +++ b/frontend/src/pages/Screenshots/ScreenshotsGamePage.tsx @@ -7,7 +7,6 @@ import { FaAngleLeft } from 'react-icons/fa6' import { ScreenshotImg } from '@/components/ScreenshotImg/ScreenshotImg' import { useCallback, useMemo, useState } from 'react' import { ScreenshotsCarouselModal } from '@/components/ScreenshotsCarouselModal/ScreenshotsCarouselModal' -import { screenshots } from '$models' import { Dialog } from '@/components/ui/dialog' function useScreenshotsDir(gameId: string) { @@ -40,6 +39,7 @@ function ScreenshotsGamePage() { const closeScreenshotsModal = useCallback(() => { setModalIndex(null) }, []) + return (
@@ -52,7 +52,7 @@ function ScreenshotsGamePage() {
-

+

Screenshots for {dir.gameName}

diff --git a/frontend/src/pages/Screenshots/ScreenshotsHomePage.tsx b/frontend/src/pages/Screenshots/ScreenshotsHomePage.tsx index fc90d83..33349fe 100644 --- a/frontend/src/pages/Screenshots/ScreenshotsHomePage.tsx +++ b/frontend/src/pages/Screenshots/ScreenshotsHomePage.tsx @@ -45,6 +45,7 @@ function ScreenshotsHome() { setModalIndex(null) setModalScreenshots([]) }, []) + return (

Screenshots