broadfield-dev commited on
Commit
7b84ed4
·
verified ·
1 Parent(s): 37fdec4

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +28 -1
templates/index.html CHANGED
@@ -19,6 +19,7 @@
19
  .description { color: #555; font-size: 0.9em; }
20
  .published { font-size: 0.8em; color: #95a5a6; }
21
  .no-articles { text-align: center; color: #2c3e50; margin-top: 20px; }
 
22
  </style>
23
  </head>
24
  <body>
@@ -28,6 +29,9 @@
28
  <input type="text" name="search" class="search-bar" placeholder="Search news...">
29
  </form>
30
  </div>
 
 
 
31
  {% if has_articles %}
32
  {% for category, articles in categorized_articles.items() %}
33
  <div class="category-section">
@@ -52,7 +56,30 @@
52
  </div>
53
  {% endfor %}
54
  {% else %}
55
- <div class="no-articles">No articles available yet. Try refreshing the page.</div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  {% endif %}
57
  </body>
58
  </html>
 
19
  .description { color: #555; font-size: 0.9em; }
20
  .published { font-size: 0.8em; color: #95a5a6; }
21
  .no-articles { text-align: center; color: #2c3e50; margin-top: 20px; }
22
+ .loading-message { text-align: center; color: #3498db; margin: 10px 0; }
23
  </style>
24
  </head>
25
  <body>
 
29
  <input type="text" name="search" class="search-bar" placeholder="Search news...">
30
  </form>
31
  </div>
32
+ {% if loading %}
33
+ <div class="loading-message">Fetching new RSS feeds in the background...</div>
34
+ {% endif %}
35
  {% if has_articles %}
36
  {% for category, articles in categorized_articles.items() %}
37
  <div class="category-section">
 
56
  </div>
57
  {% endfor %}
58
  {% else %}
59
+ <div class="no-articles">No articles available yet. Loading new feeds...</div>
60
+ {% endif %}
61
+
62
+ {% if loading %}
63
+ <script>
64
+ function checkLoadingStatus() {
65
+ fetch('/check_loading')
66
+ .then(response => response.json())
67
+ .then(data => {
68
+ if (data.status === "complete") {
69
+ location.reload(); // Refresh page when loading is done
70
+ } else {
71
+ setTimeout(checkLoadingStatus, 2000); // Check every 2 seconds
72
+ }
73
+ })
74
+ .catch(error => {
75
+ console.error('Error checking loading status:', error);
76
+ setTimeout(checkLoadingStatus, 2000); // Retry on error
77
+ });
78
+ }
79
+ document.addEventListener('DOMContentLoaded', () => {
80
+ checkLoadingStatus();
81
+ });
82
+ </script>
83
  {% endif %}
84
  </body>
85
  </html>