(report)
| 275 | } |
| 276 | |
| 277 | function renderViewer(report) { |
| 278 | uiState.currentReport = report; |
| 279 | byId("reportViewerTitle").textContent = report.title || "精读报告"; |
| 280 | byId("reportViewerMeta").textContent = [report.user_id, report.saved_at || report.updated_at, report.report_path] |
| 281 | .filter(Boolean) |
| 282 | .join(" | "); |
| 283 | byId("reportViewerBody").className = "markdown-body"; |
| 284 | byId("reportViewerBody").innerHTML = renderMarkdown(report.markdown || ""); |
| 285 | renderMeta(report); |
| 286 | |
| 287 | const linkMap = { |
| 288 | openReportAbsBtn: report.abs_url || "", |
| 289 | openReportPdfBtn: report.pdf_url || "", |
| 290 | openReportDocBtn: report.doc_url || "", |
| 291 | }; |
| 292 | Object.entries(linkMap).forEach(([id, href]) => { |
| 293 | const button = byId(id); |
| 294 | button.disabled = !href; |
| 295 | if (href) button.dataset.href = href; |
| 296 | else delete button.dataset.href; |
| 297 | }); |
| 298 | const copyButton = byId("copyReportPathBtn"); |
| 299 | copyButton.disabled = !report.report_path; |
| 300 | if (report.report_path) copyButton.dataset.path = report.report_path; |
| 301 | else delete copyButton.dataset.path; |
| 302 | } |
| 303 | |
| 304 | function renderList(reports, activeId = "") { |
| 305 | const target = byId("reportsList"); |
no test coverage detected