feat: replace views stat with topic-category breakdown on creator detail page
This commit is contained in:
parent
95b11ae5bc
commit
7a3db5212b
1 changed files with 19 additions and 2 deletions
|
|
@ -106,8 +106,25 @@ export default function CreatorDetail() {
|
||||||
)}
|
)}
|
||||||
<span className="creator-detail__stats">
|
<span className="creator-detail__stats">
|
||||||
{creator.video_count} video{creator.video_count !== 1 ? "s" : ""}
|
{creator.video_count} video{creator.video_count !== 1 ? "s" : ""}
|
||||||
<span className="queue-card__separator">·</span>
|
{techniques.length > 0 && (
|
||||||
{creator.view_count.toLocaleString()} views
|
<>
|
||||||
|
<span className="queue-card__separator">·</span>
|
||||||
|
{Object.entries(
|
||||||
|
techniques.reduce<Record<string, number>>((acc, t) => {
|
||||||
|
const cat = t.topic_category || "Uncategorized";
|
||||||
|
acc[cat] = (acc[cat] || 0) + 1;
|
||||||
|
return acc;
|
||||||
|
}, {}),
|
||||||
|
)
|
||||||
|
.sort(([, a], [, b]) => b - a)
|
||||||
|
.map(([cat, count], i) => (
|
||||||
|
<span key={cat} className="creator-detail__topic-stat">
|
||||||
|
{i > 0 && <span className="queue-card__separator">·</span>}
|
||||||
|
{cat}: {count}
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue