Add classification annotation grid item component#1680
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a Svelte classification grid tile with image/video thumbnails, optional classification labels, selection state, and full-sample crop-window callbacks. Tests cover rendering, URL selection, labels, accessibility, annotation payloads, and callback cleanup. ChangesClassification grid tiles
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant GridSettings
participant AnnotationClassificationGridItem
participant ThumbnailHelpers
participant CropSearch
GridSettings->>AnnotationClassificationGridItem: Provide thumbnail quality
AnnotationClassificationGridItem->>ThumbnailHelpers: Build media thumbnail URL
ThumbnailHelpers-->>AnnotationClassificationGridItem: Return thumbnail URL
AnnotationClassificationGridItem->>CropSearch: Emit full-sample CropWindow
AnnotationClassificationGridItem->>CropSearch: Emit null on unmount
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8ae03ec947
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
🧹 Nitpick comments (1)
lightly_studio_view/src/lib/components/AnnotationsGrid/AnnotationClassificationGridItem/AnnotationClassificationGridItem.svelte (1)
41-45: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueSimplify store subscription.
Svelte's auto-subscription prefix (
$) works natively for destructured store variables. You can remove the manual$stateand$effectsubscription logic and simply use$gridViewThumbnailQualityStoredirectly when calling the URL helpers below.♻️ Proposed refactor
const { gridViewThumbnailQualityStore } = useSettings(); - let quality = $state(get(gridViewThumbnailQualityStore)); - $effect(() => gridViewThumbnailQualityStore.subscribe((v) => (quality = v))); - // Stable id captured at init — same pattern as AnnotationItem (avoids re-readingThen, you can replace
qualitywith$gridViewThumbnailQualityStorein lines 58 and 67:return getGridImageURL({ sampleId: image.sample_id, - quality, + quality: $gridViewThumbnailQualityStore, renderedWidth, renderedHeight, cacheBuster: cachedCollectionVersion }); } const frame = annotation.parent_sample_data as VideoFrameAnnotationView; return getGridFrameURL({ sampleId: frame.sample_id, - quality, + quality: $gridViewThumbnailQualityStore, renderedWidth, renderedHeight });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lightly_studio_view/src/lib/components/AnnotationsGrid/AnnotationClassificationGridItem/AnnotationClassificationGridItem.svelte` around lines 41 - 45, In the component’s quality handling, remove the manual `get`, `$state`, and `$effect` subscription logic, then use Svelte’s auto-subscription value `$gridViewThumbnailQualityStore` directly in the URL helper calls currently using `quality`. Preserve the existing store source from `useSettings()`.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@lightly_studio_view/src/lib/components/AnnotationsGrid/AnnotationClassificationGridItem/AnnotationClassificationGridItem.svelte`:
- Around line 41-45: In the component’s quality handling, remove the manual
`get`, `$state`, and `$effect` subscription logic, then use Svelte’s
auto-subscription value `$gridViewThumbnailQualityStore` directly in the URL
helper calls currently using `quality`. Preserve the existing store source from
`useSettings()`.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 0b72a18c-8fc6-4520-9dd5-fa1d51fa4c9a
📒 Files selected for processing (4)
lightly_studio_view/src/lib/components/AnnotationsGrid/AnnotationClassificationGridItem/AnnotationClassificationGridItem.sveltelightly_studio_view/src/lib/components/AnnotationsGrid/AnnotationClassificationGridItem/AnnotationClassificationGridItem.test.tslightly_studio_view/src/lib/components/AnnotationsGrid/AnnotationClassificationGridItem/SampleClassificationPills.mock.sveltelightly_studio_view/src/lib/components/AnnotationsGrid/AnnotationsGridItem/AnnotationClassificationGridItem.mock.svelte
- default props for tests
|
/review |
…editing-annotation-grid-item-view
…editing-annotation-grid-item-view
…otation-grid-item-view' of https://github.com/lightly-ai/lightly-studio into leonardo-lig-10112-classification-grid-view-editing-annotation-grid-item-view
What has changed and why?
This PR adds
AnnotationClassificationGridItemfor classification annotations whose parent sample is an image or video frame. The component renders its thumbnail with the existing grid image and frame URL helpers, reusesSampleClassificationPillsfor label display.How has it been tested?
Unit tests
Did you update CHANGELOG.md?
Summary by CodeRabbit
New Features
Tests