mirror of
https://github.com/Ategon/Jamjar.git
synced 2025-02-12 06:16:21 +00:00
Remove unused code
This commit is contained in:
parent
6289989bce
commit
206b528075
2 changed files with 57 additions and 55 deletions
|
@ -1,40 +1,41 @@
|
|||
import { Button, Card, CardBody, Chip, User } from "@nextui-org/react";
|
||||
import { Heart } from "lucide-react";
|
||||
import { formatDistance } from "date-fns";
|
||||
import Link from "next/link";
|
||||
// import { Button, Card, CardBody, Chip, User } from "@nextui-org/react";
|
||||
// import { Heart } from "lucide-react";
|
||||
// import { formatDistance } from "date-fns";
|
||||
// import Link from "next/link";
|
||||
|
||||
export default function PostCard({ post }) {
|
||||
return (
|
||||
<Card>
|
||||
<CardBody>
|
||||
<p className="text-xl">{post.title}</p>
|
||||
export default function PostCard() {
|
||||
// return (
|
||||
// <Card>
|
||||
// <CardBody>
|
||||
// <p className="text-xl">{post.title}</p>
|
||||
|
||||
{post.flairs &&
|
||||
Object.values(post.flairs).map((flair) => (
|
||||
<div key={flair.id}>
|
||||
<Chip>{flair.name}</Chip>
|
||||
</div>
|
||||
))}
|
||||
// {post.flairs &&
|
||||
// Object.values(post.flairs).map((flair) => (
|
||||
// <div key={flair.id}>
|
||||
// <Chip>{flair.name}</Chip>
|
||||
// </div>
|
||||
// ))}
|
||||
|
||||
<div className="flex items-center gap-3">
|
||||
<p>By</p>
|
||||
<Link href={`/u/${post.author.slug}`}>
|
||||
<User name={post.author.name} />
|
||||
</Link>
|
||||
<p>
|
||||
{formatDistance(new Date(post.createdAt), new Date(), {
|
||||
addSuffix: true,
|
||||
})}
|
||||
</p>
|
||||
</div>
|
||||
// <div className="flex items-center gap-3">
|
||||
// <p>By</p>
|
||||
// <Link href={`/u/${post.author.slug}`}>
|
||||
// <User name={post.author.name} />
|
||||
// </Link>
|
||||
// <p>
|
||||
// {formatDistance(new Date(post.createdAt), new Date(), {
|
||||
// addSuffix: true,
|
||||
// })}
|
||||
// </p>
|
||||
// </div>
|
||||
|
||||
<p>{post.content}</p>
|
||||
<div className="flex justify-between">
|
||||
<Button>
|
||||
<Heart /> {post.likers.length}
|
||||
</Button>
|
||||
</div>
|
||||
</CardBody>
|
||||
</Card>
|
||||
);
|
||||
// <p>{post.content}</p>
|
||||
// <div className="flex justify-between">
|
||||
// <Button>
|
||||
// <Heart /> {post.likers.length}
|
||||
// </Button>
|
||||
// </div>
|
||||
// </CardBody>
|
||||
// </Card>
|
||||
// );
|
||||
return <div></div>;
|
||||
}
|
||||
|
|
|
@ -1,28 +1,29 @@
|
|||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import PostCard from "./PostCard";
|
||||
// import { useEffect, useState } from "react";
|
||||
// import PostCard from "./PostCard";
|
||||
|
||||
export default function Posts() {
|
||||
const [posts, setPosts] = useState();
|
||||
// const [posts, setPosts] = useState();
|
||||
|
||||
useEffect(() => {
|
||||
const fetchPosts = async () => {
|
||||
const response = await fetch("http://localhost:3005/api/v1/posts");
|
||||
setPosts(await response.json());
|
||||
};
|
||||
// useEffect(() => {
|
||||
// const fetchPosts = async () => {
|
||||
// const response = await fetch("http://localhost:3005/api/v1/posts");
|
||||
// setPosts(await response.json());
|
||||
// };
|
||||
|
||||
fetchPosts();
|
||||
}, []);
|
||||
// fetchPosts();
|
||||
// }, []);
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-3 p-4">
|
||||
{posts &&
|
||||
posts.map((post) => (
|
||||
<div key={post.key}>
|
||||
<PostCard post={post} />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
// return (
|
||||
// <div className="flex flex-col gap-3 p-4">
|
||||
// {posts &&
|
||||
// posts.map((post) => (
|
||||
// <div key={post.key}>
|
||||
// <PostCard post={post} />
|
||||
// </div>
|
||||
// ))}
|
||||
// </div>
|
||||
// );
|
||||
return <div></div>;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue