|
|
@@ -171,6 +171,30 @@ document.addEventListener("alpine:init", () => {
|
|
|
},
|
|
|
},
|
|
|
|
|
|
+ isCurrentVideo(playlistName, index) {
|
|
|
+ const playlist = this.playlists[playlistName];
|
|
|
+ if (!playlist || !Array.isArray(playlist)) return false;
|
|
|
+
|
|
|
+ // Find the index of the first video that is not "done"
|
|
|
+ const currentIndex = playlist.findIndex(
|
|
|
+ (video) => video.status !== "done",
|
|
|
+ );
|
|
|
+
|
|
|
+ // If no "current" video found (all are done) or current index doesn't match, return false
|
|
|
+ return currentIndex === index && currentIndex !== -1;
|
|
|
+ },
|
|
|
+
|
|
|
+ videoItemClass: {
|
|
|
+ [":class"]() {
|
|
|
+ return {
|
|
|
+ "current-video": this.isCurrentVideo(
|
|
|
+ this.$el.dataset.playlistName,
|
|
|
+ parseInt(this.$el.dataset.playlistIndex),
|
|
|
+ ),
|
|
|
+ };
|
|
|
+ },
|
|
|
+ },
|
|
|
+
|
|
|
removeVideoButton: {
|
|
|
["@click"]() {
|
|
|
this.removeVideo(
|