Skip to content

Conversation

@sanggggg
Copy link
Collaborator

@sanggggg sanggggg commented Dec 2, 2025

Summary

Adds independent interval control to the session activity histogram, allowing users to customize the granularity of time-based data visualization separately from the duration selection.

Changes

  • New interval selector UI: Added dropdown with 5 interval options (30m, 1h, 6h, 1d, 1w) next to the existing duration selector
  • Smart interval filtering: Automatically hides interval options that are longer than the selected duration (e.g., for "Last 6 hours", only 30m and 1h are available)
  • Auto-reset logic: When duration changes and the current interval becomes invalid, automatically resets to the largest valid interval
  • Centered histogram bars: Offset timestamps by half the interval duration to align bar centers with x-axis tick marks instead of left edges
  • Updated defaults: Changed default view from 24h/15min to 30d/1d for better overview of long-term activity
  • Refactored configuration: Separated TIME_RANGE_CONFIG from interval settings for independent control

Interval Availability Matrix

Duration Available Intervals
Last 6 hours 30m, 1h
Last 24 hours 30m, 1h, 6h
Last 7 days 30m, 1h, 6h, 1d
Last 30 days 30m, 1h, 6h, 1d, 1w

Technical Details

  • Implemented availableIntervals computed value that filters options based on duration
  • Added useEffect hook to handle interval validation when duration changes
  • Modified timestamp formatting logic to adapt labels based on interval granularity
  • Timestamp centering: centeredTime = originalTime + (intervalMinutes / 2)

Testing

  • ✅ All Biome formatting and linting checks pass
  • ✅ Interval selector shows correct options for each duration
  • ✅ Auto-reset works when switching from longer to shorter durations
  • ✅ Charts render correctly with all interval/duration combinations

🤖 Generated with Claude Code

Add UI controls to independently adjust time interval granularity in the activity timeline charts. Previously, intervals were hardcoded per duration; now users can select from 30m, 1h, 6h, 1d, 1w intervals based on the selected duration.

Changes:
- Add interval selector dropdown with options: 30m, 1h, 6h, 1d, 1w
- Implement smart filtering to hide intervals longer than selected duration
- Auto-reset interval when duration changes and current interval becomes invalid
- Center histogram bars on x-axis by offsetting timestamps by half interval
- Update default view to 30 days duration with 1 day interval
- Separate TIME_RANGE_CONFIG from interval configuration for better flexibility

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@sanggggg sanggggg merged commit 9cfcbb5 into main Dec 2, 2025
5 checks passed
@sanggggg sanggggg deleted the feat/add-interval-control-to-histogram branch December 2, 2025 05:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants