This repository has been archived on 2024-06-01. You can view files and clone it, but cannot push or open issues or pull requests.
Liam d50242b96e
All checks were successful
Deploy App / docker (ubuntu-latest) (push) Successful in 1m4s
Publish Docker Image / docker (ubuntu-latest) (push) Successful in 53s
add comments to the html and use text-xs on the main page
2024-04-24 18:29:29 +01:00

48 lines
1.2 KiB
TypeScript

import React, { ReactElement } from "react";
import { ActionMenu } from "@/app/components/action-menu";
import { Metadata } from "next";
import { notFound } from "next/navigation";
import { Button } from "@/app/components/ui/button";
import Link from "next/link";
import {
generatePasteMetadata,
getPaste,
type Paste,
} from "@/app/common/pastes";
import { PastePageProps } from "@/app/types/paste-page";
export async function generateMetadata({
params: { id },
}: PastePageProps): Promise<Metadata> {
return generatePasteMetadata(id);
}
export default async function Paste({
params: { id },
}: PastePageProps): Promise<ReactElement> {
const data: Paste | undefined = await getPaste(id);
if (data == undefined) {
return notFound();
}
return (
<div className="relative h-full">
{/* Action Menu */}
<ActionMenu>
<Link href={"/"}>
<Button>New</Button>
</Link>
<Link href={`/${id}`}>
<Button>Formated</Button>
</Link>
</ActionMenu>
{/* Paste Content */}
<div className="p-1 hljs !bg-transparent text-sm">
<code>{data.content}</code>
</div>
</div>
);
}