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
src/components/posts
|
@ -1,40 +1,41 @@
|
||||||
import { Button, Card, CardBody, Chip, User } from "@nextui-org/react";
|
// import { Button, Card, CardBody, Chip, User } from "@nextui-org/react";
|
||||||
import { Heart } from "lucide-react";
|
// import { Heart } from "lucide-react";
|
||||||
import { formatDistance } from "date-fns";
|
// import { formatDistance } from "date-fns";
|
||||||
import Link from "next/link";
|
// import Link from "next/link";
|
||||||
|
|
||||||
export default function PostCard({ post }) {
|
export default function PostCard() {
|
||||||
return (
|
// return (
|
||||||
<Card>
|
// <Card>
|
||||||
<CardBody>
|
// <CardBody>
|
||||||
<p className="text-xl">{post.title}</p>
|
// <p className="text-xl">{post.title}</p>
|
||||||
|
|
||||||
{post.flairs &&
|
// {post.flairs &&
|
||||||
Object.values(post.flairs).map((flair) => (
|
// Object.values(post.flairs).map((flair) => (
|
||||||
<div key={flair.id}>
|
// <div key={flair.id}>
|
||||||
<Chip>{flair.name}</Chip>
|
// <Chip>{flair.name}</Chip>
|
||||||
</div>
|
// </div>
|
||||||
))}
|
// ))}
|
||||||
|
|
||||||
<div className="flex items-center gap-3">
|
// <div className="flex items-center gap-3">
|
||||||
<p>By</p>
|
// <p>By</p>
|
||||||
<Link href={`/u/${post.author.slug}`}>
|
// <Link href={`/u/${post.author.slug}`}>
|
||||||
<User name={post.author.name} />
|
// <User name={post.author.name} />
|
||||||
</Link>
|
// </Link>
|
||||||
<p>
|
// <p>
|
||||||
{formatDistance(new Date(post.createdAt), new Date(), {
|
// {formatDistance(new Date(post.createdAt), new Date(), {
|
||||||
addSuffix: true,
|
// addSuffix: true,
|
||||||
})}
|
// })}
|
||||||
</p>
|
// </p>
|
||||||
</div>
|
// </div>
|
||||||
|
|
||||||
<p>{post.content}</p>
|
// <p>{post.content}</p>
|
||||||
<div className="flex justify-between">
|
// <div className="flex justify-between">
|
||||||
<Button>
|
// <Button>
|
||||||
<Heart /> {post.likers.length}
|
// <Heart /> {post.likers.length}
|
||||||
</Button>
|
// </Button>
|
||||||
</div>
|
// </div>
|
||||||
</CardBody>
|
// </CardBody>
|
||||||
</Card>
|
// </Card>
|
||||||
);
|
// );
|
||||||
|
return <div></div>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +1,29 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useEffect, useState } from "react";
|
// import { useEffect, useState } from "react";
|
||||||
import PostCard from "./PostCard";
|
// import PostCard from "./PostCard";
|
||||||
|
|
||||||
export default function Posts() {
|
export default function Posts() {
|
||||||
const [posts, setPosts] = useState();
|
// const [posts, setPosts] = useState();
|
||||||
|
|
||||||
useEffect(() => {
|
// useEffect(() => {
|
||||||
const fetchPosts = async () => {
|
// const fetchPosts = async () => {
|
||||||
const response = await fetch("http://localhost:3005/api/v1/posts");
|
// const response = await fetch("http://localhost:3005/api/v1/posts");
|
||||||
setPosts(await response.json());
|
// setPosts(await response.json());
|
||||||
};
|
// };
|
||||||
|
|
||||||
fetchPosts();
|
// fetchPosts();
|
||||||
}, []);
|
// }, []);
|
||||||
|
|
||||||
return (
|
// return (
|
||||||
<div className="flex flex-col gap-3 p-4">
|
// <div className="flex flex-col gap-3 p-4">
|
||||||
{posts &&
|
// {posts &&
|
||||||
posts.map((post) => (
|
// posts.map((post) => (
|
||||||
<div key={post.key}>
|
// <div key={post.key}>
|
||||||
<PostCard post={post} />
|
// <PostCard post={post} />
|
||||||
</div>
|
// </div>
|
||||||
))}
|
// ))}
|
||||||
</div>
|
// </div>
|
||||||
);
|
// );
|
||||||
|
return <div></div>;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue