diff --git a/frontend/src/components/comment_tile.tsx b/frontend/src/components/comment_tile.tsx index 6906b49..d99f45e 100644 --- a/frontend/src/components/comment_tile.tsx +++ b/frontend/src/components/comment_tile.tsx @@ -269,7 +269,7 @@ function DeleteCommentDialog({ ); } -function CommentContent({ content }: { content: string }) { +export function CommentContent({ content }: { content: string }) { const lines = content.split("\n"); for (let i = 0; i < lines.length; i++) { let line = lines[i]; diff --git a/frontend/src/i18n.ts b/frontend/src/i18n.ts index 262c827..1087279 100644 --- a/frontend/src/i18n.ts +++ b/frontend/src/i18n.ts @@ -232,6 +232,7 @@ export const i18nData = { "Write down your comment": "Write down your comment", "Click to view more": "Click to view more", "Comment Details": "Comment Details", + "Posted a comment": "Posted a comment", }, }, "zh-CN": { @@ -456,6 +457,7 @@ export const i18nData = { "Write down your comment": "写下您的评论", "Click to view more": "点击查看更多", "Comment Details": "评论详情", + "Posted a comment": "发布了一个评论", }, }, "zh-TW": { @@ -680,6 +682,7 @@ export const i18nData = { "Write down your comment": "寫下您的評論", "Click to view more": "點擊查看更多", "Comment Details": "評論詳情", + "Posted a comment": "發布了評論", }, }, }; diff --git a/frontend/src/network/models.ts b/frontend/src/network/models.ts index a0e441f..0bc9639 100644 --- a/frontend/src/network/models.ts +++ b/frontend/src/network/models.ts @@ -171,7 +171,7 @@ export enum ActivityType { Unknown = 0, ResourcePublished = 1, ResourceUpdated = 2, - ResourceCommented = 3, + NewComment = 3, } export interface Activity { @@ -181,5 +181,5 @@ export interface Activity { created_at: string; resource?: Resource; user?: User; - comment?: CommentWithResource; + comment?: Comment; } diff --git a/frontend/src/pages/activities_page.tsx b/frontend/src/pages/activities_page.tsx index 45001ee..b192ef5 100644 --- a/frontend/src/pages/activities_page.tsx +++ b/frontend/src/pages/activities_page.tsx @@ -7,6 +7,7 @@ import { MdArrowRight } from "react-icons/md"; import { useNavigate } from "react-router"; import Loading from "../components/loading.tsx"; import { ImageGrid } from "../components/image.tsx"; +import { CommentContent } from "../components/comment_tile.tsx"; export default function ActivitiesPage() { const [activities, setActivities] = useState([]); @@ -67,7 +68,7 @@ function ActivityCard({ activity }: { activity: Activity }) { "Unknown activity", t("Published a resource"), t("Updated a resource"), - t("Commented on a resource"), + t("Posted a comment"), ]; const navigate = useNavigate(); @@ -92,19 +93,10 @@ function ActivityCard({ activity }: { activity: Activity }) { )} ); - } else if (activity.type === ActivityType.ResourceCommented) { + } else if (activity.type === ActivityType.NewComment) { content = ( -
-
- {activity.comment?.content} -
- -
- - - {activity.comment?.resource?.title} - -
+
+
); } @@ -120,8 +112,8 @@ function ActivityCard({ activity }: { activity: Activity }) { activity.type === ActivityType.ResourceUpdated ) { navigate(`/resources/${activity.resource?.id}`); - } else if (activity.type === ActivityType.ResourceCommented) { - navigate(`/resources/${activity.comment?.resource.id}#comments`); + } else if (activity.type === ActivityType.NewComment) { + navigate(`/comments/${activity.comment?.id}`); } }} >