Skip to content

Commit 3218788

Browse files
committed
added local time tooltip
1 parent 25bc6cf commit 3218788

2 files changed

Lines changed: 42 additions & 6 deletions

File tree

src/main/resources/static/css/styles.css

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,6 +1359,32 @@ button:disabled {
13591359
.event .timestamp {
13601360
color: var(--color-text-muted);
13611361
margin-right: 0.75rem;
1362+
position: relative;
1363+
border-bottom: 1px dotted currentColor;
1364+
cursor: default;
1365+
}
1366+
1367+
.event .timestamp .timestamp-tooltip {
1368+
visibility: hidden;
1369+
opacity: 0;
1370+
position: absolute;
1371+
left: 0;
1372+
top: 100%;
1373+
margin-top: 4px;
1374+
background: #333;
1375+
color: #fff;
1376+
padding: 0.25rem 0.5rem;
1377+
border-radius: var(--radius-sm);
1378+
font-size: 0.75rem;
1379+
white-space: nowrap;
1380+
z-index: 1000;
1381+
pointer-events: none;
1382+
transition: opacity 0.15s ease-out, visibility 0.15s ease-out;
1383+
}
1384+
1385+
.event .timestamp:hover .timestamp-tooltip {
1386+
visibility: visible;
1387+
opacity: 1;
13621388
}
13631389

13641390
/* --------------------------------------------------------------------------

src/main/resources/static/js/dashboard.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,16 @@ const Dashboard = (function() {
665665
* @param {Object} event - The event object
666666
* @param {boolean} skipRender - If true, skip DOM rendering (used for batch init)
667667
*/
668+
/**
669+
* Builds the timestamp HTML with a local-time tooltip
670+
*/
671+
function buildTimestampHtml(isoTimestamp) {
672+
const dt = new Date(isoTimestamp);
673+
const utcTime = dt.toLocaleTimeString('en-US', { hour12: false, timeZone: 'UTC' }) + ' UTC';
674+
const localTime = dt.toLocaleTimeString('en-US', { hour12: false });
675+
return `<span class="timestamp">${utcTime}<span class="timestamp-tooltip">Local Time: ${localTime}</span></span>`;
676+
}
677+
668678
function addEventToLog(event, skipRender) {
669679
eventLog.unshift(event);
670680
if (skipRender) return;
@@ -673,7 +683,7 @@ const Dashboard = (function() {
673683
if (logEl) {
674684
const levelClass = event.level.toLowerCase();
675685
const simClass = getSimulationClass(event.simulationType);
676-
const time = new Date(event.timestamp).toLocaleTimeString('en-US', { hour12: false, timeZone: 'UTC' }) + ' UTC';
686+
const timestampHtml = buildTimestampHtml(event.timestamp);
677687
const emoji = getSimulationEmoji(event.simulationType, event.event);
678688
const prefix = emoji ? emoji + ' ' : '';
679689

@@ -692,13 +702,13 @@ const Dashboard = (function() {
692702

693703
if (isSimulationBoundaryEvent) {
694704
// Make the message text clickable with dotted underline
695-
eventDiv.innerHTML = `<span class="timestamp">${time}</span> ${prefix}<span class="sim-message"
705+
eventDiv.innerHTML = `${timestampHtml} ${prefix}<span class="sim-message"
696706
data-sim-id="${event.simulationId}"
697707
title="Click to copy Simulation ID: ${event.simulationId}"
698708
onclick="Dashboard.copySimulationId('${event.simulationId}', this)">${event.message}</span>`;
699709
} else {
700710
// Regular event without clickable simulation ID
701-
eventDiv.innerHTML = `<span class="timestamp">${time}</span> ${prefix}${event.message}`;
711+
eventDiv.innerHTML = `${timestampHtml} ${prefix}${event.message}`;
702712
}
703713

704714
logEl.insertBefore(eventDiv, logEl.firstChild);
@@ -720,7 +730,7 @@ const Dashboard = (function() {
720730
eventLog.forEach(event => {
721731
const levelClass = event.level.toLowerCase();
722732
const simClass = getSimulationClass(event.simulationType);
723-
const time = new Date(event.timestamp).toLocaleTimeString('en-US', { hour12: false, timeZone: 'UTC' }) + ' UTC';
733+
const timestampHtml = buildTimestampHtml(event.timestamp);
724734
const emoji = getSimulationEmoji(event.simulationType, event.event);
725735
const prefix = emoji ? emoji + ' ' : '';
726736
const nonSimClass = simClass ? '' : 'non-sim';
@@ -737,12 +747,12 @@ const Dashboard = (function() {
737747
event.event === 'MEMORY_RELEASED');
738748

739749
if (isSimulationBoundaryEvent) {
740-
eventDiv.innerHTML = `<span class="timestamp">${time}</span> ${prefix}<span class="sim-message"
750+
eventDiv.innerHTML = `${timestampHtml} ${prefix}<span class="sim-message"
741751
data-sim-id="${event.simulationId}"
742752
title="Click to copy Simulation ID: ${event.simulationId}"
743753
onclick="Dashboard.copySimulationId('${event.simulationId}', this)">${event.message}</span>`;
744754
} else {
745-
eventDiv.innerHTML = `<span class="timestamp">${time}</span> ${prefix}${event.message}`;
755+
eventDiv.innerHTML = `${timestampHtml} ${prefix}${event.message}`;
746756
}
747757

748758
logEl.appendChild(eventDiv);

0 commit comments

Comments
 (0)