+
diff --git a/src/app/(posts)/components/preview/index.tsx b/src/app/(posts)/components/preview/index.tsx
index d36915c6..4b27b6c4 100644
--- a/src/app/(posts)/components/preview/index.tsx
+++ b/src/app/(posts)/components/preview/index.tsx
@@ -37,7 +37,7 @@ const MarkdownPreview = ({
headers: {
"Content-Type": "application/json"
},
- body,
+ body
})
if (resp.ok) {
diff --git a/src/app/(posts)/new/components/new.tsx b/src/app/(posts)/new/components/new.tsx
index 434116f9..cef7c11d 100644
--- a/src/app/(posts)/new/components/new.tsx
+++ b/src/app/(posts)/new/components/new.tsx
@@ -55,6 +55,7 @@ const Post = ({
title: doc.title,
content: doc.content,
id: doc.id
+ // eslint-disable-next-line no-mixed-spaces-and-tabs
}))
: [emptyDoc]
@@ -300,7 +301,7 @@ const Post = ({
placeholderText="Won't expire"
selected={expiresAt}
showTimeInput={true}
- // @ts-ignore
+ // @ts-expect-error fix time input type
customTimeInput={
}
timeInputLabel="Time:"
dateFormat="MM/dd/yyyy h:mm aa"
diff --git a/src/app/(posts)/new/from/[id]/page.tsx b/src/app/(posts)/new/from/[id]/page.tsx
index cbd2fc18..6f4e2a39 100644
--- a/src/app/(posts)/new/from/[id]/page.tsx
+++ b/src/app/(posts)/new/from/[id]/page.tsx
@@ -31,7 +31,7 @@ const NewFromExisting = async ({
select: {
title: true,
content: true,
- id: true,
+ id: true
}
}
}
diff --git a/src/app/(posts)/new/layout.tsx b/src/app/(posts)/new/layout.tsx
index 255ac4c6..6be613b1 100644
--- a/src/app/(posts)/new/layout.tsx
+++ b/src/app/(posts)/new/layout.tsx
@@ -1,6 +1,3 @@
-import { getCurrentUser } from "@lib/server/session"
-import { redirect } from "next/navigation"
-
export default function NewLayout({ children }: { children: React.ReactNode }) {
return <>{children}>
}
diff --git a/src/app/(posts)/new/page.tsx b/src/app/(posts)/new/page.tsx
index 74fb9adc..35ce0707 100644
--- a/src/app/(posts)/new/page.tsx
+++ b/src/app/(posts)/new/page.tsx
@@ -5,4 +5,4 @@ const New = () =>
export default New
-export const dynamic = 'force-static'
+export const dynamic = "force-static"
diff --git a/src/app/(posts)/post/[id]/components/header/title/index.tsx b/src/app/(posts)/post/[id]/components/header/title/index.tsx
index 26f4e461..10b488fc 100644
--- a/src/app/(posts)/post/[id]/components/header/title/index.tsx
+++ b/src/app/(posts)/post/[id]/components/header/title/index.tsx
@@ -26,9 +26,11 @@ export const PostTitle = ({
}: TitleProps) => {
return (
-
+
{title}{" "}
by{" "}
diff --git a/src/app/(posts)/post/[id]/components/post-files/index.tsx b/src/app/(posts)/post/[id]/components/post-files/index.tsx
index 7647dedc..d343c586 100644
--- a/src/app/(posts)/post/[id]/components/post-files/index.tsx
+++ b/src/app/(posts)/post/[id]/components/post-files/index.tsx
@@ -77,11 +77,13 @@ const PostFiles = ({
}
return (
-
+
{post.files?.map(({ id, content, title, html }) => (
{
content: true,
updatedAt: true,
title: true,
- html: true,
+ html: true
}
}
}
diff --git a/src/app/admin/components/tables.tsx b/src/app/admin/components/tables.tsx
index 2058a4ef..571dbfee 100644
--- a/src/app/admin/components/tables.tsx
+++ b/src/app/admin/components/tables.tsx
@@ -1,7 +1,6 @@
"use client"
import Button from "@components/button"
-import ButtonDropdown from "@components/button-dropdown"
import { Spinner } from "@components/spinner"
import { useToasts } from "@components/toasts"
import { Post, User } from "@lib/server/prisma"
@@ -19,7 +18,6 @@ export function UserTable({
email: string | null
role: string | null
displayName: string | null
-
}[]
}) {
const { setToast } = useToasts()
diff --git a/src/app/admin/page.tsx b/src/app/admin/page.tsx
index a0cefe4d..ffc7d003 100644
--- a/src/app/admin/page.tsx
+++ b/src/app/admin/page.tsx
@@ -1,4 +1,3 @@
-import { Spinner } from "@components/spinner"
import { getAllPosts, getAllUsers } from "@lib/server/prisma"
import { PostTable, UserTable } from "./components/tables"
diff --git a/src/app/author/[username]/page.tsx b/src/app/author/[username]/page.tsx
index 0008d2a9..a437a0a1 100644
--- a/src/app/author/[username]/page.tsx
+++ b/src/app/author/[username]/page.tsx
@@ -1,6 +1,8 @@
import PostList from "@components/post-list"
import { getPostsByUser, getUserById } from "@lib/server/prisma"
+import Image from "next/image"
import { Suspense } from "react"
+import { User } from "react-feather"
async function PostListWrapper({
posts,
@@ -28,15 +30,40 @@ export default async function UserPage({
}) {
// TODO: the route should be user.name, not id
const id = params.username
- const user = await getUserById(id)
+ const user = await getUserById(id, {
+ image: true
+ })
const posts = getPostsByUser(id, true)
+ const Avatar = () => {
+ if (!user?.image) {
+ return
+ }
+ return (
+
+ )
+ }
return (
<>
- Public posts by {user?.displayName || "Anonymous"}
+
+
Public posts by {user?.displayName || "Anonymous"}
+
+
}>
- {/* @ts-ignore because TS async JSX support is iffy */}
+ {/* @ts-expect-error because TS async JSX support is iffy */}
>
diff --git a/src/app/components/header/index.tsx b/src/app/components/header/index.tsx
index 73629f4a..e38c9b5a 100644
--- a/src/app/components/header/index.tsx
+++ b/src/app/components/header/index.tsx
@@ -60,12 +60,10 @@ const Header = () => {
)
} else if (tab.href) {
return (
-
-
+
+
)
}
diff --git a/src/app/components/post-list/list-item.tsx b/src/app/components/post-list/list-item.tsx
index 432dd96a..b6bdba51 100644
--- a/src/app/components/post-list/list-item.tsx
+++ b/src/app/components/post-list/list-item.tsx
@@ -129,7 +129,6 @@ const ListItem = ({
{getIconFromFilename(file.title)}
-
{file.title || "Untitled file"}
diff --git a/src/app/components/post-list/post-list.module.css b/src/app/components/post-list/post-list.module.css
index f81421c2..4e828992 100644
--- a/src/app/components/post-list/post-list.module.css
+++ b/src/app/components/post-list/post-list.module.css
@@ -33,3 +33,9 @@
gap: var(--gap-half);
margin-bottom: var(--gap);
}
+
+@media (max-width: 768px) {
+ .container ul {
+ padding: 0 var(--gap);
+ }
+}
diff --git a/src/app/components/skeleton/index.tsx b/src/app/components/skeleton/index.tsx
index aab0ab75..6e8b1627 100644
--- a/src/app/components/skeleton/index.tsx
+++ b/src/app/components/skeleton/index.tsx
@@ -3,11 +3,13 @@ import styles from "./skeleton.module.css"
export default function Skeleton({
width = 100,
height = 24,
- borderRadius = 4,
+ borderRadius = 4
}: {
width?: number | string
- height?: number | string,
+ height?: number | string
borderRadius?: number | string
}) {
- return
+ return (
+
+ )
}
diff --git a/src/app/components/toasts/index.tsx b/src/app/components/toasts/index.tsx
index 91dc4b4e..482e30af 100644
--- a/src/app/components/toasts/index.tsx
+++ b/src/app/components/toasts/index.tsx
@@ -1,4 +1,4 @@
-"use client";
+"use client"
import Toast, { Toaster } from "react-hot-toast"
export type ToastType = "success" | "error" | "loading" | "default"
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index 7ede1614..6d05d0d2 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -4,9 +4,9 @@ import { Providers } from "./providers"
import Page from "@components/page"
import { Toasts } from "@components/toasts"
import Header from "@components/header"
-import { Inter } from '@next/font/google';
+import { Inter } from "@next/font/google"
-const inter = Inter({ subsets: ['latin'], variable: "--inter-font" })
+const inter = Inter({ subsets: ["latin"], variable: "--inter-font" })
interface RootLayoutProps {
children: React.ReactNode
diff --git a/src/app/settings/components/sections/profile.module.css b/src/app/settings/components/sections/profile.module.css
index 16da00c2..082519c6 100644
--- a/src/app/settings/components/sections/profile.module.css
+++ b/src/app/settings/components/sections/profile.module.css
@@ -5,3 +5,43 @@
max-width: 300px;
margin-top: var(--gap);
}
+
+/*
+
+
+
*/
+/* we want the file input to be invisible and full width but still interactive button */
+.upload {
+ position: relative;
+ display: flex;
+ flex-direction: column;
+ gap: var(--gap);
+ max-width: 300px;
+ margin-top: var(--gap);
+ cursor: pointer;
+}
+
+.uploadInput {
+ position: absolute;
+ opacity: 0;
+ cursor: pointer;
+ width: 300px;
+ height: 37px;
+ cursor: pointer;
+}
+
+.uploadButton {
+ width: 100%;
+}
+
+/* hover should affect button */
+.uploadInput:hover + button {
+ border: 1px solid var(--fg);
+
+}
diff --git a/src/app/settings/components/sections/profile.tsx b/src/app/settings/components/sections/profile.tsx
index e85b429f..a1f02158 100644
--- a/src/app/settings/components/sections/profile.tsx
+++ b/src/app/settings/components/sections/profile.tsx
@@ -4,13 +4,13 @@ import Button from "@components/button"
import Input from "@components/input"
import Note from "@components/note"
import { useToasts } from "@components/toasts"
-import { User } from "next-auth"
+import { useSession } from "next-auth/react"
import { useState } from "react"
import styles from "./profile.module.css"
-const Profile = ({ user }: { user: User }) => {
- // TODO: make this displayName, requires fetching user from DB as session doesnt have it
- const [name, setName] = useState(user.name || "")
+const Profile = () => {
+ const { data: session } = useSession()
+ const [name, setName] = useState(session?.user.displayName || "")
const [submitting, setSubmitting] = useState(false)
const { setToast } = useToasts()
@@ -31,10 +31,10 @@ const Profile = ({ user }: { user: User }) => {
setSubmitting(true)
const data = {
- displayName: name,
+ displayName: name
}
- const res = await fetch(`/api/user/${user.id}`, {
+ const res = await fetch(`/api/user/${session?.user.id}`, {
method: "PUT",
headers: {
"Content-Type": "application/json"
@@ -57,6 +57,18 @@ const Profile = ({ user }: { user: User }) => {
}
}
+ /* if we have their email, they signed in with OAuth */
+ // const imageViaOauth = Boolean(session?.user.email)
+
+ // const TooltipComponent = ({ children }: { children: React.ReactNode }) =>
+ // imageViaOauth ? (
+ //
+ // {children}
+ //
+ // ) : (
+ // <>{children}>
+ // )
+
return (
<>
@@ -83,12 +95,49 @@ const Profile = ({ user }: { user: User }) => {
type="email"
width={"100%"}
placeholder="my@email.io"
- value={user.email || undefined}
+ value={session?.user.email || undefined}
disabled
aria-label="Email"
/>
-