This commit is contained in:
Max Leiter 2022-12-04 14:26:14 -08:00
parent 72633c6ad2
commit 5918b13867
18 changed files with 49 additions and 26 deletions

View file

@ -7,7 +7,7 @@ import { signIn } from "next-auth/react"
import Input from "@components/input"
import Button from "@components/button"
import Note from "@components/note"
import { GitHub } from 'react-feather'
import { GitHub } from "react-feather"
const Auth = ({
page,
requiresServerPassword
@ -68,7 +68,7 @@ const Auth = ({
buttonType="primary"
width="100%"
style={{
color: 'var(--fg)'
color: "var(--fg)"
}}
iconLeft={<GitHub />}
onClick={(e) => {

View file

@ -11,7 +11,13 @@ type Item = File & {
icon: JSX.Element
}
const FileDropdown = ({ files, loading }: { files: File[], loading?: boolean }) => {
const FileDropdown = ({
files,
loading
}: {
files: File[]
loading?: boolean
}) => {
if (loading) {
return <Spinner />
}

View file

@ -86,7 +86,8 @@ function FileDropzone({ setDocs }: { setDocs: (docs: Document[]) => void }) {
<input {...getInputProps()} />
{!isDragActive && (
<p style={{ color: "var(--gray)" }}>
Drag some files here, or <span className={styles.verb} /> to select files
Drag some files here, or <span className={styles.verb} /> to select
files
</p>
)}
{isDragActive && <p>Release to drop the files here</p>}

View file

@ -1,4 +1,11 @@
import { Bold, Code, Image as ImageIcon, Italic, Link, List } from "react-feather"
import {
Bold,
Code,
Image as ImageIcon,
Italic,
Link,
List
} from "react-feather"
import { RefObject, useMemo } from "react"
import styles from "./formatting-icons.module.css"
import { TextareaMarkdownRef } from "textarea-markdown-editor"

View file

@ -69,7 +69,6 @@ const PostPage = ({ post: initialPost, isProtected, isAuthor }: Props) => {
preview={html}
/>
))}
</>
)
}

View file

@ -1,4 +1,4 @@
'use client';
"use client"
import { Post, PostWithFilesAndAuthor } from "@lib/server/prisma"
import PasswordModal from "@components/password-modal"

View file

@ -67,10 +67,10 @@ const getPost = async (id: string) => {
createdAt: new Date("1970-01-01"),
expiresAt: new Date("1970-01-01"),
author: {
displayName: "",
displayName: ""
},
description: "",
authorId: "",
authorId: ""
},
isProtected: true,
isAuthor: isAuthorOrAdmin

View file

@ -57,7 +57,11 @@ export function PostTable({
<tbody>
{posts?.map((post) => (
<tr key={post.id}>
<td><a href={`/post/${post.id}`} target="_blank" rel="noreferrer">{post.title}</a></td>
<td>
<a href={`/post/${post.id}`} target="_blank" rel="noreferrer">
{post.title}
</a>
</td>
<td>{"author" in post ? post.author.name : "no author"}</td>
<td>{post.createdAt.toLocaleDateString()}</td>
<td>{post.visibility}</td>

View file

@ -4,13 +4,19 @@ import { Suspense } from "react"
async function PostListWrapper({
posts,
userId,
userId
}: {
posts: ReturnType<typeof getPostsByUser>
userId: string
}) {
const data = (await posts).filter((post) => post.visibility === "public")
return <PostList morePosts={false} userId={userId} initialPosts={JSON.stringify(data)} />
return (
<PostList
morePosts={false}
userId={userId}
initialPosts={JSON.stringify(data)}
/>
)
}
export default async function UserPage({

View file

@ -1,4 +1,4 @@
'use client'
"use client"
import Tooltip from "@components/tooltip"
import { timeAgo } from "@lib/time-ago"
import { useMemo, useState, useEffect } from "react"

View file

@ -1,4 +1,4 @@
'use client';
"use client"
import PasswordModal from "@components/password-modal"
import { useCallback, useState } from "react"

View file

@ -159,13 +159,15 @@ const Header = () => {
// TODO: this is a hack to close the radix ui menu when a next link is clicked
const onClick = () => {
document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' }));
document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape" }))
}
return (
<header className={clsx(styles.header, {
[styles.loading]: isLoading,
})}>
<header
className={clsx(styles.header, {
[styles.loading]: isLoading
})}
>
<div className={styles.tabs}>
<div className={styles.buttons}>{buttons}</div>
</div>

View file

@ -1,4 +1,4 @@
'use client';
"use client"
import Button from "@components/button"
import Tooltip from "@components/tooltip"

View file

@ -1,3 +1,3 @@
import styles from './spinner.module.css'
import styles from "./spinner.module.css"
export const Spinner = () => <div className={styles.spinner} />

View file

@ -18,9 +18,7 @@ export default async function RootLayout({ children }: RootLayoutProps) {
<html lang="en">
<head />
<body>
<LayoutWrapper>
{children}
</LayoutWrapper>
<LayoutWrapper>{children}</LayoutWrapper>
</body>
</html>
</ServerThemeProvider>

View file

@ -63,7 +63,7 @@ export const config = (env: Environment): Config => {
validNodeEnvs(env.NODE_ENV)
throwIfUndefined("DATABASE_URL");
throwIfUndefined("DATABASE_URL")
const config: Config = {
is_production,

View file

@ -7,7 +7,7 @@ import config from "@lib/config"
const providers: NextAuthOptions["providers"] = [
GitHubProvider({
clientId: config.github_client_id,
clientSecret: config.github_client_secret,
clientSecret: config.github_client_secret
})
]