Skip to content

Commit

Permalink
feat: implement comment count
Browse files Browse the repository at this point in the history
  • Loading branch information
SwiichyCode committed Feb 25, 2024
1 parent 7add481 commit a30c551
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/actions/getRepositories.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const getRepositoriesOnScroll = async ({
createdBy: true,
language: true,
topics: true,
comments: true,
},
orderBy: {
id: "desc",
Expand Down
3 changes: 3 additions & 0 deletions src/app/repositories/[repositoryId]/loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function loading() {
return <p>Loading...</p>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const RepositoryCardComment = ({ repository }: Props) => {
className="flex items-center space-x-1 hover:text-[#2F81F7]"
>
<CommentDiscussionIcon className="h-4 w-4" />
<span>0</span>
<span>{repository.comments.length}</span>
</Link>
);
};
2 changes: 1 addition & 1 deletion src/types/prisma.type.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Prisma } from "@prisma/client";

export type Repository = Prisma.RepositoryGetPayload<{
include: { createdBy: true; language: true };
include: { createdBy: true; language: true; comments: true };
}>;

export type User = Prisma.UserGetPayload<{
Expand Down

0 comments on commit a30c551

Please sign in to comment.