Skip to content

Commit c2412c7

Browse files
committed
feat: update timeline display and session management styles
1 parent 8025374 commit c2412c7

File tree

4 files changed

+57
-51
lines changed

4 files changed

+57
-51
lines changed

src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ <h4 id="selected-day-title">Today's Sessions</h4>
250250
<!-- Will be filled by JavaScript with hour markers -->
251251
</div>
252252
<!-- Timeline Track -->
253-
<div class="timeline-track" id="timeline-track" style="display: flex;">
253+
<div class="timeline-track" id="timeline-track">
254254
<!-- Will show session blocks positioned by time -->
255255
</div>
256256
</div>

src/managers/navigation-manager.js

Lines changed: 43 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -846,13 +846,21 @@ export class NavigationManager {
846846
setupTimelineHours(timelineHours) {
847847
timelineHours.innerHTML = '';
848848

849-
// Show only major hours every 3 hours: 6, 9, 12, 15, 18
850-
const majorHours = [6, 9, 12, 15, 18];
849+
// Show major hours every 4 hours: 0, 4, 8, 12, 16, 20
850+
const majorHours = [0, 4, 8, 12, 16, 20];
851+
const timelineStartHour = 0; // 12 AM (midnight)
852+
const timelineRangeHours = 24; // Full day = 24 hours
851853

852854
majorHours.forEach(hour => {
853855
const hourElement = document.createElement('div');
854856
hourElement.className = 'timeline-hour';
855-
hourElement.textContent = `${hour}:00`;
857+
hourElement.textContent = `${hour.toString().padStart(2, '0')}:00`;
858+
859+
// Calculate correct position percentage
860+
const hoursFromStart = hour - timelineStartHour;
861+
const percentage = (hoursFromStart / timelineRangeHours) * 100;
862+
hourElement.style.left = `${percentage}%`;
863+
856864
timelineHours.appendChild(hourElement);
857865
});
858866
}
@@ -870,11 +878,11 @@ export class NavigationManager {
870878
const [startHour, startMinute] = session.start_time.split(':').map(Number);
871879
const [endHour, endMinute] = session.end_time.split(':').map(Number);
872880

873-
// Calculate position and width (6 AM = 0%, 10 PM = 100%)
881+
// Calculate position and width (00:00 = 0%, 23:59 = 100%)
874882
const startTimeInMinutes = startHour * 60 + startMinute;
875883
const endTimeInMinutes = endHour * 60 + endMinute;
876-
const timelineStartMinutes = 6 * 60; // 6 AM
877-
const timelineEndMinutes = 22 * 60; // 10 PM
884+
const timelineStartMinutes = 0; // 00:00 (midnight)
885+
const timelineEndMinutes = 24 * 60; // 24:00 (next midnight)
878886
const timelineRangeMinutes = timelineEndMinutes - timelineStartMinutes;
879887

880888
const leftPercent = Math.max(0, ((startTimeInMinutes - timelineStartMinutes) / timelineRangeMinutes) * 100);
@@ -921,18 +929,23 @@ export class NavigationManager {
921929
// Add event listeners for all sessions (including historical ones)
922930
this.addTimelineSessionEventListeners(sessionElement, session, date);
923931

924-
// Handle overlapping sessions by stacking them vertically
932+
// Place sessions in their own rows
925933
const offset = this.calculateSessionOffset(session, allSessions);
934+
sessionElement.style.transform = `translateY(${offset}px)`;
926935
if (offset > 0) {
927-
sessionElement.style.transform = `translateY(${offset}px)`;
928936
sessionElement.classList.add('session-stacked');
937+
}
929938

930-
// Expand timeline track height if needed
931-
const currentHeight = parseInt(timelineTrack.style.height) || 50;
932-
const requiredHeight = 50 + offset + 35; // base height + offset + session height
933-
if (requiredHeight > currentHeight) {
934-
timelineTrack.style.height = `${requiredHeight}px`;
935-
}
939+
// Calculate required height for all sessions
940+
const totalSessions = allSessions.length;
941+
const rowHeight = 20; // 15px session height + 5px spacing
942+
const baseHeight = 20; // Base padding
943+
const requiredHeight = baseHeight + (totalSessions * rowHeight);
944+
945+
// Update timeline track height
946+
const currentHeight = parseInt(timelineTrack.style.height) || 50;
947+
if (requiredHeight > currentHeight) {
948+
timelineTrack.style.height = `${requiredHeight}px`;
936949
}
937950

938951
timelineTrack.appendChild(sessionElement);
@@ -1206,9 +1219,9 @@ export class NavigationManager {
12061219
const widthPercent = parseFloat(sessionElement.style.width);
12071220
const rightPercent = leftPercent + widthPercent;
12081221

1209-
// Convert percentages back to time (6 AM to 10 PM range)
1210-
const timelineStartMinutes = 6 * 60; // 6 AM
1211-
const timelineRangeMinutes = 16 * 60; // 16 hours (6 AM to 10 PM)
1222+
// Convert percentages back to time (00:00 to 23:59 range)
1223+
const timelineStartMinutes = 0; // 00:00 (midnight)
1224+
const timelineRangeMinutes = 24 * 60; // 24 hours (full day)
12121225

12131226
const startMinutes = timelineStartMinutes + (leftPercent / 100) * timelineRangeMinutes;
12141227
const endMinutes = timelineStartMinutes + (rightPercent / 100) * timelineRangeMinutes;
@@ -1411,9 +1424,8 @@ export class NavigationManager {
14111424

14121425
updateDragTooltip(tooltip, mouseEvent, percentage, session) {
14131426
// Calculate time from percentage
1414-
const timelineStartMinutes = 6 * 60; // 6 AM
1415-
const timelineRangeMinutes = 16 * 60; // 16 hours (6 AM to 10 PM)
1416-
const widthPercent = parseFloat(session.duration) / timelineRangeMinutes * 100;
1427+
const timelineStartMinutes = 0; // 00:00 (midnight)
1428+
const timelineRangeMinutes = 24 * 60; // 24 hours (full day)
14171429

14181430
const startMinutes = timelineStartMinutes + (percentage / 100) * timelineRangeMinutes;
14191431
const endMinutes = startMinutes + (session.duration || 25); // Default 25 min if no duration
@@ -1439,9 +1451,9 @@ export class NavigationManager {
14391451
const widthPercent = parseFloat(sessionElement.style.width);
14401452
const rightPercent = leftPercent + widthPercent;
14411453

1442-
// Convert percentages to time (6 AM to 10 PM range)
1443-
const timelineStartMinutes = 6 * 60; // 6 AM
1444-
const timelineRangeMinutes = 16 * 60; // 16 hours
1454+
// Convert percentages to time (00:00 to 23:59 range)
1455+
const timelineStartMinutes = 0; // 00:00 (midnight)
1456+
const timelineRangeMinutes = 24 * 60; // 24 hours
14451457

14461458
const startMinutes = timelineStartMinutes + (leftPercent / 100) * timelineRangeMinutes;
14471459
const endMinutes = timelineStartMinutes + (rightPercent / 100) * timelineRangeMinutes;
@@ -1465,8 +1477,14 @@ export class NavigationManager {
14651477
}
14661478

14671479
calculateSessionOffset(session, allSessions) {
1468-
// Always return 0 to keep all sessions on the same line
1469-
return 0;
1480+
if (!allSessions || allSessions.length <= 1) return 0;
1481+
1482+
// Find the index of this session in the array
1483+
const sessionIndex = allSessions.findIndex(s => s.id === session.id);
1484+
1485+
// Each session gets its own row
1486+
const rowHeight = 20; // 15px session height + 5px spacing
1487+
return sessionIndex * rowHeight;
14701488
}
14711489

14721490
createSessionHoverTooltip(session) {

src/styles/shared-components.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,8 @@
402402
height: 100vh;
403403
overflow-y: auto;
404404
z-index: 100;
405+
border-radius: 16px;
406+
;
405407
}
406408

407409
/* Sidebar navigation container */

src/styles/timeline.css

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,24 @@
1111
}
1212

1313
.timeline-hours {
14-
display: flex;
15-
justify-content: space-between;
16-
margin-bottom: 0.2rem;
1714
position: relative;
15+
margin-bottom: 0.2rem;
1816
height: 12px;
1917
padding: 0 5px;
2018
}
2119

2220
.timeline-hour {
2321
font-size: 9px;
2422
color: #9ca3af;
25-
position: relative;
23+
position: absolute;
2624
text-align: center;
2725
display: flex;
2826
align-items: center;
2927
justify-content: center;
3028
height: 12px;
3129
font-weight: 400;
3230
letter-spacing: 0.5px;
31+
transform: translateX(-50%);
3332
}
3433

3534
.timeline-hour::after {
@@ -39,26 +38,16 @@
3938
left: 50%;
4039
transform: translateX(-50%);
4140
width: 1px;
42-
height: 45px;
41+
height: calc(100vh - 200px);
42+
max-height: 500px;
4343
background: #e5e7eb;
4444
z-index: 1;
4545
}
4646

47-
.timeline-hour:first-child::after {
48-
left: 0;
49-
transform: none;
50-
}
51-
52-
.timeline-hour:last-child::after {
53-
right: 0;
54-
left: auto;
55-
transform: none;
56-
}
57-
5847
.timeline-track {
5948
position: relative;
60-
height: 50px;
61-
min-height: 50px;
49+
height: 40px;
50+
min-height: 40px;
6251
background: white;
6352
border-radius: 4px;
6453
border: 1px solid #e0e0e0;
@@ -68,16 +57,15 @@
6857

6958
.timeline-session {
7059
position: absolute;
71-
height: 35px;
60+
height: 15px;
7261
border-radius: 4px;
7362
cursor: move;
7463
display: flex;
7564
align-items: center;
7665
justify-content: center;
77-
font-size: 0.7rem;
66+
font-size: 0.6rem;
7867
font-weight: 500;
7968
color: white;
80-
top: 7px;
8169
min-width: 30px;
8270
user-select: none;
8371
transition: all 0.2s ease;
@@ -124,8 +112,7 @@
124112
.timeline-session.historical {
125113
opacity: 0.6;
126114
cursor: default;
127-
height: 20px;
128-
top: 15px;
115+
height: 15px;
129116
min-width: 20px;
130117
border-radius: 2px;
131118
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
@@ -139,8 +126,7 @@
139126

140127
/* Today's Sessions - Minimal Display */
141128
.timeline-session.today-session {
142-
height: 30px;
143-
top: 10px;
129+
height: 15px;
144130
z-index: 10;
145131
}
146132

0 commit comments

Comments
 (0)