From 3beccf01c8a315d07af3e7dad979df3a3af1265c Mon Sep 17 00:00:00 2001 From: Rainnny7 Date: Tue, 16 Apr 2024 16:56:38 -0400 Subject: [PATCH] Update src --- Frontend/src/app/(pages)/player/[[...slug]]/page.tsx | 11 +++++++++-- Frontend/src/app/components/player/player-search.tsx | 7 ++++++- Frontend/tailwind.config.ts | 6 +++++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Frontend/src/app/(pages)/player/[[...slug]]/page.tsx b/Frontend/src/app/(pages)/player/[[...slug]]/page.tsx index e894c02..466c261 100644 --- a/Frontend/src/app/(pages)/player/[[...slug]]/page.tsx +++ b/Frontend/src/app/(pages)/player/[[...slug]]/page.tsx @@ -14,9 +14,16 @@ import { CachedPlayer, getPlayer, type RestfulMCAPIError } from "restfulmc-lib"; const PlayerPage = async ({ params }: PageProps): Promise => { let error: string | undefined = undefined; // The error to display let result: CachedPlayer | undefined = undefined; // The player to display - const query: string | undefined = params.slug; // The query to search for + let query: string | undefined = params.slug?.[0]; // The query to search for + + // Limit the query to 36 chars + if (query && query.length > 36) { + query = query.substr(0, 36); + } + + // Try and get the player to display try { - result = params.slug ? await getPlayer(query) : undefined; // Get the player to display + result = params.slug ? await getPlayer(query) : undefined; } catch (err) { error = (err as RestfulMCAPIError).message; // Set the error message } diff --git a/Frontend/src/app/components/player/player-search.tsx b/Frontend/src/app/components/player/player-search.tsx index 0a81b6d..88093c4 100644 --- a/Frontend/src/app/components/player/player-search.tsx +++ b/Frontend/src/app/components/player/player-search.tsx @@ -23,7 +23,12 @@ const PlayerSearch = ({ className="flex flex-col gap-7 justify-center items-center" action={handleRedirect} > - + Search ); diff --git a/Frontend/tailwind.config.ts b/Frontend/tailwind.config.ts index afec2ee..94bcd01 100644 --- a/Frontend/tailwind.config.ts +++ b/Frontend/tailwind.config.ts @@ -1,5 +1,5 @@ import type { Config } from "tailwindcss"; -const { fontFamily } = require("tailwindcss/defaultTheme"); +const { fontFamily, screens } = require("tailwindcss/defaultTheme"); const config = { darkMode: ["class"], @@ -75,6 +75,10 @@ const config = { "accordion-up": "accordion-up 0.2s ease-out", }, }, + screens: { + xs: "475px", + ...screens, + }, }, plugins: [require("tailwindcss-animate")], } satisfies Config;