Pause
diff --git a/modules/game/components/Piece.vue b/modules/game/components/Piece.vue
index a874ea3..4d9ed96 100644
--- a/modules/game/components/Piece.vue
+++ b/modules/game/components/Piece.vue
@@ -1,6 +1,6 @@
-
+
diff --git a/modules/game/composables/useEventGame.ts b/modules/game/composables/useEventGame.ts
index 8771d93..4788dc1 100644
--- a/modules/game/composables/useEventGame.ts
+++ b/modules/game/composables/useEventGame.ts
@@ -1,18 +1,19 @@
+import { computed } from "vue";
import type { GameData, GameProps } from "../types";
-import type { ImagePieces, DisplacedMapping } from "~core/types";
-import { Levels } from "~/modules/core/constants";
+import type { ImagePieces, DisplacedMapping } from "@core/types";
+import { Levels } from "@core/constants";
export interface Options {
openModal: () => void;
}
-export async function useEventGame(
+export function useEventGame(
props: GameProps,
data: GameData,
{ openModal }: Options
) {
const { startStopwatch, stopStopwatch, resetStopwatch, displayTime } =
- await useStopwatch();
+ useStopwatch();
/** Liczba kolumn na podstawie wybranego poziomu */
const cols = computed(() => Number(Levels[props.level]));
@@ -239,19 +240,28 @@ export async function useEventGame(
if (!pieces) return;
// Znajdź klocek, który aktualnie leży na slocie pos1 i pos2
- const idx1 = pieces.findIndex((item: ImagePieces) => item.position === pos1);
- const idx2 = pieces.findIndex((item: ImagePieces) => item.position === pos2);
+ const idx1 = pieces.findIndex(
+ (item: ImagePieces) => item.position === pos1
+ );
+ const idx2 = pieces.findIndex(
+ (item: ImagePieces) => item.position === pos2
+ );
if (idx1 === -1 || idx2 === -1) return;
const newPieces = [...pieces];
// Zamień pozycje (sloty) między klockami
const tmp = newPieces[idx1].position;
- newPieces[idx1] = { ...newPieces[idx1], position: newPieces[idx2].position };
+ newPieces[idx1] = {
+ ...newPieces[idx1],
+ position: newPieces[idx2].position,
+ };
newPieces[idx2] = { ...newPieces[idx2], position: tmp };
// Posortuj według slotu aby siatka renderowała się w porządku
- data.shuffledPieces = [...newPieces].sort((a, b) => a.position - b.position);
+ data.shuffledPieces = [...newPieces].sort(
+ (a, b) => a.position - b.position
+ );
clearHighlight();
data.moves = data.moves + 1;
clearSelection();
@@ -312,7 +322,9 @@ export async function useEventGame(
return p;
});
- data.shuffledPieces = [...newPieces].sort((a, b) => a.position - b.position);
+ data.shuffledPieces = [...newPieces].sort(
+ (a, b) => a.position - b.position
+ );
clearHighlight();
data.moves = data.moves + 1;
// Po ruchu grupowym aktualizuj selectedPositions do nowych slotów
diff --git a/modules/game/composables/useShuffle.ts b/modules/game/composables/useShuffle.ts
index 4100a63..5004289 100644
--- a/modules/game/composables/useShuffle.ts
+++ b/modules/game/composables/useShuffle.ts
@@ -1,9 +1,10 @@
-import { Levels, WIDTH_GAME } from "~/modules/core/constants";
-import type { ImagePieces } from "~/modules/core/types";
+import { computed } from "vue";
+import { Levels, WIDTH_GAME } from "@core/constants";
+import type { ImagePieces } from "@core/types";
import type { GameData, GameProps } from "../types";
-async function useShuffle(props: GameProps, data: GameData) {
- const { shuffle } = await useImage();
+function useShuffle(props: GameProps, data: GameData) {
+ const { shuffle } = useImage();
const heightElement = computed