Spaces:
Running
Running
michaelkri
commited on
Commit
·
458433b
1
Parent(s):
64a66f1
Improved date
Browse files- app/static/style.css +7 -0
- app/templates/index.html +43 -11
app/static/style.css
CHANGED
|
@@ -446,6 +446,13 @@
|
|
| 446 |
margin-block-end: calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)));
|
| 447 |
}
|
| 448 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 449 |
.space-x-2 {
|
| 450 |
:where(& > :not(:last-child)) {
|
| 451 |
--tw-space-x-reverse: 0;
|
|
|
|
| 446 |
margin-block-end: calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)));
|
| 447 |
}
|
| 448 |
}
|
| 449 |
+
.space-x-1 {
|
| 450 |
+
:where(& > :not(:last-child)) {
|
| 451 |
+
--tw-space-x-reverse: 0;
|
| 452 |
+
margin-inline-start: calc(calc(var(--spacing) * 1) * var(--tw-space-x-reverse));
|
| 453 |
+
margin-inline-end: calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-x-reverse)));
|
| 454 |
+
}
|
| 455 |
+
}
|
| 456 |
.space-x-2 {
|
| 457 |
:where(& > :not(:last-child)) {
|
| 458 |
--tw-space-x-reverse: 0;
|
app/templates/index.html
CHANGED
|
@@ -6,6 +6,7 @@
|
|
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
<title>Focal</title>
|
| 8 |
<link rel="stylesheet" type="text/css" href="../static/style.css">
|
|
|
|
| 9 |
<style>
|
| 10 |
.collapsible-content {
|
| 11 |
max-height: 0;
|
|
@@ -74,7 +75,7 @@
|
|
| 74 |
|
| 75 |
<div class="flex justify-center">
|
| 76 |
<div
|
| 77 |
-
class="flex items-center space-x-
|
| 78 |
{% if update_time == -1 %}
|
| 79 |
<svg class="text-blue-600 h-3 w-3 animate-spin" xmlns="http://www.w3.org/2000/svg" fill="none"
|
| 80 |
viewBox="0 0 24 24">
|
|
@@ -121,8 +122,12 @@
|
|
| 121 |
{% for article in articles %}
|
| 122 |
<article>
|
| 123 |
<hr class="h-px my-8 bg-gray-200 border-0 dark:bg-gray-700">
|
| 124 |
-
<span class="text-sm text-gray-500"
|
| 125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
{% if article.image_url %}
|
| 127 |
<img class="w-full h-48 object-cover rounded-lg mb-4 mt-4" src="{{ article.image_url }}" />
|
| 128 |
{% endif %}
|
|
@@ -130,20 +135,18 @@
|
|
| 130 |
{{ article.content }}
|
| 131 |
</p>
|
| 132 |
<button type="button"
|
| 133 |
-
class="toggle-button cursor-pointer flex items-center space-x-
|
| 134 |
aria-expanded="false" aria-controls="content-to-toggle">
|
| 135 |
<div class="icon-container relative w-4 h-4">
|
| 136 |
-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
|
| 137 |
-
|
| 138 |
-
stroke-linecap="round" stroke-linejoin="round"
|
| 139 |
class="chevron-down lucide lucide-chevron-down w-full h-full transition-opacity duration-300"
|
| 140 |
aria-hidden="true">
|
| 141 |
<path d="m6 9 6 6 6-6"></path>
|
| 142 |
</svg>
|
| 143 |
|
| 144 |
-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
|
| 145 |
-
|
| 146 |
-
stroke-linecap="round" stroke-linejoin="round"
|
| 147 |
class="chevron-up lucide lucide-chevron-down w-full h-full transition-opacity duration-300 hidden"
|
| 148 |
aria-hidden="true">
|
| 149 |
<path d="m18 15-6-6-6 6"></path>
|
|
@@ -187,7 +190,7 @@
|
|
| 187 |
</div>
|
| 188 |
|
| 189 |
<script>
|
| 190 |
-
//
|
| 191 |
document.addEventListener('DOMContentLoaded', function () {
|
| 192 |
const allToggleButtons = document.querySelectorAll('.toggle-button');
|
| 193 |
|
|
@@ -204,6 +207,35 @@
|
|
| 204 |
});
|
| 205 |
});
|
| 206 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 207 |
</script>
|
| 208 |
</body>
|
| 209 |
|
|
|
|
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
<title>Focal</title>
|
| 8 |
<link rel="stylesheet" type="text/css" href="../static/style.css">
|
| 9 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 10 |
<style>
|
| 11 |
.collapsible-content {
|
| 12 |
max-height: 0;
|
|
|
|
| 75 |
|
| 76 |
<div class="flex justify-center">
|
| 77 |
<div
|
| 78 |
+
class="flex items-center space-x-1 px-3 py-1.5 bg-gray-100 dark:bg-gray-700 rounded-lg border border-gray-200 dark:border-gray-600">
|
| 79 |
{% if update_time == -1 %}
|
| 80 |
<svg class="text-blue-600 h-3 w-3 animate-spin" xmlns="http://www.w3.org/2000/svg" fill="none"
|
| 81 |
viewBox="0 0 24 24">
|
|
|
|
| 122 |
{% for article in articles %}
|
| 123 |
<article>
|
| 124 |
<hr class="h-px my-8 bg-gray-200 border-0 dark:bg-gray-700">
|
| 125 |
+
<span class="utc-timestamp text-sm text-gray-500" data-timestamp-utc="{{ article.date }}">
|
| 126 |
+
{{ article.date }}
|
| 127 |
+
</span>
|
| 128 |
+
<h2 class="mb-4 mt-4 text-xl font-semibold tracking-tight text-gray-900">
|
| 129 |
+
{{ article.title }}
|
| 130 |
+
</h2>
|
| 131 |
{% if article.image_url %}
|
| 132 |
<img class="w-full h-48 object-cover rounded-lg mb-4 mt-4" src="{{ article.image_url }}" />
|
| 133 |
{% endif %}
|
|
|
|
| 135 |
{{ article.content }}
|
| 136 |
</p>
|
| 137 |
<button type="button"
|
| 138 |
+
class="toggle-button cursor-pointer flex items-center space-x-1 text-gray-900 bg-white border border-gray-300 focus:outline-none focus:ring-4 focus:ring-gray-100 hover:bg-gray-100 font-semibold rounded-lg text-sm px-4 py-2 me-2 mb-2"
|
| 139 |
aria-expanded="false" aria-controls="content-to-toggle">
|
| 140 |
<div class="icon-container relative w-4 h-4">
|
| 141 |
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
|
| 142 |
+
stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"
|
|
|
|
| 143 |
class="chevron-down lucide lucide-chevron-down w-full h-full transition-opacity duration-300"
|
| 144 |
aria-hidden="true">
|
| 145 |
<path d="m6 9 6 6 6-6"></path>
|
| 146 |
</svg>
|
| 147 |
|
| 148 |
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
|
| 149 |
+
stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"
|
|
|
|
| 150 |
class="chevron-up lucide lucide-chevron-down w-full h-full transition-opacity duration-300 hidden"
|
| 151 |
aria-hidden="true">
|
| 152 |
<path d="m18 15-6-6-6 6"></path>
|
|
|
|
| 190 |
</div>
|
| 191 |
|
| 192 |
<script>
|
| 193 |
+
// Collapsible sections
|
| 194 |
document.addEventListener('DOMContentLoaded', function () {
|
| 195 |
const allToggleButtons = document.querySelectorAll('.toggle-button');
|
| 196 |
|
|
|
|
| 207 |
});
|
| 208 |
});
|
| 209 |
});
|
| 210 |
+
|
| 211 |
+
|
| 212 |
+
// Time conversion function
|
| 213 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 214 |
+
const timeSpans = document.querySelectorAll('.utc-timestamp');
|
| 215 |
+
|
| 216 |
+
timeSpans.forEach(timeSpan => {
|
| 217 |
+
const datetimeStrUTC = timeSpan.getAttribute('data-timestamp-utc');
|
| 218 |
+
|
| 219 |
+
if (datetimeStrUTC) {
|
| 220 |
+
const date = new Date(datetimeStrUTC + 'Z');
|
| 221 |
+
|
| 222 |
+
const options = {
|
| 223 |
+
year: 'numeric',
|
| 224 |
+
month: 'short',
|
| 225 |
+
day: 'numeric',
|
| 226 |
+
hour: '2-digit',
|
| 227 |
+
minute: '2-digit',
|
| 228 |
+
timeZoneName: 'short',
|
| 229 |
+
};
|
| 230 |
+
|
| 231 |
+
const readableLocal = date.toLocaleString(undefined, options);
|
| 232 |
+
|
| 233 |
+
timeSpan.textContent = readableLocal;
|
| 234 |
+
} else {
|
| 235 |
+
timeSpan.textContent = 'Invalid Time';
|
| 236 |
+
}
|
| 237 |
+
});
|
| 238 |
+
});
|
| 239 |
</script>
|
| 240 |
</body>
|
| 241 |
|