Skip to content

Commit

Permalink
* Allow unsetting quick bookmark target and prompt to set it later wh…
Browse files Browse the repository at this point in the history
…en user attempt to quick bookmark
  • Loading branch information
PikachuEXE committed Sep 21, 2024
1 parent 7547b9f commit 8124dd5
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 14 deletions.
8 changes: 4 additions & 4 deletions src/renderer/components/ft-list-playlist/ft-list-playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,6 @@ export default defineComponent({
})
},

handleQuickBookmarkEnabledDisabledClick: function () {
showToast(this.$t('User Playlists.SinglePlaylistView.Toast["This playlist is already being used for quick bookmark."]'))
},

parseInvidiousData: function () {
this.title = this.data.title
if (this.thumbnailCanBeShown) {
Expand Down Expand Up @@ -194,6 +190,10 @@ export default defineComponent({
showToast(this.$t('User Playlists.SinglePlaylistView.Toast.This playlist is now used for quick bookmark'))
}
},
disableQuickBookmark() {
this.updateQuickBookmarkTargetPlaylistId(null)
showToast(this.$t('User Playlists.SinglePlaylistView.Toast.Quick bookmark disabled'))
},

...mapActions([
'openInExternalPlayer',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,9 @@
<ft-icon-button
:title="markedAsQuickBookmarkTarget ? $t('User Playlists.Quick Bookmark Enabled') : $t('User Playlists.Enable Quick Bookmark With This Playlist')"
:icon="markedAsQuickBookmarkTarget ? ['fas', 'bookmark'] : ['far', 'bookmark']"
:disabled="markedAsQuickBookmarkTarget"
:theme="markedAsQuickBookmarkTarget ? 'secondary' : 'base-no-default'"
:size="16"
@disabled-click="handleQuickBookmarkEnabledDisabledClick"
@click="enableQuickBookmarkForThisPlaylist"
@click="() => markedAsQuickBookmarkTarget ? disableQuickBookmark() : enableQuickBookmarkForThisPlaylist()"
/>
</span>
</div>
Expand Down
18 changes: 16 additions & 2 deletions src/renderer/components/ft-list-video/ft-list-video.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
formatNumber,
getRelativeTimeFromDate,
openExternalLink,
openInternalPath,
showToast,
toDistractionFreeTitle,
deepCopy
Expand Down Expand Up @@ -460,7 +461,7 @@ export default defineComponent({
})
},
quickBookmarkIconText: function () {
if (!this.isQuickBookmarkEnabled) { return false }
if (!this.isQuickBookmarkEnabled) { return this.$t('User Playlists.Add to Playlist') }

const translationProperties = {
playlistName: this.quickBookmarkPlaylist.playlistName,
Expand Down Expand Up @@ -766,7 +767,13 @@ export default defineComponent({

toggleQuickBookmarked() {
if (!this.isQuickBookmarkEnabled) {
// This should be prevented by UI
showToast(
this.$t('Video["Quick Bookmark Disabled. Click Here To Open User Playlists Page To Enable Quick Bookmark"]'),
5000,
() => {
this.createNewWindowInUserPlaylistsView()
},
)
return
}

Expand All @@ -776,6 +783,13 @@ export default defineComponent({
this.addToQuickBookmarkPlaylist()
}
},
createNewWindowInUserPlaylistsView: function () {
openInternalPath({
path: '/userPlaylists',
query: {},
doCreateNewWindow: true,
})
},
addToQuickBookmarkPlaylist() {
const videoData = {
videoId: this.id,
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/ft-list-video/ft-list-video.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
@click="togglePlaylistPrompt"
/>
<ft-icon-button
v-if="isQuickBookmarkEnabled && quickBookmarkButtonEnabled"
v-if="quickBookmarkButtonEnabled"
:title="quickBookmarkIconText"
:icon="isInQuickBookmarkPlaylist ? ['fas', 'check'] : ['fas', 'bookmark']"
class="quickBookmarkVideoIcon"
Expand Down
24 changes: 21 additions & 3 deletions src/renderer/components/watch-video-info/watch-video-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import FtCard from '../ft-card/ft-card.vue'
import FtIconButton from '../ft-icon-button/ft-icon-button.vue'
import FtShareButton from '../ft-share-button/ft-share-button.vue'
import FtSubscribeButton from '../ft-subscribe-button/ft-subscribe-button.vue'
import { formatNumber, openExternalLink, showToast } from '../../helpers/utils'
import {
formatNumber,
openExternalLink,
openInternalPath,
showToast,
} from '../../helpers/utils'

export default defineComponent({
name: 'WatchVideoInfo',
Expand Down Expand Up @@ -241,7 +246,7 @@ export default defineComponent({
})
},
quickBookmarkIconText: function () {
if (!this.isQuickBookmarkEnabled) { return false }
if (!this.isQuickBookmarkEnabled) { return this.$t('User Playlists.Add to Playlist') }

const translationProperties = {
playlistName: this.quickBookmarkPlaylist.playlistName,
Expand Down Expand Up @@ -351,7 +356,13 @@ export default defineComponent({

toggleQuickBookmarked() {
if (!this.isQuickBookmarkEnabled) {
// This should be prevented by UI
showToast(
this.$t('Video["Quick Bookmark Disabled. Click Here To Open User Playlists Page To Enable Quick Bookmark"]'),
5000,
() => {
this.createNewWindowInUserPlaylistsView()
},
)
return
}

Expand All @@ -361,6 +372,13 @@ export default defineComponent({
this.addToQuickBookmarkPlaylist()
}
},
createNewWindowInUserPlaylistsView: function () {
openInternalPath({
path: '/userPlaylists',
query: {},
doCreateNewWindow: true,
})
},
addToQuickBookmarkPlaylist() {
const videoData = {
videoId: this.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
@click="togglePlaylistPrompt"
/>
<ft-icon-button
v-if="isQuickBookmarkEnabled"
:title="quickBookmarkIconText"
:icon="isInQuickBookmarkPlaylist ? ['fas', 'check'] : ['fas', 'bookmark']"
class="quickBookmarkVideoIcon"
Expand Down
1 change: 1 addition & 0 deletions static/locales/en-US.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,7 @@ Video:
Save Video: Save Video
Video has been saved: Video has been saved
Video has been removed from your saved list: Video has been removed from your saved list
"Quick Bookmark Disabled. Click Here To Open User Playlists Page To Enable Quick Bookmark": "Quick Bookmark Disabled. Click Here To Open User Playlists Page To Enable Quick Bookmark"
Open in YouTube: Open in YouTube
Copy YouTube Link: Copy YouTube Link
Open YouTube Embedded Player: Open YouTube Embedded Player
Expand Down

0 comments on commit 8124dd5

Please sign in to comment.