Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct http return and invalid styling #269

Merged
merged 2 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async function app(req: Request): Promise<Response> {
<p>Enter your username and click get trophies</p>
<form action="https://github-profile-trophy.vercel.app/" method="get">
<label for="username">GitHub Username</label>
<input type="text" name="username" id="username" placeholder="Ex. mojombo" required>
<input type="text" name="username" id="username" placeholder="Ex. gabriel-logan" required>
<button type="submit">Get Trophy&apos;s</button>
</form>
</div>
Expand Down Expand Up @@ -117,7 +117,7 @@ async function app(req: Request): Promise<Response> {
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" }),
Expand Down
18 changes: 15 additions & 3 deletions src/error_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -62,7 +70,7 @@ abstract class BaseError {
cursor: pointer;
}
#base-show {
font-size: 14px;
font-size: 16px;
color: #333;
background-color: #f4f4f4;
padding: 10px;
Expand All @@ -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) {
Expand All @@ -98,6 +106,10 @@ abstract class BaseError {
<body>
<h1 style="text-align: center;">${this.status} - ${this.message}</h1>
<p style="text-align: center;">${this.content ?? ""}</p>
${
this.content &&
'<a id="back-link" href="https://github-profile-trophy.vercel.app/">Go back</a>'
}
</body>
</html>`;

Expand Down
Loading