Skip to content

Commit 56e3dd5

Browse files
committed
add optional link to github repo of bundle module (DISPLAY_GITHUB_LINK)
put some template links in a common file
1 parent c366216 commit 56e3dd5

14 files changed

+83
-11
lines changed
4.17 KB
Loading

assets/images/GitHub-Mark-32px.png

1.67 KB
Loading

assets/images/GitHub-Mark-64px.png

2.56 KB
Loading
3.95 KB
Loading
1.53 KB
Loading
2.28 KB
Loading

assets/main/board_page.css

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,17 @@ commands group.unrolled .icon-right {
376376
text-align: center;
377377
font-weight: normal;
378378
}
379-
#circup_page table .name { width: 100%; }
379+
#circup_page table .name {
380+
width: 100%;
381+
}
382+
#circup_page table .name .repo_link {
383+
margin-left: 8px;
384+
}
385+
#circup_page table .name .repo_link img {
386+
height: 18px;
387+
opacity: 0.5;
388+
vertical-align: bottom;
389+
}
380390
#circup_page table .board_version { white-space: nowrap; }
381391
#circup_page table .bundle_version { white-space: nowrap; }
382392
#circup_page table .status_icon {
@@ -449,6 +459,16 @@ commands group.unrolled .icon-right {
449459
padding: 2px 4px;
450460
}
451461
#bundle_list .liste p.hide { display: none; }
462+
#bundle_list .liste p .repo_link {
463+
margin-left: 8px;
464+
}
465+
#bundle_list .liste p .repo_link img {
466+
height: 16px;
467+
vertical-align: bottom;
468+
opacity: 0.5;
469+
/* filter: var(--svg-glow); */
470+
}
471+
452472
.pair0 {
453473
background: var(--color-pair0);
454474
}

assets/main/board_page.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ SPDX-FileCopyrightText: Copyright (c) 2022 Neradoc, https://neradoc.me
33
SPDX-License-Identifier: MIT
44
*/
55

6-
import { BUNDLE_ACCESS, OPEN_IN_BROWSER } from "../../config.js"
6+
import { BUNDLE_ACCESS, OPEN_IN_BROWSER, DISPLAY_GITHUB_LINK } from "../../config.js"
77
import * as common from "../main/common.js"
88
import * as tools from "../lib/tools.js"
99
import { setup_directory, refresh_list } from "../main/list_directory.js"
@@ -267,12 +267,21 @@ async function run_update_process(imports) {
267267
var module = common.library_bundle.get_module(dependency)
268268
var file_name = module.name + (module.package ? "" : ".mpy")
269269
var icon = module.package ? "📁" : "📄"
270-
var new_line = $("#circup_row_template").clone(); // clone the template
270+
if(DISPLAY_GITHUB_LINK && module.repo) {
271+
var github = $("#template-icons .repo_link").clone()
272+
github.prop("href", module.repo)
273+
github.on("click", tools.open_outside_sync)
274+
github.show()
275+
}
276+
var new_line = $("#circup_row_template").clone() // clone the template
271277
new_line.prop("id", "")
272278
new_line.find(".upload button").on("click", upload_button_call)
273279
new_line.find(".upload button").val(dependency)
274280
new_line.find(".icon").html(icon)
275281
new_line.find(".name").html(dependency)
282+
if(DISPLAY_GITHUB_LINK && module.repo) {
283+
new_line.find(".name").append(github)
284+
}
276285
new_line.find(".bundle_version").html(module.version)
277286
new_line.find(".board_version").html("...")
278287
if (imports.includes(dependency)) {

assets/main/bundler_select.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ SPDX-FileCopyrightText: Copyright (c) 2022 Neradoc, https://neradoc.me
33
SPDX-License-Identifier: MIT
44
*/
55

6-
import { DEBUG } from "../lib/tools.js"
6+
import { DISPLAY_GITHUB_LINK } from "../../config.js"
7+
import * as tools from "../lib/tools.js"
78
import * as jq from "../extlib/jquery.min.js"
89

910
export var modules_list = []
@@ -150,14 +151,20 @@ async function fill_modules_list() {
150151
keys.forEach((module_name, pair) => {
151152
var nd1 = circup.all_the_modules[module_name].dependencies.length
152153
var nd2 = circup.all_the_modules[module_name].external_dependencies.length
154+
var repo = circup.all_the_modules[module_name].repo
153155
var num_deps = ""
154-
if(DEBUG) { num_deps = `(${nd1+nd2})`; }
155-
$("#bundle_modules").append(
156-
`<p>
157-
<input class="checkbox" type="checkbox"/>
158-
<span class="module">${module_name}</span> ${num_deps}
159-
</p>`
160-
)
156+
if(tools.DEBUG) { num_deps = `(${nd1+nd2})`; }
157+
var line_to_add = $(`<p>
158+
<input class="checkbox" type="checkbox"/>
159+
<span class="module">${module_name}</span> ${num_deps}
160+
</p>`)
161+
if(DISPLAY_GITHUB_LINK && repo) {
162+
var github = $("#template-icons .repo_link").clone()
163+
github.prop("href", repo)
164+
github.on("click", tools.open_outside_sync)
165+
line_to_add.find(".module").append(github)
166+
}
167+
$("#bundle_modules").append(line_to_add)
161168
})
162169
filter_the_modules()
163170
}

assets/main/common.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ SPDX-License-Identifier: MIT
5757
--caret-color: white;
5858
--color-editor-zebra: rgba(50, 50, 50, 0.2);
5959
}
60+
.light-mode { display: none; }
61+
}
62+
@media (prefers-color-scheme: light) {
63+
.dark-mode { display: none; }
6064
}
6165

6266
body {
@@ -85,3 +89,7 @@ button, input {
8589
border-radius: 4px;
8690
padding: 2px 4px;
8791
}
92+
93+
#template-icons {
94+
display: none;
95+
}

0 commit comments

Comments
 (0)