Skip to content

Commit dfcf57e

Browse files
committed
Return to ios style progress bar
1 parent 95106e6 commit dfcf57e

2 files changed

Lines changed: 32 additions & 28 deletions

File tree

site/assets/css/main.scss

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,12 +351,11 @@ blockquote,
351351
top: 0;
352352
left: 0;
353353
width: 100%;
354-
height: 3.6em;
355-
opacity: 0.4;
354+
height: 6px;
356355
background: #3498db;
357356
transform: scaleX(0);
358357
transform-origin: left;
359-
transition: transform 0.6s ease, opacity 0.6s ease-out;
358+
transition: transform 0.6s ease, opacity 0.4s ease-out 0.1s;
360359
z-index: 10;
361360
}
362361

site/assets/js/map.js

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ class Spinner {
239239
constructor() {
240240
this.spinner = this.createSpinner();
241241
this.debounceTimeout = null;
242+
this.isHiding = false;
242243
}
243244

244245
createSpinner() {
@@ -248,42 +249,47 @@ class Spinner {
248249
}
249250

250251
show() {
251-
document.querySelector(".navbar").append(this.spinner);
252+
this.isHiding = false;
253+
const contentNode = document.querySelector(".content");
254+
contentNode.appendChild(this.spinner);
255+
// Reset spinner appearance
252256
this.spinner.classList.remove("spinner-fade-out");
253257
this.spinner.style.transform = "scaleX(0.0)";
254258
setTimeout(() => {
255259
this.spinner.style.transform = "scaleX(0.10)";
256260
}, 100);
257261
}
258262

259-
remove() {
260-
const contentNode = document.querySelector(".navbar");
261-
if (contentNode.contains(this.spinner)) {
262-
contentNode.removeChild(this.spinner);
263-
}
264-
}
265-
266263
hide() {
267-
const contentNode = document.querySelector(".navbar");
268-
if (contentNode.contains(this.spinner)) {
269-
this.spinner.addEventListener("transitionend", (event) => {
270-
if (event.propertyName === "transform") {
271-
this.spinner.classList.add("spinner-fade-out");
272-
}
273-
}, { once: true });
274-
this.spinner.addEventListener("transitionend", (event) => {
275-
if (event.propertyName === "opacity") {
276-
contentNode.removeChild(this.spinner);
277-
}
278-
}, { once: true });
279-
}
264+
if (this.isHiding) { return; };
265+
this.isHiding = true;
266+
267+
const contentNode = document.querySelector(".content");
268+
if (!contentNode.contains(this.spinner)) { return; };
269+
270+
// Expand spinner to full width
271+
this.spinner.style.transform = "scaleX(1.0)";
272+
273+
let transformDone = false;
274+
this.spinner.ontransitionend = (event) => {
275+
if (!transformDone && event.propertyName === "transform") {
276+
// When transform finishes, trigger the fade-out
277+
transformDone = true;
278+
this.spinner.classList.add("spinner-fade-out");
279+
} else if (transformDone && event.propertyName === "opacity") {
280+
// When opacity transition ends, remove the spinner
281+
contentNode.removeChild(this.spinner);
282+
this.spinner.ontransitionend = null;
283+
}
284+
};
280285
}
281286

282287
updateProgress(percentage) {
283-
const minProgress = 10,
284-
progress = Math.max(percentage, minProgress);
288+
if (this.isHiding) { return; };
289+
290+
const minProgress = 10;
291+
const progress = Math.max(percentage, minProgress);
285292

286-
// Set a debounce to prevent rapid updates and bar jitter
287293
clearTimeout(this.debounceTimeout);
288294
this.debounceTimeout = setTimeout(() => {
289295
this.spinner.style.transform = `scaleX(${progress / 100})`;
@@ -725,7 +731,6 @@ class ParquetProcessor {
725731
totalGroups = rowGroupItems.length;
726732
if (totalGroups === 0) {
727733
console.warn("No data found for the given ID.");
728-
map.spinner.remove();
729734
return results;
730735
}
731736

0 commit comments

Comments
 (0)