GRATULACJE!
Rozwiązałeś zagadkę!
@@ -40,6 +84,15 @@ const store = usePuzzleStore();
animation: fadeIn 0.5s ease;
}
+.fireworks-layer {
+ position: fixed;
+ inset: 0;
+ width: 100%;
+ height: 100%;
+ pointer-events: none;
+ z-index: 1000;
+}
+
.modal {
padding: 40px;
text-align: center;
@@ -48,6 +101,8 @@ const store = usePuzzleStore();
border: 1px solid var(--primary-accent);
box-shadow: 0 0 50px rgba(0, 242, 255, 0.2);
animation: slideUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
+ position: relative;
+ z-index: 1001;
}
h2 {
diff --git a/src/composables/useNonogram.js b/src/composables/useNonogram.js
index 22a2f9e..c227879 100644
--- a/src/composables/useNonogram.js
+++ b/src/composables/useNonogram.js
@@ -1,6 +1,5 @@
import { ref } from 'vue';
import { usePuzzleStore } from '@/stores/puzzle';
-import confetti from 'canvas-confetti';
export function useNonogram() {
const store = usePuzzleStore();
@@ -49,7 +48,6 @@ export function useNonogram() {
const stopDrag = () => {
isDragging.value = false;
dragMode.value = null;
- checkWinEffect();
};
const applyDrag = (r, c) => {
@@ -86,38 +84,6 @@ export function useNonogram() {
store.setCell(r, c, dragMode.value);
};
- const checkWinEffect = () => {
- if (store.isGameWon) {
- triggerConfetti();
- }
- };
-
- const triggerConfetti = () => {
- const duration = 3000;
- const end = Date.now() + duration;
-
- (function frame() {
- confetti({
- particleCount: 5,
- angle: 60,
- spread: 55,
- origin: { x: 0 },
- colors: ['#00f2ff', '#ff0055', '#ffffff']
- });
- confetti({
- particleCount: 5,
- angle: 120,
- spread: 55,
- origin: { x: 1 },
- colors: ['#00f2ff', '#ff0055', '#ffffff']
- });
-
- if (Date.now() < end) {
- requestAnimationFrame(frame);
- }
- }());
- };
-
return {
startDrag,
onMouseEnter,
diff --git a/src/stores/puzzle.js b/src/stores/puzzle.js
index e1475d4..88861c9 100644
--- a/src/stores/puzzle.js
+++ b/src/stores/puzzle.js
@@ -324,6 +324,12 @@ export const usePuzzleStore = defineStore('puzzle', () => {
}
}
+ function closeWinModal() {
+ if (!isGameWon.value) return;
+ isGameWon.value = false;
+ saveState();
+ }
+
return {
currentLevelId,
solution,
@@ -340,7 +346,8 @@ export const usePuzzleStore = defineStore('puzzle', () => {
checkWin,
loadState, // expose loadState
moves,
- undo
+ undo,
+ closeWinModal
};
});