diff --git a/.forgejo/workflows/docker-build.yml b/.forgejo/workflows/docker-build.yml
index 5ed2a43..d8be9df 100644
--- a/.forgejo/workflows/docker-build.yml
+++ b/.forgejo/workflows/docker-build.yml
@@ -15,18 +15,18 @@ jobs:
- name: Build Docker image
run: |
- docker build -t git.wilmoredynamics.com/ab/ab01:${GITHUB_SHA::8} .
+ docker build -t git.wilmoredynamics.com/ab/logica:${GITHUB_SHA::8} .
# Tag the image with 'latest'
- docker tag git.wilmoredynamics.com/ab/ab01:${GITHUB_SHA::8} git.wilmoredynamics.com/ab/ab01:latest
+ docker tag git.wilmoredynamics.com/ab/logica:${GITHUB_SHA::8} git.wilmoredynamics.com/ab/logica:latest
- name: Log in to Forgejo Container Registry
uses: docker/login-action@v2
with:
registry: git.wilmoredynamics.com
- username: AB # Votre nom d'utilisateur ou organisation Forgejo
+ username: ab # Votre nom d'utilisateur ou organisation Forgejo
password: ${{ secrets.FORGEJO_TOKEN }} # Votre jeton d'accès personnel Forgejo
- name: Push Docker image to Forgejo Container Registry
run: |
- docker push git.wilmoredynamics.com/ab/ab01:${GITHUB_SHA::8}
- docker push git.wilmoredynamics.com/ab/ab01:latest
\ No newline at end of file
+ docker push git.wilmoredynamics.com/ab/logica:${GITHUB_SHA::8}
+ docker push git.wilmoredynamics.com/ab/logica:latest
\ No newline at end of file
diff --git a/src/app/binero/page.tsx b/src/app/binero/page.tsx
index b3ecfd2..6293371 100644
--- a/src/app/binero/page.tsx
+++ b/src/app/binero/page.tsx
@@ -1,12 +1,12 @@
'use client';
-import { Box, Container, Typography, Button, useTheme, ButtonGroup, Alert, Snackbar, IconButton, Tooltip, Paper, Divider, Dialog, DialogTitle, DialogContent, LinearProgress, Badge } from '@mui/material';
+import { Box, Container, Typography, Button, useTheme, ButtonGroup, Alert, Snackbar, IconButton, Tooltip, Paper, Divider, Dialog, DialogTitle, DialogContent, LinearProgress } from '@mui/material';
import { BineroGrid } from '@/components/games/binero/BineroGrid';
import { Timer } from '@/components/games/sudoku/Timer';
import { generateBinero, validateGrid, isGridComplete, calculateScore } from '@/components/games/binero/bineroLogic';
import { BineroRules } from '@/components/games/binero/BineroRules';
import { useState, useCallback, useEffect, useMemo } from 'react';
-import { Help, Refresh, CheckCircle, Timer as TimerIcon, EmojiEvents, Undo, Save, Settings } from '@mui/icons-material';
+import { Help, Refresh, CheckCircle, Timer as TimerIcon, EmojiEvents, Undo, Settings } from '@mui/icons-material';
import { useLocalStorage } from '@/hooks/useLocalStorage';
type CellValue = 0 | 1 | null;
@@ -22,12 +22,6 @@ interface GameState {
gridSize: { rows: number; cols: number };
}
-const DIFFICULTY_MULTIPLIER = {
- easy: 1,
- medium: 1.5,
- hard: 2,
-};
-
const GRID_SIZES = [
{ rows: 6, cols: 6, label: '6×6' },
{ rows: 8, cols: 8, label: '8×8' },
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index 0df502b..9e397fc 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -26,7 +26,7 @@ export default function RootLayout({
children: React.ReactNode;
}) {
return (
-
+
diff --git a/src/app/page.tsx b/src/app/page.tsx
index 08b33fa..c2a1766 100644
--- a/src/app/page.tsx
+++ b/src/app/page.tsx
@@ -1,6 +1,6 @@
'use client';
-import { Box, Container, Typography, Grid, Card, CardContent, CardActions, Button, useTheme } from '@mui/material';
+import { Box, Container, Typography, Card, CardContent, CardActions, Button, useTheme } from '@mui/material';
import { Extension, Grid3x3, GridOn } from '@mui/icons-material';
import Link from 'next/link';
diff --git a/src/app/sudoku/page.tsx b/src/app/sudoku/page.tsx
index f033c1a..6312eef 100644
--- a/src/app/sudoku/page.tsx
+++ b/src/app/sudoku/page.tsx
@@ -29,22 +29,31 @@ const calculateScore = (difficulty: 'easy' | 'medium' | 'hard', timeInSeconds: n
export default function SudokuPage() {
const theme = useTheme();
const [gameState, setGameState] = useState(() => {
- const savedState = localStorage.getItem('sudokuGameState');
- const savedBestScores = localStorage.getItem('sudokuBestScores');
-
+ if (typeof window !== 'undefined') {
+ const savedBestScores = localStorage.getItem('sudokuBestScores');
+ return {
+ grid: generateSudoku('easy'),
+ difficulty: 'easy',
+ isPlaying: false,
+ score: 0,
+ bestScores: savedBestScores ? JSON.parse(savedBestScores) : { easy: 0, medium: 0, hard: 0 },
+ };
+ }
return {
grid: generateSudoku('easy'),
difficulty: 'easy',
isPlaying: false,
score: 0,
- bestScores: savedBestScores ? JSON.parse(savedBestScores) : { easy: 0, medium: 0, hard: 0 },
+ bestScores: { easy: 0, medium: 0, hard: 0 },
};
});
const [message, setMessage] = useState<{ text: string; severity: 'success' | 'error' | 'info' }>({ text: '', severity: 'info' });
useEffect(() => {
- localStorage.setItem('sudokuBestScores', JSON.stringify(gameState.bestScores));
+ if (typeof window !== 'undefined') {
+ localStorage.setItem('sudokuBestScores', JSON.stringify(gameState.bestScores));
+ }
}, [gameState.bestScores]);
const handleCellChange = (row: number, col: number, value: number | null) => {
diff --git a/src/components/games/binero/BineroGrid.tsx b/src/components/games/binero/BineroGrid.tsx
index cc7e7ff..7a1ffd4 100644
--- a/src/components/games/binero/BineroGrid.tsx
+++ b/src/components/games/binero/BineroGrid.tsx
@@ -1,6 +1,6 @@
'use client';
-import { Box, Paper, Typography, useTheme } from '@mui/material';
+import { Box, Paper, Typography, useTheme, Theme } from '@mui/material';
import { memo, useCallback, useMemo } from 'react';
type CellValue = 0 | 1 | null;
@@ -25,13 +25,13 @@ const BineroCell = memo(({
isConflict: boolean;
showHints: boolean;
onClick: () => void;
- theme: any;
+ theme: Theme;
}) => (
diff --git a/src/components/games/binero/BineroRules.tsx b/src/components/games/binero/BineroRules.tsx
index 0447f5b..c05503e 100644
--- a/src/components/games/binero/BineroRules.tsx
+++ b/src/components/games/binero/BineroRules.tsx
@@ -1,11 +1,8 @@
'use client';
-import { Box, Typography, List, ListItem, ListItemIcon, ListItemText, Paper, useTheme } from '@mui/material';
-import { Check, Close, Info } from '@mui/icons-material';
+import { Box, Typography } from '@mui/material';
export const BineroRules = () => {
- const theme = useTheme();
-
return (
diff --git a/src/components/games/binero/bineroLogic.ts b/src/components/games/binero/bineroLogic.ts
index 3c7378b..0cc92f6 100644
--- a/src/components/games/binero/bineroLogic.ts
+++ b/src/components/games/binero/bineroLogic.ts
@@ -116,7 +116,6 @@ export const generateBinero = (size: number, difficulty: 'easy' | 'medium' | 'ha
solve();
// Retirer des cellules aléatoirement selon la difficulté
- const cellsToKeep = size * size - filledCells;
let removed = 0;
while (removed < filledCells) {
diff --git a/src/components/games/sudoku/Timer.tsx b/src/components/games/sudoku/Timer.tsx
index 1f2fac6..dc7329b 100644
--- a/src/components/games/sudoku/Timer.tsx
+++ b/src/components/games/sudoku/Timer.tsx
@@ -10,7 +10,7 @@ interface TimerProps {
export const Timer = ({ isRunning, onTimeUpdate }: TimerProps) => {
const [seconds, setSeconds] = useState(0);
- const intervalRef = useRef();
+ const intervalRef = useRef(undefined);
const lastUpdateRef = useRef(0);
const isFirstRender = useRef(true);
const secondsRef = useRef(0);
@@ -22,8 +22,11 @@ export const Timer = ({ isRunning, onTimeUpdate }: TimerProps) => {
lastUpdateRef.current = now;
secondsRef.current += delta;
setSeconds(secondsRef.current);
+ if (onTimeUpdate) {
+ onTimeUpdate(secondsRef.current);
+ }
}
- }, []);
+ }, [onTimeUpdate]);
useEffect(() => {
if (isFirstRender.current) {
@@ -48,10 +51,8 @@ export const Timer = ({ isRunning, onTimeUpdate }: TimerProps) => {
}, [isRunning, updateTimer]);
useEffect(() => {
- if (onTimeUpdate) {
- onTimeUpdate(secondsRef.current);
- }
- }, [seconds, onTimeUpdate]);
+ setSeconds(secondsRef.current);
+ }, [secondsRef.current]);
const formatTime = (totalSeconds: number) => {
const hours = Math.floor(totalSeconds / 3600);
diff --git a/src/hooks/useLocalStorage.ts b/src/hooks/useLocalStorage.ts
index 49bace2..7308a8a 100644
--- a/src/hooks/useLocalStorage.ts
+++ b/src/hooks/useLocalStorage.ts
@@ -1,4 +1,4 @@
-import { useState, useEffect } from 'react';
+import { useState } from 'react';
export function useLocalStorage(key: string, initialValue: T) {
// État pour stocker notre valeur