2025-01-16 10:38:01 +08:00
|
|
|
import HeaderNav from "./_ui/HeaderNav";
|
|
|
|
import SiderNav from "./_ui/SiderNav";
|
2025-01-16 18:30:24 +08:00
|
|
|
import Search from "./_ui/Search";
|
|
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
|
|
import { faArrowRotateBack, faDeafness, faImage, faMagnet, faMessage, faPenClip, faSearch, faThumbsUp, faVideo } from '@fortawesome/free-solid-svg-icons'
|
2025-01-16 10:38:01 +08:00
|
|
|
import { LinkTypeItem } from "./_lib/types";
|
2025-01-16 18:30:24 +08:00
|
|
|
import PosterBox from "./_ui/PosterBox";
|
2025-01-22 17:37:56 +08:00
|
|
|
import { mRequest } from "./_lib/request";
|
|
|
|
import { LinkType } from "./api/linkType/route";
|
|
|
|
import { getCollection } from "./_lib/mongodb";
|
|
|
|
import { Link as _Link } from "./api/link/route";
|
|
|
|
import Link from "next/link";
|
|
|
|
import LinkListBox from "./_ui/LinkListBox";
|
2025-01-16 18:30:24 +08:00
|
|
|
|
|
|
|
export default async function Home() {
|
2025-01-22 17:37:56 +08:00
|
|
|
const collection = await getCollection('link-type')
|
|
|
|
|
|
|
|
const result = (await collection.find<LinkType>({}).toArray())
|
|
|
|
const linkTypeList = result.map(doc => {
|
|
|
|
doc._id = doc._id.toString(); // 将 _id 转换为字符串
|
|
|
|
return doc;
|
|
|
|
});
|
|
|
|
const linkCollect = await getCollection('link')
|
|
|
|
const linkList = (await linkCollect.find<_Link>({}).toArray()).map(doc => {
|
|
|
|
doc._id = doc._id.toString(); // 将 _id 转换为字符串
|
|
|
|
return doc;
|
|
|
|
})
|
2025-01-16 10:38:01 +08:00
|
|
|
|
|
|
|
return (
|
2025-01-16 18:30:24 +08:00
|
|
|
<div className="flex min-h-full w-full font-[family-name:var(--font-geist-sans)] relative">
|
2025-01-22 17:37:56 +08:00
|
|
|
<SiderNav linkList={linkTypeList} />
|
2025-01-16 18:30:24 +08:00
|
|
|
<div className="absolute -z-10 from-[#E6EEF4] h-[50vh] w-full bg-gradient-to-br via-[#F1ECF4] to-[#F5ECEA]">
|
|
|
|
|
|
|
|
<div className="absolute z-10 from-[#F9F9F9] left-0 to-transparent bg-gradient-to-t w-full h-[100px] bottom-[0px]">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<main className="flex-1 relative flex flex-col p-5 gap-y-4">
|
|
|
|
|
2025-01-16 10:38:01 +08:00
|
|
|
<HeaderNav></HeaderNav>
|
|
|
|
<Search></Search>
|
2025-01-16 18:30:24 +08:00
|
|
|
<PosterBox posterList={[]} />
|
2025-01-22 17:37:56 +08:00
|
|
|
<LinkListBox linkList={linkList} linkTypeList={linkTypeList}></LinkListBox>
|
2025-01-16 10:38:01 +08:00
|
|
|
</main>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|