mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 12:17:24 +00:00
Add comments count to Resource model and update logic for comment creation and deletion
This commit is contained in:
@@ -81,6 +81,7 @@ export interface ResourceDetails {
|
||||
author: User;
|
||||
views: number;
|
||||
downloads: number;
|
||||
comments: number;
|
||||
related: Resource[];
|
||||
}
|
||||
|
||||
|
@@ -245,6 +245,13 @@ export default function ResourcePage() {
|
||||
/>
|
||||
<MdOutlineComment className="text-xl mr-2" />
|
||||
<span className="text-sm">{t("Comments")}</span>
|
||||
{resource.comments ? (
|
||||
<span
|
||||
className={`px-1 py-0.5 ml-1 rounded-full text-xs ${page === 2 ? "bg-accent text-accent-content" : "text-base-content/60"}`}
|
||||
>
|
||||
{resource.comments}
|
||||
</span>
|
||||
) : null}
|
||||
</label>
|
||||
<div key={"comments"} className="tab-content p-2">
|
||||
<Comments resourceId={resource.id} />
|
||||
|
Reference in New Issue
Block a user