Skip to content

Commit

Permalink
chore: update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
AbePlays committed Aug 15, 2024
1 parent 44d49b7 commit ba716b4
Show file tree
Hide file tree
Showing 3 changed files with 717 additions and 346 deletions.
18 changes: 13 additions & 5 deletions app/game/[slug]/favorite.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use client'

import { BookmarkFilledIcon, BookmarkIcon } from '@radix-ui/react-icons'
import { IconButton } from '@radix-ui/themes'
import { useFormState } from 'react-dom'
import { IconButton, Spinner } from '@radix-ui/themes'
import { useEffect } from 'react'
import { useFormState, useFormStatus } from 'react-dom'
import { toast } from 'react-hot-toast'

import { GameDetail } from '@schemas/game'
Expand All @@ -15,6 +15,16 @@ export type FavoriteProps = {
userId: string
}

function Submit({ isFavorite }: { isFavorite: boolean }) {
const { pending } = useFormStatus()

return (
<IconButton aria-label="Favorite" title="Favorite" type="submit" variant="surface">
{pending ? <Spinner /> : isFavorite ? <BookmarkFilledIcon /> : <BookmarkIcon />}
</IconButton>
)
}

export default function Favorite(props: FavoriteProps) {
const { isFavorite, gameDetails, userId } = props
const [state, formAction] = useFormState(toggleFavorite, { message: '', ok: true })
Expand All @@ -34,9 +44,7 @@ export default function Favorite(props: FavoriteProps) {
<input type="hidden" name="userId" value={userId} readOnly={true} />
<input type="hidden" name="gameId" value={gameDetails.id} readOnly={true} />
<input type="hidden" name="slug" value={gameDetails.slug} readOnly={true} />
<IconButton aria-label="Favorite" title="Favorite" type="submit" variant="surface">
{isFavorite ? <BookmarkFilledIcon /> : <BookmarkIcon />}
</IconButton>
<Submit isFavorite={isFavorite} />
</form>
)
}
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,28 @@
},
"dependencies": {
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/themes": "^3.1.1",
"@radix-ui/themes": "^3.1.3",
"@supabase/ssr": "^0.4.0",
"@supabase/supabase-js": "^2.44.4",
"@supabase/supabase-js": "^2.45.1",
"next": "^14.2.5",
"next-themes": "^0.3.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-hot-toast": "^2.4.1",
"react-photo-view": "^1.2.6",
"valibot": "^0.36.0"
"valibot": "^0.37.0"
},
"devDependencies": {
"@next/bundle-analyzer": "^14.2.5",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@unocss/postcss": "^0.61.5",
"@unocss/postcss": "^0.62.1",
"eslint": "^8.57.0",
"eslint-config-next": "^14.2.5",
"eslint-config-prettier": "^9.1.0",
"postcss": "^8.4.39",
"postcss": "^8.4.41",
"prettier": "^3.3.3",
"typescript": "^5.5.3",
"unocss": "^0.61.5"
"typescript": "^5.5.4",
"unocss": "^0.62.1"
}
}
Loading

0 comments on commit ba716b4

Please sign in to comment.