From 70a95cc6ce25b4f99c5c50b5a516ab97f97b26f0 Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 16 Apr 2024 22:55:45 +0100 Subject: [PATCH] update embed --- src/app/(pages)/mojang/page.tsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/app/(pages)/mojang/page.tsx b/src/app/(pages)/mojang/page.tsx index 5f3cc9a..c0b4059 100644 --- a/src/app/(pages)/mojang/page.tsx +++ b/src/app/(pages)/mojang/page.tsx @@ -1,6 +1,7 @@ import { Card } from "@/app/components/card"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/app/components/ui/table"; import { generateEmbed } from "@/common/embed"; +import { capitalizeFirstLetter } from "@/common/string-utils"; import { cn } from "@/common/utils"; import { getMojangEndpointStatus } from "mcutils-library"; import { CachedEndpointStatus } from "mcutils-library/dist/types/cache/cachedEndpointStatus"; @@ -26,6 +27,16 @@ function getColor(status: any): string { } } +/** + * Formats the status + * + * @param status the status of the endpoint + * @returns the formatted status + */ +function formatStatus(status: any): string { + return capitalizeFirstLetter(status.toLowerCase()); +} + async function getData(): Promise { const status = await getMojangEndpointStatus(); return status; @@ -36,7 +47,7 @@ export async function generateMetadata(): Promise { const description = Object.entries(endpoints) .map(([url, status]) => { - return `${url}: ${status}`; + return `**${url}**: ${formatStatus(status)}`; }) .join("\n"); @@ -75,7 +86,9 @@ export default async function Page(): Promise { {url} - {status} + + {formatStatus(status)} + ); })}