Skip to content

feat: add configurable slideshow duration with hover slider#1363

Open
siddharthsai218 wants to merge 2 commits into
AOSSIE-Org:mainfrom
siddharthsai218:slideshow
Open

feat: add configurable slideshow duration with hover slider#1363
siddharthsai218 wants to merge 2 commits into
AOSSIE-Org:mainfrom
siddharthsai218:slideshow

Conversation

@siddharthsai218

@siddharthsai218 siddharthsai218 commented Jul 4, 2026

Copy link
Copy Markdown

Addressed Issues:

Fixes #1350

Summary

The Slideshow feature previously auto-advanced images at a fixed 3-second interval with no way for users to control the pace. This PR adds a duration control, per feedback from the maintainer on the original issue.

Behavior:

  • Clicking "Slideshow" starts immediately at the current/default duration (no extra step)
  • Hovering over the Slideshow button reveals a small settings panel with a duration slider
  • The slider snaps to 3 preset values: 2s / 5s / 10s
  • Changing the duration takes effect immediately, even while the slideshow is running

Implementation:

  • useSlideshow.ts: duration is now stored in state (default 3000ms) instead of hardcoded, and exposed from the hook along with a setter
  • MediaView.tsx: pulls the duration state from the hook and passes it down to the controls component
  • MediaViewControls.tsx: replaces the old single-click toggle with a hover-triggered settings panel containing the duration slider; clicking the button still starts/pauses the slideshow directly

Screenshots/Recordings:

BEFORE:
image
AFTER:
image
image

Additional Notes:

AI Usage Disclosure:

We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact. AI slop is strongly discouraged and may lead to banning and blocking. Do not spam our repos with AI slop.

Check one of the checkboxes below:

  • This PR does not contain AI-generated code at all.
  • This PR contains AI-generated code. I have read the AI Usage Policy and this PR complies with this policy. I have tested the code locally and I am responsible for it.

I have used the following AI models and tools: Claude

Checklist

  • My PR addresses a single issue, fixes a single bug or makes a single improvement.
  • My code follows the project's code style and conventions
  • If applicable, I have made corresponding changes or additions to the documentation
  • If applicable, I have made corresponding changes or additions to tests
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contribution Guidelines
  • Once I submit my PR, CodeRabbit AI will automatically review it and I will address CodeRabbit's comments.
  • I have filled this PR template completely and carefully, and I understand that my PR may be closed without review otherwise.

Summary by CodeRabbit

  • New Features
    • Added slideshow duration controls for image media, allowing users to adjust per-slide visibility time.
    • Introduced a slider-based duration picker in the media controls (shown in the settings area).
  • Bug Fixes
    • Updated slideshow playback so interval timing responds immediately to duration changes, keeping progression synchronized with the selected setting.

@github-actions github-actions Bot added enhancement New feature or request frontend labels Jul 4, 2026
@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c4b44a0e-3840-4ad1-afa0-ff62c6ea7c25

📥 Commits

Reviewing files that changed from the base of the PR and between f17a0cc and a674482.

📒 Files selected for processing (2)
  • frontend/src/components/Media/MediaViewControls.tsx
  • frontend/src/hooks/useSlideshow.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • frontend/src/hooks/useSlideshow.ts
  • frontend/src/components/Media/MediaViewControls.tsx

Walkthrough

The slideshow hook now tracks a configurable duration, MediaView passes it through to the controls, and MediaViewControls renders a hover-triggered duration slider for image slideshows.

Changes

Configurable Slideshow Duration

Layer / File(s) Summary
useSlideshow duration state
frontend/src/hooks/useSlideshow.ts
Adds duration state used as the interval delay, includes it in the effect dependency array, and returns it with setDuration.
MediaView wiring of duration
frontend/src/components/Media/MediaView.tsx
Destructures duration/setDuration from useSlideshow and passes them as duration/onDurationChange props to MediaViewControls.
MediaViewControls duration slider UI
frontend/src/components/Media/MediaViewControls.tsx
Adds duration/onDurationChange props, DURATION_STEPS, showSettings, slider mapping logic, and the image-only dropdown slider UI.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related PRs

Suggested labels: TypeScript/JavaScript

Suggested reviewers: rahulharpal1603

Poem

A bunny clicked a tiny dial,
And set the slideshow's rhythm style.
Fast or slow, the images glide,
With carrot-bright timing at their side.
🐇🎞️

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: making slideshow duration configurable with a hover slider.
Linked Issues check ✅ Passed The PR implements configurable 2s/5s/10s slideshow duration in the stated frontend files, matching the issue's core requirement.
Out of Scope Changes check ✅ Passed The changes stay within slideshow duration UI and hook updates; no unrelated code changes are indicated.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
frontend/src/components/Media/MediaViewControls.tsx (1)

110-121: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Range input missing an accessible label.

The <input type="range"> has no aria-label/aria-labelledby, so screen readers announce it without context.

♿ Proposed fix
                 <input
                   type="range"
+                  aria-label="Slideshow duration per image"
                   min={0}
                   max={2}
🤖 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 `@frontend/src/components/Media/MediaViewControls.tsx` around lines 110 - 121,
The range control in MediaViewControls lacks an accessible name, so add an
aria-label or aria-labelledby to the <input type="range"> used for the slider.
Update the slider element in the MediaViewControls component so screen readers
can announce its purpose clearly, keeping the existing handleSliderChange,
sliderValue, and styling behavior unchanged.
🤖 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.

Inline comments:
In `@frontend/src/components/Media/MediaViewControls.tsx`:
- Around line 82-129: The slideshow settings panel in MediaViewControls is only
controlled by mouse hover, so keyboard and touch users cannot reach the duration
slider. Update the wrapper around the Slideshow button to open/close
showSettings on focus and blur in addition to onMouseEnter/onMouseLeave, using
the existing setShowSettings state logic. Also add a tap/click fallback for
touch devices so the dropdown can be toggled without hover, while keeping the
current button and slider behavior intact.

In `@frontend/src/hooks/useSlideshow.ts`:
- Line 10: The slideshow duration state starts at a value that is not one of the
allowed UI snap points, causing `useSlideshow` and `MediaViewControls` to
disagree about the active interval. Update the initial `duration` in
`useSlideshow` to one of the values from `DURATION_STEPS` used by
`MediaViewControls` (for example, 2000) and make sure any related default/reset
logic also uses that same snap value so the hook state and slider stay aligned.

---

Nitpick comments:
In `@frontend/src/components/Media/MediaViewControls.tsx`:
- Around line 110-121: The range control in MediaViewControls lacks an
accessible name, so add an aria-label or aria-labelledby to the <input
type="range"> used for the slider. Update the slider element in the
MediaViewControls component so screen readers can announce its purpose clearly,
keeping the existing handleSliderChange, sliderValue, and styling behavior
unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9b62bec8-8470-4e27-9e33-9e774b74020b

📥 Commits

Reviewing files that changed from the base of the PR and between 401d1ae and f17a0cc.

📒 Files selected for processing (3)
  • frontend/src/components/Media/MediaView.tsx
  • frontend/src/components/Media/MediaViewControls.tsx
  • frontend/src/hooks/useSlideshow.ts

Comment thread frontend/src/components/Media/MediaViewControls.tsx
Comment thread frontend/src/hooks/useSlideshow.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feat:Add configurable duration for Slideshow

1 participant