Skip to content

Commit f92c8ab

Browse files
committed
Fix confetti not firing on first load
And reduce confetti amount for low-resource systems
1 parent 7e4dcba commit f92c8ab

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

gui/views/training.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ const skipSelectionWatcher = ref(false);
2424
onBeforeUnmount(() => { /* nothing now */ });
2525
2626
onMounted(async () => {
27+
const confettiScript = document.createElement("script");
28+
confettiScript.src = "https://cdn.jsdelivr.net/npm/canvas-confetti@1.9.2/dist/confetti.browser.min.js";
29+
document.head.appendChild(confettiScript);
30+
2731
skipSelectionWatcher.value = true;
2832
restoreSelections();
2933
3034
const res = await $api.get("/plugin/training/certs");
3135
certificates.value = res.data.certificates;
3236
33-
const confettiScript = document.createElement("script");
34-
confettiScript.src = "https://cdn.jsdelivr.net/npm/canvas-confetti@1.9.2/dist/confetti.browser.min.js";
35-
document.head.appendChild(confettiScript);
36-
3737
if (selectedCert.value) getTraining();
3838
skipSelectionWatcher.value = false;
3939
});
@@ -126,7 +126,7 @@ const restoreSelections = () => {
126126
} catch (err) {
127127
console.warn("Failed to parse saved training state:", err);
128128
}
129-
//if (selectedCert.value) getTraining();
129+
if (selectedCert.value) getTraining();
130130
}
131131
};
132132
@@ -272,8 +272,8 @@ function playConfetti() {
272272
if (!canvas || typeof confetti === 'undefined') return;
273273
const confettiCanon = confetti.create(canvas, { resize: true, useWorker: true });
274274
const frame = () => {
275-
confettiCanon({ particleCount: 100, angle: 60, spread: 55, origin: { x: 0 } });
276-
confettiCanon({ particleCount: 100, angle: 120, spread: 55, origin: { x: 1 } });
275+
confettiCanon({ particleCount: 30, angle: 60, spread: 55, origin: { x: 0 } });
276+
confettiCanon({ particleCount: 30, angle: 120, spread: 55, origin: { x: 1 } });
277277
};
278278
const tick = () => { frame(); if (Date.now() < end.value) requestAnimationFrame(tick); };
279279
tick();

0 commit comments

Comments
 (0)