Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions app/[contentType]/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import { allDocs } from 'contentlayer/generated'
const contentType = 'events'

interface PageProps {
params: {
params: Promise<{
slug: string
contentType: string
}
}>
}

type Args = {
Expand All @@ -31,10 +31,11 @@ async function getDocFromParams(params: Args) {
}

const page = async ({ params }: PageProps) => {
const { post, data } = await getDocFromParams(params)
const resolvedParams = await params
const { post, data } = await getDocFromParams(resolvedParams)

if (params.contentType === contentType && data === undefined)
console.log(`No summary generated for ${params.slug}`)
if (resolvedParams.contentType === contentType && data === undefined)
console.log(`No summary generated for ${resolvedParams.slug}`)

if (!post) {
return <div>404 sorry you poor bitdev</div>
Expand All @@ -48,14 +49,14 @@ const page = async ({ params }: PageProps) => {
<header className="font-sans flex flex-col gap-2">
<h1 className="text-4xl font-black">{post.title}</h1>
<time className="text-2xl text-gray-500">{post.date}</time>
{params.contentType === 'posts' ? (
{resolvedParams.contentType === 'posts' ? (
<p className="text-xl flex flex-row gap-2 items-center">
{post.author}
</p>
) : (
``
)}
{params.contentType === 'events' ? (
{resolvedParams.contentType === 'events' ? (
<p className="text-xl flex flex-row gap-2 items-center">
{post.meetupLink ? (
<>
Expand All @@ -70,7 +71,7 @@ const page = async ({ params }: PageProps) => {
``
)}
</header>
{params.contentType === 'events' ? (
{resolvedParams.contentType === 'events' ? (
<nav>
{/* <ul className="list-disc font-sans">
<li>Content Outline</li>
Expand Down Expand Up @@ -98,7 +99,7 @@ const page = async ({ params }: PageProps) => {

<Mdx
code={post.body.code}
slug={params.slug}
slug={resolvedParams.slug}
jsonData={data}
page={false}
/>
Expand Down
11 changes: 6 additions & 5 deletions app/[contentType]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@ import {
import PostPreview from '@/components/PostPreview'

type PageProps = {
params: {
params: Promise<{
contentType: ContentType
}
}>
}
export default function Page({ params }: PageProps) {
const { contentType } = params
export default async function Page({ params }: PageProps) {
const resolvedParams = await params
const { contentType } = resolvedParams
const allContentData = getSortedMarkdownContent(contentType)

return (
<main className="flex min-h-screen flex-col items-center justify-between p-24">
<div className="flex flex-col gap-10 border-b border-b-400 py-10">
<h2 className="text-center">{params.contentType.toUpperCase()}</h2>
<h2 className="text-center">{resolvedParams.contentType.toUpperCase()}</h2>

{allContentData.map(({ id, date, title }, i) => (
<PostPreview
Expand Down
13 changes: 7 additions & 6 deletions app/page/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import { getPageContentFromMarkdown } from '@/lib/parse-markdown-files'
const contentType = 'page'

interface PageProps {
params: {
params: Promise<{
slug: string
contentType: string
}
}>
}

type Args = {
Expand All @@ -35,12 +35,13 @@ async function getDocFromParams(params: Args) {
}

const page = async ({ params }: PageProps) => {
console.log('params [id]/page.tsx: ', params)
const resolvedParams = await params
console.log('params [id]/page.tsx: ', resolvedParams)
const currentPageData = getPageContentFromMarkdown().filter(
(page: any) => page.id === params.slug,
(page: any) => page.id === resolvedParams.slug,
)[0]
// console.log('currentPageData: ', currentPageData)
const { post, data } = await getDocFromParams(params)
const { post, data } = await getDocFromParams(resolvedParams)

if (!post) {
return <div>Watermelon 404 sorry you poor bitdev</div>
Expand All @@ -51,7 +52,7 @@ const page = async ({ params }: PageProps) => {
<article className="flex flex-row w-full">
<div className="container mx-auto max-w-5xl p-4 flex flex-col gap-4">
<h1 className="text-4xl font-black">{post.title}</h1>
<Mdx code={post.body.code} slug={params.slug} page={true} />
<Mdx code={post.body.code} slug={resolvedParams.slug} page={true} />
</div>
</article>
</main>
Expand Down
9 changes: 5 additions & 4 deletions components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@ import './Header.css'
import MeetupName from '../MeetupName'
import { ThemeSwitcher } from '../ThemeSwitcher'
import { meetup } from '@/meetup'
import Link from 'next/link'

const Header = () => {
return (
<header className="header w-full p-6 flex flex-row justify-between font-sans sticky top-0 left-0 bg-white z-50 drop-shadow-header dark:drop-shadow-header-dark dark:bg-neutral-900">
<h1 className="font-black text-2xl">
<a href="/" className="no-underline">
<Link href="/" className="no-underline">
<MeetupName />
</a>
</Link>
</h1>
<nav>
<ul className="flex flex-row gap-4 font-semibold items-center">
{meetup.mainNav.map((item) => (
<li key={item.text} className="">
<a href={item.link} className="no-underline">
<Link href={item.link} className="no-underline">
{item.text}
</a>
</Link>
</li>
))}
<ThemeSwitcher />
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@
"@bitcoin-design/bitcoin-icons-react": "^0.1.9",
"@heroicons/react": "^2.0.18",
"@types/node": "20.4.1",
"@types/react": "18.2.14",
"@types/react-dom": "18.2.6",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"autoprefixer": "10.4.14",
"clsx": "^2.0.0",
"contentlayer": "^0.3.4",
"eslint": "8.44.0",
"eslint-config-next": "13.4.9",
"eslint-config-next": "^15.3.8",
"gray-matter": "^4.0.3",
"ignore": "^5.2.4",
"langchain": "^0.0.112",
"marked": "^6.0.0",
"marked-mangle": "^1.1.0",
"next": "13.4.9",
"next": "^15.3.8",
"next-contentlayer": "^0.3.4",
"next-themes": "^0.2.1",
"path": "^0.12.7",
"postcss": "8.4.25",
"react": "18.2.0",
"react-dom": "18.2.0",
"react": "^19.2.3",
"react-dom": "^19.2.3",
"rehype-autolink-headings": "^6.1.1",
"rehype-pretty-code": "^0.10.0",
"rehype-slug": "^5.1.0",
Expand Down
Loading