diff --git a/app/games/[id]/content.tsx b/app/games/[id]/content.tsx index 9a8cc62..ebf8fce 100644 --- a/app/games/[id]/content.tsx +++ b/app/games/[id]/content.tsx @@ -1,55 +1,183 @@ "use client"; -import { useEffect } from "react"; +import { useEffect, useState } from "react"; import Link from "next/link"; import { usePlaceDetails } from "@/hooks/roblox/usePlaceDetails"; import { RobloxVerifiedSmall } from "@/components/roblox/RobloxTooltips"; -import { Button } from "@/components/ui/button"; import { useGameLaunch } from "@/components/providers/GameLaunchProvider"; +import LazyLoadedImage from "@/components/util/LazyLoadedImage"; +import { Badge } from "@/components/ui/badge"; +import { PlayGameButton } from "@/components/roblox/PlayGameButton"; interface GamePageContentProps { placeId: string; + shouldSetDocumentTitle?: boolean; } -export default function GamePageContent({ placeId }: GamePageContentProps) { +export default function GamePageContent({ + placeId, + shouldSetDocumentTitle = true +}: GamePageContentProps) { const game = usePlaceDetails(placeId); - const { launchGame } = useGameLaunch(); + const [hasHydrated, setHasHydrated] = useState(false); // Set dynamic document title useEffect(() => { + if (!shouldSetDocumentTitle) return; if (!!game) { document.title = `${game.name} | Roblox`; } - }, [game]); + }, [game, shouldSetDocumentTitle]); - if (!game) return
Loading game...
; + useEffect(() => { + setHasHydrated(true); + }, []); + + if (!hasHydrated || !game) { + return ( +
+
+
+
+
+
+
+
+
+
+
+ {Array.from({ length: 4 }).map((_, index) => ( +
+ ))} +
+
+
+
+
+
+
+
+
+ ); + } + + const avatarTypeLabel = + game.universeAvatarType === "MorphToR15" + ? "R15 Only" + : game.universeAvatarType === "MorphToR6" + ? "R6 Only" + : null; return ( -
- -
- {game.name} -
-
- - - {game.creator.name} - - {game.creator.hasVerifiedBadge && ( - - )} - +
+
+
+ +
+
+
+

+ {game.name} +

+
+ {!game.isAllGenre && ( + <> + {game.genre && game.genre !== "All" ? ( + + {game.genre} + + ) : null} + {game.genre_l1 && + game.genre_l1 !== "All" ? ( + + {game.genre_l1} + + ) : null} + {game.genre_l2 && + game.genre_l2 !== "All" ? ( + + {game.genre_l2} + + ) : null} + + )} + {game.maxPlayers === 1 ? ( + Singleplayer + ) : null} + {game.copyingAllowed ? ( + Uncopylocked + ) : null} + {avatarTypeLabel ? ( + + {avatarTypeLabel} + + ) : null} +
+
+ +
+ +
+ +
+
+

Playing now

+

+ {game.playing.toLocaleString()} +

+
+
+

Total visits

+

+ {game.visits.toLocaleString()} +

+
+
+

Favorites

+

+ {game.favoritedCount.toLocaleString()} +

+
+
+

Max players

+

+ {game.maxPlayers} +

+
+
+ +
+ + {game.creator.name} + {game.creator.hasVerifiedBadge ? ( + + ) : null} + +
+
-
- {game.description} +
+

About

+

+ {game.description || "No description provided yet."} +

); diff --git a/app/games/[id]/page.tsx b/app/games/[id]/page.tsx index dab76c8..5872afa 100644 --- a/app/games/[id]/page.tsx +++ b/app/games/[id]/page.tsx @@ -1,11 +1,89 @@ import { Suspense } from "react"; +import type { Metadata } from "next"; import GamePageContentF from "./content"; // page.tsx (Server Component) -export default async function GamePageContent({ params }: { params: { id: string } }) { +export default async function GamePageContent({ + params +}: { + params: { id: string }; +}) { return ( Loading profile…
}> ); } + +export async function generateMetadata({ + params +}: { + params: { id: string }; +}): Promise { + const placeId = params.id; + + try { + const universeRes = await fetch( + `https://apis.roblox.com/universes/v1/places/${placeId}/universe`, + { next: { revalidate: 300 } } + ); + if (!universeRes.ok) { + return { title: "Game | Roblox" }; + } + + const { universeId } = await universeRes.json(); + if (!universeId) { + return { title: "Game | Roblox" }; + } + + const gameRes = await fetch( + `https://games.roblox.com/v1/games?universeIds=${universeId}`, + { next: { revalidate: 300 } } + ); + if (!gameRes.ok) { + return { title: "Game | Roblox" }; + } + + const data = await gameRes.json(); + const game = data?.data?.[0]; + if (!game) { + return { title: "Game | Roblox" }; + } + + const title = `${game.name} | Roblox`; + const description = + game.description || + "Roblox is a global platform that brings people together through play."; + let imageUrl: string | undefined; + + try { + const thumbRes = await fetch( + `https://thumbnails.roblox.com/v1/games/multiget?universeIds=${universeId}&size=768x432&format=png&isCircular=false`, + { next: { revalidate: 300 } } + ); + if (thumbRes.ok) { + const thumbs = await thumbRes.json(); + imageUrl = thumbs?.data?.[0]?.imageUrl; + } + } catch { + imageUrl = undefined; + } + + return { + title, + description, + openGraph: { + title, + description, + images: imageUrl ? [imageUrl] : undefined + }, + twitter: { + title, + description, + images: imageUrl ? [imageUrl] : undefined + } + }; + } catch { + return { title: "Game | Roblox" }; + } +} diff --git a/app/globals.css b/app/globals.css index fdc0205..791a5d1 100644 --- a/app/globals.css +++ b/app/globals.css @@ -2,11 +2,15 @@ @import "tailwindcss"; body { - font-family: SF Pro Display, Geist; + font-family: + SF Pro Display, + Geist; } .font-super-mono { - font-family: SF Mono, Geist Mono; + font-family: + SF Mono, + Geist Mono; } @layer base { @@ -83,41 +87,41 @@ body { } @theme { - --color-background: hsl(var(--background)); - --color-foreground: hsl(var(--foreground)); - --color-muted: hsl(var(--muted)); - --color-muted-foreground: hsl(var(--muted-foreground)); - --color-popover: hsl(var(--popover)); - --color-popover-foreground: hsl(var(--popover-foreground)); - --color-card: hsl(var(--card)); - --color-card-foreground: hsl(var(--card-foreground)); - --color-primary: hsl(var(--primary)); - --color-primary-foreground: hsl(var(--primary-foreground)); - --color-secondary: hsl(var(--secondary)); - --color-secondary-foreground: hsl(var(--secondary-foreground)); - --color-accent: hsl(var(--accent)); - --color-accent-foreground: hsl(var(--accent-foreground)); - --color-destructive: hsl(var(--destructive)); - --color-destructive-foreground: hsl(var(--destructive-foreground)); - --color-border: hsl(var(--border)); - --color-input: hsl(var(--input)); - --color-ring: hsl(var(--ring)); - --color-chart-1: hsl(var(--chart-1)); - --color-chart-2: hsl(var(--chart-2)); - --color-chart-3: hsl(var(--chart-3)); - --color-chart-4: hsl(var(--chart-4)); - --color-chart-5: hsl(var(--chart-5)); - --color-sidebar: hsl(var(--sidebar-background)); - --color-sidebar-foreground: hsl(var(--sidebar-foreground)); - --color-sidebar-primary: hsl(var(--sidebar-primary)); - --color-sidebar-primary-foreground: hsl(var(--sidebar-primary-foreground)); - --color-sidebar-accent: hsl(var(--sidebar-accent)); - --color-sidebar-accent-foreground: hsl(var(--sidebar-accent-foreground)); - --color-sidebar-border: hsl(var(--sidebar-border)); - --color-sidebar-ring: hsl(var(--sidebar-ring)); - --radius-lg: var(--radius); - --radius-md: calc(var(--radius) - 2px); - --radius-sm: calc(var(--radius) - 4px); + --color-background: hsl(var(--background)); + --color-foreground: hsl(var(--foreground)); + --color-muted: hsl(var(--muted)); + --color-muted-foreground: hsl(var(--muted-foreground)); + --color-popover: hsl(var(--popover)); + --color-popover-foreground: hsl(var(--popover-foreground)); + --color-card: hsl(var(--card)); + --color-card-foreground: hsl(var(--card-foreground)); + --color-primary: hsl(var(--primary)); + --color-primary-foreground: hsl(var(--primary-foreground)); + --color-secondary: hsl(var(--secondary)); + --color-secondary-foreground: hsl(var(--secondary-foreground)); + --color-accent: hsl(var(--accent)); + --color-accent-foreground: hsl(var(--accent-foreground)); + --color-destructive: hsl(var(--destructive)); + --color-destructive-foreground: hsl(var(--destructive-foreground)); + --color-border: hsl(var(--border)); + --color-input: hsl(var(--input)); + --color-ring: hsl(var(--ring)); + --color-chart-1: hsl(var(--chart-1)); + --color-chart-2: hsl(var(--chart-2)); + --color-chart-3: hsl(var(--chart-3)); + --color-chart-4: hsl(var(--chart-4)); + --color-chart-5: hsl(var(--chart-5)); + --color-sidebar: hsl(var(--sidebar-background)); + --color-sidebar-foreground: hsl(var(--sidebar-foreground)); + --color-sidebar-primary: hsl(var(--sidebar-primary)); + --color-sidebar-primary-foreground: hsl(var(--sidebar-primary-foreground)); + --color-sidebar-accent: hsl(var(--sidebar-accent)); + --color-sidebar-accent-foreground: hsl(var(--sidebar-accent-foreground)); + --color-sidebar-border: hsl(var(--sidebar-border)); + --color-sidebar-ring: hsl(var(--sidebar-ring)); + --radius-lg: var(--radius); + --radius-md: calc(var(--radius) - 2px); + --radius-sm: calc(var(--radius) - 4px); } @layer base { @@ -140,5 +144,5 @@ body { } } @utility border-border { - border-color: hsl(var(--border)); + border-color: hsl(var(--border)); } diff --git a/app/layout.tsx b/app/layout.tsx index 280867c..7431776 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -8,6 +8,7 @@ import { QuickTopUI, QuickTopUILogoPart } from "@/components/site/QuickTopUI"; import { ReactQueryProvider } from "@/components/providers/ReactQueryProvider"; import { GameLaunchProvider } from "@/components/providers/GameLaunchProvider"; import { GameLaunchDialog } from "@/components/providers/GameLaunchDialog"; +import { DownloadDialog } from "@/components/providers/DownloadDialog"; const geistSans = Geist({ variable: "--font-geist-sans", @@ -21,9 +22,18 @@ const geistMono = Geist_Mono({ export const metadata: Metadata = { title: "Home | Roblox", - description: "Roblox is a global platform that brings people together through play.", - authors: [{name: "Roblox Corporation"}], - keywords: ["free games", "online games", "building games", "virtual worlds", "free mmo", "gaming cloud", "physics engine"] + description: + "Roblox is a global platform that brings people together through play.", + authors: [{ name: "Roblox Corporation" }], + keywords: [ + "free games", + "online games", + "building games", + "virtual worlds", + "free mmo", + "gaming cloud", + "physics engine" + ] }; export default function RootLayout({ @@ -53,6 +63,7 @@ export default function RootLayout({ {children}
+ diff --git a/app/page.tsx b/app/page.tsx index ec948af..b59ba04 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -6,15 +6,10 @@ import { } from "@/components/roblox/FriendsOnline"; import { GameCard } from "@/components/roblox/GameCard"; import { HomeLoggedInHeader } from "@/components/site/HomeUserHeader"; -import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; import { Card, CardContent } from "@/components/ui/card"; -import { - getOmniRecommendationsHome, - OmniRecommendation -} from "@/lib/omniRecommendation"; +import { getOmniRecommendationsHome } from "@/lib/omniRecommendation"; import { getThumbnails, ThumbnailRequest } from "@/lib/thumbnailLoader"; import { useQuery, useQueryClient } from "@tanstack/react-query"; -import { AlertTriangleIcon } from "lucide-react"; export default function Home() { const SORTS_ALLOWED_IDS = [100000003, 100000001]; @@ -53,8 +48,10 @@ export default function Home() { <>
- - +
+ + +
{/*
@@ -66,23 +63,39 @@ export default function Home() {
*/} -
- {isLoading || !rec ? ( +
+ {isLoading ? ( +
+
+
+ {Array.from({ length: 4 }).map((_, index) => ( + + +
+
+
+ + + ))} +
+
+ ) : !rec ? ( - -
-
- Loading... -
-
+ + 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.topic} +

+
{(sort.recommendationList || []).map( (recommendation, idxb) => { @@ -99,7 +112,7 @@ export default function Home() { } )}
-
+ )) )}
diff --git a/app/users/[id]/content.tsx b/app/users/[id]/content.tsx index a907936..6f71a1b 100644 --- a/app/users/[id]/content.tsx +++ b/app/users/[id]/content.tsx @@ -25,7 +25,11 @@ function ProfileMoreDetails({ profile }: { profile: UserProfileDetails }) { {!theirFriends && } {/* //@ts-expect-error */} - Friends} className="overflow-visible -ml-4" friends={theirFriends || []} /> + Friends} + className="overflow-visible -ml-4" + friends={theirFriends || []} + /> ); } diff --git a/app/users/[id]/page.tsx b/app/users/[id]/page.tsx index ed3e8d1..1200a4b 100644 --- a/app/users/[id]/page.tsx +++ b/app/users/[id]/page.tsx @@ -2,7 +2,11 @@ import { Suspense } from "react"; import UserProfileContent from "./content"; // page.tsx (Server Component) -export default async function UserProfilePage({ params }: { params: { id: string } }) { +export default async function UserProfilePage({ + params +}: { + params: { id: string }; +}) { return ( Loading profile…
}> diff --git a/components/providers/DownloadDialog.tsx b/components/providers/DownloadDialog.tsx new file mode 100644 index 0000000..46b5696 --- /dev/null +++ b/components/providers/DownloadDialog.tsx @@ -0,0 +1,170 @@ +"use client"; + +import { useSyncExternalStore } from "react"; +import { Button } from "@/components/ui/button"; +import { X } from "lucide-react"; +import { + closeDownloadDialog, + getDownloadDialogState, + subscribeDownloadDialog +} from "@/components/providers/download-dialog-store"; +import Link from "next/link"; + +export function DownloadDialog() { + const state = useSyncExternalStore( + subscribeDownloadDialog, + getDownloadDialogState, + getDownloadDialogState + ); + + const isLinux = + typeof window !== "undefined" && navigator.userAgent.includes("Linux"); + const downloadUrl = state.url ?? "https://www.roblox.com/download/client"; + + if (!state.isOpen) return null; + + return ( +
+
event.stopPropagation()} + > + +
+
+

+ Thanks for downloading Roblox +

+ {isLinux ? ( +

+ Unfortunately, Roblox does not support Linux + natively. The only way to play Roblox on Linux + as of now is through{" "} + + Sober + + . +

+ ) : ( +

+ Just follow the steps below to install Roblox. + The download should start in a few seconds. If + it doesn't,{" "} + + restart the download + + . +

+ )} +
+
+
+

+ Install Instructions +

+
    + {isLinux ? ( + <> +
  1. + + Install Flatpak + {" "} + using the guide provided for your + distro. +
  2. +
  3. + Add the Flathub repository to your + system with following command: +
    +												
    +													flatpak remote-add
    +													--if-not-exists flathub
    +													https://flathub.org/repo/flathub.flatpakrepo
    +												
    +											
    +
  4. +
  5. + Install and run Sober with these + commands: +
    +												
    +													flatpak install flathub
    +													org.vinegarhq.Sober
    +												
    +											
    +
    +												
    +													flatpak run
    +													org.vinegarhq.Sober
    +												
    +											
    +
  6. + + ) : ( + <> +
  7. + Once downloaded, double-click the{" "} + + Roblox.exe + {" "} + file in your Downloads folder. +
  8. +
  9. + Double-click{" "} + + RobloxPlayerInstaller + {" "} + to install the app. +
  10. +
  11. + Follow the instructions to install + Roblox on your computer. +
  12. +
  13. + Now that Roblox is installed,{" "} + + join the experience + + . +
  14. + + )} +
+
+
+
+
+
+ ); +} diff --git a/components/providers/GameLaunchDialog.tsx b/components/providers/GameLaunchDialog.tsx index 3d36e89..ffe7e9c 100644 --- a/components/providers/GameLaunchDialog.tsx +++ b/components/providers/GameLaunchDialog.tsx @@ -1,11 +1,15 @@ "use client"; import { useEffect, useState, useSyncExternalStore } from "react"; -import { closeGameLaunch, getGameLaunchState, subscribeGameLaunch } from "@/components/providers/game-launch-store"; +import { + closeGameLaunch, + getGameLaunchState, + subscribeGameLaunch +} from "@/components/providers/game-launch-store"; +import { openDownloadDialog } from "@/components/providers/download-dialog-store"; import { Button } from "@/components/ui/button"; import { X } from "lucide-react"; import { RobloxLogoIcon } from "@/components/roblox/RobloxIcons"; -import Link from "next/link"; export function GameLaunchDialog() { const state = useSyncExternalStore( @@ -16,6 +20,34 @@ export function GameLaunchDialog() { const [launchTimeouted, setLaunchTimeouted] = useState(false); + function detectOS() { + if (typeof navigator === "undefined") return "Unknown"; + const nav = navigator as Navigator & { + userAgentData?: { platform?: string }; + }; + const platform = nav.userAgentData?.platform || nav.platform || ""; + const ua = nav.userAgent || ""; + const haystack = `${platform} ${ua}`; + if (/windows/i.test(haystack)) return "Windows"; + if (/mac os x|macintosh|macos/i.test(haystack)) return "Mac"; + if (/linux/i.test(haystack)) return "Linux"; + return "Unknown"; + } + + function handleDownloadClick() { + const os = detectOS(); + const canDownload = os === "Windows" || os === "Mac"; + const url = canDownload + ? "https://www.roblox.com/download/client" + : null; + openDownloadDialog(url); + closeGameLaunch(); + if (!canDownload || !url) return; + try { + window.open(url, "_blank", "noopener,noreferrer"); + } catch {} + } + useEffect(() => { if (!state.isOpen) { setLaunchTimeouted(false); @@ -33,7 +65,7 @@ export function GameLaunchDialog() { return (
-
- +
+

{!launchTimeouted ? ( <> - Roblox is now loading.
Get Ready! + Roblox is now loading. +
+ Get ready! ) : ( - <>Download Roblox to play millions of experiences! + <> + Download Roblox to play millions of + experiences. + )}

- + {launchTimeouted ? ( + + ) : ( + + )}
diff --git a/components/providers/GameLaunchProvider.tsx b/components/providers/GameLaunchProvider.tsx index 87d327c..94afbd7 100644 --- a/components/providers/GameLaunchProvider.tsx +++ b/components/providers/GameLaunchProvider.tsx @@ -25,7 +25,7 @@ export function GameLaunchProvider({ const launchGame = useCallback((placeId: string, jobId?: string) => { openGameLaunchWithParams(placeId, jobId); - console.log("[GameLaunchProvider] Launching",{placeId, jobId}); + console.log("[GameLaunchProvider] Launching", { placeId, jobId }); const gameLaunchParams = { launchmode: "play", @@ -34,9 +34,12 @@ export function GameLaunchProvider({ gameInstanceId: jobId ?? undefined }; - console.log("[GameLaunchProvider] Constructed GameLaunchParams",gameLaunchParams); + console.log( + "[GameLaunchProvider] Constructed GameLaunchParams", + gameLaunchParams + ); - const url = new URL("roblox://experiences/start") + const url = new URL("roblox://experiences/start"); for (const [key, value] of Object.entries(gameLaunchParams)) { if (value !== undefined && value !== null) { diff --git a/components/providers/download-dialog-store.ts b/components/providers/download-dialog-store.ts new file mode 100644 index 0000000..b07fcc9 --- /dev/null +++ b/components/providers/download-dialog-store.ts @@ -0,0 +1,30 @@ +type DownloadDialogState = { + isOpen: boolean; + url: string | null; +}; + +let state: DownloadDialogState = { isOpen: false, url: null }; +const listeners = new Set<() => void>(); + +function emit() { + listeners.forEach((l) => l()); +} + +export function subscribeDownloadDialog(listener: () => void) { + listeners.add(listener); + return () => listeners.delete(listener); +} + +export function getDownloadDialogState() { + return state; +} + +export function openDownloadDialog(url: string | null) { + state = { isOpen: true, url }; + emit(); +} + +export function closeDownloadDialog() { + state = { isOpen: false, url: null }; + emit(); +} diff --git a/components/providers/game-launch-store.ts b/components/providers/game-launch-store.ts index 983d070..9582a87 100644 --- a/components/providers/game-launch-store.ts +++ b/components/providers/game-launch-store.ts @@ -15,6 +15,10 @@ export function getGameLaunchState() { return state; } +export function isGameLaunchOpen() { + return state.isOpen; +} + export function subscribeGameLaunch(listener: () => void) { listeners.add(listener); return () => listeners.delete(listener); diff --git a/components/roblox/FriendCarousel.tsx b/components/roblox/FriendCarousel.tsx index 732b097..02989ff 100644 --- a/components/roblox/FriendCarousel.tsx +++ b/components/roblox/FriendCarousel.tsx @@ -57,7 +57,7 @@ export function FriendCarousel({

{title}

{a.displayName || a.name}

- {!a.hasVerifiedBadge ? ( + {a.hasVerifiedBadge ? (
- - - - {a.displayName || a.name} + + + + {a.displayName || a.name} + + {a.hasVerifiedBadge ? ( + + ) : null} - {!a.hasVerifiedBadge ? ( - - ) : null} - -
+
); diff --git a/components/roblox/FriendsOnline.tsx b/components/roblox/FriendsOnline.tsx index 6e80dcb..be8fcb7 100644 --- a/components/roblox/FriendsOnline.tsx +++ b/components/roblox/FriendsOnline.tsx @@ -11,7 +11,11 @@ export function FriendsHomeSect( ) { const friends = useFriendsHome(); - return friends && ; + return ( + friends && ( + + ) + ); } export function BestFriendsHomeSect( diff --git a/components/roblox/GameCard.tsx b/components/roblox/GameCard.tsx index 0c79dbb..b1a3aeb 100644 --- a/components/roblox/GameCard.tsx +++ b/components/roblox/GameCard.tsx @@ -12,6 +12,10 @@ import { ContextMenuItem } from "@radix-ui/react-context-menu"; import React from "react"; import Link from "next/link"; import { useGameLaunch } from "@/components/providers/GameLaunchProvider"; +import { Dialog, DialogContent, DialogTitle } from "@/components/ui/dialog"; +import GamePageContent from "@/app/games/[id]/content"; +import { Maximize2 } from "lucide-react"; +import { useRouter } from "next/navigation"; interface GameCardProps { game: ContentMetadata; @@ -19,89 +23,113 @@ interface GameCardProps { export const GameCard = React.memo(function GameCard({ game }: GameCardProps) { const { launchGame } = useGameLaunch(); + const totalVotes = game.totalUpVotes + game.totalDownVotes; + const rating = + totalVotes > 0 ? Math.round((game.totalUpVotes / totalVotes) * 100) : 0; + const [isOpen, setIsOpen] = React.useState(false); + + const router = useRouter(); return ( - - -
-
- {game.primaryMediaAsset ? ( - - ) : ( -
- - {":("} - + + + + + + + + Open + + { + launchGame(game.rootPlaceId.toString()); + }} + > + Play + + + { + navigator.clipboard.writeText( + `${game.rootPlaceId}` + ); + }} + > + Copy placeId + + { + navigator.clipboard.writeText(`${game.universeId}`); + }} + > + Copy universeId + + + + + +
{ + e.preventDefault(); + router.push(`/games/${game.rootPlaceId}`); + }} + > + + Maximize +
+
+
+
- - - - {game.name} - - - {Math.round( - (game.totalUpVotes / - (game.totalUpVotes + game.totalDownVotes)) * - 100 - )} - % rating - {game.playerCount.toLocaleString()} playing - - - {game.ageRecommendationDisplayName || ""} - - - - - Open - - - { - launchGame(game.rootPlaceId.toString()); - }} - > - Play - - - { - navigator.clipboard.writeText(`${game.rootPlaceId}`); - }} - > - Copy rootPlaceId - - { - navigator.clipboard.writeText(`${game.universeId}`); - }} - > - Copy universeId - - - +
+
); }); diff --git a/components/roblox/PlayGameButton.tsx b/components/roblox/PlayGameButton.tsx new file mode 100644 index 0000000..81b4ff7 --- /dev/null +++ b/components/roblox/PlayGameButton.tsx @@ -0,0 +1,22 @@ +"use client"; + +import { Button } from "@/components/ui/button"; +import { useGameLaunch } from "@/components/providers/GameLaunchProvider"; +import { Play } from "lucide-react"; + +type PlayGameButtonProps = { + placeId: string; +}; + +export function PlayGameButton({ placeId }: PlayGameButtonProps) { + const { launchGame } = useGameLaunch(); + + return ( + + ); +} diff --git a/components/roblox/RobloxIcons.tsx b/components/roblox/RobloxIcons.tsx index 4e1b5a0..3f624b9 100644 --- a/components/roblox/RobloxIcons.tsx +++ b/components/roblox/RobloxIcons.tsx @@ -97,19 +97,40 @@ export const RobuxIcon = (props: React.SVGProps) => ( ); export const RobloxLogoIcon = (props: React.SVGProps) => ( - + - - + + - - + + + - + -) +); diff --git a/components/roblox/UserProfileHeader.tsx b/components/roblox/UserProfileHeader.tsx index 56f08fb..b8cdbd0 100644 --- a/components/roblox/UserProfileHeader.tsx +++ b/components/roblox/UserProfileHeader.tsx @@ -19,7 +19,6 @@ import Link from "next/link"; import { UserProfileDetails } from "@/lib/profile"; export function UserProfileHeader({ user }: { user: UserProfileDetails }) { - if (!user) { return (
@@ -42,12 +41,12 @@ export function UserProfileHeader({ user }: { user: UserProfileDetails }) { userPresence === 1 ? "border-blue/25 bg-blue/25" : userPresence === 2 - ? "border-green/25 bg-green/25" - : userPresence === 3 - ? "border-yellow/25 bg-yellow/25" - : userPresence === 0 - ? "border-surface2/25 bg-surface2/25" - : "border-red/25 bg-red/25"; + ? "border-green/25 bg-green/25" + : userPresence === 3 + ? "border-yellow/25 bg-yellow/25" + : userPresence === 0 + ? "border-surface2/25 bg-surface2/25" + : "border-red/25 bg-red/25"; const isLoaded = !!user; @@ -98,7 +97,7 @@ export function UserProfileHeader({ user }: { user: UserProfileDetails }) { )} - + {isLoaded ? ( <> @{user.name} diff --git a/components/site/HomeUserHeader.tsx b/components/site/HomeUserHeader.tsx index 6aafaf1..10aec00 100644 --- a/components/site/HomeUserHeader.tsx +++ b/components/site/HomeUserHeader.tsx @@ -15,7 +15,6 @@ import { useAccountSettings } from "@/hooks/roblox/useAccountSettings"; import { loadThumbnails } from "@/lib/thumbnailLoader"; import { toast } from "sonner"; import Link from "next/link"; -import { Button } from "../ui/button"; // chatgpt + human function randomGreeting(name: string): string { @@ -59,85 +58,79 @@ export function HomeLoggedInHeader() { userPresence === 1 ? "border-blue/25 bg-blue/25" : userPresence === 2 - ? "border-green/25 bg-green/25" - : userPresence === 3 - ? "border-yellow/25 bg-yellow/25" - : userPresence === 0 - ? "border-surface2/25 bg-surface2/25" - : "border-red/25 bg-red/25"; + ? "border-green/25 bg-green/25" + : userPresence === 3 + ? "border-yellow/25 bg-yellow/25" + : userPresence === 0 + ? "border-surface2/25 bg-surface2/25" + : "border-red/25 bg-red/25"; const isLoaded = !!profile && !!accountSettings; return ( <> {/* */} -
{ - if (e.button === 2) { - toast("[debug] reloading user pfp"); - console.log("[debug] reloading user pfp"); - loadThumbnails([ - { - type: "AvatarHeadShot", - targetId: profile ? profile.id : 1, - format: "webp", - size: "720x720" - } - ]).catch(() => {}); - } - }} - > - {!isLoaded ? ( - - ) : ( - - )} -
- - {isLoaded ? ( - - {randomGreeting( - preferredName || - profile.displayName || - "Robloxian!" - )} - - ) : ( - <> - - - )} - {!!accountSettings && - accountSettings.IsPremium === true ? ( - - ) : ( - <> - )} - {isLoaded ? ( - - ) : ( - <> - )} - - - {isLoaded ? ( - <> - @{profile.name} - {!!userActivity && userPresence === 2 ? ( - <> - {userActivity.lastLocation} - ) : ( - <> - )} - - ) : ( - - )} - +
+
{ + if (e.button === 2) { + toast("[debug] reloading user pfp"); + console.log("[debug] reloading user pfp"); + loadThumbnails([ + { + type: "AvatarHeadShot", + targetId: profile ? profile.id : 1, + format: "webp", + size: "720x720" + } + ]).catch(() => {}); + } + }} + > + {!isLoaded ? ( + + ) : ( + + )} +
+ + {isLoaded ? ( + + {randomGreeting( + preferredName || + profile.displayName || + "Robloxian!" + )} + + ) : ( + + )} + {!!accountSettings && + accountSettings.IsPremium === true ? ( + + ) : null} + {isLoaded && profile.hasVerifiedBadge ? ( + + ) : null} + + + {isLoaded ? ( + <> + @{profile.name} + {!!userActivity && userPresence === 2 ? ( + <> - {userActivity.lastLocation} + ) : null} + + ) : ( + + )} + +
diff --git a/components/site/OutfitQuickChooser.tsx b/components/site/OutfitQuickChooser.tsx index 0ee4cfd..0d273d4 100644 --- a/components/site/OutfitQuickChooser.tsx +++ b/components/site/OutfitQuickChooser.tsx @@ -6,8 +6,9 @@ import LazyLoadedImage from "../util/LazyLoadedImage"; import { StupidHoverThing } from "../util/MiscStuff"; import { loadThumbnails } from "@/lib/thumbnailLoader"; import { useCurrentAccount } from "@/hooks/roblox/useCurrentAccount"; -import { useEffect } from "react"; -import { X } from "lucide-react"; +import { useEffect, useMemo, useState } from "react"; +import { Search, X } from "lucide-react"; +import { Input } from "@/components/ui/input"; type OutfitSelectorProps = { setVisible: (visible: boolean) => void; @@ -23,6 +24,7 @@ export function OutfitSelector({ }: OutfitSelectorProps) { const outfits = useAvatarOutfits(); const acc = useCurrentAccount(); + const [query, setQuery] = useState(""); useEffect(() => { if (!outfits || outfits.length === 0) return; @@ -47,6 +49,15 @@ export function OutfitSelector({ const isLoading = outfits === null; const hasOutfits = Array.isArray(outfits) && outfits.length > 0; + const filteredOutfits = useMemo(() => { + if (!hasOutfits) return []; + if (!query.trim()) return outfits; + const lowered = query.trim().toLowerCase(); + return outfits.filter((outfit) => + outfit.name.toLowerCase().includes(lowered) + ); + }, [hasOutfits, outfits, query]); + return (
event.stopPropagation()} > -
+
-

Outfits

+

+ Outfits +

Pick a look to update your avatar instantly.

- +
+
+ + + setQuery(event.target.value) + } + placeholder="Search outfits" + className="pl-9" + /> +
+ +
@@ -91,39 +117,55 @@ export function OutfitSelector({ ))}
) : hasOutfits ? ( -
- {outfits.map((outfit: { id: number; name: string }) => ( - - - - ))} +
+

+ {filteredOutfits.length} outfit + {filteredOutfits.length === 1 ? "" : "s"} +

+
+ {filteredOutfits.map( + (outfit: { id: number; name: string }) => ( + + + + ) + )} +
+ {filteredOutfits.length === 0 ? ( +
+ No outfits match that search yet. +
+ ) : null}
) : (
- No outfits found yet. Make one in the Roblox avatar editor, - then come back here. + No outfits found yet. Make one in the Roblox avatar + editor, then come back here.
)}
diff --git a/components/site/QuickTopUI.tsx b/components/site/QuickTopUI.tsx index f87ccd6..cebb96b 100644 --- a/components/site/QuickTopUI.tsx +++ b/components/site/QuickTopUI.tsx @@ -81,9 +81,12 @@ async function updateOutfit(outfit: { id: number }, acc: { id: number }) { ); } - await proxyFetch(`https://avatar.roblox.com/v1/avatar/redraw-thumbnail`, { - method: "POST" - }); + await proxyFetch( + `https://avatar.roblox.com/v1/avatar/redraw-thumbnail`, + { + method: "POST" + } + ); loadThumbnails([ { @@ -158,7 +161,10 @@ export const QuickTopUILogoPart = React.memo(function () { > - +

{"Roblox"}

{/*

{process.env.NODE_ENV} {process.env.NEXT_PUBLIC_CWD}{" "} diff --git a/components/ui/badge.tsx b/components/ui/badge.tsx index 341d7fe..8851c12 100644 --- a/components/ui/badge.tsx +++ b/components/ui/badge.tsx @@ -24,7 +24,8 @@ const badgeVariants = cva( ); export interface BadgeProps - extends React.HTMLAttributes, + extends + React.HTMLAttributes, VariantProps {} function Badge({ className, variant, ...props }: BadgeProps) { diff --git a/components/ui/button.tsx b/components/ui/button.tsx index 4884521..e1efd43 100644 --- a/components/ui/button.tsx +++ b/components/ui/button.tsx @@ -35,7 +35,8 @@ const buttonVariants = cva( ); export interface ButtonProps - extends React.ButtonHTMLAttributes, + extends + React.ButtonHTMLAttributes, VariantProps { asChild?: boolean; } diff --git a/components/ui/chart.tsx b/components/ui/chart.tsx index 41e40e5..23b0920 100644 --- a/components/ui/chart.tsx +++ b/components/ui/chart.tsx @@ -102,15 +102,17 @@ ${colorConfig const ChartTooltip = RechartsPrimitive.Tooltip; -type ChartTooltipContentProps = - RechartsPrimitive.TooltipContentProps & - React.ComponentProps<"div"> & { - hideLabel?: boolean; - hideIndicator?: boolean; - indicator?: "line" | "dot" | "dashed"; - nameKey?: string; - labelKey?: string; - }; +type ChartTooltipContentProps = RechartsPrimitive.TooltipContentProps< + number | string, + string +> & + React.ComponentProps<"div"> & { + hideLabel?: boolean; + hideIndicator?: boolean; + indicator?: "line" | "dot" | "dashed"; + nameKey?: string; + labelKey?: string; + }; const ChartTooltipContent = React.forwardRef< HTMLDivElement, diff --git a/components/ui/dialog.tsx b/components/ui/dialog.tsx index 04dd916..0aefd23 100644 --- a/components/ui/dialog.tsx +++ b/components/ui/dialog.tsx @@ -21,7 +21,7 @@ const DialogOverlay = React.forwardRef< , + extends + React.ComponentPropsWithoutRef, VariantProps {} const SheetContent = React.forwardRef< diff --git a/hooks/roblox/useFriends.ts b/hooks/roblox/useFriends.ts index 6f3f5d5..66c85e2 100644 --- a/hooks/roblox/useFriends.ts +++ b/hooks/roblox/useFriends.ts @@ -6,9 +6,9 @@ import { proxyFetch } from "@/lib/utils"; import { loadThumbnails } from "@/lib/thumbnailLoader"; import assert from "assert"; -export function useFriendsHome( targetId?: string ) { +export function useFriendsHome(targetId?: string) { const acct = useCurrentAccount(); - const target = targetId || (acct ? acct.id : "acctId") + const target = targetId || (acct ? acct.id : "acctId"); const { data: friends } = useQuery({ queryKey: ["friends", target], queryFn: async () => { @@ -47,15 +47,20 @@ export function useFriendsHome( targetId?: string ) { format: "webp" })) ).catch(() => {}); - const friendsList = j.data.map((a) => { - const x = j2.data.find((b) => b.id === a.id); - return !!x ? { - id: a.id, - hasVerifiedBadge: x?.hasVerifiedBadge || false, - name: x?.name || "?", - displayName: x?.displayName || "?" - } : null; - }).filter(a=>!!a).filter(a=>a.id.toString()!=="-1"); + const friendsList = j.data + .map((a) => { + const x = j2.data.find((b) => b.id === a.id); + return !!x + ? { + id: a.id, + hasVerifiedBadge: x?.hasVerifiedBadge || false, + name: x?.name || "?", + displayName: x?.displayName || "?" + } + : null; + }) + .filter((a) => !!a) + .filter((a) => a.id.toString() !== "-1"); return friendsList; }, enabled: !!acct, diff --git a/hooks/roblox/usePlaceDetails.ts b/hooks/roblox/usePlaceDetails.ts index dfb43d9..5b9e910 100644 --- a/hooks/roblox/usePlaceDetails.ts +++ b/hooks/roblox/usePlaceDetails.ts @@ -18,14 +18,25 @@ type PlaceDetails = { name: string; description: string; creator: Creator; + sourceName: string | null; + sourceDescription: string | null; + price: number | null; + allowedGearGenres: string[]; + allowedGearCategories: string[]; + isGenreEnforced: boolean; + copyingAllowed: boolean; playing: number; visits: number; maxPlayers: number; created: string; updated: string; + studioAccessToApisAllowed: boolean; + createVipServersAllowed: boolean; genre: string; genre_l1?: string; genre_l2?: string; + untranslated_genre_l1?: string; + isAllGenre?: boolean; favoritedCount: number; isFavoritedByUser: boolean; universeAvatarType: string; diff --git a/hooks/roblox/usePresence.ts b/hooks/roblox/usePresence.ts index 9606bc9..fd5dadc 100644 --- a/hooks/roblox/usePresence.ts +++ b/hooks/roblox/usePresence.ts @@ -51,7 +51,7 @@ export function useFriendsPresence(userIds: number[]) { // assert is shit if (!res.ok) { throw "wtf?"; - }; + } const json = await res.json(); diff --git a/tailwind.config.ts b/tailwind.config.ts index 1a737ad..764056f 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -105,7 +105,5 @@ export default { } } }, - plugins: [ - require("tailwindcss-animate") - ] + plugins: [require("tailwindcss-animate")] } satisfies Config; diff --git a/tsconfig.json b/tsconfig.json index e7ff3a2..fd75fd2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,41 +1,33 @@ { - "compilerOptions": { - "target": "ES2017", - "lib": [ - "dom", - "dom.iterable", - "esnext" - ], - "allowJs": true, - "skipLibCheck": true, - "strict": true, - "noEmit": true, - "esModuleInterop": true, - "module": "esnext", - "moduleResolution": "bundler", - "resolveJsonModule": true, - "isolatedModules": true, - "jsx": "react-jsx", - "incremental": true, - "plugins": [ - { - "name": "next" - } - ], - "paths": { - "@/*": [ - "./*" - ] - } - }, - "include": [ - "next-env.d.ts", - "**/*.ts", - "**/*.tsx", - ".next/types/**/*.ts", - ".next/dev/types/**/*.ts" - ], - "exclude": [ - "node_modules" - ] + "compilerOptions": { + "target": "ES2017", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "noEmit": true, + "esModuleInterop": true, + "module": "esnext", + "moduleResolution": "bundler", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "react-jsx", + "incremental": true, + "plugins": [ + { + "name": "next" + } + ], + "paths": { + "@/*": ["./*"] + } + }, + "include": [ + "next-env.d.ts", + "**/*.ts", + "**/*.tsx", + ".next/types/**/*.ts", + ".next/dev/types/**/*.ts" + ], + "exclude": ["node_modules"] }