From 1e95438b2c4e3dd9870b6624bd6d98575d37faae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SwimJ=C3=A9j=C3=A9?= Date: Fri, 6 Dec 2024 06:44:06 +0100 Subject: [PATCH 1/4] Fin Chaos Page --- front/src/components/chaos/MonInput.tsx | 4 ++-- front/src/components/chaos/monButton.tsx | 2 +- front/src/components/chaos/style.css | 1 + front/src/pages/ChaosPage.tsx | 22 +++++++++++++--------- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/front/src/components/chaos/MonInput.tsx b/front/src/components/chaos/MonInput.tsx index 184896e..1a9bed6 100644 --- a/front/src/components/chaos/MonInput.tsx +++ b/front/src/components/chaos/MonInput.tsx @@ -1,10 +1,10 @@ //import { useState } from "react"; -export default function MonInput({text, new_focus}) { +export default function MonInput({text, new_focus, police}) { return (
- +
) } \ No newline at end of file diff --git a/front/src/components/chaos/monButton.tsx b/front/src/components/chaos/monButton.tsx index 9951303..136b780 100644 --- a/front/src/components/chaos/monButton.tsx +++ b/front/src/components/chaos/monButton.tsx @@ -1,4 +1,4 @@ -import { useState } from "react"; + diff --git a/front/src/components/chaos/style.css b/front/src/components/chaos/style.css index 6e3a951..f0fbe2d 100644 --- a/front/src/components/chaos/style.css +++ b/front/src/components/chaos/style.css @@ -1,3 +1,4 @@ + #keys { display: grid; grid-template-columns: auto auto 1fr; diff --git a/front/src/pages/ChaosPage.tsx b/front/src/pages/ChaosPage.tsx index d5f8beb..5db36a4 100644 --- a/front/src/pages/ChaosPage.tsx +++ b/front/src/pages/ChaosPage.tsx @@ -6,11 +6,10 @@ import { useState } from "react"; export default function ChaosPage(){ - const array_input = [1,2,3,4]; const [array_letter,setArray_letter]=useState(["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"," ","!"]); const [sizeFrontw,setSizeFrontw] = useState(16) - const [sizeFronth,setSizeFronth] = useState(10) + const [sizeFronth,setSizeFronth] = useState(20) const [color,setColor] = useState("#ffffff") function randomFront(){setSizeFronth(Math.floor(Math.random() * (1000))); @@ -25,19 +24,16 @@ export default function ChaosPage(){ return arr; } - const myArray = [1, 2, 3, 4, 5]; - const shuffledArray = shuffleArray(myArray); - console.log(shuffledArray); // Affiche un tableau mélangé - const [entry1,setEntry1] = useState("champ1") + const [entry1,setEntry1] = useState("") function E1(ent:string) { setEntry1(entry1+ent); } const [connarddefocus,setFocus] = useState(()=>E1) - const [entry2,setEntry2] = useState("champ2") + const [entry2,setEntry2] = useState("") function E2(ent:string) { setEntry2(entry2+ent); } @@ -47,12 +43,20 @@ export default function ChaosPage(){ setFocus(()=>E); } + const [entry3,setEntry3] = useState("") + function E3(ent:string) { + setEntry3(entry3+ent); + } return(

Chaos Page

- changeFocus(E1)}/> - changeFocus(E2)}/> +

Quel est votre nom ?

+ changeFocus(E1)} police={""}/> +

Quel adjectif désigne le mieux Xi Junpin ?

+ changeFocus(E2)} police={""}/> +

Combien font 1+1 ?

+ changeFocus(E3)} police={"Wingdings"}/>
{array_letter.map((letter) => {return Date: Fri, 6 Dec 2024 06:53:41 +0100 Subject: [PATCH 2/4] =?UTF-8?q?Hot=20Fix:=20Ajout=20page=20chaos=20+=20Fix?= =?UTF-8?q?=20myst=C3=A8re?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/components/NavBar.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/front/src/components/NavBar.tsx b/front/src/components/NavBar.tsx index d868b75..d6f6c87 100644 --- a/front/src/components/NavBar.tsx +++ b/front/src/components/NavBar.tsx @@ -11,9 +11,10 @@ export default function NavBar(){ Home Game Articles + Le Chaos
- +
); } \ No newline at end of file From 75c29c719abfea8f5c8cdbd8444831a72f02455a Mon Sep 17 00:00:00 2001 From: iMax Date: Fri, 6 Dec 2024 06:57:50 +0100 Subject: [PATCH 3/4] Hot Fix: Debug for build --- front/src/components/chaos/MonInput.tsx | 8 +++++++- front/src/components/chaos/monButton.tsx | 13 ++++++++++--- front/src/pages/ChaosPage.tsx | 4 ++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/front/src/components/chaos/MonInput.tsx b/front/src/components/chaos/MonInput.tsx index 1a9bed6..ae96388 100644 --- a/front/src/components/chaos/MonInput.tsx +++ b/front/src/components/chaos/MonInput.tsx @@ -1,6 +1,12 @@ //import { useState } from "react"; -export default function MonInput({text, new_focus, police}) { +interface MonInputProps { + text: string; + new_focus: () => void; + police: string; +} + +export default function MonInput({text, new_focus, police}: MonInputProps) { return (
diff --git a/front/src/components/chaos/monButton.tsx b/front/src/components/chaos/monButton.tsx index 136b780..e06033f 100644 --- a/front/src/components/chaos/monButton.tsx +++ b/front/src/components/chaos/monButton.tsx @@ -1,8 +1,15 @@ +interface MonButtonProps { + letter: string; + changetext: (arg0: string) => void; + sizeFrontw: number; + sizeFronth: number; + rdmFront: () => void; + color: string; +} + - - -export default function MonButton({letter,changetext,sizeFrontw,sizeFronth,rdmFront,color}) { +export default function MonButton({letter,changetext,sizeFrontw,sizeFronth,rdmFront,color}: MonButtonProps) { diff --git a/front/src/pages/ChaosPage.tsx b/front/src/pages/ChaosPage.tsx index e04b7a7..9efc84b 100644 --- a/front/src/pages/ChaosPage.tsx +++ b/front/src/pages/ChaosPage.tsx @@ -16,7 +16,7 @@ export default function ChaosPage(){ setSizeFrontw(Math.floor(Math.random() * (1000))); setColor(`#${Math.floor(Math.random() * 16777215).toString(16)}`)} - function shuffleArray(arr) { + function shuffleArray(arr: string[]) { for (let i = arr.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); // Choisir un index aléatoire [arr[i], arr[j]] = [arr[j], arr[i]]; // Échanger les éléments @@ -39,7 +39,7 @@ export default function ChaosPage(){ setEntry2(entry2+ent); } - function changeFocus(E) { + function changeFocus(E: (ent:string)=>void) { setArray_letter(shuffleArray(array_letter)); setFocus(()=>E); } From 6228e839d7b2ad04200d1f5ef099e78caf7e12ed Mon Sep 17 00:00:00 2001 From: Lukian Date: Fri, 6 Dec 2024 07:00:04 +0100 Subject: [PATCH 4/4] Updated backend --- back/src/main.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/back/src/main.rs b/back/src/main.rs index 7242d32..c7312e9 100644 --- a/back/src/main.rs +++ b/back/src/main.rs @@ -73,6 +73,8 @@ async fn main() -> Result<(), std::io::Error> { .service(get_articles) .service(api) .service(Files::new("/", "public").index_file("index.html")) + .service(Files::new("/game", "public").index_file("index.html")) + .service(Files::new("/chaos", "public").index_file("index.html")) }) .bind(("0.0.0.0", 2486))? .run()