somratpro commited on
Commit
1eb3ace
·
1 Parent(s): a3d9f77

feat: refactor UptimeRobot setup UI with improved messaging and success state styling

Browse files
Files changed (1) hide show
  1. health-server.js +17 -12
health-server.js CHANGED
@@ -436,6 +436,10 @@ function renderDashboard(initialData) {
436
  display: none;
437
  }
438
 
 
 
 
 
439
  .helper-summary {
440
  margin-top: 14px;
441
  padding: 12px 14px;
@@ -450,6 +454,10 @@ function renderDashboard(initialData) {
450
  color: var(--text);
451
  }
452
 
 
 
 
 
453
  .helper-toggle {
454
  margin-top: 14px;
455
  display: inline-flex;
@@ -557,21 +565,16 @@ function renderDashboard(initialData) {
557
  <div class="stat-card helper-card">
558
  <span class="stat-label">Keep Space Awake</span>
559
  <div id="uptimerobot-public-flow">
560
- <div class="helper-copy">
561
- If you use a free Hugging Face Space, it can still sleep.
562
- To keep it awake, create an external UptimeRobot monitor here.
563
- Use your <strong>Main API key</strong>.
564
- </div>
565
- <div class="helper-copy">
566
- Do <strong>not</strong> use the Read-only API key or a Monitor-specific API key.
567
- </div>
568
  <div id="uptimerobot-summary" class="helper-summary">
569
- Optional one-time setup. If you already created the monitor before, you do not need to paste the key again.
570
  </div>
571
  <button id="uptimerobot-toggle" class="helper-toggle" type="button">
572
  Set Up Monitor
573
  </button>
574
  <div id="uptimerobot-shell" class="helper-shell hidden">
 
 
 
575
  <div class="helper-row">
576
  <input
577
  id="uptimerobot-key"
@@ -590,7 +593,7 @@ function renderDashboard(initialData) {
590
  </div>
591
  </div>
592
  <div id="uptimerobot-private-note" class="helper-summary hidden">
593
- <strong>Not available on private Spaces.</strong> External monitors like UptimeRobot cannot reliably access a private Hugging Face Space health URL, so this setup only works on public Spaces.
594
  </div>
595
  <div id="uptimerobot-result" class="helper-result"></div>
596
  </div>
@@ -668,11 +671,13 @@ function renderDashboard(initialData) {
668
  const toggle = document.getElementById('uptimerobot-toggle');
669
 
670
  if (isConfigured) {
671
- summary.innerHTML = '<strong>Already set up.</strong> Your monitor should keep running from UptimeRobot even after this Space restarts.';
 
672
  shell.classList.add('hidden');
673
  toggle.textContent = 'Set Up Again';
674
  } else {
675
- summary.innerHTML = 'Optional one-time setup. If you already created the monitor before, you do not need to paste the key again.';
 
676
  toggle.textContent = 'Set Up Monitor';
677
  }
678
  }
 
436
  display: none;
437
  }
438
 
439
+ .helper-intro.hidden {
440
+ display: none;
441
+ }
442
+
443
  .helper-summary {
444
  margin-top: 14px;
445
  padding: 12px 14px;
 
454
  color: var(--text);
455
  }
456
 
457
+ .helper-summary.success {
458
+ background: rgba(16, 185, 129, 0.08);
459
+ }
460
+
461
  .helper-toggle {
462
  margin-top: 14px;
463
  display: inline-flex;
 
565
  <div class="stat-card helper-card">
566
  <span class="stat-label">Keep Space Awake</span>
567
  <div id="uptimerobot-public-flow">
 
 
 
 
 
 
 
 
568
  <div id="uptimerobot-summary" class="helper-summary">
569
+ One-time setup for public Spaces. Paste your UptimeRobot <strong>Main API key</strong> to create the monitor.
570
  </div>
571
  <button id="uptimerobot-toggle" class="helper-toggle" type="button">
572
  Set Up Monitor
573
  </button>
574
  <div id="uptimerobot-shell" class="helper-shell hidden">
575
+ <div class="helper-copy">
576
+ Do <strong>not</strong> use the Read-only API key or a Monitor-specific API key.
577
+ </div>
578
  <div class="helper-row">
579
  <input
580
  id="uptimerobot-key"
 
593
  </div>
594
  </div>
595
  <div id="uptimerobot-private-note" class="helper-summary hidden">
596
+ <strong>This Space is private.</strong> External monitors cannot reliably access private HF health URLs, so keep-awake setup is only available on public Spaces.
597
  </div>
598
  <div id="uptimerobot-result" class="helper-result"></div>
599
  </div>
 
671
  const toggle = document.getElementById('uptimerobot-toggle');
672
 
673
  if (isConfigured) {
674
+ summary.classList.add('success');
675
+ summary.innerHTML = '<strong>Already set up.</strong> Your UptimeRobot monitor should keep this public Space awake.';
676
  shell.classList.add('hidden');
677
  toggle.textContent = 'Set Up Again';
678
  } else {
679
+ summary.classList.remove('success');
680
+ summary.innerHTML = 'One-time setup for public Spaces. Paste your UptimeRobot <strong>Main API key</strong> to create the monitor.';
681
  toggle.textContent = 'Set Up Monitor';
682
  }
683
  }