Skip to content

Commit

Permalink
Search bar total books tooltip: added total listening time for the bo…
Browse files Browse the repository at this point in the history
…oks in the selection
  • Loading branch information
joonaspaakko committed Oct 1, 2023
1 parent f354bf2 commit ed5275f
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 7 deletions.
Binary file modified audible-library-extractor-0.2.10.zip
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="icons">
<div class="icon-wrap" v-tippy :content="'Items in current selection: <strong>'+ $store.getters.collection.length +'</strong> / <strong>' + $store.getters.collectionTotal +'</strong>'">
<div class="icon-wrap" v-tippy="{ trigger: 'click mouseenter' }" :content="'Items in current selection: <strong>'+ $store.getters.collection.length +'</strong> / <strong>' + $store.getters.collectionTotal +'</strong>.' + (!selectionHours ? '' : '<br> That amounts to: ' + selectionHours + '. ') + ($route.name === 'series' ? 'Owned books only!' : '')">
<div class="book-in-selection">
<div class="inner-wrap">
{{ $store.getters.collection.length }}
Expand Down Expand Up @@ -29,9 +29,13 @@
</template>

<script>
import secondsToTimeString from "@output-mixins/gallery-secondsToTimeString.js";
import timeStringToSeconds from "@output-mixins/gallery-timeStringToSeconds.js";
export default {
name: "searchIcons",
props: ["listName"],
mixins: [secondsToTimeString, timeStringToSeconds],
data: function() {
return {
items: [
Expand Down Expand Up @@ -74,6 +78,19 @@ export default {
});
},
selectionHours() {
let result = _.sumBy( this.$store.getters.collection, ( book ) => {
const length = book.length ? this.timeStringToSeconds(book.length) : 0;
return length;
});
if ( result ) result = this.secondsToTimeString(result, true);
return (result||'').trim();
}
},
methods: {
Expand Down
31 changes: 26 additions & 5 deletions src/gallery/_components/snippets/gallery-sorter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
/ {{ $store.getters.collectionSource.length }}
</span> -->
</span>

<!-- <span class="books-in-filter" v-if="listName === 'filter'">
({{ filterHours }})
</span> -->

</label>

Expand Down Expand Up @@ -119,11 +123,13 @@ import '@vueform/multiselect/themes/default.css';
import VueSlider from 'vue-slider-component';
import slugify from "@output-mixins/gallery-slugify.js";
import Multiselect from '@vueform/multiselect'
// import timeStringToSeconds from "@output-mixins/gallery-timeStringToSeconds.js";
// import secondsToTimeString from "@output-mixins/gallery-secondsToTimeString.js";
export default {
name: "sorter",
props: [ "label", "currentList", "listName", "item", "index", "tippyTop" ],
mixins: [slugify],
mixins: [slugify/*, timeStringToSeconds, secondsToTimeString*/],
components: {
VueSlider,
Multiselect,
Expand Down Expand Up @@ -179,8 +185,7 @@ export default {
},
computed: {
filterAmounts: function( ) {
filterBooks: function( ) {
this.$compEmitter.emit('repositionSearchOpts'); // potentially changes the width of the container...
Expand Down Expand Up @@ -209,14 +214,30 @@ export default {
return _.filter( collection, function(book) {
return vue.item.condition(book) && conditionCheck( book );
}).length;
});
}
else {
return 0;
return [];
}
},
filterAmounts: function( ) {
return this.filterBooks.length;
},
// filterHours: function( ) {
// const result = _.sumBy( this.filterBooks, ( book ) => {
// const length = book.length ? this.timeStringToSeconds(book.length) : 0;
// return length;
// });
// return this.secondsToTimeString(result, true);
// },
rangeVal: function() {
// let itemRange = _.get( this.item, 'range' );
Expand Down
14 changes: 13 additions & 1 deletion src/gallery/_mixins/changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,25 @@ export default {
version: 'v.0.2.10',
highlights: ``,
changes: [
{
description: `Search bar total books tooltip: added total listening time for the books in the selection.`,
class: 'added',
},
{
description: `Fixed an issue where collections page was visible in the navigation, even though it was empty.`,
class: 'fixed',
},
{
description: `Fixed an issue that could prevent the series sub page from loading in some cases.`,
class: 'fixed',
},
{
description: `It's not impossible but difficult to navigate back from book details "Links lead to my library" links.`,
class: 'fixed',
link: issue(127),
},
{
description: `Clock keeps spinning after all tasks completed`,
description: `Clock keeps spinning after all tasks completed.`,
class: 'fixed',
link: issue(130),
},
Expand Down

0 comments on commit ed5275f

Please sign in to comment.