revert: i hate this

This commit is contained in:
Jason
2023-11-01 10:37:09 -07:00
parent 10a7f71f7a
commit 4db87316ac

View File

@@ -1,6 +1,5 @@
'use client' 'use client'
import Comments from '@/components/Comments'
import Image from '@/components/Image' import Image from '@/components/Image'
import Link from '@/components/Link' import Link from '@/components/Link'
import PageTitle from '@/components/PageTitle' import PageTitle from '@/components/PageTitle'
@@ -13,7 +12,6 @@ import NextImage from 'next/image'
import { CoreContent } from 'pliny/utils/contentlayer' import { CoreContent } from 'pliny/utils/contentlayer'
import { formatDate } from 'pliny/utils/formatDate' import { formatDate } from 'pliny/utils/formatDate'
import { ReactNode, useState } from 'react' import { ReactNode, useState } from 'react'
import { Redis } from "@upstash/redis"
interface LayoutProps { interface LayoutProps {
content: CoreContent<Blog> content: CoreContent<Blog>
@@ -23,13 +21,8 @@ interface LayoutProps {
prev?: { path: string; title: string } prev?: { path: string; title: string }
} }
const redis = Redis.fromEnv() export default function PostLayout({ content, authorDetails, next, prev, children }: LayoutProps) {
export const revalidate = 60
export default async function PostLayout({ content, authorDetails, next, prev, children }: LayoutProps) {
const { path, slug, tags, date, title, thumbnail } = content const { path, slug, tags, date, title, thumbnail } = content
const views = (await redis.get<number>(["pageviews", "projects", slug].join(":"))) ?? 0;
const displayThumbnail = thumbnail ? thumbnail : '/static/images/twitter-card.png' const displayThumbnail = thumbnail ? thumbnail : '/static/images/twitter-card.png'
const [isLoading, setIsLoading] = useState(true) const [isLoading, setIsLoading] = useState(true)
@@ -67,14 +60,6 @@ export default async function PostLayout({ content, authorDetails, next, prev, c
<time dateTime={date}> <time dateTime={date}>
{formatDate(date, siteMetadata.locale)} {formatDate(date, siteMetadata.locale)}
</time> </time>
{views > 0 && (
<span className="ml-2">
<span className="text-primary">
{views.toLocaleString()}
</span>{" "}
views
</span>
)}
</dd> </dd>
</div> </div>
</dl> </dl>