From a50a8b71fd0ccc82a971ebb3e3015a83135a51c1 Mon Sep 17 00:00:00 2001 From: Gabriel Logan <96627244+gabriel-logan@users.noreply.github.com> Date: Wed, 22 May 2024 02:07:05 -0300 Subject: [PATCH] fix: correct http return and invalid styling (#269) * fix: correct http return and invalid styling Page responded with incorrect http return message. * fix: correct http return and invalid styling Update error_page.ts --- api/index.ts | 4 ++-- src/error_page.ts | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/api/index.ts b/api/index.ts index e40ba7a..fd4a33c 100644 --- a/api/index.ts +++ b/api/index.ts @@ -80,7 +80,7 @@ async function app(req: Request): Promise {

Enter your username and click get trophies

- +
@@ -117,7 +117,7 @@ async function app(req: Request): Promise { const userResponseInfo = await client.requestUserInfo(username); if (userResponseInfo instanceof ServiceError) { return new Response( - ErrorPage({ error: userInfo, username }).render(), + ErrorPage({ error: userResponseInfo, username }).render(), { status: userResponseInfo.code, headers: new Headers({ "Content-Type": "text" }), diff --git a/src/error_page.ts b/src/error_page.ts index be4688b..0da194f 100644 --- a/src/error_page.ts +++ b/src/error_page.ts @@ -28,6 +28,14 @@ abstract class BaseError { p { color: #666; } + #back-link { + display: flex; + justify-content: center; + text-decoration: none; + } + #back-link:hover { + text-decoration: underline; + } section { width: 80%; margin: 0 auto; @@ -62,7 +70,7 @@ abstract class BaseError { cursor: pointer; } #base-show { - font-size: 14px; + font-size: 16px; color: #333; background-color: #f4f4f4; padding: 10px; @@ -75,12 +83,12 @@ abstract class BaseError { } @media (max-width: 768px) { #base-show { - font-size: 14; + font-size: 14px; } } @media (max-width: 480px) { #base-show { - font-size: 8; + font-size: 8px; } } @media (min-width: 768px) { @@ -98,6 +106,10 @@ abstract class BaseError {

${this.status} - ${this.message}

${this.content ?? ""}

+ ${ + this.content && + 'Go back' + } `;