Skip to content

Commit

Permalink
Switch back to Edge Runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
noobnooc committed Mar 18, 2024
1 parent 495efac commit 06b2e50
Show file tree
Hide file tree
Showing 15 changed files with 73 additions and 392 deletions.
2 changes: 2 additions & 0 deletions app/[lang]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import avatar from "../../public/avatar.png";
import Link from "next/link";
import { dictionaryKeys, getDictionary } from "../../dictionaries";

export const runtime = "edge";

export async function generateMetadata({
params,
}: {
Expand Down
142 changes: 0 additions & 142 deletions app/[lang]/opengraph-image.back.tsx

This file was deleted.

124 changes: 45 additions & 79 deletions app/[lang]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { getDictionary } from "@/dictionaries";
import Link from "next/link";
import { PencilIcon } from "@heroicons/react/24/solid";

export const runtime = "edge";

function Title({
className,
children,
Expand Down Expand Up @@ -62,97 +64,61 @@ export default async function Home({
return (
<main className="mx-auto flex w-full max-w-screen-lg flex-col gap-4 px-4 py-8">
<div className="grid relative grid-cols-1 sm:gap-8 sm:grid-cols-2">
<div className="flex flex-col gap-4 sm:gap-8 sm:sticky sm:top-10">
<ProfileCard
className="bottom-0 aspect-auto sm:aspect-square"
motto={dictionary.meta.motto}
bio={dictionary.meta.bio}
/>
<div>
<Label className="col-span-2 mb-4">
{dictionary.labels.contactMe}
</Label>
<div className="grid grid-cols-2 gap-4 sm:gap-8">
{dictionary.contacts.map((contact) => (
<ProfileCard
className="bottom-0 aspect-auto sm:aspect-square"
motto={dictionary.meta.motto}
bio={dictionary.meta.bio}
/>
<div>
<Label className="col-span-2 mt-8 mb-4 sm:hidden">
{dictionary.labels.doing}
</Label>
<div className="grid grid-cols-2 gap-4 sm:gap-8 self-start">
{dictionary.works
.filter((work) => work.primary)
.map((work) => (
<Card
key={contact.name}
className="flex justify-between bg-white/50 dark:bg-indigo-100/5"
link={contact.link}
key={work.name}
className={twMerge(
"relative flex aspect-square flex-col gap-2 sm:gap-4",
`bg-${work.color}-300/10 dark:bg-${work.color}-400/10`,
)}
link={work.link}
>
<div className="flex flex-col">
<Title className="">{contact.label}</Title>
<Subtitle>{contact.name}</Subtitle>
<div className="flex gap-2 sm:gap-4">
<Image
className="h-10 w-10 sm:h-20 sm:w-20 rounded-xl"
src={work.image!}
alt={dictionary.labels.icon(work.name)}
/>
<div className="flex flex-col">
<Title className="text-md">{work.name}</Title>
<div className="opacity-50 text-xs sm:text-sm">
{new URL(work.link).host}
</div>
</div>
</div>
<contact.icon className="self-center h-6 w-6 sm:h-10 sm:w-10 opacity-50" />
<Subtitle className="">{work.summary}</Subtitle>
</Card>
))}
</div>
</div>
</div>
<Label className="col-span-2 mt-8 mb-4 sm:hidden">
{dictionary.labels.doing}
</Label>
<div className="grid grid-cols-2 gap-4 sm:gap-8 self-start">
{dictionary.works
.filter((work) => work.primary)
.map((work) => (
<div className="col-span-2">
<Label className="mb-4">{dictionary.labels.contactMe}</Label>
<div className="grid grid-cols-2 sm:grid-cols-4 gap-4 sm:gap-8">
{dictionary.contacts.map((contact) => (
<Card
key={work.name}
className={twMerge(
"relative flex aspect-square flex-col gap-2 sm:gap-4",
`bg-${work.color}-300/10 dark:bg-${work.color}-400/10`,
)}
link={work.link}
key={contact.name}
className="flex justify-between bg-white/50 dark:bg-indigo-100/5"
link={contact.link}
>
<div className="flex gap-2 sm:gap-4">
<Image
className="h-10 w-10 sm:h-20 sm:w-20 rounded-xl"
src={work.image!}
alt={dictionary.labels.icon(work.name)}
/>
<div className="flex flex-col">
<Title className="text-md">{work.name}</Title>
<div className="opacity-50 text-xs sm:text-sm">
{new URL(work.link).host}
</div>
</div>
<div className="flex flex-col">
<Title className="">{contact.label}</Title>
<Subtitle>{contact.name}</Subtitle>
</div>
<Subtitle className="">{work.summary}</Subtitle>
<contact.icon className="self-center h-6 w-6 sm:h-10 sm:w-10 opacity-50" />
</Card>
))}

<div className="col-span-2">
<Label className="col-span-2 mb-4">
{dictionary.labels.writing}
</Label>
<div className="grid grid-cols-2 gap-4 sm:gap-8">
<Card>
<Link
className="flex aspect-square flex-col"
href={dictionary.urls.posts}
>
<PencilIcon className="mb-auto box-border h-12 w-12 self-end rounded-lg border bg-black p-3 text-white sm:h-16 sm:w-16" />
<Subtitle>nooc.me/posts</Subtitle>
<Title className="">{dictionary.labels.posts}</Title>
</Link>
</Card>
<Card
className="flex aspect-square flex-col bg-red-300/10 dark:bg-red-400/10"
link="https://subnooc.com"
>
<Image
className="mb-auto h-12 w-12 self-end rounded-lg border sm:h-16 sm:w-16"
alt="Subnooc Icon"
width="256"
height={256}
src={subnooc}
/>
<Subtitle>subnooc.com</Subtitle>
<Title className="text-red-500">
{dictionary.labels.subnooc}
</Title>
</Card>
</div>
</div>
</div>
</div>
Expand Down
13 changes: 8 additions & 5 deletions app/[lang]/posts/[...slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import { getDictionary, languageLabels } from "@/dictionaries";
import { SiX } from "@icons-pack/react-simple-icons";
import { Metadata } from "next";
import { MDXContent } from "@/components/mdx-components";
import classNames from "classnames";

export const runtime = "edge";

export async function generateMetadata({
params,
Expand Down Expand Up @@ -94,11 +97,11 @@ export default async function PostPage({
) : undefined}
</div>
<p className="opacity-70 mt-2">{post.description}</p>
<hr className="my-4" />
<div className="leading-loose flex flex-col gap-4">
<hr className="mt-4" />
{/* <div className="leading-loose flex flex-col gap-4">
<MDXContent code={post.content} />
</div>
{/* <div
</div> */}
<div
className={classNames(
"prose dark:prose-invert",
"prose-headings:font-serif prose-headings:mt-8",
Expand All @@ -109,7 +112,7 @@ export default async function PostPage({
"before:prose-p:content-none after:prose-p:content-none",
)}
dangerouslySetInnerHTML={{ __html: post.content }}
></div> */}
></div>
<hr className="my-8" />
<div className="flex items-center gap-4">
<span className="opacity-50">{dictionary.labels.shareTo}</span>
Expand Down
4 changes: 3 additions & 1 deletion app/[lang]/posts/categories/[categorySlug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { Metadata } from "next";
import { notFound } from "next/navigation";
import { displayDate } from "@/lib/date";

export const runtime = "edge";

export async function generateMetadata({
params,
}: {
Expand Down Expand Up @@ -85,7 +87,7 @@ export default async function CategoryPostsPage({
))}
</ul>
<section className="basis-1/4 sticky top-28 border rounded-3xl p-4 flex-col">
<div className="opacity-50 mb-4">{category.name[params.lang]}</div>
<div className="opacity-50 mb-2">{category.name[params.lang]}</div>
<div>{category.description?.[params.lang]}</div>
</section>
</main>
Expand Down
4 changes: 3 additions & 1 deletion app/[lang]/posts/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { displayDate } from "../../../lib/date";
import { Language, getDictionary } from "@/dictionaries";
import { Metadata } from "next";

export const runtime = "edge";

export async function generateMetadata({
params,
}: {
Expand Down Expand Up @@ -66,7 +68,7 @@ export default async function PostsPage({
))}
</ul>
<section className="basis-1/4 sticky top-28 border rounded-3xl p-4 flex-col">
<div className="opacity-50 mb-4">{dictionary.labels.categories}</div>
<div className="opacity-50 mb-2">{dictionary.labels.categories}</div>
<ol className="underline">
{categories.map((category) => (
<li key={category.slug}>
Expand Down
Loading

0 comments on commit 06b2e50

Please sign in to comment.