@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetarchive/ia-book-actions",
3
- "version": "0.1.11-b3",
3
+ "version": "0.1.11-b5",
4
4
  "description": "Bookreader actions for borrowable book",
5
5
  "author": "Internet Archive",
6
6
  "license": "AGPL-3.0-only",
@@ -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 strokeDashOffset =
538
- (secondsLeft / this.loanRenewTimeConfig.loanTotalTime) * 315;
537
+ const firstStrokeDashOffset = Number.parseInt(((secondsLeft / this.loanRenewTimeConfig.loanTotalTime) * 315) * 1.5, 10);
538
+ const actualStrokeDashOffset = firstStrokeDashOffset > 315 ? 315 : firstStrokeDashOffset;
539
539
 
540
- console.log('resetTimerCountState === ', { secondsLeft, strokeDashOffset});
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
- `${Number(strokeDashOffset)}` // the perimeter of the circle = (π * 2 * radius)
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
- ${this.timerCountdownTemplate}
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;