Skip to content

Commit

Permalink
feat: improve display on error
Browse files Browse the repository at this point in the history
  • Loading branch information
novalagung committed Jul 19, 2024
1 parent 8635a3b commit 8dba030
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 7 additions & 0 deletions extension/assets/internal/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,12 @@
// =========== PRAYER TIME

activePrayerTimeDurationInMinute: 10,
isLocationAndPrayerTimeError: false,

// render player time placeholder.
// used on the screen during loading data process
renderPrayerTimePlaceholder() {
this.isLocationAndPrayerTimeError = false
$('.location .text').text('Loading ...')
// $(`.prayer-time tbody`).css('visibility', 'hidden')

Expand All @@ -107,6 +109,7 @@

// render player time error.
renderPrayerTimeError(err) {
this.isLocationAndPrayerTimeError = true
$('.location .text').text('Error ❌')

Array(6).fill(0).forEach((each, i) => {
Expand Down Expand Up @@ -256,6 +259,10 @@
let isAlarmEverSet = false

const doRenderPrayerTime = () => {
if (this.isLocationAndPrayerTimeError) {
return
}

const hmFormatter = (str) => parseInt(str.slice(0, 5).replace(':', ''), 10)
const nowHM = parseInt(Utility.now().add(-1 * this.activePrayerTimeDurationInMinute, 'minutes').format('HHmm'), 10)
const fajrHM = hmFormatter(schedule.Fajr)
Expand Down
3 changes: 1 addition & 2 deletions extension/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
</tr>
<tr class="prayer-time-row">
<!-- Isya -->
<td>'</td>
<td></td>
<td data-when='isya'>18:58</td>
<td>WIB</td>
</tr>
Expand Down Expand Up @@ -194,7 +194,6 @@
<script src="assets/3rd-parties/draggable/draggable.bundle.min.js"></script>
<script src="assets/internal/scripts/utility.js"></script>
<script src="assets/internal/scripts/constant.js"></script>
<script src="assets/internal/scripts/component.js"></script>
<script src="assets/internal/scripts/i18n.js"></script>
<script src="assets/internal/scripts/app.js"></script>
</body>
Expand Down

0 comments on commit 8dba030

Please sign in to comment.