mirror of
https://github.com/ershisan99/www.git
synced 2026-01-30 05:12:10 +00:00
filter user games by season in stream card component
This commit is contained in:
@@ -4,6 +4,7 @@ import { cn } from '@/lib/utils'
|
|||||||
import type { SelectGames } from '@/server/db/types'
|
import type { SelectGames } from '@/server/db/types'
|
||||||
import type { LeaderboardEntry } from '@/server/services/neatqueue.service'
|
import type { LeaderboardEntry } from '@/server/services/neatqueue.service'
|
||||||
import { RANKED_CHANNEL } from '@/shared/constants'
|
import { RANKED_CHANNEL } from '@/shared/constants'
|
||||||
|
import { filterGamesBySeason } from '@/shared/seasons'
|
||||||
import { api } from '@/trpc/react'
|
import { api } from '@/trpc/react'
|
||||||
import { Swords } from 'lucide-react'
|
import { Swords } from 'lucide-react'
|
||||||
import { useParams } from 'next/navigation'
|
import { useParams } from 'next/navigation'
|
||||||
@@ -66,7 +67,8 @@ export function StreamCardClient() {
|
|||||||
|
|
||||||
const [gamesQueryResult, gamesQuery] =
|
const [gamesQueryResult, gamesQuery] =
|
||||||
api.history.user_games.useSuspenseQuery({ user_id: id })
|
api.history.user_games.useSuspenseQuery({ user_id: id })
|
||||||
const games = gamesQueryResult || []
|
const allGames = gamesQueryResult || []
|
||||||
|
const games = filterGamesBySeason(allGames, 'season3')
|
||||||
|
|
||||||
const [rankedUserRank, rankedUserQuery] =
|
const [rankedUserRank, rankedUserQuery] =
|
||||||
api.leaderboard.get_user_rank.useSuspenseQuery({
|
api.leaderboard.get_user_rank.useSuspenseQuery({
|
||||||
@@ -172,7 +174,8 @@ function Opponent({ id, wins }: { id: string; wins?: number }) {
|
|||||||
const { data: gamesQueryResult } = api.history.user_games.useQuery({
|
const { data: gamesQueryResult } = api.history.user_games.useQuery({
|
||||||
user_id: id,
|
user_id: id,
|
||||||
})
|
})
|
||||||
const games = gamesQueryResult || []
|
const allGames = gamesQueryResult || []
|
||||||
|
const games = filterGamesBySeason(allGames, 'season3')
|
||||||
|
|
||||||
const { data: rankedUserRank } = api.leaderboard.get_user_rank.useQuery({
|
const { data: rankedUserRank } = api.leaderboard.get_user_rank.useQuery({
|
||||||
channel_id: RANKED_CHANNEL,
|
channel_id: RANKED_CHANNEL,
|
||||||
|
|||||||
Reference in New Issue
Block a user