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

Function renderList

deployments/desktop/static/reports.js:304–325  ·  view source on GitHub ↗
(reports, activeId = "")

Source from the content-addressed store, hash-verified

302 }
303
304 function renderList(reports, activeId = "") {
305 const target = byId("reportsList");
306 if (!reports.length) {
307 target.className = "result-list empty";
308 target.textContent = "没有匹配的精读报告。";
309 return;
310 }
311 const recentSet = new Set(uiState.recentReportIds || []);
312 const ordered = [
313 ...reports.filter((item) => recentSet.has(item.report_id)),
314 ...reports.filter((item) => !recentSet.has(item.report_id)),
315 ];
316 target.className = "reports-list";
317 target.innerHTML = ordered.map((report) => `
318 <button type="button" class="report-row ${report.report_id === activeId ? "active" : ""} ${recentSet.has(report.report_id) ? "recent" : ""}" data-report-id="${window.escapeHtml ? window.escapeHtml(report.report_id) : report.report_id}">
319 <h4>${window.escapeHtml ? window.escapeHtml(report.title || "精读报告") : (report.title || "精读报告")}${recentSet.has(report.report_id) ? ' <span class="report-badge">本次生成</span>' : ''}</h4>
320 <p>${window.escapeHtml ? window.escapeHtml(report.user_id || "未标记用户") : (report.user_id || "未标记用户")}${report.arxiv_id ? ` | ${window.escapeHtml ? window.escapeHtml(report.arxiv_id) : report.arxiv_id}` : ""}</p>
321 <p>${window.escapeHtml ? window.escapeHtml(report.saved_at || report.updated_at || "") : (report.saved_at || report.updated_at || "")}</p>
322 <p>${window.escapeHtml ? window.escapeHtml(report.snippet || report.report_path || "") : (report.snippet || report.report_path || "")}</p>
323 </button>
324 `).join("");
325 }
326
327 async function loadReportContent(reportId, silent = false) {
328 if (!reportId) throw new Error("report_id is required");

Callers 2

loadReportContentFunction · 0.85
refreshReportsFunction · 0.85

Calls 1

byIdFunction · 0.85

Tested by

no test coverage detected