{buttons}
+
{!hideSearch && (
)
}
diff --git a/src/app/components/post-list/post-list.module.css b/src/app/components/post-list/post-list.module.css
index 39f82288..d59f02e4 100644
--- a/src/app/components/post-list/post-list.module.css
+++ b/src/app/components/post-list/post-list.module.css
@@ -4,6 +4,10 @@
margin: 0;
}
+.container > * {
+ width: 100%;
+}
+
.container ul li {
padding: 0.5rem 0;
}
diff --git a/src/app/components/skeleton/index.tsx b/src/app/components/skeleton/index.tsx
index 6e8b1627..3a2a87c6 100644
--- a/src/app/components/skeleton/index.tsx
+++ b/src/app/components/skeleton/index.tsx
@@ -3,13 +3,18 @@ import styles from "./skeleton.module.css"
export default function Skeleton({
width = 100,
height = 24,
- borderRadius = 4
+ borderRadius = 4,
+ style
}: {
width?: number | string
height?: number | string
borderRadius?: number | string
+ style?: React.CSSProperties
}) {
return (
-
+
)
}
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index 5f52e814..7e049acf 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -4,7 +4,8 @@ import Layout from "@components/layout"
import { Toasts } from "@components/toasts"
import Header from "@components/header"
import { Inter } from "@next/font/google"
-import { PropsWithChildren } from "react"
+import { PropsWithChildren, Suspense } from "react"
+import { Spinner } from "@components/spinner"
const inter = Inter({ subsets: ["latin"], variable: "--inter-font" })
@@ -19,7 +20,9 @@ export default async function RootLayout({
-
+ }>
+
+
{children}
diff --git a/src/app/mine/page.tsx b/src/app/mine/page.tsx
index ef2dce82..13ee3d1b 100644
--- a/src/app/mine/page.tsx
+++ b/src/app/mine/page.tsx
@@ -3,6 +3,7 @@ import { getPostsByUser } from "@lib/server/prisma"
import PostList from "@components/post-list"
import { getCurrentUser } from "@lib/server/session"
import { authOptions } from "@lib/server/auth"
+import { Suspense } from "react"
export default async function Mine() {
const userId = (await getCurrentUser())?.id
@@ -15,12 +16,14 @@ export default async function Mine() {
const stringifiedPosts = JSON.stringify(posts)
return (
-
+ }>
+
+
)
}
diff --git a/src/app/page.tsx b/src/app/page.tsx
index 5aefbb51..d2785d16 100644
--- a/src/app/page.tsx
+++ b/src/app/page.tsx
@@ -2,17 +2,72 @@ import Image from "next/image"
import Card from "@components/card"
import { getWelcomeContent } from "src/pages/api/welcome"
import DocumentTabs from "./(posts)/components/tabs"
-import { getAllPosts, Post } from "@lib/server/prisma"
+import { getAllPosts } from "@lib/server/prisma"
import PostList, { NoPostsFound } from "@components/post-list"
-import { Suspense } from "react"
+import { cache, Suspense } from "react"
+import ErrorBoundary from "@components/error/fallback"
+import { Stack } from "@components/stack"
-export async function getWelcomeData() {
+const getWelcomeData = cache(async () => {
const welcomeContent = await getWelcomeContent()
return welcomeContent
-}
+})
export default async function Page() {
- const getPostsPromise = getAllPosts({
+ const { title } = await getWelcomeData()
+
+ return (
+
+
+
+
+ {/* @ts-expect-error because of async RSC */}
+
+
+
+ }
+ >
+ {/* @ts-expect-error because of async RSC */}
+
+
+
+
+ )
+}
+
+async function WelcomePost() {
+ const { content, rendered, title } = await getWelcomeData()
+ return (
+
+
+ {content}
+
+
+ )
+}
+
+async function PublicPostList() {
+ const posts = await getAllPosts({
select: {
id: true,
title: true,
@@ -38,66 +93,12 @@ export default async function Page() {
createdAt: "desc"
}
})
- const { content, rendered, title } = await getWelcomeData()
- return (
-
-}) {
- try {
- const posts = await getPostsPromise
-
- if (posts.length === 0) {
- return
- }
-
- return (
-
- )
- } catch (error) {
+ if (posts.length === 0) {
return
}
-}
-export const revalidate = 60
+ return (
+
+ )
+}
diff --git a/src/app/settings/components/sections/profile.tsx b/src/app/settings/components/sections/profile.tsx
index 3955425a..55ffb8ac 100644
--- a/src/app/settings/components/sections/profile.tsx
+++ b/src/app/settings/components/sections/profile.tsx
@@ -12,7 +12,6 @@ import { User } from "@prisma/client"
function Profile() {
const { session } = useSessionSWR()
- console.log(session)
const { data: userData } = useSWR(
session?.user?.id ? `/api/user/${session?.user?.id}` : null
)
@@ -104,7 +103,7 @@ function Profile() {
type="email"
width={"100%"}
placeholder="my@email.io"
- value={session?.user.email || undefined}
+ value={session?.user.email || ""}
disabled
aria-label="Email"
/>
diff --git a/src/lib/server/auth.ts b/src/lib/server/auth.ts
index 131f6641..2cbbaf27 100644
--- a/src/lib/server/auth.ts
+++ b/src/lib/server/auth.ts
@@ -49,7 +49,6 @@ const providers = () => {
// @ts-expect-error TODO: fix types
credentials: credentialsOptions() as unknown,
async authorize(credentials) {
- console.log("credentials")
if (!credentials || !credentials.username || !credentials.password) {
throw new Error("Missing credentials")
}
diff --git a/src/pages/api/file/raw/[id].ts b/src/pages/api/file/raw/[id].ts
index 4a9de371..c4a3027b 100644
--- a/src/pages/api/file/raw/[id].ts
+++ b/src/pages/api/file/raw/[id].ts
@@ -5,7 +5,6 @@ import { withMethods } from "@lib/api-middleware/with-methods"
const getRawFile = async (req: NextApiRequest, res: NextApiResponse) => {
const { id, download } = req.query
-
const file = await prisma.file.findUnique({
where: {
id: parseQueryParam(id)
)}
{!showSkeleton && posts && posts.length > 0 ? (
-
+
-
+ -
- {posts.map((post) => {
- return (
-
-
+ {posts.map((post) => {
+ return (
+
{title}
+Recent public posts
+
-
-
-
-
- )
-}
-
-async function PublicPostList({
- getPostsPromise
-}: {
- getPostsPromise: Promise
-
-
- {title}
-
-
- }
- >
- {/* @ts-expect-error because of async RSC */}
-
-
-
-