2023-11-22 11:59:45 +00:00
|
|
|
import {redirect} from "next/navigation"
|
|
|
|
import { headers } from 'next/headers'
|
2023-11-22 11:27:11 +00:00
|
|
|
import Feed from "@/components/Feed"
|
2023-11-10 17:17:30 +00:00
|
|
|
import SearchBar from "@/components/SearchBar"
|
2023-11-10 13:34:04 +00:00
|
|
|
|
2023-11-22 11:59:45 +00:00
|
|
|
type Props = {
|
|
|
|
searchParams?: {
|
|
|
|
q?: string | undefined
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export default function Home({searchParams}: Props) {
|
|
|
|
const headerList = headers()
|
|
|
|
const referer = headerList.get("referer")
|
|
|
|
|
|
|
|
if(!referer && searchParams?.q) {
|
|
|
|
redirect(`/search?q=${searchParams.q}`)
|
|
|
|
}
|
|
|
|
|
2023-11-10 13:34:04 +00:00
|
|
|
return (
|
2023-11-14 15:52:42 +00:00
|
|
|
<>
|
2023-11-10 17:17:30 +00:00
|
|
|
<SearchBar />
|
2023-11-15 09:35:32 +00:00
|
|
|
<div className="space-y-8 w-full my-10">
|
|
|
|
<div className="flex flex-row flex-wrap justify-between w-full">
|
2023-11-22 11:27:11 +00:00
|
|
|
<Feed
|
|
|
|
title="Latest from the community"
|
|
|
|
icon={'paper-icon'}
|
2023-11-22 11:59:45 +00:00
|
|
|
className="w-[calc(33%-20px)] max-w-md"
|
2023-11-22 11:27:11 +00:00
|
|
|
/>
|
|
|
|
<Feed
|
|
|
|
title="Rising Posts"
|
|
|
|
icon={'trend-up-icon'}
|
2023-11-22 11:59:45 +00:00
|
|
|
className="w-[calc(33%-20px)] max-w-md"
|
2023-11-22 11:27:11 +00:00
|
|
|
/>
|
|
|
|
<Feed
|
|
|
|
title="Top Posts"
|
|
|
|
icon={'top-arrow-icon'}
|
2023-11-22 11:59:45 +00:00
|
|
|
className="w-[calc(33%-20px)] max-w-md"
|
2023-11-22 11:27:11 +00:00
|
|
|
/>
|
2023-11-15 09:35:32 +00:00
|
|
|
</div>
|
2023-11-22 11:27:11 +00:00
|
|
|
<Feed
|
|
|
|
title="Another heading"
|
|
|
|
icon={'trend-up-icon'}
|
|
|
|
className="w-full"
|
|
|
|
/>
|
2023-11-10 13:34:04 +00:00
|
|
|
</div>
|
2023-11-14 15:52:42 +00:00
|
|
|
</>
|
2023-11-10 17:17:30 +00:00
|
|
|
)
|
2023-11-22 11:27:11 +00:00
|
|
|
}
|