From bd40be94ab9fa7795a62ea9081f3b6f2d5e74e32 Mon Sep 17 00:00:00 2001 From: Greg Lorenzen Date: Thu, 18 Jul 2024 18:35:16 +0000 Subject: [PATCH] Add toolbar option for displaying details on book card hover --- client/components/app/BookShelfToolbar.vue | 37 ++++++++++++++++++++++ client/components/cards/LazyBookCard.vue | 5 ++- client/store/user.js | 1 + client/strings/en-us.json | 2 ++ 4 files changed, 44 insertions(+), 1 deletion(-) diff --git a/client/components/app/BookShelfToolbar.vue b/client/components/app/BookShelfToolbar.vue index 5a869f7f6..54450164c 100644 --- a/client/components/app/BookShelfToolbar.vue +++ b/client/components/app/BookShelfToolbar.vue @@ -159,6 +159,7 @@ export default { } this.addSubtitlesMenuItem(items) + this.addDetailsOnHoverMenuItem(items) return items }, @@ -329,6 +330,7 @@ export default { this.addSubtitlesMenuItem(items) this.addCollapseSeriesMenuItem(items) + this.addDetailsOnHoverMenuItem(items) return items }, @@ -367,6 +369,21 @@ export default { } } }, + addDetailsOnHoverMenuItem(items) { + if (this.isBookLibrary && (!this.page || this.page === 'search')) { + if (this.settings.showDetailsOnHover) { + items.push({ + text: this.$strings.LabelHideDetailsOnHover, + action: 'hide-details-on-hover' + }) + } else { + items.push({ + text: this.$strings.LabelShowDetailsOnHover, + action: 'show-details-on-hover' + }) + } + } + }, handleSubtitlesAction(action) { if (action === 'show-subtitles') { this.settings.showSubtitles = true @@ -393,6 +410,19 @@ export default { } return false }, + handleDetailsOnHoverAction(action) { + if (action === 'show-details-on-hover') { + this.settings.showDetailsOnHover = true + this.updateShowDetailsOnHover() + return true + } + if (action === 'hide-details-on-hover') { + this.settings.showDetailsOnHover = false + this.updateShowDetailsOnHover() + return true + } + return false + }, contextMenuAction({ action }) { if (action === 'export-opml') { this.exportOPML() @@ -401,6 +431,8 @@ export default { return } else if (this.handleCollapseSeriesAction(action)) { return + } else if (this.handleDetailsOnHoverAction(action)) { + return } }, exportOPML() { @@ -423,6 +455,8 @@ export default { this.markSeriesFinished() } else if (this.handleSubtitlesAction(action)) { return + } else if (this.handleDetailsOnHoverAction(action)) { + return } }, showOpenSeriesRSSFeed() { @@ -555,6 +589,9 @@ export default { updateShowSubtitles() { this.saveSettings() }, + updateShowDetailsOnHover() { + this.saveSettings() + }, updateAuthorSort() { this.saveSettings() }, diff --git a/client/components/cards/LazyBookCard.vue b/client/components/cards/LazyBookCard.vue index 67884b47a..eefc31050 100644 --- a/client/components/cards/LazyBookCard.vue +++ b/client/components/cards/LazyBookCard.vue @@ -1,6 +1,6 @@