1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-03 14:06:40 -04:00

consistent arrow functions

This commit is contained in:
2025-03-12 18:10:11 -04:00
parent 6a57fde2f1
commit e61ca889a7
39 changed files with 121 additions and 126 deletions

View File

@ -8,7 +8,7 @@ import Loading from "../../../components/Loading";
import HitCounter from "./counter";
import { getPostSlugs, getFrontMatter } from "../../../lib/helpers/posts";
import { metadata as defaultMetadata } from "../../layout";
import config from "../../../lib/config/constants";
import config from "../../../lib/config";
import type { Metadata, Route } from "next";
import type { Article, WithContext } from "schema-dts";
@ -20,16 +20,16 @@ export const dynamicParams = false;
// https://nextjs.org/docs/app/building-your-application/rendering/partial-prerendering#using-partial-prerendering
export const experimental_ppr = true;
export async function generateStaticParams() {
export const generateStaticParams = async () => {
const slugs = await getPostSlugs();
// map slugs into a static paths object required by next.js
return slugs.map((slug) => ({
slug,
}));
}
};
export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }): Promise<Metadata> {
export const generateMetadata = async ({ params }: { params: Promise<{ slug: string }> }): Promise<Metadata> => {
const { slug } = await params;
const frontmatter = await getFrontMatter(slug);
@ -54,9 +54,9 @@ export async function generateMetadata({ params }: { params: Promise<{ slug: str
canonical: `/notes/${slug}`,
},
};
}
};
export default async function Page({ params }: { params: Promise<{ slug: string }> }) {
const Page = async ({ params }: { params: Promise<{ slug: string }> }) => {
const { slug } = await params;
const frontmatter = await getFrontMatter(slug);
@ -153,4 +153,6 @@ export default async function Page({ params }: { params: Promise<{ slug: string
)}
</>
);
}
};
export default Page;

View File

@ -1,7 +1,7 @@
import Link from "../../components/Link";
import Time from "../../components/Time";
import { getAllPosts } from "../../lib/helpers/posts";
import config from "../../lib/config/constants";
import config from "../../lib/config";
import { metadata as defaultMetadata } from "../layout";
import type { ReactElement } from "react";
import type { Metadata, Route } from "next";
@ -23,7 +23,7 @@ export const metadata: Metadata = {
},
};
export default async function Page() {
const Page = async () => {
// parse the year of each note and group them together
const notes = await getAllPosts();
const notesByYear: {
@ -58,5 +58,7 @@ export default async function Page() {
// grouped posts enter this component ordered chronologically -- we want reverse chronological
const reversed = sections.reverse();
return <>{reversed}</>;
}
return reversed;
};
export default Page;