add time uploaded to the paste
All checks were successful
Deploy App / docker (ubuntu-latest) (push) Successful in 1m4s
Publish Docker Image / docker (ubuntu-latest) (push) Successful in 57s

This commit is contained in:
Lee 2024-04-23 21:59:22 +01:00
parent 7b392a4be3
commit e9f63a369d
3 changed files with 17 additions and 5 deletions

@ -21,7 +21,7 @@ type Paste = {
/** /**
* The date the paste was created. * The date the paste was created.
*/ */
created: number; created: string;
/** /**
* The detected language of the paste. * The detected language of the paste.
@ -59,10 +59,13 @@ export async function generateMetadata({
description: "Not found", description: "Not found",
}; };
} }
const created = moment(data.created)
.format("MMMM Do YYYY, h:mm:ss a")
.toString();
return { return {
title: `Paste - ${id}.${data.language}`, title: `Paste - ${id}.${data.language}`,
description: `Created: ${moment(data.created)}\n\nClick to view the paste.`, description: `Created: ${created}\n\nClick to view the paste.`,
}; };
} }
@ -75,11 +78,19 @@ export default async function Paste({
return notFound(); return notFound();
} }
const created = moment(data.created)
.format("MMMM Do YYYY, h:mm:ss a")
.toString();
return ( return (
<div className="relative"> <div className="relative h-full">
<div className="absolute top-0 right-0 flex flex-col items-end mx-3 mt-2"> <div className="absolute top-0 right-0 flex flex-col items-end mx-3 mt-2">
<ActionMenu /> <ActionMenu />
</div>
<div className="absolute right-0 bottom-0 text-right p-1.5">
<p>{data.language}</p> <p>{data.language}</p>
<p>{created}</p>
</div> </div>
<div className="p-1 hljs !bg-transparent text-sm"> <div className="p-1 hljs !bg-transparent text-sm">

@ -60,7 +60,7 @@ export default function Home(): ReactElement {
/> />
</div> </div>
<div className="absolute top-0 right-0 mx-3 mt-2"> <div className="absolute top-0 right-0 mx-3 mt-2 ">
<ActionMenu> <ActionMenu>
<Button onClick={() => createPaste()} className="flex gap-1"> <Button onClick={() => createPaste()} className="flex gap-1">
{creating && ( {creating && (

@ -4,6 +4,7 @@ import { ThemeProvider } from "@/app/components/theme-provider";
import { ReactNode } from "react"; import { ReactNode } from "react";
import { jetbrainsMono } from "@/app/common/font/font"; import { jetbrainsMono } from "@/app/common/font/font";
import { Toaster } from "@/app/components/ui/toaster"; import { Toaster } from "@/app/components/ui/toaster";
import { cn } from "@/app/common/utils";
export const metadata: Metadata = { export const metadata: Metadata = {
title: "Paste", title: "Paste",
@ -17,7 +18,7 @@ export default function RootLayout({
}>) { }>) {
return ( return (
<html lang="en"> <html lang="en">
<body className={jetbrainsMono.className}> <body className={cn(jetbrainsMono.className, "w-screen h-screen")}>
<Toaster /> <Toaster />
<ThemeProvider <ThemeProvider
attribute="class" attribute="class"