()
| 7 | import helpers from "utils/helpers"; |
| 8 | |
| 9 | export default function Problems() { |
| 10 | const $page = Page(strings["problems"]); |
| 11 | /**@type {EditorFile[]} */ |
| 12 | const files = editorManager.files; |
| 13 | const $content = <div id="problems"></div>; |
| 14 | |
| 15 | files.forEach((file) => { |
| 16 | if (file.type !== "editor") return; |
| 17 | const annotations = collectAnnotations(file); |
| 18 | if (!annotations.length) return; |
| 19 | |
| 20 | const title = `${file.name} (${annotations.length})`; |
| 21 | $content.append( |
| 22 | <details open="true" className="single-file"> |
| 23 | <summary>{title}</summary> |
| 24 | <div className="problems"> |
| 25 | {annotations.map((annotation) => { |
| 26 | const { type, text, row, column } = annotation; |
| 27 | const icon = getIconForType(type); |
| 28 | |
| 29 | return ( |
| 30 | <div |
| 31 | className="problem" |
| 32 | data-action="goto" |
| 33 | data-file-id={file.id} |
| 34 | annotation={annotation} |
| 35 | > |
| 36 | <span className={`icon ${icon}`}></span> |
| 37 | <span data-type={type} className="problem-message"> |
| 38 | {text} |
| 39 | </span> |
| 40 | <span className="problem-line"> |
| 41 | {row + 1}:{column + 1} |
| 42 | </span> |
| 43 | </div> |
| 44 | ); |
| 45 | })} |
| 46 | </div> |
| 47 | </details>, |
| 48 | ); |
| 49 | }); |
| 50 | |
| 51 | $content.addEventListener("click", clickHandler); |
| 52 | $page.body = $content; |
| 53 | app.append($page); |
| 54 | helpers.showAd(); |
| 55 | |
| 56 | $page.onhide = function () { |
| 57 | hideAd(); |
| 58 | actionStack.remove("problems"); |
| 59 | }; |
| 60 | |
| 61 | actionStack.push({ |
| 62 | id: "problems", |
| 63 | action: $page.hide, |
| 64 | }); |
| 65 | |
| 66 | /** |
no test coverage detected