@internetarchive/ia-book-actions 0.0.29-alpha40 → 0.0.29-alpha42

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/demo/index.html CHANGED
@@ -120,7 +120,6 @@
120
120
  // set defaultLendingStatus for unavailable (without borrowables) book
121
121
  let iaBookActions = document.querySelector('ia-book-actions');
122
122
 
123
-
124
123
  iaBookActions.userid = userid;
125
124
  iaBookActions.identifier = identifier;
126
125
  iaBookActions.bookTitle = 'Contemporary Black biography. Volume 39 : profiles from the interContemporary Black biography. Volume 39';
@@ -134,7 +133,7 @@
134
133
 
135
134
  let isDevBox = true;
136
135
  iaBookActions.loanRenewTimeConfig = {
137
- loanTotalTime: isDevBox ? 13 : 3600, // 60 second = 1 min
136
+ loanTotalTime: isDevBox ? 15 : 3600, // 60 second = 1 min
138
137
  loanRenewAtLast: isDevBox ? 10 : 3540, // at last 10th minute
139
138
  pageChangedInLast: isDevBox ? 5 : 900, // within last 15 second/minute
140
139
  isDevBox: isDevBox,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetarchive/ia-book-actions",
3
- "version": "0.0.29-alpha40",
3
+ "version": "0.0.29-alpha42",
4
4
  "description": "Bookreader actions for borrowable book",
5
5
  "author": "Internet Archive",
6
6
  "license": "AGPL-3.0-only",
@@ -79,6 +79,30 @@ export default class TimerCountdown extends LitElement {
79
79
  }, timerIntervalSeconds * 1000);
80
80
  }
81
81
 
82
+ /**
83
+ * get remaining time with timeunit
84
+ *
85
+ * @memberof TimerCountdown
86
+ * @return string
87
+ */
88
+ get remainingTime() {
89
+ let unitOfTime = 'second';
90
+ let timeLeft = Math.round(this.secondsLeftOnLoan);
91
+
92
+ if (this.isDevBox) {
93
+ return `${timeLeft} seconds`;
94
+ }
95
+
96
+ if (timeLeft > 60) {
97
+ unitOfTime = 'minute';
98
+ timeLeft = Math.floor(timeLeft / 60);
99
+ }
100
+
101
+ return timeLeft !== 1
102
+ ? `${timeLeft} ${unitOfTime}s`
103
+ : `${timeLeft} ${unitOfTime}`;
104
+ }
105
+
82
106
  render() {
83
107
  return html`
84
108
  <svg
@@ -89,8 +113,8 @@ export default class TimerCountdown extends LitElement {
89
113
  >
90
114
  <circle class="circle" cx="50" cy="50" r="50" />
91
115
  </svg>
92
- <span class="sr-only"></span>
93
- <span>${Math.round(this.secondsLeftOnLoan)}</span>
116
+ <span class="sr-only">${this.remainingTime}</span>
117
+ <span>${this.remainingTime}</span>
94
118
  `;
95
119
  }
96
120
 
@@ -131,6 +155,17 @@ export default class TimerCountdown extends LitElement {
131
155
  stroke-dasharray: 0;
132
156
  animation: ${timerSecondsLeft} circletimer linear;
133
157
  }
158
+
159
+ .sr-only {
160
+ position: absolute;
161
+ left: -9999px;
162
+ width: 1px;
163
+ height: 1px;
164
+ margin: 0;
165
+ padding: 0;
166
+ border: none;
167
+ overflow: hidden;
168
+ }
134
169
  `;
135
170
  }
136
171
  }
@@ -646,7 +646,7 @@ export default class IABookActions extends LitElement {
646
646
  .identifier}"
647
647
  >info@archive.org</a
648
648
  ><br /><br />
649
- errorLog: ${errorMsg}`;
649
+ <code>errorLog: ${errorMsg}</code>`;
650
650
  }
651
651
 
652
652
  this.modal.showModal({