From 4ab7f74a4e5710d96b850a274001a697431ba48f Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Sat, 24 Feb 2024 16:58:18 -0500 Subject: [PATCH] More adjustments to context menu --- .../src/components/VideoFeed/VideoRowList.bs | 27 ++++++++++++++----- .../src/components/VideoFeed/VideoRowList.xml | 1 + 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/playlet-lib/src/components/VideoFeed/VideoRowList.bs b/playlet-lib/src/components/VideoFeed/VideoRowList.bs index ff6a1bee..eda2b438 100644 --- a/playlet-lib/src/components/VideoFeed/VideoRowList.bs +++ b/playlet-lib/src/components/VideoFeed/VideoRowList.bs @@ -154,17 +154,22 @@ function GetContextMenuOptionsForItem(rowItem as object) as object options.push(ContextMenuUtils.CreateOption("Play", m.videoQueue, "FuncPlayVideo", [rowItem])) options.push(ContextMenuUtils.CreateOption("Queue", m.videoQueue, "FuncAddToQueueVideo", [rowItem])) - item = ContextMenuUtils.CreateOption("Open channel", m.top, "OpenVideoChannel", [rowItem]) - options.push(item) + authorId = rowItem.authorId + if not StringUtils.IsNullOrEmpty(authorId) + options.push(ContextMenuUtils.CreateOption("Open channel", m.top, "OpenVideoChannel", [rowItem])) + end if else if rowItem.type = "playlist" options.push(ContextMenuUtils.CreateOption("Play", m.videoQueue, "FuncPlayPlaylist", [rowItem, 0])) options.push(ContextMenuUtils.CreateOption("Queue", m.videoQueue, "FuncAddToQueuePlaylist", [rowItem])) - item = ContextMenuUtils.CreateOption("Open", m.top, "OpenPlaylist", [rowItem]) - options.push(item) + options.push(ContextMenuUtils.CreateOption("Open playlist", m.top, "OpenPlaylist", [rowItem])) + + authorId = rowItem.authorId + if not StringUtils.IsNullOrEmpty(authorId) + options.push(ContextMenuUtils.CreateOption("Open channel", m.top, "OpenPlaylistChannel", [rowItem])) + end if else if rowItem.type = "channel" - item = ContextMenuUtils.CreateOption("Open", m.top, "OpenChannel", [rowItem]) - options.push(item) + options.push(ContextMenuUtils.CreateOption("Open", m.top, "OpenChannel", [rowItem])) else LogWarn("Unknown long pressed item type:", rowItem.type) return [] @@ -191,6 +196,16 @@ function OpenVideoChannel(video as object) as void ChannelUtils.Open(channel) end function +function OpenPlaylistChannel(playlist as object) as void + authorId = playlist.authorId + if StringUtils.IsNullOrEmpty(authorId) + LogWarn("Invalid authorId:", authorId) + return + end if + channel = InvidiousContent.ToChannelContentNode(invalid, { authorId: authorId }, invalid) + ChannelUtils.Open(channel) +end function + function Refresh(unsued as dynamic) InitContent() end function diff --git a/playlet-lib/src/components/VideoFeed/VideoRowList.xml b/playlet-lib/src/components/VideoFeed/VideoRowList.xml index 46db9ea2..e35e338c 100644 --- a/playlet-lib/src/components/VideoFeed/VideoRowList.xml +++ b/playlet-lib/src/components/VideoFeed/VideoRowList.xml @@ -11,6 +11,7 @@ + \ No newline at end of file