2024-09-16 19:44:19 +00:00
|
|
|
import type { Metadata, ResolvingMetadata } from 'next';
|
|
|
|
import Image from 'next/image';
|
|
|
|
|
|
|
|
import Content from './content';
|
2024-09-16 20:02:13 +00:00
|
|
|
import * as style from './page.css';
|
2024-09-16 20:03:02 +00:00
|
|
|
import download_image from './download.svg';
|
2024-09-16 19:44:19 +00:00
|
|
|
|
|
|
|
type SearchParams = { [key: string]: string | string[] | undefined };
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
params: { file: string },
|
|
|
|
searchParams: SearchParams,
|
|
|
|
};
|
|
|
|
|
2024-09-16 19:57:33 +00:00
|
|
|
function get_path(file: string[]) {
|
|
|
|
return file.join("/");
|
|
|
|
}
|
|
|
|
|
2024-09-16 19:44:19 +00:00
|
|
|
function get_root(search_params: SearchParams) {
|
|
|
|
return search_params['root'] ?? 'raw.monodon.me';
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function generateMetadata(
|
|
|
|
{ params, searchParams }: Props,
|
|
|
|
parent: ResolvingMetadata,
|
|
|
|
): Promise<Metadata> {
|
|
|
|
return {
|
2024-09-16 19:57:33 +00:00
|
|
|
title: `${get_path(params.file)} | ${get_root(searchParams)}`,
|
2024-09-16 19:44:19 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export default async function Page({
|
|
|
|
params, searchParams
|
|
|
|
}: Props) {
|
2024-09-16 20:02:13 +00:00
|
|
|
const path = get_path(params.file);
|
|
|
|
const root = `https://${get_root(searchParams)}/`;
|
2024-09-16 19:44:19 +00:00
|
|
|
|
|
|
|
return (
|
2024-09-16 20:02:13 +00:00
|
|
|
<div className={style.root}>
|
|
|
|
<div className={style.center}>
|
|
|
|
<div className={style.title_group}>
|
|
|
|
<div className={style.title_text_group}>
|
|
|
|
<p className={style.supertitle}>{root}</p>
|
|
|
|
<p className={style.title}>{path}</p>
|
2024-09-16 19:44:19 +00:00
|
|
|
</div>
|
2024-09-16 20:02:13 +00:00
|
|
|
<button className={style.download_button}>
|
2024-09-16 19:44:19 +00:00
|
|
|
<Image
|
2024-09-16 20:02:13 +00:00
|
|
|
className={style.download_button_image}
|
2024-09-16 19:44:19 +00:00
|
|
|
src={download_image}
|
|
|
|
alt="Download Button"
|
|
|
|
/>
|
|
|
|
</button>
|
|
|
|
</div>
|
2024-09-16 20:02:13 +00:00
|
|
|
<Content src={`${root}${path}`} />
|
2024-09-16 19:44:19 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|