@internetarchive/ia-book-actions 0.1.11-b3 → 0.1.11-b5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/ia-book-actions.js +13 -13
package/package.json
CHANGED
package/src/ia-book-actions.js
CHANGED
|
@@ -534,10 +534,11 @@ export default class IABookActions extends LitElement {
|
|
|
534
534
|
if (!timerCountdown) return;
|
|
535
535
|
|
|
536
536
|
const secondsLeft = Number.parseInt((Number(this.lendingStatus.secondsLeftOnLoan)), 10);
|
|
537
|
-
const
|
|
538
|
-
|
|
537
|
+
const firstStrokeDashOffset = Number.parseInt(((secondsLeft / this.loanRenewTimeConfig.loanTotalTime) * 315) * 1.5, 10);
|
|
538
|
+
const actualStrokeDashOffset = firstStrokeDashOffset > 315 ? 315 : firstStrokeDashOffset;
|
|
539
539
|
|
|
540
|
-
|
|
540
|
+
|
|
541
|
+
console.log('resetTimerCountState === ', { secondsLeft, firstStrokeDashOffset, actualStrokeDashOffset});
|
|
541
542
|
|
|
542
543
|
// set seconds left in loan expire
|
|
543
544
|
timerCountdown.style?.setProperty('--secondsLeftOnLoan', `${secondsLeft}s`);
|
|
@@ -545,7 +546,7 @@ export default class IABookActions extends LitElement {
|
|
|
545
546
|
// set circle stroke offset left in loan expire
|
|
546
547
|
timerCountdown.style?.setProperty(
|
|
547
548
|
'--strokeLeftOnLoan',
|
|
548
|
-
`${
|
|
549
|
+
`${actualStrokeDashOffset}` // the perimeter of the circle = (π * 2 * radius)
|
|
549
550
|
);
|
|
550
551
|
|
|
551
552
|
const animationCircle = timerCountdown.shadowRoot.querySelector('.circle');
|
|
@@ -574,14 +575,6 @@ export default class IABookActions extends LitElement {
|
|
|
574
575
|
></book-title-bar>`;
|
|
575
576
|
}
|
|
576
577
|
|
|
577
|
-
get timerCountdownTemplate() {
|
|
578
|
-
return this.borrowType === 'browsed'
|
|
579
|
-
? html`<timer-countdown
|
|
580
|
-
.secondsLeftOnLoan=${Number(this.lendingStatus.secondsLeftOnLoan)}
|
|
581
|
-
></timer-countdown>`
|
|
582
|
-
: nothing;
|
|
583
|
-
}
|
|
584
|
-
|
|
585
578
|
get bookActionBar() {
|
|
586
579
|
return html`
|
|
587
580
|
<collapsible-action-group
|
|
@@ -606,7 +599,10 @@ export default class IABookActions extends LitElement {
|
|
|
606
599
|
>
|
|
607
600
|
</collapsible-action-group>
|
|
608
601
|
${this.textGroupTemplate} ${this.infoIconTemplate}
|
|
609
|
-
|
|
602
|
+
<timer-countdown
|
|
603
|
+
.secondsLeftOnLoan=${Number(this.lendingStatus.secondsLeftOnLoan)}
|
|
604
|
+
class=${this.borrowType === 'browsed' ? '' : 'hide'}
|
|
605
|
+
></timer-countdown>
|
|
610
606
|
`;
|
|
611
607
|
}
|
|
612
608
|
|
|
@@ -952,6 +948,10 @@ export default class IABookActions extends LitElement {
|
|
|
952
948
|
display: block;
|
|
953
949
|
}
|
|
954
950
|
|
|
951
|
+
.hide {
|
|
952
|
+
display: none;
|
|
953
|
+
}
|
|
954
|
+
|
|
955
955
|
.lending-wrapper {
|
|
956
956
|
width: 100%;
|
|
957
957
|
margin: 0 auto;
|