Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(playlist-plugin): enhance configuration options for playlist modal #25

Merged
merged 2 commits into from
Jul 12, 2024

Conversation

jboix
Copy link
Contributor

@jboix jboix commented Jun 10, 2024

Description

Resolves #16 by introducing new configuration options that allow integrators to specify which buttons should appear in the playlist modal. Also exposes the modal options.

Example

import Pillarbox from '@srgssr/pillarbox-web';
import '@srgssr/pillarbox-playlist';
import '@srgssr/pillarbox-playlist/ui';

const player = new Pillarbox('my-player', {
  plugins: { 
    // Include the playlist plugin 
    pillarboxPlaylist: true,
    // Include the playlist UI plugin
    pillarboxPlaylistUI: {
      // Change the placement of the playlist button
      inserChildBefore: 'subsCapsButton',
      pillarboxPlaylistMenuDialog: {
        // Force the playback to pause when the modal is opened
        pauseOnOpen: true,
        // Remove the shuffle button 
        pillarboxPlaylistControls: { pillarboxPlaylistShuffleButton: false }
      }
    }
  }
});

Changes Made

  • Added pillarboxPlaylistMenuDialog option to configure the modal dialog component.
  • Exposed pillarboxPlaylistMenuDialog.pauseOnOpen option to control whether the player pauses when the modal is opened.
  • Added pillarboxPlaylistMenuDialog.pillarboxPlaylistControls option to define the order, addition, or removal of the control buttons.
  • Split the pillarboxPlaylistControls into individual components that can be registered separately.
  • Added a test for the playlist plugin UI registration.

Checklist

  • I have followed the project's style and contribution guidelines.
  • I have performed a self-review of my own changes.
  • I have made corresponding changes to the documentation.
  • I have added tests that prove my fix is effective or that my feature works.

@jboix jboix self-assigned this Jun 10, 2024
Copy link

github-actions bot commented Jun 10, 2024

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 99.56% 1156 / 1161
🔵 Statements 99.56% 1156 / 1161
🔵 Functions 97.33% 73 / 75
🔵 Branches 93.96% 109 / 116
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
packages/pillarbox-playlist/src/pillarbox-playlist-ui.js 100% 100% 100% 100%
packages/pillarbox-playlist/src/pillarbox-playlist.js 98.85% 89.36% 95.83% 98.85% 107-110, 394
packages/pillarbox-playlist/src/components/modal/pillarbox-playlist-controls.js 100% 100% 100% 100%
packages/pillarbox-playlist/src/components/modal/pillarbox-playlist-modal.js 100% 100% 100% 100%
packages/pillarbox-playlist/src/components/modal/pillarbox-playlist-next-item-button.js 100% 100% 100% 100%
packages/pillarbox-playlist/src/components/modal/pillarbox-playlist-repeat-button.js 100% 83.33% 100% 100%
packages/pillarbox-playlist/src/components/modal/pillarbox-playlist-shuffle-button.js 100% 100% 100% 100%
packages/pillarbox-playlist/src/components/modal/pillarbox-previous-item-button.js 100% 100% 100% 100%
packages/skip-button/src/skip-button.js 100% 88.88% 85.71% 100%
Generated in workflow #89

Copy link

github-actions bot commented Jun 10, 2024

PR Preview Action v1.4.7
Preview removed because the pull request was closed.
2024-07-12 07:56 UTC

@jboix jboix marked this pull request as ready for review June 10, 2024 12:44
@jboix jboix force-pushed the feat/better-playlist-options branch 2 times, most recently from 57c64df to b76033d Compare June 11, 2024 09:57
@jboix jboix requested a review from amtins June 11, 2024 14:11
@jboix jboix force-pushed the feat/better-playlist-options branch from b76033d to f54ccec Compare June 21, 2024 09:52
@amtins
Copy link
Member

amtins commented Jun 26, 2024

@jboix sorry I didn't get back to you sooner. I had very quickly looked at the PR, but unfortunately didn't have the time I would have liked to devote to it. However, overall feedback, would it be possible to have something more videojs-like in terms of developer experience?

From:

player.getChild('playlistMenuDialog').getChild('pillarboxPlaylistMenuItemsList')

To:

player.getChild('playlistMenuDialog').getChild('pillarboxPlaylistMenuItemsList')
// And
player.playlistMenuDialog.pillarboxPlaylistMenuItemsList

From:

pillarboxPlaylistUI: {
  inserChildBefore: 'subsCapsButton',
  modal: {
    pauseOnOpen: true,
    controls: { shuffleButton: false }
  }
}

To:

pillarboxPlaylistUI: {
  inserChildBefore: 'subsCapsButton',
  // real component name
  playlistMenuDialog: {
    pauseOnOpen: true,
    // real component name
    playlistControls: { shuffleButton: false }
  }
}

@jboix jboix force-pushed the feat/better-playlist-options branch 4 times, most recently from 34e0f95 to 3ee96bd Compare July 5, 2024 13:46
@amtins amtins added the enhancement New feature or request label Jul 9, 2024
@jboix jboix force-pushed the feat/better-playlist-options branch 2 times, most recently from 8f47a25 to 678889f Compare July 11, 2024 11:24
@jboix jboix requested a review from amtins July 11, 2024 11:29
Copy link
Member

@amtins amtins left a comment

Choose a reason for hiding this comment

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

Thank you for the good work, LGTM!

jboix added 2 commits July 12, 2024 09:42
Resolves #16 by introducing new configuration options that allow integrators to specify which
buttons should appear in the playlist modal. Also exposes the modal options.

- Added `pillarboxPlaylistMenuDialog` option to configure the modal dialog component.
- Exposed `pillarboxPlaylistMenuDialog.pauseOnOpen` option to control whetherWQ the player
  pauses when the modal is opened.
- Added `pillarboxPlaylistMenuDialog.pillarboxPlaylistControls` option to define the order,
  addition, or remova of the control buttons.

***Other Changes***

- Split the `controls` into individual components that can be registered separately.
- Added a test for the playlist plugin UI registration.
- Added suffix `pillarboxPlaylist` to all components to avoid naming clashes.
The controlText function was being called with this.localize(text),
which resulted in redundant localization.
@jboix jboix force-pushed the feat/better-playlist-options branch from 678889f to 7c840a9 Compare July 12, 2024 07:44
@jboix jboix merged commit c6bb013 into main Jul 12, 2024
4 checks passed
@jboix jboix deleted the feat/better-playlist-options branch July 12, 2024 07:56
Copy link

🎉 This PR is included in version @srgssr/skip-button-v1.0.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

[pillarbox-playlist] Enhance configuration options
2 participants