cjerzak commited on
Commit
abbb659
·
verified ·
1 Parent(s): d2b40ea

Update app.R

Browse files
Files changed (1) hide show
  1. app.R +0 -96
app.R CHANGED
@@ -283,102 +283,6 @@ ui <- dashboardPage(
283
  )
284
  )
285
  ),
286
-
287
- # ---- Here is the minimal "Share" button HTML + JS inlined in Shiny ----
288
- # We wrap it in tags$div(...) and tags$script(HTML(...)) so it is recognized
289
- # by Shiny. You can adjust the styling or placement as needed.
290
- tags$div(
291
- style = "text-align: left; margin: 1em 0 1em 0em;",
292
- HTML('
293
- <button id="share-button"
294
- style="
295
- display: inline-flex;
296
- align-items: center;
297
- justify-content: center;
298
- gap: 8px;
299
- padding: 5px 10px;
300
- font-size: 16px;
301
- font-weight: normal;
302
- color: #000;
303
- background-color: #fff;
304
- border: 1px solid #ddd;
305
- border-radius: 6px;
306
- cursor: pointer;
307
- box-shadow: 0 1.5px 0 #000;
308
- ">
309
- <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor"
310
- stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
311
- <circle cx="18" cy="5" r="3"></circle>
312
- <circle cx="6" cy="12" r="3"></circle>
313
- <circle cx="18" cy="19" r="3"></circle>
314
- <line x1="8.59" y1="13.51" x2="15.42" y2="17.49"></line>
315
- <line x1="15.41" y1="6.51" x2="8.59" y2="10.49"></line>
316
- </svg>
317
- <strong>Share</strong>
318
- </button>
319
- '),
320
- # Insert the JS as well
321
- tags$script(
322
- HTML("
323
- (function() {
324
- const shareBtn = document.getElementById('share-button');
325
- // Reusable helper function to show a small “Copied!” message
326
- function showCopyNotification() {
327
- const notification = document.createElement('div');
328
- notification.innerText = 'Copied to clipboard';
329
- notification.style.position = 'fixed';
330
- notification.style.bottom = '20px';
331
- notification.style.right = '20px';
332
- notification.style.backgroundColor = 'rgba(0, 0, 0, 0.8)';
333
- notification.style.color = '#fff';
334
- notification.style.padding = '8px 12px';
335
- notification.style.borderRadius = '4px';
336
- notification.style.zIndex = '9999';
337
- document.body.appendChild(notification);
338
- setTimeout(() => { notification.remove(); }, 2000);
339
- }
340
- shareBtn.addEventListener('click', function() {
341
- const currentURL = window.location.href;
342
- const pageTitle = document.title || 'Check this out!';
343
- // If browser supports Web Share API
344
- if (navigator.share) {
345
- navigator.share({
346
- title: pageTitle,
347
- text: 'Thought you’d like this!',
348
- url: currentURL
349
- })
350
- .catch((error) => {
351
- console.log('Sharing failed', error);
352
- });
353
- } else {
354
- // Fallback: Copy URL
355
- if (navigator.clipboard && navigator.clipboard.writeText) {
356
- navigator.clipboard.writeText(currentURL).then(() => {
357
- showCopyNotification();
358
- }, (err) => {
359
- console.error('Could not copy text: ', err);
360
- });
361
- } else {
362
- // Double fallback for older browsers
363
- const textArea = document.createElement('textarea');
364
- textArea.value = currentURL;
365
- document.body.appendChild(textArea);
366
- textArea.select();
367
- try {
368
- document.execCommand('copy');
369
- showCopyNotification();
370
- } catch (err) {
371
- alert('Please copy this link:\\n' + currentURL);
372
- }
373
- document.body.removeChild(textArea);
374
- }
375
- }
376
- });
377
- })();
378
- ")
379
- )
380
- ),
381
- # ---- End: Minimal Share button snippet ----
382
 
383
  # ========== Sidebar ================
384
  dashboardSidebar(
 
283
  )
284
  )
285
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
286
 
287
  # ========== Sidebar ================
288
  dashboardSidebar(