MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / renderPush

Function renderPush

deployments/desktop/static/app.js:707–792  ·  view source on GitHub ↗
(push, options = {})

Source from the content-addressed store, hash-verified

705}
706
707function renderPush(push, options = {}) {
708 const preserveSelection = Boolean(options.preserveSelection);
709 state.push = push || null;
710 if (!preserveSelection) {
711 state.selected.clear();
712 state.skipped.clear();
713 $("reportResults").classList.add("hidden");
714 $("reportList").innerHTML = "";
715 }
716 const metadata = push?.metadata || {};
717 const fallbackText = metadata.fallback_used
718 ? ` | ${metadata.fallback_days || 7} 天兜底${metadata.fallback_relaxed ? "(宽松匹配)" : ""}`
719 : "";
720 const previewText = metadata.preview ? " | 实时预览" : "";
721
722 if (!push || !push.papers || !push.papers.length) {
723 if (push) {
724 $("pushMeta").textContent = `推送 ${push.push_id || ""} | ${push.push_time || "未知时间"} | 0 篇论文${fallbackText}${previewText}`;
725 $("latestPushStat").textContent = "0";
726 } else {
727 $("pushMeta").textContent = "尚未加载推送。";
728 $("latestPushStat").textContent = "-";
729 }
730 $("paperList").className = "paper-list empty";
731 if (push && Number(metadata.total_fetched || 0) > 0) {
732 $("paperList").textContent =
733 `本次抓取了 ${metadata.total_fetched} 篇候选论文,但没有论文通过当前画像的相关性筛选。可以把天数调大,或调整画像/必读规则后再运行。`;
734 } else if (push) {
735 $("paperList").textContent = "本轮推送没有可展示的论文。可以把天数调大后再运行。";
736 } else {
737 $("paperList").textContent = "请先运行每日推送,或加载最近一次推送。";
738 }
739 updateSelectionSummary();
740 return;
741 }
742
743 $("pushMeta").textContent = `推送 ${push.push_id} | ${push.push_time || "未知时间"} | ${push.papers.length} 篇论文${fallbackText}${previewText}`;
744 $("latestPushStat").textContent = push.papers.length;
745 $("paperList").className = "paper-list";
746 $("paperList").innerHTML = "";
747
748 push.papers.forEach((paper) => {
749 const card = document.createElement("article");
750 card.className = "paper-card";
751 const authors = (paper.authors || []).slice(0, 5).join(", ");
752 const category = paper.category && paper.category !== "unknown" ? paper.category : "未知";
753 const sourceLabel = formatSourceLabel(paper.source || paper.metadata?.source || "");
754 const categoryClass = categoryBadgeClass(paper.category || "");
755 const links = [
756 paper.url ? `<a href="${paper.url}" target="_blank" rel="noreferrer">原文</a>` : "",
757 paper.pdf_url ? `<a href="${paper.pdf_url}" target="_blank" rel="noreferrer">PDF</a>` : "",
758 ].filter(Boolean).join(" | ");
759 card.innerHTML = `
760 <div class="paper-top">
761 <div>
762 <h4 class="paper-title">${paper.number}. ${escapeHtml(paper.title)}</h4>
763 <div class="paper-meta">${escapeHtml(authors || "未知作者")}</div>
764 </div>

Callers 3

loadLatestPushFunction · 0.70
handleDailyTaskFunction · 0.70

Calls 7

formatSourceLabelFunction · 0.85
categoryBadgeClassFunction · 0.85
formatCategoryLabelFunction · 0.85
formatDateBadgeFunction · 0.85
$Function · 0.70
updateSelectionSummaryFunction · 0.70
escapeHtmlFunction · 0.70

Tested by

no test coverage detected