Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions browser-extension/src/entrypoints/posts/Posts/PostDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,15 @@ function PostDetailPage() {
<h1 className="mt-2 mb-1 ">
Analyse des commentaires malveillants
</h1>
<span className="text-base mt-0">
<div className="text-base mt-0">
Données collectées le{" "}
{formatAnalysisDate(post.latestAnalysisDate)}
</span>
{formatAnalysisDate(post.firstAnalysisDate)}
</div>
{post.analysisCount > 1 && (
<div className="text-base mt-0 italic">
Mise à jour le {formatAnalysisDate(post.latestAnalysisDate)}
</div>
)}
</div>
<h3 className="text-left">Publication analysée</h3>
<Card>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ const inProgressPost: Post = {
comments: Array<PostComment>(100).fill(exampleComment),
latestAnalysisDate: "2026-03-22T00:00:00.000Z",
latestAnalysisStatus: "IN_PROGRESS",
firstAnalysisDate: "2026-03-22T00:00:00.000Z",
analysisCount: 1,
};

const completedPost: Post = {
Expand Down
9 changes: 9 additions & 0 deletions browser-extension/src/shared/model/post/Post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ export type Post = PostSharedProperties & {
*/
comments: PostComment[];

/**
* Date of first PostSnapshot
*/
firstAnalysisDate: string;

/**
* Number of PostSnapshot associated to this post
*/
analysisCount: number;
/**
* Date of the latest snapshot on which this post is based.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export function buildPostFromSnapshots(snapshots: PostSnapshot[]): Post {
textContent: latest.textContent,
title: latest.title,
comments: buildCommentsFromSnapshots(oldestFirst),
firstAnalysisDate: oldest.scrapedAt,
analysisCount: snapshots.length,
latestAnalysisDate: latest.scrapedAt,
latestAnalysisStatus: latest.classificationStatus,
};
Expand Down
15 changes: 4 additions & 11 deletions browser-extension/src/shared/utils/__tests__/post-util.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,9 @@ import { Post, PostComment } from "@/shared/model/post/Post";
* @returns Array containing a single Post with dummy data
*/
function createDummyPostWithDate(publishedAt: PublicationDate): Post {
return {
postId: "dummy-post-1",
socialNetwork: SocialNetwork.YouTube,
url: "https://www.youtube.com/watch?v=dummy",
return createDummyPost({
publishedAt,
author: {
name: "Dummy Author",
accountHref: "https://youtube.com/@dummyauthor",
},
latestAnalysisDate: new Date().toLocaleDateString(),
comments: [],
};
});
}

/**
Expand All @@ -48,6 +39,8 @@ function createDummyPost(overrides: Partial<Post> = {}): Post {
name: "Dummy Author",
accountHref: "https://youtube.com/@dummyauthor",
},
firstAnalysisDate: new Date().toLocaleDateString(),
analysisCount: 1,
latestAnalysisDate: new Date().toLocaleDateString(),
comments: [],
...overrides,
Expand Down
Loading