1+ import { GamevaultGame } from "@/api/models/GamevaultGame" ;
12import { Media } from "@/components/Media" ;
23import { useAuth } from "@/context/AuthContext" ;
34import { useDownloads } from "@/context/DownloadContext" ;
4- import { Game , getGameCoverMediaId } from "@/hooks/useGames" ;
5+ import { getGameCoverMediaId } from "@/hooks/useGames" ;
56import { CloudArrowDownIcon } from "@heroicons/react/16/solid" ;
67import { Button } from "@tw/button" ;
78import {
@@ -13,23 +14,15 @@ import {
1314} from "@tw/dropdown" ;
1415import clsx from "clsx" ;
1516import { useCallback } from "react" ;
17+ import { useNavigate } from "react-router" ;
1618
17- export function GameCard ( { game } : { game : Game } ) {
19+ export function GameCard ( { game } : { game : GamevaultGame } ) {
1820 const coverId = getGameCoverMediaId ( game ) ;
1921 const { serverUrl } = useAuth ( ) ;
2022 const { startDownload } = useDownloads ( ) as any ;
2123
22- const filename = ( ( ) => {
23- const p = game . path || ( game as any ) . Path ;
24- if ( ! p ) return `${ game . title } .zip` ;
25- // Derive filename similar to Path.GetFileName
26- try {
27- const parts = p . split ( / \\ | \/ / ) ;
28- const last = parts [ parts . length - 1 ] ;
29- return last || `${ game . title } .zip` ;
30- } catch {
31- return `${ game . title } .zip` ;
32- }
24+ const filename = ( ( ) => {
25+ return `${ game . title } .zip` ;
3326 } ) ( ) ;
3427
3528 const rawSize = ( game as any ) . size ;
@@ -71,14 +64,15 @@ export function GameCard({ game }: { game: Game }) {
7164 [ game . id ] ,
7265 ) ;
7366
74- const handleClientOpen = useCallback (
67+ const navigate = useNavigate ( ) ;
68+
69+ const handleOpenGameView = useCallback (
7570 ( e : React . MouseEvent ) => {
7671 e . preventDefault ( ) ;
7772 e . stopPropagation ( ) ;
78- const url = `gamevault://show?gameid=${ game . id } ` ;
79- window . location . href = url ;
73+ navigate ( `/library/${ game . id } ` ) ;
8074 } ,
81- [ game . id ] ,
75+ [ navigate , game . id ] ,
8276 ) ;
8377
8478 return (
@@ -97,10 +91,10 @@ export function GameCard({ game }: { game: Game }) {
9791 className = "h-full w-full object-contain rounded-none"
9892 square
9993 alt = { game . title }
100- onClick = { handleClientOpen }
94+ onClick = { handleOpenGameView }
10195 />
10296 ) : (
103- < div onClick = { handleClientOpen } className = "text-xs text-fg-muted" >
97+ < div onClick = { handleOpenGameView } className = "text-xs text-fg-muted" >
10498 No Cover
10599 </ div >
106100 ) }
@@ -130,7 +124,7 @@ export function GameCard({ game }: { game: Game }) {
130124 < h3 className = "text-sm font-medium truncate" title = { game . title } >
131125 { game . metadata ?. title || game . title }
132126 </ h3 >
133- { game . sort_title && game . sort_title !== game . title && (
127+ { game . sortTitle && game . sortTitle !== game . title && (
134128 < p
135129 className = "mt-0.5 text-xs text-fg-muted truncate"
136130 title = { game . title }
0 commit comments