Skip to content

Commit e8dd2c1

Browse files
Add last synced timestamp to demo
1 parent 52e12fb commit e8dd2c1

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

demo.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,16 @@
161161
to { transform: translateY(0); opacity: 1; }
162162
}
163163

164+
.last-updated {
165+
color: #666;
166+
font-size: 12px;
167+
margin-top: 10px;
168+
}
169+
.last-updated .time {
170+
color: #10b981;
171+
font-weight: 500;
172+
}
173+
164174
.footer {
165175
text-align: center;
166176
padding: 30px;
@@ -179,6 +189,7 @@ <h1>📝 Live Notes</h1>
179189
<span class="dot" id="statusDot"></span>
180190
<span id="statusText">Connecting...</span>
181191
</div>
192+
<div id="lastUpdated" class="last-updated"></div>
182193
</header>
183194

184195
<div id="notesList" class="notes-list"></div>
@@ -228,6 +239,13 @@ <h1>📝 Live Notes</h1>
228239
document.getElementById('statusText').textContent = text;
229240
}
230241

242+
function updateTimestamp() {
243+
const now = new Date();
244+
const time = now.toLocaleTimeString();
245+
document.getElementById('lastUpdated').innerHTML =
246+
`Last synced: <span class="time">${time}</span>`;
247+
}
248+
231249
function showToast() {
232250
const toast = document.getElementById('updateToast');
233251
toast.classList.add('show');
@@ -294,6 +312,7 @@ <h3>${titleCased}</h3>
294312
client.on('sync', async (event) => {
295313
if (event.status === 'complete') {
296314
setStatus('synced', `Synced • ${event.commit?.slice(0, 7)}`);
315+
updateTimestamp();
297316
await loadNotes();
298317
} else if (event.status === 'error') {
299318
setStatus('error', 'Sync failed');

0 commit comments

Comments
 (0)