feat(web): up avatars, follower count, and dedupe views/avg secondary
This commit is contained in:
1 parent
1ed3746f4b
commit
2ff3e7952b
23 files changed
+209
-58
No files matched your search
@@ -133,6 +133,14 @@ function upPrimary(item, sort) {
|
||||
return { label: "播放/小时", text: formatCount(item.efficiency) };
|
||||
}
|
||||
|
||||
function upSecondary(item, sort) {
|
||||
// “总播放”排序时主指标已是总播放,副指标改为平均播放,避免重复。
|
||||
if (sort === "views") {
|
||||
return { label: "平均播放", text: formatCount(item.avg_views) };
|
||||
}
|
||||
return { label: "总播放", text: formatCount(item.total_views) };
|
||||
}
|
||||
|
||||
function listHtml(data, scope, sort, startRank) {
|
||||
if (!data.items.length) {
|
||||
return emptyState(
|
||||
@@ -143,8 +151,11 @@ function listHtml(data, scope, sort, startRank) {
|
||||
if (scope === "up") {
|
||||
return `<div class="rank-list">${data.items.map((item, index) => {
|
||||
const primary = upPrimary(item, sort);
|
||||
const secondary = upSecondary(item, sort);
|
||||
return upCard(item, {
|
||||
rank: startRank + index, primaryLabel: primary.label, primaryText: primary.text,
|
||||
rank: startRank + index,
|
||||
primaryLabel: primary.label, primaryText: primary.text,
|
||||
secondaryLabel: secondary.label, secondaryText: secondary.text,
|
||||
});
|
||||
}).join("")}</div>`;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { api } from "../api.js";
|
||||
import {
|
||||
badge, emptyState, sectionHeader, videoCard,
|
||||
avatar, badge, emptyState, sectionHeader, videoCard,
|
||||
} from "../components.js";
|
||||
import { barChart, lineChart, themeColor } from "../charts.js";
|
||||
import {
|
||||
@@ -43,14 +43,17 @@ export async function renderUp(root, { params, query }) {
|
||||
</header>
|
||||
|
||||
<div class="detail-hero compact-hero">
|
||||
<div class="detail-hero-body">
|
||||
<h1>${escapeHtml(up.up_name || `UP ${mid}`)}</h1>
|
||||
<div class="detail-meta">
|
||||
<span>mid ${up.up_mid}</span>
|
||||
${up.blacklisted ? badge("黑名单 · 仅影响发现", "warning") : ""}
|
||||
${(up.folders || []).map((title) => badge(title)).join("")}
|
||||
<div class="up-hero-head">
|
||||
${avatar(up, "hero-avatar")}
|
||||
<div class="detail-hero-body">
|
||||
<h1>${escapeHtml(up.up_name || `UP ${mid}`)}</h1>
|
||||
<div class="detail-meta">
|
||||
<span>mid ${up.up_mid}</span>
|
||||
${up.blacklisted ? badge("黑名单 · 仅影响发现", "warning") : ""}
|
||||
${(up.folders || []).map((title) => badge(title)).join("")}
|
||||
</div>
|
||||
<p class="section-note">首次发布 ${escapeHtml(formatDate(up.first_pubdate))} · 最近发布 ${escapeHtml(formatDate(up.latest_pubdate))}</p>
|
||||
</div>
|
||||
<p class="section-note">首次发布 ${escapeHtml(formatDate(up.first_pubdate))} · 最近发布 ${escapeHtml(formatDate(up.latest_pubdate))}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user