@@ -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 ) {
0 commit comments