feat: add a solution for React preview time display#50
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
Adds time preview functionality to the TimeSlider component, allowing users to preview the time at the cursor position when hovering over the slider. This feature is implemented with a new PreviewTimeDisplay component and enhanced Tooltip system that can track cursor position.
- Added preview time state management to media store with new preview mediator
- Created PreviewTimeDisplay component for showing previewed time in tooltips
- Enhanced Tooltip component with cursor tracking capabilities
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/react/react/src/utils/component-factory.tsx | Improved ref handling and component type definitions |
| packages/react/react/src/skins/default/styles.ts | Added background color to SliderPointer for visual consistency |
| packages/react/react/src/skins/default/MediaSkinDefault.tsx | Integrated preview tooltip with TimeSlider component |
| packages/react/react/src/index.ts | Added PreviewTimeDisplay to public exports |
| packages/react/react/src/components/Tooltip.tsx | Added cursor tracking functionality for tooltips |
| packages/react/react/src/components/TimeSlider.tsx | Enhanced with ref composition and prop types |
| packages/react/react/src/components/PreviewTimeDisplay.tsx | New component for displaying preview time |
| packages/react/react/src/components/CurrentTimeDisplay.tsx | Cleaned up type definitions for consistency |
| packages/core/media-store/src/state-mediators/preview.ts | New preview state mediator for handling preview time |
| packages/core/media-store/src/state-mediators/index.ts | Added preview mediator to exports |
| packages/core/media-store/src/media-store.ts | Integrated preview mediator into default store |
| packages/core/media-store/src/index.ts | Added preview time display to exports |
| packages/core/media-store/src/factory.ts | Enhanced factory to support preview state and action handling |
| packages/core/media-store/src/component-state-definitions/time-slider.ts | Added preview time state and request method |
| packages/core/media-store/src/component-state-definitions/preview-time-display.ts | New state definition for preview time display |
| packages/core/core/src/components/time-slider.ts | Added preview time dispatching on pointer movement |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
demo: https://vjs-10-demo-react-git-preview-time-mux.vercel.app/?skin=default
There's many ways to go about this. I didn't like the idea of coupling the preview time or any preview feature too closely to the time slider. Made it possible to use this with a regular Tooltip component with an added option
trackCursorAxis.This pull request introduces support for previewing the time when hovering or interacting with the time slider, enabling features like displaying a tooltip with the previewed time. The main changes include expanding the state and actions for the time slider, adding a new preview time display component, and updating the media store and tooltip logic to support these features.
Time Slider Preview Functionality:
previewTimestate andrequestPreviewmethod to theTimeSliderStateand connected them to pointer movement in theTimeSlidercomponent, enabling tracking of the time under the pointer for preview purposes. [1] [2] [3]previewTimeproperty, including a new preview state mediator and associated action handling. [1] [2] [3] [4] [5] [6] [7]Preview Time Display Component:
PreviewTimeDisplayReact component, including its state hook and rendering logic, to display the formatted preview time in the UI.Tooltip Enhancements:
x,y, orboth) for scenarios like time slider tooltips, including new props and integration with the floating UI logic. [1] [2] [3] [4] [5] [6] [7]React Component Improvements:
TimeSliderand related components to better support refs and composed refs, and made minor type improvements for props and state. [1] [2] [3] [4]CurrentTimeDisplayfor consistency. [1] [2] [3]These changes collectively enable a richer, more interactive time slider experience, supporting features like preview tooltips and improved accessibility.
References: [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27]