This commit is contained in:
parent
7ad9987cd1
commit
70a95cc6ce
@ -1,6 +1,7 @@
|
|||||||
import { Card } from "@/app/components/card";
|
import { Card } from "@/app/components/card";
|
||||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/app/components/ui/table";
|
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/app/components/ui/table";
|
||||||
import { generateEmbed } from "@/common/embed";
|
import { generateEmbed } from "@/common/embed";
|
||||||
|
import { capitalizeFirstLetter } from "@/common/string-utils";
|
||||||
import { cn } from "@/common/utils";
|
import { cn } from "@/common/utils";
|
||||||
import { getMojangEndpointStatus } from "mcutils-library";
|
import { getMojangEndpointStatus } from "mcutils-library";
|
||||||
import { CachedEndpointStatus } from "mcutils-library/dist/types/cache/cachedEndpointStatus";
|
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<CachedEndpointStatus> {
|
async function getData(): Promise<CachedEndpointStatus> {
|
||||||
const status = await getMojangEndpointStatus();
|
const status = await getMojangEndpointStatus();
|
||||||
return status;
|
return status;
|
||||||
@ -36,7 +47,7 @@ export async function generateMetadata(): Promise<Metadata> {
|
|||||||
|
|
||||||
const description = Object.entries(endpoints)
|
const description = Object.entries(endpoints)
|
||||||
.map(([url, status]) => {
|
.map(([url, status]) => {
|
||||||
return `${url}: ${status}`;
|
return `**${url}**: ${formatStatus(status)}`;
|
||||||
})
|
})
|
||||||
.join("\n");
|
.join("\n");
|
||||||
|
|
||||||
@ -75,7 +86,9 @@ export default async function Page(): Promise<JSX.Element> {
|
|||||||
{url}
|
{url}
|
||||||
</Link>
|
</Link>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className={cn(getColor(status), "p-[0.3rem] text-center")}>{status}</TableCell>
|
<TableCell className={cn(getColor(status), "p-[0.3rem] text-center")}>
|
||||||
|
{formatStatus(status)}
|
||||||
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
Loading…
Reference in New Issue
Block a user