%# app/views/admin/timeline/show.html.erb %> <%# Instance variables: @users_with_timeline_data, @primary_user, @date, @next_date, @prev_date %> <% primary_user_tz = @primary_user&.timezone || (current_user&.timezone || 'UTC') timeline_start_hour = 0 timeline_end_hour = 23 user_colors = ['#7C3AED', '#10B981', '#3B82F6', '#F59E0B', '#EF4444', '#DB2777', '#6D28D9'] users_data_array = Array(@users_with_timeline_data) num_users = users_data_array.count num_users = 1 if num_users == 0 # Ensure num_users is at least 1 for calculations # Fixed REM values for layout (assuming 1rem = 16px for px calculations) line_left_rem = 4.0 line_right_rem = 0.5 activity_col_area_start_rem = line_left_rem # Header spacer aligns with hour labels activity_col_area_end_rem = line_right_rem # Header spacer aligns with right padding of grid gutter_rem = 0.25 pixels_per_hour = 128 # Controls vertical scale pixels_per_minute = pixels_per_hour / 60.0 min_column_width_px = 186 # Minimum width for each user column gutter_px = gutter_rem * 16 # Gutter in pixels # Calculate the total minimum width required for all user columns + gutters + fixed label/padding areas # This width will be applied to the admin-timeline-content-sizer div user_columns_total_min_width_px = (num_users * min_column_width_px) gutters_total_width_px = (num_users > 1 ? (num_users - 1) * gutter_px : 0) # Total min width for the content that scrolls (headers part) min_header_content_width_px = user_columns_total_min_width_px + gutters_total_width_px # Total min width for the grid content part (timeline-grid-scroll-container's content) # This area includes the hour labels on the left, then the user activity columns, then right padding min_grid_content_width_px = (line_left_rem * 16) + min_header_content_width_px + (line_right_rem * 16) # The sizer div needs to be at least as wide as the widest of its direct children (header row or grid row) # The header row's actual content part (user headers) spans min_header_content_width_px. # Add fixed spacers for the header: total_min_scroll_width_px = (activity_col_area_start_rem * 16) + min_header_content_width_px + (activity_col_area_end_rem * 16) # Current admin user and selected users for Stimulus current_admin_user = { id: current_user.id, display_name: current_user.display_name, avatar_url: current_user.avatar_url } current_admin_user_json = current_admin_user.to_json initial_selected_users_json = @initial_selected_user_objects.to_json current_date_for_form = @date.to_s %>