import VisibilityBadge from "../badges/visibility-badge" import FadeIn from "@components/fade-in" import ExpirationBadge from "@components/badges/expiration-badge" import CreatedAgoBadge from "@components/badges/created-ago-badge" import { useRouter } from "next/navigation" import styles from "./list-item.module.css" import Link from "@components/link" import type { PostWithFiles } from "@lib/server/prisma" import type { File } from "@lib/server/prisma" import Tooltip from "@components/tooltip" import Badge from "@components/badges/badge" import Card from "@components/card" import Button from "@components/button" import { ArrowUpCircle, Edit, Trash } from "react-feather" // TODO: isOwner should default to false so this can be used generically const ListItem = ({ post, isOwner = true, deletePost }: { post: PostWithFiles isOwner?: boolean deletePost: () => void }) => { const router = useRouter() const editACopy = () => { router.push(`/new/from/${post.id}`) } const viewParentClick = () => { router.push(`/post/${post.parentId}`) } return (
  • <>

    {post.title}

    {isOwner && ( {post.parentId && (
    {post.description && (

    {post.description}

    )}
    {post.files?.length === 1 ? "1 file" : `${post.files?.length || 0} files`}

    <> {post?.files?.map((file: File) => { return (
    {file.title || "Untitled file"}
    ) })}
  • ) } export default ListItem