ITEP-66906 Components refactoring#536
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors indicator components by inlining wrappers with Spectrum Views, relocates video indicators closer to their usage, and centralizes PhotoPlaceholder in the @geti/ui package.
- Replaced
IndicatorWrapperusages withViewfrom@geti/ui - Moved
VideoIndicatorandVideoFrameNumberIndicatorinto the media-item-view folder - Extracted
PhotoPlaceholderinto the shared UI library and updated imports
Reviewed Changes
Copilot reviewed 17 out of 19 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| shared/components/media-item-view/video-indicator.component.tsx | New inline VideoIndicator using View |
| shared/components/media-item-view/video-frame-number-indicator.component.tsx | New inline VideoFrameNumberIndicator |
| shared/components/indicator-wrapper/indicator-wrapper.component.tsx | Deleted legacy IndicatorWrapper |
| shared/components/indicator-wrapper/indicator-wrapper.module.scss | Removed unused styles |
| pages/**/user-photo-placeholder.component.tsx | Updated import to use centralized PhotoPlaceholder |
| packages/ui/src/photo-placeholder/utils.ts | Added color/contrast utilities |
| packages/ui/src/photo-placeholder/photo-placeholder.component.tsx | Implemented PhotoPlaceholder in UI package |
| packages/ui/index.ts | Exported PhotoPlaceholder |
Comments suppressed due to low confidence (2)
web_ui/src/shared/components/media-item-view/video-frame-number-indicator.component.tsx:15
- [nitpick] The
idis too generic and omits 'number'; consider renaming to 'video-frame-number-indicator-id' to align with the component name and avoid collisions.
id={'video-frame-indicator-id'}
web_ui/src/shared/components/media-item-view/video-indicator.component.tsx:16
- New
VideoIndicatorand its variations lack unit tests. Adding tests to cover both duration-only and frames-plus-duration render paths will improve reliability.
export const VideoIndicator = ({ duration, frames }: VideoIndicatorProps): JSX.Element => {
| borderRadius={'small'} | ||
| height={'size-200'} | ||
| UNSAFE_className={classes.videoFrameText} | ||
| UNSAFE_style={{ backgroundColor: 'var(--spectrum-global-color-gray-50)' }} |
There was a problem hiding this comment.
[nitpick] Instead of using UNSAFE_style for backgroundColor, consider leveraging the backgroundColor prop on View or a dedicated CSS class for consistency with Spectrum patterns.
| UNSAFE_style={{ backgroundColor: 'var(--spectrum-global-color-gray-50)' }} | |
| backgroundColor={'var(--spectrum-global-color-gray-50)'} |
There was a problem hiding this comment.
[Suggestion] Maybe we could move all of these styles to the class videoFrameText?
There was a problem hiding this comment.
I agree that it's worth moving custom styles to classes. However, I'd rather keep property attributes if possible to maintain readability and consistency.
📝 Description
PR summary:
IndicatorWrapperwith inline componentPhotoPlaceholderto@geti/uiJIRA: ITEP-66906
✨ Type of Change
Select the type of change your PR introduces:
🧪 Testing Scenarios
Describe how the changes were tested and how reviewers can test them too:
✅ Checklist
Before submitting the PR, ensure the following: