Skip to content

Commit e26553b

Browse files
committed
Information Pop-up added
1 parent 62c7986 commit e26553b

1 file changed

Lines changed: 36 additions & 12 deletions

File tree

‎app.R‎

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,14 @@ ui <- fluidPage(
260260
.charm-tutorial { text-align: center; margin: 16px 0 0; font-size: 14px; }
261261
.charm-footer { text-align: center; font-size: 12px; color: #666; max-width: 900px;
262262
margin: 0 auto; padding-top: 14px; border-top: 1px solid #e0e0e0; }
263+
#charm-info { position: fixed; bottom: 20px; right: 20px; z-index: 1000; text-align: right; }
264+
#charm-info-btn { background: #EAEBEB; border: 1px solid #2c3e50; border-radius: 999px;
265+
padding: 5px 13px; font-size: 12px; color: #2c3e50; cursor: pointer; }
266+
#charm-info-btn:hover { background: #dfe1e1; }
267+
#charm-info-panel { display: none; position: absolute; bottom: 100%; right: 0; margin-bottom: 8px;
268+
min-width: 130px; background: #EAEBEB; padding: 8px 12px; border-radius: 10px;
269+
border: 1px solid #2c3e50; text-align: center; box-shadow: 0 4px 12px rgba(0,0,0,.2); }
270+
#charm-info.open #charm-info-panel { display: block; }
263271
")),
264272
tags$script(HTML("
265273
Shiny.addCustomMessageHandler('toggleCursor', function(state) {
@@ -271,6 +279,24 @@ ui <- fluidPage(
271279
if (btn) btn.click();
272280
}, msg.delay || 300);
273281
});
282+
document.addEventListener('click', function(e) {
283+
var w = document.getElementById('charm-info');
284+
if (!w) return;
285+
var btn = document.getElementById('charm-info-btn');
286+
if (e.target.closest('#charm-info-btn')) {
287+
var open = w.classList.toggle('open');
288+
btn.setAttribute('aria-expanded', open ? 'true' : 'false');
289+
} else if (!e.target.closest('#charm-info-panel') || e.target.closest('#charm-info-panel a')) {
290+
w.classList.remove('open');
291+
btn.setAttribute('aria-expanded', 'false');
292+
}
293+
});
294+
document.addEventListener('keydown', function(e) {
295+
if (e.key === 'Escape') {
296+
var w = document.getElementById('charm-info');
297+
if (w) { w.classList.remove('open'); document.getElementById('charm-info-btn').setAttribute('aria-expanded', 'false'); }
298+
}
299+
});
274300
Shiny.addCustomMessageHandler('showStatus', function(msg) {
275301
var bar = document.getElementById('charm-status-bar');
276302
if (!bar) return;
@@ -1170,19 +1196,16 @@ ui <- fluidPage(
11701196
# )
11711197
),
11721198

1173-
# GitHub link floating across ALL tabs
1199+
# Info button floating across ALL tabs: collapsed to a small "Info" pill,
1200+
# click to open the panel (version, packages, tutorial, Zenodo, GitHub).
11741201
tags$div(
1175-
style = "
1176-
position: fixed;
1177-
bottom: 20px;
1178-
right: 20px;
1179-
z-index: 1000;
1180-
background-color: #EAEBEB;
1181-
padding: 8px 12px;
1182-
border-radius: 10px;
1183-
border: 1px solid #2c3e50;
1184-
text-align: center;
1185-
",
1202+
id = "charm-info",
1203+
tags$button(
1204+
id = "charm-info-btn", type = "button", "aria-expanded" = "false",
1205+
fa("circle-info", fill = "#2c3e50", height = "1em"), " Info"
1206+
),
1207+
tags$div(
1208+
id = "charm-info-panel",
11861209
tags$div(
11871210
style = "font-size: 11px; color: #2c3e50; margin-bottom: 4px;",
11881211
"Version: 0.9.3"
@@ -1222,6 +1245,7 @@ ui <- fluidPage(
12221245
fa("github", fill = "black", height = "1.5em"),
12231246
" GitHub"
12241247
)
1248+
)
12251249
)
12261250
)
12271251

0 commit comments

Comments
 (0)