Changes
This commit is contained in:
parent
6a9ec1fe9f
commit
b560341068
1
Frontend/.gitignore
vendored
1
Frontend/.gitignore
vendored
@ -1,5 +1,6 @@
|
|||||||
node_modules
|
node_modules
|
||||||
.next/
|
.next/
|
||||||
|
.fleet/
|
||||||
.vscode/
|
.vscode/
|
||||||
.env*.local
|
.env*.local
|
||||||
next-env.d.ts
|
next-env.d.ts
|
4
Frontend/.prettierrc
Normal file
4
Frontend/.prettierrc
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"trailingComma": "es5",
|
||||||
|
"tabWidth": 4
|
||||||
|
}
|
@ -3,6 +3,7 @@ import { minecrafter } from "@/font/fonts";
|
|||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { Metadata } from "next";
|
import { Metadata } from "next";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
import { ReactElement } from "react";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Page metadata.
|
* Page metadata.
|
||||||
@ -16,7 +17,7 @@ export const metadata: Metadata = {
|
|||||||
*
|
*
|
||||||
* @returns the page jsx
|
* @returns the page jsx
|
||||||
*/
|
*/
|
||||||
const DocsPage = (): JSX.Element => (
|
const DocsPage = (): ReactElement => (
|
||||||
<main className="h-[64vh] flex flex-col gap-3 justify-center items-center">
|
<main className="h-[64vh] flex flex-col gap-3 justify-center items-center">
|
||||||
{/* Creeper */}
|
{/* Creeper */}
|
||||||
<div className="absolute left-28 bottom-16 pointer-events-none">
|
<div className="absolute left-28 bottom-16 pointer-events-none">
|
||||||
|
@ -7,7 +7,7 @@ import StatisticCounters from "@/components/landing/statistic-counters";
|
|||||||
*
|
*
|
||||||
* @returns the page jsx
|
* @returns the page jsx
|
||||||
*/
|
*/
|
||||||
const LandingPage = (): JSX.Element => (
|
const LandingPage = (): ReactElement => (
|
||||||
<main className="px-3">
|
<main className="px-3">
|
||||||
<Hero />
|
<Hero />
|
||||||
<FeaturedContent />
|
<FeaturedContent />
|
||||||
|
@ -7,13 +7,14 @@ import { PageProps } from "@/types/page";
|
|||||||
import { Metadata } from "next";
|
import { Metadata } from "next";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { CachedPlayer, getPlayer, type RestfulMCAPIError } from "restfulmc-lib";
|
import { CachedPlayer, getPlayer, type RestfulMCAPIError } from "restfulmc-lib";
|
||||||
|
import { ReactElement } from "react";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The page to lookup a player.
|
* The page to lookup a player.
|
||||||
*
|
*
|
||||||
* @returns the page jsx
|
* @returns the page jsx
|
||||||
*/
|
*/
|
||||||
const PlayerPage = async ({ params }: PageProps): Promise<JSX.Element> => {
|
const PlayerPage = async ({ params }: PageProps): Promise<ReactElement> => {
|
||||||
let error: string | undefined = undefined; // The error to display
|
let error: string | undefined = undefined; // The error to display
|
||||||
let result: CachedPlayer | undefined = undefined; // The player to display
|
let result: CachedPlayer | undefined = undefined; // The player to display
|
||||||
const query: string | undefined = trimQuery(params.slug?.[0]); // The query to search for
|
const query: string | undefined = trimQuery(params.slug?.[0]); // The query to search for
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
import { minecrafter } from "@/font/fonts";
|
import { minecrafter } from "@/font/fonts";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import CountUp from "react-countup";
|
import CountUp from "react-countup";
|
||||||
|
import { ReactElement } from "react";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Props for the counter.
|
* Props for the counter.
|
||||||
@ -34,10 +35,13 @@ type CounterProps = {
|
|||||||
* @param duration the optional duration of the count up
|
* @param duration the optional duration of the count up
|
||||||
* @returns the counter jsx
|
* @returns the counter jsx
|
||||||
*/
|
*/
|
||||||
const Counter = ({ name, amount, duration }: CounterProps): JSX.Element => (
|
const Counter = ({ name, amount, duration }: CounterProps): ReactElement => (
|
||||||
<div className="flex flex-col items-center gap-4">
|
<div className="flex flex-col items-center gap-4">
|
||||||
<h1
|
<h1
|
||||||
className={cn("text-6xl text-minecraft-green-3", minecrafter.className)}
|
className={cn(
|
||||||
|
"text-6xl text-minecraft-green-3",
|
||||||
|
minecrafter.className
|
||||||
|
)}
|
||||||
>
|
>
|
||||||
{name}
|
{name}
|
||||||
</h1>
|
</h1>
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
|
import { ReactElement } from "react";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A creeper image.
|
* A creeper image.
|
||||||
*
|
*
|
||||||
* @returns the creeper jsx
|
* @returns the creeper jsx
|
||||||
*/
|
*/
|
||||||
const Creeper = (): JSX.Element => (
|
const Creeper = (): ReactElement => (
|
||||||
<Image
|
<Image
|
||||||
src="/media/creeper.png"
|
src="/media/creeper.png"
|
||||||
alt="A Minecraft Creeper"
|
alt="A Minecraft Creeper"
|
||||||
|
@ -1,2 +1,4 @@
|
|||||||
const Footer = (): JSX.Element => <footer>FOOTER</footer>;
|
import { ReactElement } from "react";
|
||||||
|
|
||||||
|
const Footer = (): ReactElement => <footer>FOOTER</footer>;
|
||||||
export default Footer;
|
export default Footer;
|
||||||
|
@ -4,7 +4,7 @@ import { StarIcon } from "@heroicons/react/24/outline";
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { Suspense } from "react";
|
import { Suspense } from "react";
|
||||||
|
|
||||||
const GitHubStarButton = async (): Promise<JSX.Element> => {
|
const GitHubStarButton = async (): Promise<ReactElement> => {
|
||||||
return (
|
return (
|
||||||
<Link
|
<Link
|
||||||
href="https://github.com/Rainnny7/RESTfulMC"
|
href="https://github.com/Rainnny7/RESTfulMC"
|
||||||
@ -13,7 +13,9 @@ const GitHubStarButton = async (): Promise<JSX.Element> => {
|
|||||||
>
|
>
|
||||||
<MinecraftButton className="flex gap-1.5 items-center group/star">
|
<MinecraftButton className="flex gap-1.5 items-center group/star">
|
||||||
{/* Star Count */}
|
{/* Star Count */}
|
||||||
<Suspense fallback={<Skeleton className="w-4 h-5 rounded-md" />}>
|
<Suspense
|
||||||
|
fallback={<Skeleton className="w-4 h-5 rounded-md" />}
|
||||||
|
>
|
||||||
<GitHubStarCount />
|
<GitHubStarCount />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
|
|
||||||
|
@ -3,18 +3,21 @@ import { minecrafter } from "@/font/fonts";
|
|||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { FeaturedItemProps } from "@/types/config";
|
import { FeaturedItemProps } from "@/types/config";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
import { ReactElement } from "react";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The featured content component.
|
* The featured content component.
|
||||||
*
|
*
|
||||||
* @returns the featured content jsx
|
* @returns the featured content jsx
|
||||||
*/
|
*/
|
||||||
const FeaturedContent = (): JSX.Element => (
|
const FeaturedContent = (): ReactElement => (
|
||||||
<div className="flex justify-center items-center">
|
<div className="flex justify-center items-center">
|
||||||
<div className="max-w-2xl flex flex-wrap justify-center gap-5">
|
<div className="max-w-2xl flex flex-wrap justify-center gap-5">
|
||||||
{config.featuredItems.map((item, index) => (
|
{config.featuredItems.map(
|
||||||
|
(item: FeaturedItemProps, index: number) => (
|
||||||
<FeaturedItem key={index} {...item} />
|
<FeaturedItem key={index} {...item} />
|
||||||
))}
|
)
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@ -30,7 +33,7 @@ const FeaturedItem = ({
|
|||||||
description,
|
description,
|
||||||
image,
|
image,
|
||||||
href,
|
href,
|
||||||
}: FeaturedItemProps): JSX.Element => (
|
}: FeaturedItemProps): ReactElement => (
|
||||||
<Link
|
<Link
|
||||||
className="pt-28 w-[19rem] h-80 flex flex-col gap-1 items-center bg-center bg-cover bg-no-repeat rounded-3xl text-center backdrop-blur-md hover:scale-[1.01] transition-all transform-gpu"
|
className="pt-28 w-[19rem] h-80 flex flex-col gap-1 items-center bg-center bg-cover bg-no-repeat rounded-3xl text-center backdrop-blur-md hover:scale-[1.01] transition-all transform-gpu"
|
||||||
href={href}
|
href={href}
|
||||||
@ -39,7 +42,10 @@ const FeaturedItem = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<h1
|
<h1
|
||||||
className={cn("text-3xl font-semibold text-white", minecrafter.className)}
|
className={cn(
|
||||||
|
"text-3xl font-semibold text-white",
|
||||||
|
minecrafter.className
|
||||||
|
)}
|
||||||
>
|
>
|
||||||
{name}
|
{name}
|
||||||
</h1>
|
</h1>
|
||||||
|
@ -4,13 +4,14 @@ import config from "@/config";
|
|||||||
import { minecrafter } from "@/font/fonts";
|
import { minecrafter } from "@/font/fonts";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
import { ReactElement } from "react";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The hero content.
|
* The hero content.
|
||||||
*
|
*
|
||||||
* @returns the hero jsx
|
* @returns the hero jsx
|
||||||
*/
|
*/
|
||||||
const Hero = (): JSX.Element => (
|
const Hero = (): ReactElement => (
|
||||||
<div className="pt-56 pb-40 flex flex-col gap-8 justify-center items-center">
|
<div className="pt-56 pb-40 flex flex-col gap-8 justify-center items-center">
|
||||||
<div className="flex flex-col gap-4 items-center text-center">
|
<div className="flex flex-col gap-4 items-center text-center">
|
||||||
{/* Title */}
|
{/* Title */}
|
||||||
@ -30,7 +31,9 @@ const Hero = (): JSX.Element => (
|
|||||||
{/* Links */}
|
{/* Links */}
|
||||||
<div className="flex gap-5 xs:gap-10">
|
<div className="flex gap-5 xs:gap-10">
|
||||||
<Link href="/docs">
|
<Link href="/docs">
|
||||||
<MinecraftButton className="w-44 h-12">Get Started</MinecraftButton>
|
<MinecraftButton className="w-44 h-12">
|
||||||
|
Get Started
|
||||||
|
</MinecraftButton>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
{/* Star on Github <3 */}
|
{/* Star on Github <3 */}
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import Counter from "@/components/counter";
|
import Counter from "@/components/counter";
|
||||||
|
import { ReactElement } from "react";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The statistic counters component.
|
* The statistic counters component.
|
||||||
*
|
*
|
||||||
* @returns the counters jsx
|
* @returns the counters jsx
|
||||||
*/
|
*/
|
||||||
const StatisticCounters = (): JSX.Element => (
|
const StatisticCounters = (): ReactElement => (
|
||||||
<div className="py-56 flex justify-center items-center">
|
<div className="py-56 flex justify-center items-center">
|
||||||
<div className="grid grid-flow-row grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-4 gap-24">
|
<div className="grid grid-flow-row grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-4 gap-24">
|
||||||
<Counter name="Testing" amount={1_000_000} />
|
<Counter name="Testing" amount={1_000_000} />
|
||||||
|
@ -7,13 +7,14 @@ import { cn } from "@/lib/utils";
|
|||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { usePathname } from "next/navigation";
|
import { usePathname } from "next/navigation";
|
||||||
|
import { ReactElement } from "react";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The navbar for the site.
|
* The navbar for the site.
|
||||||
*
|
*
|
||||||
* @returns the navbar jsx
|
* @returns the navbar jsx
|
||||||
*/
|
*/
|
||||||
const Navbar = (): JSX.Element => {
|
const Navbar = (): ReactElement => {
|
||||||
const path: string = usePathname(); // Get the current path
|
const path: string = usePathname(); // Get the current path
|
||||||
return (
|
return (
|
||||||
<nav className="fixed inset-x-0 flex h-16 sm:px-12 justify-center sm:justify-between items-center bg-navbar-background z-50">
|
<nav className="fixed inset-x-0 flex h-16 sm:px-12 justify-center sm:justify-between items-center bg-navbar-background z-50">
|
||||||
@ -42,7 +43,8 @@ const Navbar = (): JSX.Element => {
|
|||||||
|
|
||||||
{/* Links */}
|
{/* Links */}
|
||||||
<div className="flex gap-7">
|
<div className="flex gap-7">
|
||||||
{Object.entries(config.navbarLinks).map((link, index) => {
|
{Object.entries(config.navbarLinks).map(
|
||||||
|
(link: [string, string], index: number) => {
|
||||||
const url: string = link[1]; // The href of the link
|
const url: string = link[1]; // The href of the link
|
||||||
let active: boolean = path.startsWith(url); // Is this the active link?
|
let active: boolean = path.startsWith(url); // Is this the active link?
|
||||||
return (
|
return (
|
||||||
@ -57,7 +59,8 @@ const Navbar = (): JSX.Element => {
|
|||||||
{link[0]}
|
{link[0]}
|
||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
})}
|
}
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { CachedPlayer, SkinPart } from "restfulmc-lib";
|
import { CachedPlayer, SkinPart } from "restfulmc-lib";
|
||||||
|
import { ReactElement } from "react";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The result of a player search.
|
* The result of a player search.
|
||||||
@ -18,7 +19,7 @@ const PlayerResult = ({
|
|||||||
},
|
},
|
||||||
}: {
|
}: {
|
||||||
player: CachedPlayer;
|
player: CachedPlayer;
|
||||||
}): JSX.Element => (
|
}): ReactElement => (
|
||||||
<div className="px-2 py-3 flex flex-col gap-3 items-center bg-muted rounded-xl divide-y divide-zinc-700">
|
<div className="px-2 py-3 flex flex-col gap-3 items-center bg-muted rounded-xl divide-y divide-zinc-700">
|
||||||
{/* Details */}
|
{/* Details */}
|
||||||
<div className="flex gap-5 items-center">
|
<div className="flex gap-5 items-center">
|
||||||
@ -33,11 +34,17 @@ const PlayerResult = ({
|
|||||||
|
|
||||||
{/* Name, Unique ID, and Badges */}
|
{/* Name, Unique ID, and Badges */}
|
||||||
<div className="flex flex-col gap-1.5">
|
<div className="flex flex-col gap-1.5">
|
||||||
<h1 className="text-xl font-bold text-minecraft-green-3">{username}</h1>
|
<h1 className="text-xl font-bold text-minecraft-green-3">
|
||||||
<code className="text-xs xs:text-sm text-zinc-300">{uniqueId}</code>
|
{username}
|
||||||
|
</h1>
|
||||||
|
<code className="text-xs xs:text-sm text-zinc-300">
|
||||||
|
{uniqueId}
|
||||||
|
</code>
|
||||||
|
|
||||||
{/* Legacy Badge */}
|
{/* Legacy Badge */}
|
||||||
{legacy && <p className="text-sm font-semibold uppercase">Legacy</p>}
|
{legacy && (
|
||||||
|
<p className="text-sm font-semibold uppercase">Legacy</p>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ const PlayerSearch = ({
|
|||||||
query,
|
query,
|
||||||
}: {
|
}: {
|
||||||
query: string | undefined;
|
query: string | undefined;
|
||||||
}): JSX.Element => {
|
}): ReactElement => {
|
||||||
const handleRedirect = async (form: FormData) => {
|
const handleRedirect = async (form: FormData) => {
|
||||||
"use server";
|
"use server";
|
||||||
redirect(`/player/${form.get("query")}`);
|
redirect(`/player/${form.get("query")}`);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user