|
|
@@ -88,6 +88,7 @@ document.addEventListener("alpine:init", () => {
|
|
|
...video,
|
|
|
originalIndex: currentIndex + index,
|
|
|
doneButtonText: video.status === "done" ? "Remove Done Status" : "Mark as Done",
|
|
|
+ isNonContiguousDone: this.isNonContiguousDone(playlistName, currentIndex + index),
|
|
|
}));
|
|
|
|
|
|
return {
|
|
|
@@ -108,9 +109,10 @@ document.addEventListener("alpine:init", () => {
|
|
|
) {
|
|
|
this.currentPlaylistVideos = [];
|
|
|
} else {
|
|
|
- this.currentPlaylistVideos = this.playlists[this.currentPlaylistName].map((video) => ({
|
|
|
+ this.currentPlaylistVideos = this.playlists[this.currentPlaylistName].map((video, index) => ({
|
|
|
...video,
|
|
|
doneButtonText: video.status === "done" ? "Remove Done Status" : "Mark as Done",
|
|
|
+ isNonContiguousDone: this.isNonContiguousDone(this.currentPlaylistName, index),
|
|
|
}));
|
|
|
}
|
|
|
},
|
|
|
@@ -482,6 +484,22 @@ document.addEventListener("alpine:init", () => {
|
|
|
},
|
|
|
},
|
|
|
|
|
|
+ isNonContiguousDone(playlistName, videoIndex) {
|
|
|
+ const playlist = this.playlists[playlistName];
|
|
|
+ if (!playlist || !playlist[videoIndex] || playlist[videoIndex].status !== "done") {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // Check if there's any non-done video before this done video
|
|
|
+ for (let i = 0; i < videoIndex; i++) {
|
|
|
+ if (playlist[i].status !== "done") {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ },
|
|
|
+
|
|
|
isCurrentVideo(playlistName, index) {
|
|
|
const currentIndex = this.currentIndices[playlistName];
|
|
|
return currentIndex === index;
|
|
|
@@ -507,6 +525,7 @@ document.addEventListener("alpine:init", () => {
|
|
|
"current-video": this.isCurrentVideo(playlistName, index),
|
|
|
"done-video":
|
|
|
this.isDoneVideo(playlistName, index) && video.status === "done",
|
|
|
+ "non-contiguous-done-video": this.isNonContiguousDone(playlistName, index),
|
|
|
};
|
|
|
},
|
|
|
},
|