Skip to content

Commit

Permalink
Merge pull request #689 from IgorKowalczyk/loading
Browse files Browse the repository at this point in the history
Fix client-side errors, remove old API routes, fix photography page, refactor components
  • Loading branch information
IgorKowalczyk authored Dec 12, 2023
2 parents 0639576 + 8fb59be commit d0c8b14
Show file tree
Hide file tree
Showing 33 changed files with 75 additions and 482 deletions.
104 changes: 0 additions & 104 deletions app/api/github/repositories/list/route.js

This file was deleted.

17 changes: 0 additions & 17 deletions app/api/github/repositories/popular/route.js

This file was deleted.

52 changes: 0 additions & 52 deletions app/api/github/user/contributions/[...year]/route.js

This file was deleted.

17 changes: 0 additions & 17 deletions app/api/github/user/contributions/route.js

This file was deleted.

17 changes: 0 additions & 17 deletions app/api/github/user/contributions/years/route.js

This file was deleted.

17 changes: 0 additions & 17 deletions app/api/github/user/route.js

This file was deleted.

6 changes: 5 additions & 1 deletion app/api/og/repository/[owner]/[repository]/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import { ImageResponse } from "next/og";

export const runtime = "edge";
export const contentType = "image/png";
export const revalidate = 60 * 60 * 24 * 7 // 7 days
export const alt = "Repository";
export const size = {
width: 1200,
height: 630,
};

export async function GET(request, { params }) {
const start = Date.now();
Expand Down
15 changes: 0 additions & 15 deletions app/api/photography/route.js

This file was deleted.

12 changes: 0 additions & 12 deletions app/api/technologies/route.js

This file was deleted.

9 changes: 2 additions & 7 deletions app/blog/[slug]/opengraph-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,21 @@ import { redirect } from "next/navigation";
import { ImageResponse } from "next/og";

export const runtime = "edge";

export const contentType = "image/png";
export const alt = meta.title;

export const size = {
width: 1200,
height: 630,
};

export const contentType = "image/png";

export default async function Image({ params }) {
const { slug } = params;
const post = allBlogs.find((post) => post.slug === slug);

const fontBold = await fetch(new URL("/public/fonts/Geist-Black.otf", import.meta.url)).then((res) => res.arrayBuffer());
const fontRegular = await fetch(new URL("/public/fonts/Geist-Regular.otf", import.meta.url)).then((res) => res.arrayBuffer());

if (!post) {
return redirect("/opengraph-image");
}
if (!post) return redirect("/opengraph-image");

return new ImageResponse(
(
Expand Down
4 changes: 1 addition & 3 deletions app/blog/[slug]/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ export async function generateMetadata({ params }) {
export default function Post({ params }) {
const post = allBlogs.find((post) => post?.slug === params?.slug);

if (!post) {
return notFound();
}
if (!post) return notFound();

return (
<article className="mx-auto mb-16 flex min-h-screen w-full max-w-2xl flex-col items-start justify-center">
Expand Down
3 changes: 1 addition & 2 deletions app/blog/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import Link from "next/link";
import { CalendarIcon } from "@heroicons/react/24/solid";
import { parseISO } from "/lib/utils";

export const runtime = "edge";

export default function Blog() {
const posts = allBlogs.map((post) => pick(post, ["slug", "title", "summary", "publishedAt"])).sort((a, b) => Number(new Date(b.publishedAt)) - Number(new Date(a.publishedAt)));

return (
<div className="mx-auto mb-16 flex max-w-2xl flex-col items-start justify-center">
<h1 className="mb-4 flex items-center justify-center box-decoration-clone bg-clip-text text-center text-[2rem] font-semibold motion-reduce:transition-none">
Expand Down
2 changes: 0 additions & 2 deletions app/contact/page.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { Contact } from "components/client/Contact";
import { Dots, Squares } from "components/Decorations";

export const runtime = "edge";

export const metadata = {
title: "Contact",
};
Expand Down
11 changes: 2 additions & 9 deletions app/error.jsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
"use client";

import { ExclamationTriangleIcon } from "@heroicons/react/24/outline";
import Button from "components/Button";
import Balancer from "react-wrap-balancer";

export default function Error({ error, reset }) {
export default function Error({ error }) {
return (
<div className="-mt-24 flex min-h-screen flex-1 flex-col items-center justify-center px-8">
<div className="max-w-4xl rounded-md border border-neutral-200 px-9 py-6 shadow-2xl duration-200 motion-reduce:transition-none dark:border-neutral-800 dark:bg-[#161617]">
<div className="mx-auto mb-3 w-fit rounded-full border border-neutral-200 p-3 dark:border-neutral-800">
<ExclamationTriangleIcon className="h-10 w-10 text-red-500" />
</div>
<h1 className="mx-0 mt-0 bg-gradient-to-r from-[#ff7170] to-[#ffe57f] box-decoration-clone bg-clip-text text-center text-3xl font-semibold text-fill-transparent">Ughh, an unexpected error!</h1>
<p className="mt-3 text-center text-neutral-800 dark:text-neutral-200">
<Balancer ratio={0.5}>{error.message.toString() || "Oh no, something went wrong... maybe refresh?"}</Balancer>
</p>
<Button onClick={() => reset()} className="mx-auto">
Reset app
</Button>
<p className="mt-3 text-center text-neutral-800 dark:text-neutral-200">{error.message.toString() || "Oh no, something went wrong... maybe you should refresh the page?"}</p>
</div>
</div>
);
Expand Down
2 changes: 0 additions & 2 deletions app/feed/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { allBlogs } from "contentlayer/generated";
import { NextResponse } from "next/server";
import { meta } from "/config";

export const runtime = "edge";

export async function GET() {
return new NextResponse(
`<?xml version="1.0" encoding="utf-8"?>
Expand Down
Loading

0 comments on commit d0c8b14

Please sign in to comment.