Skip to content

Commit

Permalink
Game details on home view is broken + filter navigation
Browse files Browse the repository at this point in the history
Fixes #293
Fixes #294
  • Loading branch information
andrew-codes committed May 9, 2024
1 parent 4f28521 commit 6d63905
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
9 changes: 4 additions & 5 deletions apps/playnite-web/src/components/GameFigure.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Box, Stack, styled } from '@mui/material'
import { Link } from '@remix-run/react'
import { Box, Button, Stack, styled } from '@mui/material'
import { FC, PropsWithChildren, useCallback, useState } from 'react'
import { useInView } from 'react-intersection-observer'
import type { IGame } from '../domain/types'
Expand Down Expand Up @@ -30,7 +29,7 @@ const GameFigure: FC<
width: string
height: string
noDefer: boolean
onSelect?: (evt) => void
onSelect?: (evt, game: IGame) => void
}>
> = ({ children, game, style, noDefer, onSelect, width, height }) => {
const [hasBeenInViewBefore, setHasBeenInViewBefore] = useState(false)
Expand All @@ -49,7 +48,7 @@ const GameFigure: FC<
{hasBeenInViewBefore || noDefer
? [
<Box sx={{ position: 'relative' }} key={`${game.id}-image`}>
<Link to={`/browse/${game.id}`} onClick={onSelect}>
<Button onClick={(evt) => onSelect?.(evt, game)}>
{!imageHasError ? (
<Image
src={game.cover}
Expand All @@ -68,7 +67,7 @@ const GameFigure: FC<
}}
/>
)}
</Link>
</Button>
<Box
sx={(theme) => ({
position: 'absolute',
Expand Down
2 changes: 1 addition & 1 deletion apps/playnite-web/src/components/HorizontalGameList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const ImageListWithoutOverflow = styled(ImageList)`
const HorizontalGameList: FC<{
games: IList<Match<IGame>>
noDeferCount: number
onSelect?: (game: IGame) => void
onSelect?: (evt, game: IGame) => void
}> = ({ games, noDeferCount, onSelect }) => {
const theme = useTheme()
const isXl = useMediaQuery(theme.breakpoints.up('xl'))
Expand Down
7 changes: 4 additions & 3 deletions apps/playnite-web/src/routes/_index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ import NoFilter from '../domain/filters/NoFilter'
import { IGame, Playlist } from '../domain/types'

async function loader({ request }: LoaderFunctionArgs) {
const api = getGameApi()
try {
const api = getGameApi()
const games = await api.getGames()

return json({
lists: [
{
name: 'Playing',
games: games
.filter((game) => game.completionStatus?.name === 'Playing')
.filter((game) => game.completionStatus?.name === 'Played')
.map((game) => game.gamePlatforms),
},
{
Expand Down Expand Up @@ -69,7 +70,7 @@ function Index() {
const handleClose = useCallback(() => {
setRightDrawerOpen(false)
}, [])
const handleGameSelect = useCallback((game: IGame) => {
const handleGameSelect = useCallback((evt, game: IGame) => {
setGame(game)
setRightDrawerOpen(true)
}, [])
Expand Down
2 changes: 1 addition & 1 deletion apps/playnite-web/src/routes/browse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ function Browse() {
setFiltersInDrawer(false)
navigate(-1)
}, [])

const handleSelection = useCallback((evt, game) => {
setRightDrawerOpen(true)
navigate(`/browse/${game.id}`)
}, [])

const games = useMemo(
Expand Down

0 comments on commit 6d63905

Please sign in to comment.