File: {fileDetails.name}
+Size: {(fileDetails.size / 1024).toFixed(2)} KB
+Uploaded by: {fileDetails.owner}
+From 52c1961ddfda09cccbe5519b5755ac3cb39c1ba7 Mon Sep 17 00:00:00 2001 From: ZareMate <0.zaremate@gmail.com> Date: Tue, 15 Apr 2025 08:56:41 +0200 Subject: [PATCH] test of the new embed system --- src/app/share/[id].tsx | 53 ++++++++++++++++++++++++++++++++++++++++++ src/app/share/page.tsx | 11 +++++++++ 2 files changed, 64 insertions(+) create mode 100644 src/app/share/[id].tsx diff --git a/src/app/share/[id].tsx b/src/app/share/[id].tsx new file mode 100644 index 0000000..81c88b2 --- /dev/null +++ b/src/app/share/[id].tsx @@ -0,0 +1,53 @@ +// pages/share/[id].tsx + +import Head from "next/head"; +import { GetServerSideProps } from "next"; + +interface FileDetails { + name: string; + size: number; + owner: string; + uploadDate: string; + id: string; + url: string; +} + +export const getServerSideProps: GetServerSideProps = async (context) => { + const id = context.query.id as string; + + const res = await fetch(`${process.env.NEXT_PUBLIC_BASE_URL}/api/share?id=${id}`); + if (!res.ok) { + return { + notFound: true, + }; + } + + const fileDetails: FileDetails = await res.json(); + + return { + props: { + fileDetails, + }, + }; +}; + +export default function SharePage({ fileDetails }: { fileDetails: FileDetails }) { + return ( + <> +
+Size: {(fileDetails.size / 1024).toFixed(2)} KB
+Uploaded by: {fileDetails.owner}
+