Spaces:
Running
Running
Update templates/index.html
Browse files- templates/index.html +1 -147
templates/index.html
CHANGED
@@ -44,150 +44,4 @@
|
|
44 |
color: white;
|
45 |
padding: 10px;
|
46 |
border-radius: 5px;
|
47 |
-
font-size:
|
48 |
-
text-align: center;
|
49 |
-
margin-bottom: 15px;
|
50 |
-
}
|
51 |
-
.tiles {
|
52 |
-
display: grid;
|
53 |
-
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
54 |
-
gap: 20px;
|
55 |
-
justify-content: center;
|
56 |
-
}
|
57 |
-
.article-tile {
|
58 |
-
background-color: white;
|
59 |
-
padding: 15px;
|
60 |
-
border-radius: 8px;
|
61 |
-
box-shadow: 0 4px 8px rgba(0,0,0,0.1); /* Subtle shadow like screenshot */
|
62 |
-
transition: transform 0.2s;
|
63 |
-
overflow: hidden;
|
64 |
-
border: 1px solid #e0e0e0; /* Subtle grey outline from screenshot */
|
65 |
-
}
|
66 |
-
.article-tile:hover {
|
67 |
-
transform: scale(1.05);
|
68 |
-
box-shadow: 0 6px 12px rgba(0,0,0,0.15);
|
69 |
-
}
|
70 |
-
.article-tile img, .article-tile svg {
|
71 |
-
width: 100%;
|
72 |
-
height: 150px;
|
73 |
-
object-fit: cover;
|
74 |
-
border-radius: 5px;
|
75 |
-
}
|
76 |
-
.title a {
|
77 |
-
font-size: 1.1em;
|
78 |
-
color: #2c3e50;
|
79 |
-
text-decoration: none;
|
80 |
-
display: block;
|
81 |
-
margin: 10px 0;
|
82 |
-
font-weight: bold;
|
83 |
-
}
|
84 |
-
.title a:hover {
|
85 |
-
color: #3498db;
|
86 |
-
}
|
87 |
-
.description {
|
88 |
-
color: #555;
|
89 |
-
font-size: 0.9em;
|
90 |
-
margin: 5px 0;
|
91 |
-
line-height: 1.4;
|
92 |
-
}
|
93 |
-
.published {
|
94 |
-
font-size: 0.8em;
|
95 |
-
color: #95a5a6;
|
96 |
-
margin-top: 10px;
|
97 |
-
}
|
98 |
-
#loading {
|
99 |
-
display: block;
|
100 |
-
position: fixed;
|
101 |
-
top: 0;
|
102 |
-
left: 0;
|
103 |
-
width: 100%;
|
104 |
-
height: 100%;
|
105 |
-
background: rgba(0,0,0,0.5);
|
106 |
-
z-index: 1000;
|
107 |
-
}
|
108 |
-
.loader {
|
109 |
-
position: absolute;
|
110 |
-
top: 50%;
|
111 |
-
left: 50%;
|
112 |
-
transform: translate(-50%, -50%);
|
113 |
-
width: 50px;
|
114 |
-
height: 50px;
|
115 |
-
border: 5px solid #f3f3f3;
|
116 |
-
border-top: 5px solid #3498db;
|
117 |
-
border-radius: 50%;
|
118 |
-
animation: spin 1s linear infinite;
|
119 |
-
}
|
120 |
-
@keyframes spin {
|
121 |
-
0% { transform: translate(-50%, -50%) rotate(0deg); }
|
122 |
-
100% { transform: translate(-50%, -50%) rotate(360deg); }
|
123 |
-
}
|
124 |
-
</style>
|
125 |
-
</head>
|
126 |
-
<body>
|
127 |
-
<div id="loading"><div class="loader"></div></div>
|
128 |
-
<h1>News Feed Hub</h1>
|
129 |
-
<div class="search-container">
|
130 |
-
<form method="POST" id="searchForm">
|
131 |
-
<input type="text" name="search" class="search-bar" placeholder="Search news semantically...">
|
132 |
-
</form>
|
133 |
-
</div>
|
134 |
-
{% for category, articles in categorized_articles.items() %}
|
135 |
-
<div class="category-section">
|
136 |
-
<div class="category-title">{{ category }}</div>
|
137 |
-
<div class="tiles">
|
138 |
-
{% for article in articles %}
|
139 |
-
<div class="article-tile">
|
140 |
-
{% if article.image != "svg" %}
|
141 |
-
<img src="{{ article.image }}" alt="Article Image">
|
142 |
-
{% else %}
|
143 |
-
<svg width="100%" height="150" viewBox="0 0 300 150" xmlns="http://www.w3.org/2000/svg">
|
144 |
-
<rect width="300" height="150" fill="#e0e0e0"/>
|
145 |
-
<text x="50%" y="50%" text-anchor="middle" dy=".3em" font-size="20" fill="#666">
|
146 |
-
No Image Available
|
147 |
-
</text>
|
148 |
-
</svg>
|
149 |
-
{% endif %}
|
150 |
-
<div class="title"><a href="{{ article.link }}" target="_blank">{{ article.title }}</a></div>
|
151 |
-
<div class="description">{{ article.description }}</div>
|
152 |
-
<div class="published">Published: {{ article.published }}</div>
|
153 |
-
</div>
|
154 |
-
{% endfor %}
|
155 |
-
</div>
|
156 |
-
</div>
|
157 |
-
{% endfor %}
|
158 |
-
|
159 |
-
<script>
|
160 |
-
document.addEventListener('DOMContentLoaded', () => {
|
161 |
-
const form = document.getElementById('searchForm');
|
162 |
-
const loading = document.getElementById('loading');
|
163 |
-
|
164 |
-
form.addEventListener('submit', () => {
|
165 |
-
loading.style.display = 'block';
|
166 |
-
});
|
167 |
-
|
168 |
-
// Poll until feeds are loaded
|
169 |
-
function checkFeeds() {
|
170 |
-
fetch('/check_feeds')
|
171 |
-
.then(response => response.json())
|
172 |
-
.then(data => {
|
173 |
-
if (data.status === "loaded") {
|
174 |
-
window.location.href = '/index';
|
175 |
-
} else if (data.status === "error") {
|
176 |
-
console.error('Error loading feeds:', data.message);
|
177 |
-
loading.style.display = 'none';
|
178 |
-
alert('Failed to load RSS feeds. Please try again.');
|
179 |
-
} else {
|
180 |
-
setTimeout(checkFeeds, 1000); // Check every second
|
181 |
-
}
|
182 |
-
})
|
183 |
-
.catch(error => {
|
184 |
-
console.error('Error checking feeds:', error);
|
185 |
-
loading.style.display = 'none';
|
186 |
-
alert('Network error while loading feeds. Please try again.');
|
187 |
-
});
|
188 |
-
}
|
189 |
-
checkFeeds();
|
190 |
-
});
|
191 |
-
</script>
|
192 |
-
</body>
|
193 |
-
</html>
|
|
|
44 |
color: white;
|
45 |
padding: 10px;
|
46 |
border-radius: 5px;
|
47 |
+
font-size:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|