"use client"; import { BestFriendsHomeSect, FriendsHomeSect } from "@/components/roblox/FriendsOnline"; import { GameCard } from "@/components/roblox/GameCard"; import { HomeLoggedInHeader } from "@/components/site/HomeUserHeader"; import { Card, CardContent } from "@/components/ui/card"; import { getOmniRecommendationsHome } from "@/lib/omniRecommendation"; import { getThumbnails, ThumbnailRequest } from "@/lib/thumbnailLoader"; import { useQuery, useQueryClient } from "@tanstack/react-query"; export default function Home() { const SORTS_ALLOWED_IDS = [100000003, 100000001]; const queryClient = useQueryClient(); const { data: rec, isLoading } = useQuery({ queryKey: ["omni-recommendations"], queryFn: async () => { const r = await getOmniRecommendationsHome(); if (r) { // Prefetch game thumbnails into React Query cache const gameRequests: ThumbnailRequest[] = Object.entries( r.contentMetadata.Game ).map(([_, g]) => ({ type: "GameThumbnail" as const, targetId: Number(g.rootPlaceId), format: "webp", size: "384x216" })); await queryClient.prefetchQuery({ queryKey: [ "thumbnails", gameRequests.map((r) => r.targetId) ], queryFn: () => getThumbnails(gameRequests) }); } return r; }, staleTime: 1000 * 60 * 5, // 5 minutes refetchOnWindowFocus: false }); return ( <>
{/*
Warning This is work in progress, you can follow the development process on GitHub.
*/}
{isLoading ? (
{Array.from({ length: 4 }).map((_, index) => (
))}
) : !rec ? ( We could not load recommendations right now. Try again in a moment. ) : ( rec.sorts .filter((a) => SORTS_ALLOWED_IDS.includes(a.topicId)) .map((sort, idx) => (

{sort.topic}

{(sort.recommendationList || []).map( (recommendation, idxb) => { const game = rec.contentMetadata.Game[ recommendation.contentId.toString() ]; return ( ); } )}
)) )}
); }