cjerzak commited on
Commit
6dbfcee
·
verified ·
1 Parent(s): aea85e3

Update app.R

Browse files
Files changed (1) hide show
  1. app.R +34 -13
app.R CHANGED
@@ -117,6 +117,27 @@ getMetricLabel <- function(metric_value) {
117
 
118
  # UI Definition
119
  ui <- fluidPage(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  titlePanel("Multiscale Representations Explorer"),
121
 
122
  tags$p(
@@ -130,13 +151,13 @@ ui <- fluidPage(
130
  icon("external-link", style = "font-size: 12px;")
131
  )
132
  ),
133
-
134
  # ---- Here is the minimal "Share" button HTML + JS inlined in Shiny ----
135
  # We wrap it in tags$div(...) and tags$script(HTML(...)) so it is recognized
136
  # by Shiny. You can adjust the styling or placement as needed.
137
  tags$div(
138
- style = "text-align: left; margin: 1em 0 1em 0em;",
139
- HTML('
140
  <button id="share-button"
141
  style="
142
  display: inline-flex;
@@ -164,9 +185,9 @@ ui <- fluidPage(
164
  <strong>Share</strong>
165
  </button>
166
  '),
167
- # Insert the JS as well
168
- tags$script(
169
- HTML("
170
  (function() {
171
  const shareBtn = document.getElementById('share-button');
172
  // Reusable helper function to show a small “Copied!” message
@@ -223,10 +244,10 @@ ui <- fluidPage(
223
  });
224
  })();
225
  ")
226
- )
227
- ),
228
  # ---- End: Minimal Share button snippet ----
229
-
230
 
231
  sidebarLayout(
232
  sidebarPanel(
@@ -247,7 +268,7 @@ ui <- fluidPage(
247
  checkboxInput("compareToBest", "Compare to best single scale", value = FALSE)
248
  ),
249
  mainPanel(
250
- plotOutput("heatmapPlot", height = "600px"),
251
  div(style = "margin-top: 10px; font-style: italic;", uiOutput("contextNote"))
252
  )
253
  )
@@ -340,7 +361,8 @@ server <- function(input, output) {
340
  })
341
 
342
  # Heatmap Output
343
- output$heatmapPlot <- renderPlot({
 
344
  interp_data <- interpolated_data()
345
  if (is.null(interp_data)) {
346
  plot.new()
@@ -454,5 +476,4 @@ server <- function(input, output) {
454
  }
455
 
456
  # Run the Shiny App
457
- shinyApp(ui = ui, server = server)
458
-
 
117
 
118
  # UI Definition
119
  ui <- fluidPage(
120
+ tags$head(
121
+ # Make the layout fluid on phones
122
+ tags$meta(name = "viewport",
123
+ content = "width=device-width, initial-scale=1"),
124
+
125
+ # Tiny CSS tweaks that only activate below 576 px
126
+ tags$style(HTML("
127
+ @media (max-width: 575.98px) {
128
+ /* shrink side padding so the sidebar fits */
129
+ .sidebar-panel, .panel-body, .form-group {padding-left:8px !important; padding-right:8px !important;}
130
+
131
+ /* make the Share button & inputs finger‑friendly */
132
+ #share-button {font-size: 0.9rem; padding: 6px 10px;}
133
+ select.form-control {font-size: 0.9rem; height: 36px;}
134
+
135
+ /* relax margins in the heading paragraph */
136
+ p {margin-bottom: 0.6rem;}
137
+ }
138
+ "))
139
+ ),
140
+
141
  titlePanel("Multiscale Representations Explorer"),
142
 
143
  tags$p(
 
151
  icon("external-link", style = "font-size: 12px;")
152
  )
153
  ),
154
+
155
  # ---- Here is the minimal "Share" button HTML + JS inlined in Shiny ----
156
  # We wrap it in tags$div(...) and tags$script(HTML(...)) so it is recognized
157
  # by Shiny. You can adjust the styling or placement as needed.
158
  tags$div(
159
+ style = "text-align: left; margin: 1em 0 1em 0em;",
160
+ HTML('
161
  <button id="share-button"
162
  style="
163
  display: inline-flex;
 
185
  <strong>Share</strong>
186
  </button>
187
  '),
188
+ # Insert the JS as well
189
+ tags$script(
190
+ HTML("
191
  (function() {
192
  const shareBtn = document.getElementById('share-button');
193
  // Reusable helper function to show a small “Copied!” message
 
244
  });
245
  })();
246
  ")
247
+ )
248
+ ),
249
  # ---- End: Minimal Share button snippet ----
250
+
251
 
252
  sidebarLayout(
253
  sidebarPanel(
 
268
  checkboxInput("compareToBest", "Compare to best single scale", value = FALSE)
269
  ),
270
  mainPanel(
271
+ plotOutput("heatmapPlot"),
272
  div(style = "margin-top: 10px; font-style: italic;", uiOutput("contextNote"))
273
  )
274
  )
 
361
  })
362
 
363
  # Heatmap Output
364
+ output$heatmapPlot <- renderPlot(
365
+ {
366
  interp_data <- interpolated_data()
367
  if (is.null(interp_data)) {
368
  plot.new()
 
476
  }
477
 
478
  # Run the Shiny App
479
+ shinyApp(ui = ui, server = server)