-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Upgraded NextAuth.js & Prisma * Upgraded TailwindCSS to v3 * Removed TailwindCSS `mode` as `jit` is now default * Minor TailwindCSS config migration tweaks * Purged `transform` class usage * Added currentColor to TailwindCSS theme colors https://tailwindcss.com/docs/upgrade-guide#fill-and-stroke-use-color-palette * Added TypeScript to dev dependencies * Added initial TypeScript config * Added next-env.d.ts * Initial TypeScript migration * Upgraded all neccessary packages + moved Prettier to dev dependency * Updated package-lock.json * Updated packae-lock.json * Added shared fetcher * Initial components TypeScript overhaul * Added @types/js-cookie * Added @types import path alias * Deleted jsconfig.json * Added initial Cloudinary TypeScript support * Fixed app layout optional prop * Added method validation to all "save" endpoints * Updated package-lock.json * Removed console.log * Minor cloudinary type fixes * Fixed cloudinary mouse event type * Console.log tweaks * Fixed NextAuth.js session user id/username * Migrated app index/login page to TypeScript * Added initial sites [slug] page TypeScript migration * Added initial sites index page migration to TypeScript * Migrated domain card component to TypeScript * Cleaned up app settings page user session type * Improved API endpoints error handling * Added reusable UserSettings type * Removed array-to-image dependency * Upgraded save-image function to TypeScript * Added custom NextAuth type declarations Overrides default Session & User interfaces to add additional id & username properties * Improved middleware error handling * Fixed image placeholder * Minor TODO fixes * Minor type tweaks / fixes * Fixed multiple types / TODO's * Updated API endpoints to new structure following #25 * Moved method logic handling to lib directory vercel/platforms#25 (comment) * Added HttpMethod enum * Cleaned up API domain structure * Removed old domain endpoints * refactor: refactor app/post to typescript Refactor the postId & settings pages to use tsx * refactor: address PR comments * Minor cleanup * Minor cleanup * Migrated site/[id] pages to TypeScript * Updated HTTP methods to use enum * Fixed nested anchor element errors using passHref * Fixed login page svg error * Migrated remark plugins to TypeScript * Added initial Twitter types * Migrated Twitter media to TypeScript * Migrated Twitter lib function(s) to TypeScript * Migrated sites layout component to TypeScript * Migrate Tweet.js to Typescript * Updated OAuth env vars check to use GitHub * Code review fixes * Minor tweaks / fixes * Fixed format:write script * Minor cleanup * Fix security issue (#54) * Removed old post/site JS api endpoints * Fixed image upload bug * Added @type & disabled swcMinify in Next.js config * minor fixes * Fixes from main branch merge * Cleaned up revalidate function * update to latest API * removed some .js files * Cleaned up middleware * bug: Remove leaked Post type from prisma client * Added error toast to post index page * Refactored getStatic props to export types * Fixed Prisma client leak bug * fixed a few small changes * fixed some type issues * Update _middleware.ts Co-authored-by: Cillian Barron <[email protected]> Co-authored-by: Francisco Hanna <[email protected]> Co-authored-by: Steven Tey <[email protected]>
- Loading branch information
1 parent
a1dd8e6
commit 327dfa1
Showing
92 changed files
with
2,997 additions
and
1,416 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import Link from "next/link"; | ||
import BlurImage from "./BlurImage"; | ||
import Date from "./Date"; | ||
|
||
import type { Post } from "@prisma/client"; | ||
|
||
interface BlogCardProps { | ||
data: Pick< | ||
Post, | ||
"slug" | "image" | "imageBlurhash" | "title" | "description" | "createdAt" | ||
>; | ||
} | ||
|
||
export default function BlogCard({ data }: BlogCardProps) { | ||
return ( | ||
<Link href={`/${data.slug}`}> | ||
<a> | ||
<div className="rounded-2xl border-2 border-gray-100 overflow-hidden shadow-md bg-white hover:shadow-xl hover:-translate-y-1 transition-all ease duration-200"> | ||
{data.image ? ( | ||
<BlurImage | ||
src={data.image} | ||
alt={data.title ?? "Blog "} | ||
width={500} | ||
height={400} | ||
layout="responsive" | ||
objectFit="cover" | ||
placeholder="blur" | ||
blurDataURL={data.imageBlurhash ?? undefined} | ||
/> | ||
) : ( | ||
<div className="absolute flex items-center justify-center w-full h-full bg-gray-100 text-gray-500 text-4xl select-none"> | ||
? | ||
</div> | ||
)} | ||
<div className="py-8 px-5 h-36 border-t border-gray-200"> | ||
<h3 className="font-cal text-xl tracking-wide">{data.title}</h3> | ||
<p className="text-md italic text-gray-600 my-2 truncate"> | ||
{data.description} | ||
</p> | ||
<p className="text-sm text-gray-600 my-2"> | ||
Published <Date dateString={data.createdAt.toString()} /> | ||
</p> | ||
</div> | ||
</div> | ||
</a> | ||
</Link> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import Head from "next/head"; | ||
|
||
import type { MouseEvent, ReactNode } from "react"; | ||
import type { | ||
CloudinaryCallbackImage, | ||
CloudinaryWidget, | ||
CloudinaryWidgetResult, | ||
} from "@/types"; | ||
|
||
interface ChildrenProps { | ||
open: (e: MouseEvent) => void; | ||
} | ||
|
||
interface CloudinaryUploadWidgetProps { | ||
callback: (image: CloudinaryCallbackImage) => void; | ||
children: (props: ChildrenProps) => ReactNode; | ||
} | ||
|
||
export default function CloudinaryUploadWidget({ | ||
callback, | ||
children, | ||
}: CloudinaryUploadWidgetProps) { | ||
function showWidget() { | ||
const widget: CloudinaryWidget = window.cloudinary.createUploadWidget( | ||
{ | ||
cloudName: "vercel-platforms", | ||
uploadPreset: "w0vnflc6", | ||
cropping: true, | ||
}, | ||
(error: unknown | undefined, result: CloudinaryWidgetResult) => { | ||
if (!error && result && result.event === "success") { | ||
callback(result.info); | ||
} | ||
} | ||
); | ||
|
||
widget.open(); | ||
} | ||
|
||
function open(e: MouseEvent) { | ||
e.preventDefault(); | ||
showWidget(); | ||
} | ||
|
||
return ( | ||
<> | ||
<Head> | ||
// this is Next.js specific, but if you're using something like Create | ||
React App, // you could download the script in componentDidMount using | ||
this method: https://stackoverflow.com/a/34425083/1424568 | ||
<script | ||
src="https://widget.cloudinary.com/v2.0/global/all.js" | ||
type="text/javascript" | ||
/> | ||
</Head> | ||
{children({ open })} | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
import { parseISO, format } from "date-fns"; | ||
|
||
export default function Date({ dateString }) { | ||
interface DateProps { | ||
dateString: string; | ||
} | ||
|
||
export default function Date({ dateString }: DateProps) { | ||
const date = parseISO(dateString); | ||
|
||
return <time dateTime={dateString}>{format(date, "LLL d, yyyy")}</time>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.