From 9d67dd94d85e8f7105ca1975fce8255870f0daeb Mon Sep 17 00:00:00 2001 From: anonymousratwastaken Date: Sat, 24 Oct 2026 10:24:37 +0100 Subject: [PATCH] Replace play dialog with inline server address field - Add PlayField with Java/Bedrock edition switcher, read-only address input, and copy button - Show Add Friend link for Bedrock gamertag - Remove Play and Donate buttons and footer line from homepage - Animate server status chip into an expandable panel with spring motion and outside-click/Escape close --- src/app/page.tsx | 20 +--- src/components/play-dialog.tsx | 58 ++++++++++++ src/components/server-status-chip.tsx | 128 ++++++++++++++++---------- 3 files changed, 142 insertions(+), 64 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index 83dae72..8ccfb32 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,17 +1,14 @@ "use client"; import localFont from "next/font/local"; -import Link from "next/link"; -import { useRef, useState } from "react"; -import { Button } from "@/components/ui/button"; +import { useRef } from "react"; import { TopBar } from "@/components/top-bar"; -import { PlayDialog } from "@/components/play-dialog"; +import { PlayField } from "@/components/play-dialog"; import { ServerStatusChip } from "@/components/server-status-chip"; import { GradientShimmer, type GradientShimmerHandle } from "@/components/gradient-shimmer"; const makeSans = localFont({ src: "../../public/font/makesans.ttf" }); export default function Page() { - const [playOpen, setPlayOpen] = useState(false); const shimmerRef = useRef(null); return (
@@ -24,20 +21,11 @@ export default function Page() {

FRG Network

A small and fun Minecraft server and surrounding community.

-
- - +
+ shimmerRef.current?.emphasize()} />
-

Java & Bedrock · frg.network

-
); } diff --git a/src/components/play-dialog.tsx b/src/components/play-dialog.tsx index 4ae1f4d..64364f4 100644 --- a/src/components/play-dialog.tsx +++ b/src/components/play-dialog.tsx @@ -1,7 +1,10 @@ "use client"; import { useState } from "react"; +import { CheckIcon, ChevronDownIcon, CopyIcon } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from "@/components/ui/dialog"; +import { DropdownMenu, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"; +import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "@/components/ui/input-group"; import { Tabs, TabsList, TabsTrigger, TabsContent } from "@/components/ui/tabs"; export function PlayDialog({ open, onOpenChange }: { open: boolean; onOpenChange: (v: boolean) => void }) { @@ -35,3 +38,58 @@ export function PlayButton({ size = "sm" }: { size?: "sm" | "default" | "lg" }) ); } + +const PLATFORMS = { + java: { label: "Java", value: "frg.network", copyLabel: "Copy address", href: undefined, hint: "Multiplayer → Add Server, then paste the address." }, + bedrock: { label: "Bedrock", value: "FRG Servers", copyLabel: "Copy gamertag", href: "https://www.xbox.com/en-GB/play/user/FRG%20Servers", hint: "Add this gamertag as an Xbox Live friend, then join via Friends." }, +} as const; +type Platform = keyof typeof PLATFORMS; + +export function PlayField({ onMouseEnter }: { onMouseEnter?: () => void }) { + const [platform, setPlatform] = useState("java"); + const [copied, setCopied] = useState(false); + const p = PLATFORMS[platform]; + const copy = async () => { + await navigator.clipboard.writeText(p.value); + setCopied(true); + setTimeout(() => setCopied(false), 1500); + }; + return ( +
+
+ + + + + + {p.label} + + + + { setPlatform(v as Platform); setCopied(false); }}> + {(Object.keys(PLATFORMS) as Platform[]).map((k) => ( + {PLATFORMS[k].label} + ))} + + + + + e.currentTarget.select()} /> + + + {copied ? : } + + + +
+ {p.href && ( +
+ +
+ )} +

{copied ? "Copied!" : p.hint}

+
+ ); +} diff --git a/src/components/server-status-chip.tsx b/src/components/server-status-chip.tsx index 2f782d6..34fec7b 100644 --- a/src/components/server-status-chip.tsx +++ b/src/components/server-status-chip.tsx @@ -1,5 +1,6 @@ "use client"; -import { useEffect, useState } from "react"; +import { useEffect, useRef, useState } from "react"; +import { motion } from "motion/react"; import type { ServerStatus } from "@/lib/server-status"; const REFRESH_MS = 60_000; @@ -19,6 +20,23 @@ const TEXT = { export function ServerStatusChip() { const [status, setStatus] = useState(null); const [open, setOpen] = useState(false); + const rootRef = useRef(null); + + useEffect(() => { + if (!open) return; + const onDown = (e: PointerEvent) => { + if (!rootRef.current?.contains(e.target as Node)) setOpen(false); + }; + const onKey = (e: KeyboardEvent) => { + if (e.key === "Escape") setOpen(false); + }; + document.addEventListener("pointerdown", onDown); + document.addEventListener("keydown", onKey); + return () => { + document.removeEventListener("pointerdown", onDown); + document.removeEventListener("keydown", onKey); + }; + }, [open]); useEffect(() => { let cancelled = false; @@ -45,55 +63,69 @@ export function ServerStatusChip() { : null; return ( -
- - - {open && ( -
+
+ - {status ? ( -
-
Address
-
{status.host}
-
Players
-
- {state === "online" && status.players ? `${status.players.online} / ${status.players.max}` : "—"} -
-
Version
-
{state === "online" && status.version ? status.version : "—"}
- {state === "online" && status.motd && ( - <> -
Message
-
{status.motd}
- + setOpen((v) => !v)} + aria-expanded={open} + aria-controls="server-status-panel" + className="flex w-full items-center gap-2 px-3 py-1 text-xs font-medium text-muted-foreground hover:text-foreground transition-colors whitespace-nowrap" + > + + {status ? TEXT[state] : "Checking…"} + {state === "online" && status?.players && ( + · {status.players.online} online + )} + + + +
+ {status ? ( +
+
Players
+
+ {state === "online" && status.players ? `${status.players.online} / ${status.players.max}` : "—"} +
+
Version
+
{state === "online" && status.version ? status.version : "—"}
+ {state === "online" && status.motd && ( + <> +
Message
+
{status.motd}
+ + )} +
+ ) : ( +

Fetching server status…

)} -
- ) : ( -

Fetching server status…

- )} -

- {state === "unknown" && status - ? "We couldn't reach the status service. Try again shortly." - : lastChecked - ? `Last checked ${lastChecked} UTC · refreshes every minute` - : null} -

-
- )} +

+ {state === "unknown" && status + ? "We couldn't reach the status service. Try again shortly." + : lastChecked + ? `Last checked ${lastChecked} UTC · refreshes every minute` + : null} +

+
+ + +
); }