()
| 101 | $page.addEventListener("click", clickHandler); |
| 102 | |
| 103 | function renderAppThemes() { |
| 104 | // Remove and destroy CodeMirror preview when showing app themes |
| 105 | destroyPreview("switch-tab"); |
| 106 | $themePreview.remove(); |
| 107 | const content = []; |
| 108 | |
| 109 | if (!DOES_SUPPORT_THEME) { |
| 110 | content.push( |
| 111 | <div className="list-item"> |
| 112 | <span className="icon warningreport_problem"></span> |
| 113 | <div className="container"> |
| 114 | <span className="text">{strings["unsupported device"]}</span> |
| 115 | </div> |
| 116 | </div>, |
| 117 | ); |
| 118 | } |
| 119 | |
| 120 | const currentTheme = appSettings.value.appTheme; |
| 121 | let $currentItem; |
| 122 | themes.list().forEach((themeSummary) => { |
| 123 | const theme = themes.get(themeSummary.id); |
| 124 | const isCurrentTheme = theme.id === currentTheme; |
| 125 | const isPremium = theme.version === "paid" && !config.HAS_PRO; |
| 126 | const $item = ( |
| 127 | <Item |
| 128 | name={themeSummary.name} |
| 129 | isPremium={isPremium} |
| 130 | isCurrent={isCurrentTheme} |
| 131 | swatches={getAppThemeSwatches(theme)} |
| 132 | onclick={() => setAppTheme(theme, isPremium)} |
| 133 | /> |
| 134 | ); |
| 135 | content.push($item); |
| 136 | if (isCurrentTheme) $currentItem = $item; |
| 137 | }); |
| 138 | |
| 139 | list.el.content = content; |
| 140 | $currentItem?.scrollIntoView(); |
| 141 | } |
| 142 | |
| 143 | function renderEditorThemes() { |
| 144 | const currentTheme = ( |
no test coverage detected