Spaces:
Running
Running
Update templates/index.html
Browse files- templates/index.html +39 -123
templates/index.html
CHANGED
@@ -1,154 +1,70 @@
|
|
1 |
<!DOCTYPE html>
|
2 |
<html lang="en" data-theme="dark">
|
3 |
-
|
4 |
<head>
|
5 |
<meta charset="UTF-8">
|
6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7 |
<title>Sentinel TradeFlow Protocol</title>
|
8 |
-
|
9 |
-
<!-- Pico.css for modern styling -->
|
10 |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css">
|
11 |
-
|
12 |
-
<!-- HTMX Core and Server-Sent Events (SSE) Extension -->
|
13 |
<script src="https://unpkg.com/[email protected]"></script>
|
14 |
<script src="https://unpkg.com/htmx.org/dist/ext/sse.js"></script>
|
15 |
-
|
16 |
<style>
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
}
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
}
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
}
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
}
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
border: 1px solid #374151; /* Subtle border */
|
41 |
-
border-radius: 0.5rem;
|
42 |
-
padding: 0; /* Remove default padding to use header/body structure */
|
43 |
-
}
|
44 |
-
|
45 |
-
article > header {
|
46 |
-
padding: 1rem 1.5rem;
|
47 |
-
border-bottom: 1px solid #374151;
|
48 |
-
font-weight: bold;
|
49 |
-
}
|
50 |
-
|
51 |
-
#signal-container {
|
52 |
-
padding: 1.5rem;
|
53 |
-
min-height: 200px; /* Give the container some initial height */
|
54 |
-
}
|
55 |
-
|
56 |
-
/* Styles for the dynamically loaded signal cards */
|
57 |
-
.card {
|
58 |
-
background-color: #374151; /* Darker card background for contrast */
|
59 |
-
border-radius: 0.375rem;
|
60 |
-
border-left-width: 5px;
|
61 |
-
border-left-style: solid;
|
62 |
-
margin-bottom: 1.5rem;
|
63 |
-
padding: 1rem 1.5rem;
|
64 |
-
}
|
65 |
-
|
66 |
-
blockquote {
|
67 |
-
margin: 0 0 1rem 0;
|
68 |
-
padding: 0;
|
69 |
-
border: none;
|
70 |
-
font-style: normal;
|
71 |
-
font-weight: 500;
|
72 |
-
}
|
73 |
-
|
74 |
-
blockquote a {
|
75 |
-
color: #E5E7EB;
|
76 |
-
text-decoration: none;
|
77 |
-
}
|
78 |
-
blockquote a:hover {
|
79 |
-
text-decoration: underline;
|
80 |
-
}
|
81 |
-
|
82 |
-
/* Color coding for impact */
|
83 |
-
.impact-low { border-left-color: #38BDF8; } /* Light Blue */
|
84 |
-
.impact-medium { border-left-color: #FBBF24; } /* Amber */
|
85 |
-
.impact-high { border-left-color: #F87171; } /* Red */
|
86 |
-
.impact-error { border-left-color: #4B5563; } /* Gray */
|
87 |
-
|
88 |
-
/* Color coding for sentiment */
|
89 |
-
.sentiment-positive { color: #34D399; } /* Green */
|
90 |
-
.sentiment-negative { color: #F87171; } /* Red */
|
91 |
-
.sentiment-neutral { color: #9CA3AF; } /* Gray */
|
92 |
-
.sentiment-error { color: #FBBF24; } /* Amber */
|
93 |
-
|
94 |
-
.status-online {
|
95 |
-
color: #34D399;
|
96 |
-
font-weight: bold;
|
97 |
-
}
|
98 |
-
|
99 |
</style>
|
100 |
</head>
|
101 |
-
|
102 |
-
<!-- Enable the HTMX SSE extension for the page -->
|
103 |
<body hx-ext="sse">
|
104 |
-
|
105 |
<main class="container">
|
106 |
-
|
107 |
-
<header>
|
108 |
<h1>Sentinel TradeFlow Protocol</h1>
|
109 |
<p>Autonomous Low-Latency Signal Generation</p>
|
110 |
</header>
|
111 |
|
112 |
-
<article>
|
|
|
|
|
|
|
|
|
113 |
<header class="grid">
|
114 |
<div><strong>Signal Stream</strong></div>
|
115 |
-
|
116 |
-
<div id="signal-status" style="text-align: right;">Status: CONNECTING...</div>
|
117 |
</header>
|
118 |
-
|
119 |
-
|
120 |
-
<div
|
121 |
-
id="signal-container"
|
122 |
-
sse-connect="/api/signals/stream"
|
123 |
-
hx-swap="afterbegin">
|
124 |
-
<!--
|
125 |
-
sse-connect: Tells HTMX to connect to this endpoint.
|
126 |
-
hx-swap="afterbegin": Tells HTMX to prepend new messages to this div.
|
127 |
-
HTMX listens for the default 'message' event from the server.
|
128 |
-
-->
|
129 |
</div>
|
130 |
</article>
|
131 |
-
|
132 |
</main>
|
133 |
|
134 |
-
<!-- This small script provides better user feedback for the connection status -->
|
135 |
<script>
|
136 |
-
document.body.addEventListener('htmx:sseOpen', function(
|
137 |
-
|
138 |
-
if (statusDiv) {
|
139 |
-
// Update the status text and color when the connection is live.
|
140 |
-
statusDiv.innerHTML = 'Status: <span class="status-online">ONLINE</span>';
|
141 |
-
}
|
142 |
-
});
|
143 |
-
|
144 |
-
document.body.addEventListener('htmx:sseError', function(event) {
|
145 |
const statusDiv = document.getElementById('signal-status');
|
146 |
-
if (statusDiv)
|
147 |
-
|
148 |
-
|
149 |
-
|
|
|
150 |
});
|
151 |
</script>
|
152 |
-
|
153 |
</body>
|
154 |
</html>
|
|
|
1 |
<!DOCTYPE html>
|
2 |
<html lang="en" data-theme="dark">
|
|
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<title>Sentinel TradeFlow Protocol</title>
|
|
|
|
|
7 |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css">
|
|
|
|
|
8 |
<script src="https://unpkg.com/[email protected]"></script>
|
9 |
<script src="https://unpkg.com/htmx.org/dist/ext/sse.js"></script>
|
|
|
10 |
<style>
|
11 |
+
:root { --pico-font-family: 'Inter', system-ui, sans-serif; --pico-font-size: 100%; }
|
12 |
+
body { background-color: #111927; color: #E5E7EB; }
|
13 |
+
.container { max-width: 960px; margin: 2rem auto; }
|
14 |
+
.header { text-align: center; margin-bottom: 3rem; }
|
15 |
+
.header h1 { color: #38BDF8; margin-bottom: 0.25rem; }
|
16 |
+
.header p { color: #9CA3AF; margin: 0; }
|
17 |
+
article { background-color: #1F2937; border: 1px solid #374151; border-radius: 0.5rem; }
|
18 |
+
article > header { padding: 1rem 1.5rem; border-bottom: 1px solid #374151; font-weight: bold; }
|
19 |
+
.price-ticker { display: flex; justify-content: space-around; padding: 0.75rem 1.5rem; font-size: 0.9rem; }
|
20 |
+
.signal-stream-container { padding: 1.5rem; min-height: 400px; }
|
21 |
+
.card { background-color: #374151; border-radius: 0.375rem; border-left: 5px solid; margin-bottom: 1.5rem; padding: 1rem 1.5rem; transition: transform 0.2s ease-in-out; }
|
22 |
+
.card:hover { transform: translateY(-3px); }
|
23 |
+
blockquote { margin: 0 0 1rem; padding: 0; border: none; font-style: normal; font-weight: 500; }
|
24 |
+
blockquote a { color: #E5E7EB; text-decoration: none; }
|
25 |
+
blockquote a:hover { text-decoration: underline; }
|
26 |
+
.impact-low { border-left-color: #38BDF8; }
|
27 |
+
.impact-medium { border-left-color: #FBBF24; }
|
28 |
+
.impact-high { border-left-color: #F87171; }
|
29 |
+
.sentiment-positive { color: #34D399; }
|
30 |
+
.sentiment-negative { color: #F87171; }
|
31 |
+
.sentiment-neutral { color: #9CA3AF; }
|
32 |
+
.status { text-align: right; }
|
33 |
+
.status-online { color: #34D399; font-weight: bold; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
</style>
|
35 |
</head>
|
|
|
|
|
36 |
<body hx-ext="sse">
|
|
|
37 |
<main class="container">
|
38 |
+
<header class="header">
|
|
|
39 |
<h1>Sentinel TradeFlow Protocol</h1>
|
40 |
<p>Autonomous Low-Latency Signal Generation</p>
|
41 |
</header>
|
42 |
|
43 |
+
<article class="price-ticker" hx-get="/api/prices" hx-trigger="every 30s" hx-swap="innerHTML">
|
44 |
+
<span aria-busy="true">Loading prices...</span>
|
45 |
+
</article>
|
46 |
+
|
47 |
+
<article style="margin-top: 2rem;">
|
48 |
<header class="grid">
|
49 |
<div><strong>Signal Stream</strong></div>
|
50 |
+
<div class="status" id="signal-status">Status: CONNECTING... (Last Signal: <span id="last-signal-time">never</span>)</div>
|
|
|
51 |
</header>
|
52 |
+
<div class="signal-stream-container" sse-connect="/api/signals/stream" hx-swap="afterbegin">
|
53 |
+
<!-- New signals will appear here -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
</div>
|
55 |
</article>
|
|
|
56 |
</main>
|
57 |
|
|
|
58 |
<script>
|
59 |
+
document.body.addEventListener('htmx:sseOpen', function(evt) {
|
60 |
+
document.querySelector('#signal-status .status-text')?.remove();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
const statusDiv = document.getElementById('signal-status');
|
62 |
+
if (statusDiv.querySelector('.status-online')) return; // Already online
|
63 |
+
const onlineSpan = document.createElement('span');
|
64 |
+
onlineSpan.className = 'status-online';
|
65 |
+
onlineSpan.textContent = 'ONLINE';
|
66 |
+
statusDiv.prepend(onlineSpan, 'Status: ');
|
67 |
});
|
68 |
</script>
|
|
|
69 |
</body>
|
70 |
</html>
|