From 5668519c335b69d3aa15505c9eac6134d85efd02 Mon Sep 17 00:00:00 2001 From: d_yanis Date: Mon, 11 Dec 2023 17:29:20 +0100 Subject: [PATCH] Add the display of tactic name --- front/style/home.css | 10 ++++++++++ front/style/home/global.css | 5 ----- front/style/home/tactic.css | 10 ---------- front/style/home/titre.css | 15 --------------- front/views/Home.tsx | 23 +++++++++++++++++------ src/App/Controller/UserController.php | 7 +++++-- 6 files changed, 32 insertions(+), 38 deletions(-) create mode 100644 front/style/home.css delete mode 100644 front/style/home/global.css delete mode 100644 front/style/home/tactic.css delete mode 100644 front/style/home/titre.css diff --git a/front/style/home.css b/front/style/home.css new file mode 100644 index 0000000..e175e68 --- /dev/null +++ b/front/style/home.css @@ -0,0 +1,10 @@ +/* #header { + background-color: var(--white); + transition: box-shadow .3s linear; + outline: 0; + box-shadow: 0 10px 15px #00000026; +} */ + +#header { + +} \ No newline at end of file diff --git a/front/style/home/global.css b/front/style/home/global.css deleted file mode 100644 index f215ab7..0000000 --- a/front/style/home/global.css +++ /dev/null @@ -1,5 +0,0 @@ -#main { - margin-left:10%; - margin-right:10%; - background-color: grey; -} \ No newline at end of file diff --git a/front/style/home/tactic.css b/front/style/home/tactic.css deleted file mode 100644 index 7dea75e..0000000 --- a/front/style/home/tactic.css +++ /dev/null @@ -1,10 +0,0 @@ -#titreTactic { - background-color: red; - padding-right : 10px; - margin-top : 10px; -} - -#titreTactic h2 { - display: inline; - padding-right : 25px; -} \ No newline at end of file diff --git a/front/style/home/titre.css b/front/style/home/titre.css deleted file mode 100644 index 199c9bc..0000000 --- a/front/style/home/titre.css +++ /dev/null @@ -1,15 +0,0 @@ -#IQ { - color : red; -} - -#B { - color : blue; -} - -#IQBall { - text-align: center; -} - -#title { - background-color: aqua; -} \ No newline at end of file diff --git a/front/views/Home.tsx b/front/views/Home.tsx index de4eb87..f757a30 100644 --- a/front/views/Home.tsx +++ b/front/views/Home.tsx @@ -1,19 +1,30 @@ -import "../style/home/global.css" -import "../style/home/tactic.css" -import "../style/home/titre.css" +import "../style/home.css" -export default function Home() { +interface Tactic { + id : number + name : string + creationDate : number +} + +export default function Home({ + tactics +} : { + tactics : Tactic[] +}) { + console.log(tactics); return (
- <Body/> + {tactics.map(tactic => ( + <div>{tactic.name}</div> + ))} </div> ) } export function Title() { return ( - <div id="title"> + <div id="header"> <h1 id="IQBall"><span id="IQ">IQ</span><span id="B">B</span>all</h1> <img src=""></img> </div> diff --git a/src/App/Controller/UserController.php b/src/App/Controller/UserController.php index e5679d3..be5c28f 100644 --- a/src/App/Controller/UserController.php +++ b/src/App/Controller/UserController.php @@ -22,7 +22,10 @@ class UserController { */ public function home(SessionHandle $session): ViewHttpResponse { $lastTactic = $this->tactics->getLast(5); - return ViewHttpResponse::react("views/Home.tsx", $this->listTacticToJson($lastTactic)); + return ViewHttpResponse::react("views/Home.tsx", [ + "tactics" => $lastTactic + ]); + // return ViewHttpResponse::react("views/Home.tsx", []); } private function listTacticToJson(array $listTactic) : array { @@ -36,7 +39,7 @@ class UserController { ]; array_push($jsonReturn, $jsonTactic); } - var_dump($jsonReturn); + // var_dump($jsonReturn); return $jsonReturn; }