add last updated to mojang status embed
All checks were successful
Deploy App / docker (ubuntu-latest) (push) Successful in 1m38s

This commit is contained in:
Lee 2024-04-17 17:33:12 +01:00
parent fd950efa17
commit 5217ee4aab
5 changed files with 30 additions and 3 deletions

@ -15,6 +15,7 @@
"clsx": "^2.1.0",
"lucide-react": "^0.368.0",
"mcutils-library": "^1.2.1",
"moment": "^2.30.1",
"next": "14.2.1",
"next-themes": "^0.3.0",
"react": "^18",

7
pnpm-lock.yaml generated

@ -23,6 +23,9 @@ dependencies:
mcutils-library:
specifier: ^1.2.1
version: 1.2.1(@babel/core@7.24.4)(@types/node@20.12.7)
moment:
specifier: ^2.30.1
version: 2.30.1
next:
specifier: 14.2.1
version: 14.2.1(@babel/core@7.24.4)(react-dom@18.2.0)(react@18.2.0)
@ -3596,6 +3599,10 @@ packages:
resolution: {integrity: sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==}
engines: {node: '>=16 || 14 >=14.17'}
/moment@2.30.1:
resolution: {integrity: sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==}
dev: false
/ms@2.1.2:
resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}

@ -2,6 +2,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 { formatTime } from "@/common/time-utils";
import { cn } from "@/common/utils";
import { CachedEndpointStatus, getMojangEndpointStatus } from "mcutils-library";
import { Metadata } from "next";
@ -55,6 +56,7 @@ export async function generateMetadata(): Promise<Metadata> {
return `**${url}**: ${formatStatus(status)}`;
})
.join("\n");
description += `\n\nUpdated: ${formatTime(new Date())}`;
return generateEmbed({
title: "Mojang Status",

11
src/common/time-utils.ts Normal file

@ -0,0 +1,11 @@
import moment from "moment";
/**
* Formats the time
*
* @param time the time to format
* @returns the formatted time
*/
export function formatTime(time: Date): string {
return moment(time).format("lll");
}

@ -1,6 +1,12 @@
import { type ClassValue, clsx } from "clsx"
import { twMerge } from "tailwind-merge"
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
/**
* Merge class values together
*
* @param inputs the class values
* @returns the merged class values
*/
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
return twMerge(clsx(inputs));
}