From 5ef36b754cb94fc33f27780abcc0c09409b9612d Mon Sep 17 00:00:00 2001 From: d_yanis Date: Mon, 4 Dec 2023 16:17:49 +0100 Subject: [PATCH 01/26] Add a basic react view with html component --- .vscode/launch.json | 38 +++++++++++++++++++++++++++ config.php | 3 +-- front/views/Home.tsx | 7 +++++ public/index.php | 4 +-- src/App/Controller/UserController.php | 4 +-- 5 files changed, 48 insertions(+), 8 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 front/views/Home.tsx diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..0aaa092 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,38 @@ +{ + // Utilisez IntelliSense pour en savoir plus sur les attributs possibles. + // Pointez pour afficher la description des attributs existants. + // Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Launch built-in server and debug", + "type": "php", + "request": "launch", + "runtimeArgs": [ + "-S", + "localhost:8080", + "-t", + "./public" + ], + "port": 8080, + "serverReadyAction": { + "action": "openExternally" + } + }, + { + "name": "Debug current script in console", + "type": "php", + "request": "launch", + "program": "${file}", + "cwd": "${fileDirname}", + "externalConsole": false, + "port": 9003 + }, + { + "name": "Listen for Xdebug", + "type": "php", + "request": "launch", + "port": 9003 + } + ] +} \ No newline at end of file diff --git a/config.php b/config.php index 6e510c8..c65c3db 100644 --- a/config.php +++ b/config.php @@ -10,7 +10,6 @@ const SUPPORTS_FAST_REFRESH = _SUPPORTS_FAST_REFRESH; /** * Maps the given relative source uri (relative to the `/front` folder) to its actual location depending on imported profile. * @param string $assetURI relative uri path from `/front` folder - * @return string valid url that points to the given uri */ function asset(string $assetURI): string { return _asset($assetURI); @@ -19,4 +18,4 @@ function asset(string $assetURI): string { global $_data_source_name; $data_source_name = $_data_source_name; const DATABASE_USER = _DATABASE_USER; -const DATABASE_PASSWORD = _DATABASE_PASSWORD; +const DATABASE_PASSWORD = _DATABASE_PASSWORD; \ No newline at end of file diff --git a/front/views/Home.tsx b/front/views/Home.tsx new file mode 100644 index 0000000..9e506fa --- /dev/null +++ b/front/views/Home.tsx @@ -0,0 +1,7 @@ +export default function Home(){ + return ( +
+

Home

+
+ ) +} \ No newline at end of file diff --git a/public/index.php b/public/index.php index 78ee4d6..964abcd 100644 --- a/public/index.php +++ b/public/index.php @@ -1,6 +1,5 @@ match(), PhpSessionHandle::init()), fn() => getTwig()); +App::render(runMatch(getRoutes()->match(), PhpSessionHandle::init()), fn() => getTwig()); \ No newline at end of file diff --git a/src/App/Controller/UserController.php b/src/App/Controller/UserController.php index d6f9f89..2f7485d 100644 --- a/src/App/Controller/UserController.php +++ b/src/App/Controller/UserController.php @@ -21,9 +21,7 @@ class UserController { * @return ViewHttpResponse the home page view */ public function home(SessionHandle $session): ViewHttpResponse { - //TODO use session's account to get the last 5 tactics of the logged-in account - $listTactic = $this->tactics->getLast(5); - return ViewHttpResponse::twig("home.twig", ["recentTactic" => $listTactic]); + return ViewHttpResponse::react("views/Home.tsx", []); } /** From 3aa7919393e55862f19e3b6ba5a6cc5ef9fb8635 Mon Sep 17 00:00:00 2001 From: d_yanis Date: Mon, 4 Dec 2023 18:13:02 +0100 Subject: [PATCH 02/26] Add the css of the page --- front/style/home.css | 7 +++++++ front/views/Home.tsx | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 front/style/home.css diff --git a/front/style/home.css b/front/style/home.css new file mode 100644 index 0000000..d9c37f9 --- /dev/null +++ b/front/style/home.css @@ -0,0 +1,7 @@ +#IQ { + color : red; +} + +#B { + color : blue; +} \ No newline at end of file diff --git a/front/views/Home.tsx b/front/views/Home.tsx index 9e506fa..fb50fb7 100644 --- a/front/views/Home.tsx +++ b/front/views/Home.tsx @@ -1,7 +1,9 @@ +import "../style/home.css" + export default function Home(){ return (
-

Home

+

IQBall

) } \ No newline at end of file From 23a0039fe44de7da0710e8b7c85e137157b24836 Mon Sep 17 00:00:00 2001 From: d_yanis Date: Mon, 4 Dec 2023 19:02:56 +0100 Subject: [PATCH 03/26] WIP Page Home integration img --- front/style/home.css | 4 ++++ front/views/Home.tsx | 22 ++++++++++++++++++++-- public/index.php | 2 ++ src/App/Controller/UserController.php | 4 ++++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/front/style/home.css b/front/style/home.css index d9c37f9..4f11371 100644 --- a/front/style/home.css +++ b/front/style/home.css @@ -4,4 +4,8 @@ #B { color : blue; +} + +#IQBall { + text-align: center; } \ No newline at end of file diff --git a/front/views/Home.tsx b/front/views/Home.tsx index fb50fb7..2d2d0be 100644 --- a/front/views/Home.tsx +++ b/front/views/Home.tsx @@ -2,8 +2,26 @@ import "../style/home.css" export default function Home(){ return ( -
-

IQBall

+
+ + <Body/> + </div> + ) +} + +export function Title(){ + return( + <div id="title"> + <h1 id="IQBall"><span id="IQ">IQ</span><span id="B">B</span>all</h1> + <img src=""></img> + </div> + ) +} + +export function Body(){ + return( + <div id="body"> + </div> ) } \ No newline at end of file diff --git a/public/index.php b/public/index.php index 964abcd..c42c889 100644 --- a/public/index.php +++ b/public/index.php @@ -102,6 +102,8 @@ function getRoutes(): AltoRouter { $ar->map("GET", "/team/members/remove", Action::auth(fn(SessionHandle $s) => getTeamController()->displayDeleteMember($s))); $ar->map("POST", "/team/members/remove", Action::auth(fn(SessionHandle $s) => getTeamController()->deleteMember($_POST, $s))); + //temp + $ar->map("GET", "/test", Action::auth(fn(SessionHandle $s) => getUserController()->homeTwig($s))); return $ar; } diff --git a/src/App/Controller/UserController.php b/src/App/Controller/UserController.php index 2f7485d..37aae73 100644 --- a/src/App/Controller/UserController.php +++ b/src/App/Controller/UserController.php @@ -24,6 +24,10 @@ class UserController { return ViewHttpResponse::react("views/Home.tsx", []); } + public function homeTwig(SessionHandle $session): ViewHttpResponse { + return ViewHttpResponse::twig("home.twig", []); + } + /** * @return ViewHttpResponse account settings page */ From 6d36115204ecf52a322ac00a4fefe52bbca0b762 Mon Sep 17 00:00:00 2001 From: d_yanis <dahmane.yanis.2004@gmail.com> Date: Tue, 5 Dec 2023 17:31:31 +0100 Subject: [PATCH 04/26] WIP page home --- front/style/home/global.css | 5 +++ front/style/home/tactic.css | 10 ++++++ front/style/{home.css => home/titre.css} | 4 +++ front/views/Home.tsx | 40 +++++++++++++++++++----- 4 files changed, 51 insertions(+), 8 deletions(-) create mode 100644 front/style/home/global.css create mode 100644 front/style/home/tactic.css rename front/style/{home.css => home/titre.css} (67%) diff --git a/front/style/home/global.css b/front/style/home/global.css new file mode 100644 index 0000000..f215ab7 --- /dev/null +++ b/front/style/home/global.css @@ -0,0 +1,5 @@ +#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 new file mode 100644 index 0000000..7dea75e --- /dev/null +++ b/front/style/home/tactic.css @@ -0,0 +1,10 @@ +#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.css b/front/style/home/titre.css similarity index 67% rename from front/style/home.css rename to front/style/home/titre.css index 4f11371..199c9bc 100644 --- a/front/style/home.css +++ b/front/style/home/titre.css @@ -8,4 +8,8 @@ #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 2d2d0be..72643ab 100644 --- a/front/views/Home.tsx +++ b/front/views/Home.tsx @@ -1,16 +1,18 @@ -import "../style/home.css" +import "../style/home/global.css" +import "../style/home/tactic.css" +import "../style/home/titre.css" -export default function Home(){ +export default function Home() { return ( - <div id="main-div"> + <div id="main"> <Title/> <Body/> </div> ) } -export function Title(){ - return( +export function Title() { + return ( <div id="title"> <h1 id="IQBall"><span id="IQ">IQ</span><span id="B">B</span>all</h1> <img src=""></img> @@ -18,10 +20,32 @@ export function Title(){ ) } -export function Body(){ - return( + +export function Body() { + return ( <div id="body"> - + <Team/> + <Tactic/> + </div> + ) +} + +export function Team() { + return ( + <div id="team"> + <h2>Mes équipes</h2> + <button id="createTeam">+</button> + </div> + ) +} + +export function Tactic() { + return ( + <div id="tactic"> + <div id="titreTactic"> + <h2>Mes stratégies</h2> + <button id="createTactic" onClick={location.pathname = "/tactic/new"}>+</button> + </div> </div> ) } \ No newline at end of file From 86230fc702231743681b4b77ca473569dc536c41 Mon Sep 17 00:00:00 2001 From: d_yanis <dahmane.yanis.2004@gmail.com> Date: Tue, 5 Dec 2023 23:18:30 +0100 Subject: [PATCH 05/26] WIP : Trying to give some argument to the JSView Home --- front/views/Home.tsx | 2 +- src/App/Controller/UserController.php | 18 +++++++++++++++++- src/Core/Model/TacticModel.php | 4 ++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/front/views/Home.tsx b/front/views/Home.tsx index 72643ab..de4eb87 100644 --- a/front/views/Home.tsx +++ b/front/views/Home.tsx @@ -44,7 +44,7 @@ export function Tactic() { <div id="tactic"> <div id="titreTactic"> <h2>Mes stratégies</h2> - <button id="createTactic" onClick={location.pathname = "/tactic/new"}>+</button> + <button id="createTactic" onClick={() => (location.pathname = "/tactic/new")}>+</button> </div> </div> ) diff --git a/src/App/Controller/UserController.php b/src/App/Controller/UserController.php index 37aae73..e5679d3 100644 --- a/src/App/Controller/UserController.php +++ b/src/App/Controller/UserController.php @@ -21,7 +21,23 @@ class UserController { * @return ViewHttpResponse the home page view */ public function home(SessionHandle $session): ViewHttpResponse { - return ViewHttpResponse::react("views/Home.tsx", []); + $lastTactic = $this->tactics->getLast(5); + return ViewHttpResponse::react("views/Home.tsx", $this->listTacticToJson($lastTactic)); + } + + private function listTacticToJson(array $listTactic) : array { + $jsonReturn = []; + foreach ($listTactic as $tactic){ + //var_dump($tactic); + $jsonTactic = [ + "id" => $tactic["id"], + "name" => $tactic["name"], + "creationDate" => $tactic["creation_date"] + ]; + array_push($jsonReturn, $jsonTactic); + } + var_dump($jsonReturn); + return $jsonReturn; } public function homeTwig(SessionHandle $session): ViewHttpResponse { diff --git a/src/Core/Model/TacticModel.php b/src/Core/Model/TacticModel.php index 136b27d..9a71f4f 100644 --- a/src/Core/Model/TacticModel.php +++ b/src/Core/Model/TacticModel.php @@ -54,6 +54,10 @@ class TacticModel { * @param integer $nb * @return array<array<string,mixed>> */ + + /** + * Return the nb last tactics + */ public function getLast(int $nb): ?array { return $this->tactics->getLast($nb); } From 5668519c335b69d3aa15505c9eac6134d85efd02 Mon Sep 17 00:00:00 2001 From: d_yanis <dahmane.yanis.2004@gmail.com> Date: Mon, 11 Dec 2023 17:29:20 +0100 Subject: [PATCH 06/26] 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 ( <div id="main"> <Title/> - <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; } From 4a2424ac225c9d7f21413252857f9d7aa716debc Mon Sep 17 00:00:00 2001 From: DahmaneYanis <dahmane.yanis.2004@gmail.com> Date: Sun, 17 Dec 2023 22:20:28 +0100 Subject: [PATCH 07/26] WIP Home --- front/views/Home.tsx | 19 ++++++++++++++++--- src/App/Controller/UserController.php | 1 + src/Core/Gateway/TacticInfoGateway.php | 2 +- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/front/views/Home.tsx b/front/views/Home.tsx index f757a30..1deedec 100644 --- a/front/views/Home.tsx +++ b/front/views/Home.tsx @@ -18,6 +18,7 @@ export default function Home({ {tactics.map(tactic => ( <div>{tactic.name}</div> ))} + <Body tactics={tactics}/> </div> ) } @@ -32,11 +33,12 @@ export function Title() { } -export function Body() { + +export function Body({tactics} : {tactics : Tactic[]}) { return ( <div id="body"> <Team/> - <Tactic/> + <Tactic tactics={tactics}/> </div> ) } @@ -50,12 +52,23 @@ export function Team() { ) } -export function Tactic() { +export function Tactic({tactics} : { tactics : Tactic[]}) { + const listTactic = tactics.map(tactic => + <li + key = {tactic.id} + > + {tactic.name} : {tactic.creationDate} + </li> + ); return ( <div id="tactic"> <div id="titreTactic"> <h2>Mes stratégies</h2> <button id="createTactic" onClick={() => (location.pathname = "/tactic/new")}>+</button> + <ul> + {listTactic} + </ul> + </div> </div> ) diff --git a/src/App/Controller/UserController.php b/src/App/Controller/UserController.php index be5c28f..84e9440 100644 --- a/src/App/Controller/UserController.php +++ b/src/App/Controller/UserController.php @@ -22,6 +22,7 @@ class UserController { */ public function home(SessionHandle $session): ViewHttpResponse { $lastTactic = $this->tactics->getLast(5); + var_dump($lastTactic); return ViewHttpResponse::react("views/Home.tsx", [ "tactics" => $lastTactic ]); diff --git a/src/Core/Gateway/TacticInfoGateway.php b/src/Core/Gateway/TacticInfoGateway.php index 447c7a5..985c58a 100644 --- a/src/Core/Gateway/TacticInfoGateway.php +++ b/src/Core/Gateway/TacticInfoGateway.php @@ -49,7 +49,7 @@ class TacticInfoGateway { [":nb" => [$nb, PDO::PARAM_INT]] ); if (count($res) == 0) { - return null; + return []; } return $res; } From 45f2cf3817b8175a5b763e7d85367d81069a50ad Mon Sep 17 00:00:00 2001 From: DahmaneYanis <dahmane.yanis.2004@gmail.com> Date: Mon, 18 Dec 2023 12:01:47 +0100 Subject: [PATCH 08/26] Add the structure and some style --- front/style/home.css | 54 +++++++++++++++++++----- front/views/Home.tsx | 61 +++++++++++++++++---------- front/views/ProfilPage.tsx | 1 + src/App/Controller/UserController.php | 19 +-------- 4 files changed, 86 insertions(+), 49 deletions(-) create mode 100644 front/views/ProfilPage.tsx diff --git a/front/style/home.css b/front/style/home.css index e175e68..198c2af 100644 --- a/front/style/home.css +++ b/front/style/home.css @@ -1,10 +1,44 @@ -/* #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 + +#main { + margin-left : 2%; + margin-right: 2%; + border : solid 2px purple; + display: flex; + flex-direction: column; + +} + +button { + border-radius: 100%; +} + +#header { + text-align: center; + background-color: green; + margin : 0px; +} + +#body { + display: flex; + flex-direction: row; + border : solid 10px yellow; + margin:0px + } + +#personal-space { + background-color: red; +} + +#sideMenu { + background-color: blue; + +} + +#ps-title { + text-align: center; +} + +#sideMenu h2 { + display: inline-block; + margin-right : 5%; +} diff --git a/front/views/Home.tsx b/front/views/Home.tsx index 1deedec..8a4efb7 100644 --- a/front/views/Home.tsx +++ b/front/views/Home.tsx @@ -1,24 +1,17 @@ import "../style/home.css" +import { CSSProperties } from "react" interface Tactic { id : number name : string - creationDate : number + creation_date : string } -export default function Home({ - tactics -} : { - tactics : Tactic[] -}) { - console.log(tactics); +export default function Home({ lastTactics } : { lastTactics : Tactic[] }) { return ( <div id="main"> <Title/> - {tactics.map(tactic => ( - <div>{tactic.name}</div> - ))} - <Body tactics={tactics}/> + <Body lastTactics={lastTactics}/> </div> ) } @@ -27,18 +20,41 @@ export function Title() { return ( <div id="header"> <h1 id="IQBall"><span id="IQ">IQ</span><span id="B">B</span>all</h1> - <img src=""></img> </div> ) } +export function Body({ lastTactics } : { lastTactics : Tactic[] }) { + const widthPersonalSpace = 70; + const widthSideMenu = 100-widthPersonalSpace + return ( + <div id="body"> + <PersonalSpace width = {widthPersonalSpace}/> + <SideMenu width = {widthSideMenu} lastTactics={lastTactics} /> + + </div> + ) +} +export function SideMenu({ width, lastTactics } : { width : number, lastTactics : Tactic[] }) { -export function Body({tactics} : {tactics : Tactic[]}) { return ( - <div id="body"> + <div id="sideMenu" style={{ + width : width + "%", + }}> <Team/> - <Tactic tactics={tactics}/> + <Tactic lastTactics={lastTactics}/> + </div> + ) +} + + +export function PersonalSpace({ width }: { width : number }) { + return ( + <div id="personal-space" style={{ + width : width + "%", + }}> + <h2 id="ps-title">Espace Personnel</h2> </div> ) } @@ -47,28 +63,29 @@ export function Team() { return ( <div id="team"> <h2>Mes équipes</h2> - <button id="createTeam">+</button> + <button onClick={() => location.pathname="/tactic/new"}>+</button> </div> ) } -export function Tactic({tactics} : { tactics : Tactic[]}) { - const listTactic = tactics.map(tactic => +export function Tactic({lastTactics} : { lastTactics : Tactic[]}) { + + const listTactic = lastTactics.map(tactic => <li key = {tactic.id} > - {tactic.name} : {tactic.creationDate} + {tactic.name} : {tactic.creation_date} + <button onClick={() => {location.pathname="/tactic/"+tactic.id+"/edit"}}>open</button> </li> - ); + ); return ( <div id="tactic"> <div id="titreTactic"> - <h2>Mes stratégies</h2> + <h2>Mes cinq dernières stratégies</h2> <button id="createTactic" onClick={() => (location.pathname = "/tactic/new")}>+</button> <ul> {listTactic} </ul> - </div> </div> ) diff --git a/front/views/ProfilPage.tsx b/front/views/ProfilPage.tsx new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/front/views/ProfilPage.tsx @@ -0,0 +1 @@ + diff --git a/src/App/Controller/UserController.php b/src/App/Controller/UserController.php index 84e9440..e17b357 100644 --- a/src/App/Controller/UserController.php +++ b/src/App/Controller/UserController.php @@ -22,28 +22,13 @@ class UserController { */ public function home(SessionHandle $session): ViewHttpResponse { $lastTactic = $this->tactics->getLast(5); - var_dump($lastTactic); + // var_dump($lastTactic); return ViewHttpResponse::react("views/Home.tsx", [ - "tactics" => $lastTactic + "lastTactics" => $lastTactic ]); // return ViewHttpResponse::react("views/Home.tsx", []); } - private function listTacticToJson(array $listTactic) : array { - $jsonReturn = []; - foreach ($listTactic as $tactic){ - //var_dump($tactic); - $jsonTactic = [ - "id" => $tactic["id"], - "name" => $tactic["name"], - "creationDate" => $tactic["creation_date"] - ]; - array_push($jsonReturn, $jsonTactic); - } - // var_dump($jsonReturn); - return $jsonReturn; - } - public function homeTwig(SessionHandle $session): ViewHttpResponse { return ViewHttpResponse::twig("home.twig", []); } From 7bb93be50c4c2eb5100a12f8c0a830e918f6624f Mon Sep 17 00:00:00 2001 From: DahmaneYanis <dahmane.yanis.2004@gmail.com> Date: Mon, 18 Dec 2023 12:13:53 +0100 Subject: [PATCH 09/26] WIP --- front/style/home.css | 2 +- front/views/Home.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/front/style/home.css b/front/style/home.css index 198c2af..cc773e6 100644 --- a/front/style/home.css +++ b/front/style/home.css @@ -8,7 +8,7 @@ } -button { +.new { border-radius: 100%; } diff --git a/front/views/Home.tsx b/front/views/Home.tsx index 8a4efb7..4a6425c 100644 --- a/front/views/Home.tsx +++ b/front/views/Home.tsx @@ -63,7 +63,7 @@ export function Team() { return ( <div id="team"> <h2>Mes équipes</h2> - <button onClick={() => location.pathname="/tactic/new"}>+</button> + <button className="new" onClick={() => location.pathname="/tactic/new"}>+</button> </div> ) } @@ -82,7 +82,7 @@ export function Tactic({lastTactics} : { lastTactics : Tactic[]}) { <div id="tactic"> <div id="titreTactic"> <h2>Mes cinq dernières stratégies</h2> - <button id="createTactic" onClick={() => (location.pathname = "/tactic/new")}>+</button> + <button className="new" id="createTactic" onClick={() => (location.pathname = "/tactic/new")}>+</button> <ul> {listTactic} </ul> From fdea80ce87797672f06d391103464b3e328f2c35 Mon Sep 17 00:00:00 2001 From: DahmaneYanis <dahmane.yanis.2004@gmail.com> Date: Mon, 18 Dec 2023 17:39:04 +0100 Subject: [PATCH 10/26] WIP update the tactic research --- front/style/home.css | 26 +++++++++++++++++++++----- front/views/Home.tsx | 18 +++++++++--------- src/App/Controller/UserController.php | 2 +- 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/front/style/home.css b/front/style/home.css index cc773e6..c6989e9 100644 --- a/front/style/home.css +++ b/front/style/home.css @@ -1,11 +1,11 @@ #main { - margin-left : 2%; - margin-right: 2%; + margin-left : 10%; + margin-right: 10%; border : solid 2px purple; display: flex; flex-direction: column; - + font-family: Helvetica,; } .new { @@ -30,8 +30,7 @@ } #sideMenu { - background-color: blue; - + background-color: grey; } #ps-title { @@ -42,3 +41,20 @@ display: inline-block; margin-right : 5%; } + +.titreSideMenu { + border-bottom: black solid 2px; + width: 95%; + +} + +#sideMenu .title { + font-size: 13px; + font-weight: bold; + color : #FFFFFF; + letter-spacing: 1px; + text-transform: uppercase; + background-color: black; + padding : 1.5%; + margin-bottom: 0px; +} \ No newline at end of file diff --git a/front/views/Home.tsx b/front/views/Home.tsx index 4a6425c..43de571 100644 --- a/front/views/Home.tsx +++ b/front/views/Home.tsx @@ -25,7 +25,7 @@ export function Title() { } export function Body({ lastTactics } : { lastTactics : Tactic[] }) { - const widthPersonalSpace = 70; + const widthPersonalSpace = 67.5; const widthSideMenu = 100-widthPersonalSpace return ( <div id="body"> @@ -61,8 +61,8 @@ export function PersonalSpace({ width }: { width : number }) { export function Team() { return ( - <div id="team"> - <h2>Mes équipes</h2> + <div className="titreSideMenu"> + <h2 className="title">Mes équipes</h2> <button className="new" onClick={() => location.pathname="/tactic/new"}>+</button> </div> ) @@ -80,13 +80,13 @@ export function Tactic({lastTactics} : { lastTactics : Tactic[]}) { ); return ( <div id="tactic"> - <div id="titreTactic"> - <h2>Mes cinq dernières stratégies</h2> + <div className="titreSideMenu"> + <h2 className="title">Mes cinq dernières stratégies</h2> <button className="new" id="createTactic" onClick={() => (location.pathname = "/tactic/new")}>+</button> - <ul> - {listTactic} - </ul> - </div> + </div> + <ul> + {listTactic} + </ul> </div> ) } \ No newline at end of file diff --git a/src/App/Controller/UserController.php b/src/App/Controller/UserController.php index e17b357..38b8567 100644 --- a/src/App/Controller/UserController.php +++ b/src/App/Controller/UserController.php @@ -22,7 +22,7 @@ class UserController { */ public function home(SessionHandle $session): ViewHttpResponse { $lastTactic = $this->tactics->getLast(5); - // var_dump($lastTactic); + var_dump($session->getAccount()); return ViewHttpResponse::react("views/Home.tsx", [ "lastTactics" => $lastTactic ]); From 7a04924617e867f7c1402f74ec4cb23a24573377 Mon Sep 17 00:00:00 2001 From: DahmaneYanis <dahmane.yanis.2004@gmail.com> Date: Tue, 19 Dec 2023 08:43:00 +0100 Subject: [PATCH 11/26] Fix the owner issue --- front/style/home.css | 4 ++-- src/App/Controller/UserController.php | 4 ++-- src/Core/Gateway/TacticInfoGateway.php | 12 +++++++++--- src/Core/Model/TacticModel.php | 5 +++-- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/front/style/home.css b/front/style/home.css index c6989e9..ed496dc 100644 --- a/front/style/home.css +++ b/front/style/home.css @@ -21,12 +21,12 @@ #body { display: flex; flex-direction: row; - border : solid 10px yellow; + border : solid 10px violet; margin:0px } #personal-space { - background-color: red; + background-color: orange; } #sideMenu { diff --git a/src/App/Controller/UserController.php b/src/App/Controller/UserController.php index 38b8567..eaa0120 100644 --- a/src/App/Controller/UserController.php +++ b/src/App/Controller/UserController.php @@ -21,8 +21,8 @@ class UserController { * @return ViewHttpResponse the home page view */ public function home(SessionHandle $session): ViewHttpResponse { - $lastTactic = $this->tactics->getLast(5); - var_dump($session->getAccount()); + $limitNbTactics = 5; + $lastTactic = $this->tactics->getLast($limitNbTactics, $session->getAccount()->getId()); return ViewHttpResponse::react("views/Home.tsx", [ "lastTactics" => $lastTactic ]); diff --git a/src/Core/Gateway/TacticInfoGateway.php b/src/Core/Gateway/TacticInfoGateway.php index 985c58a..5721f6f 100644 --- a/src/Core/Gateway/TacticInfoGateway.php +++ b/src/Core/Gateway/TacticInfoGateway.php @@ -43,10 +43,16 @@ class TacticInfoGateway { * @param integer $nb * @return array<array<string,mixed>> */ - public function getLast(int $nb): ?array { + public function getLast(int $nb, int $ownerId): ?array { $res = $this->con->fetch( - "SELECT * FROM Tactic ORDER BY creation_date DESC LIMIT :nb ", - [":nb" => [$nb, PDO::PARAM_INT]] + "SELECT * + FROM Tactic + WHERE owner = :ownerId + ORDER BY creation_date + DESC LIMIT :nb", + [ + ":ownerId" => [$ownerId, PDO::PARAM_INT],":nb" => [$nb, PDO::PARAM_INT] + ] ); if (count($res) == 0) { return []; diff --git a/src/Core/Model/TacticModel.php b/src/Core/Model/TacticModel.php index 9a71f4f..d9e783e 100644 --- a/src/Core/Model/TacticModel.php +++ b/src/Core/Model/TacticModel.php @@ -2,6 +2,7 @@ namespace IQBall\Core\Model; +use IQBall\App\Session\SessionHandle; use IQBall\Core\Data\TacticInfo; use IQBall\Core\Gateway\TacticInfoGateway; use IQBall\Core\Validation\ValidationFail; @@ -58,8 +59,8 @@ class TacticModel { /** * Return the nb last tactics */ - public function getLast(int $nb): ?array { - return $this->tactics->getLast($nb); + public function getLast(int $nb, int $ownerId): ?array { + return $this->tactics->getLast($nb, $ownerId); } /** From 9febc0f29e3e7f61d7fbea9bed64100defd4dcee Mon Sep 17 00:00:00 2001 From: DahmaneYanis <dahmane.yanis.2004@gmail.com> Date: Tue, 19 Dec 2023 10:54:20 +0100 Subject: [PATCH 12/26] Can display all tactics in the personal space --- front/style/home.css | 11 ++++- front/views/Home.tsx | 63 +++++++++++++++++++++++--- src/App/Controller/UserController.php | 6 ++- src/Core/Gateway/TacticInfoGateway.php | 25 +++++++++- src/Core/Model/TacticModel.php | 9 ++++ 5 files changed, 103 insertions(+), 11 deletions(-) diff --git a/front/style/home.css b/front/style/home.css index ed496dc..19067f8 100644 --- a/front/style/home.css +++ b/front/style/home.css @@ -33,7 +33,7 @@ background-color: grey; } -#ps-title { +#titlePersonalSpace h2 { text-align: center; } @@ -57,4 +57,13 @@ background-color: black; padding : 1.5%; margin-bottom: 0px; +} + +table { + width: 100%; +} + +td { + text-align: center; + border : 3px solid black; } \ No newline at end of file diff --git a/front/views/Home.tsx b/front/views/Home.tsx index 43de571..b0442ef 100644 --- a/front/views/Home.tsx +++ b/front/views/Home.tsx @@ -7,11 +7,11 @@ interface Tactic { creation_date : string } -export default function Home({ lastTactics } : { lastTactics : Tactic[] }) { +export default function Home({ lastTactics, allTactics } : { lastTactics : Tactic[] , allTactics : Tactic[]}) { return ( <div id="main"> <Title/> - <Body lastTactics={lastTactics}/> + <Body lastTactics={lastTactics} allTactics={allTactics}/> </div> ) } @@ -24,12 +24,12 @@ export function Title() { ) } -export function Body({ lastTactics } : { lastTactics : Tactic[] }) { +export function Body({ lastTactics, allTactics } : { lastTactics : Tactic[], allTactics : Tactic[]}) { const widthPersonalSpace = 67.5; const widthSideMenu = 100-widthPersonalSpace return ( <div id="body"> - <PersonalSpace width = {widthPersonalSpace}/> + <PersonalSpace width = {widthPersonalSpace} allTactics = {allTactics}/> <SideMenu width = {widthSideMenu} lastTactics={lastTactics} /> </div> @@ -49,12 +49,63 @@ export function SideMenu({ width, lastTactics } : { width : number, lastTactics } -export function PersonalSpace({ width }: { width : number }) { +export function PersonalSpace({ width, allTactics }: { width : number, allTactics : Tactic[] }) { return ( <div id="personal-space" style={{ width : width + "%", }}> - <h2 id="ps-title">Espace Personnel</h2> + <TitlePersonalSpace/> + <BodyPersonalSpace allTactics = {allTactics}/> + </div> + ) +} + +function TitlePersonalSpace() { + return ( + <div id="titlePersonalSpace"> + <h2>Espace Personnel</h2> + </div> + ) +} + +function BodyPersonalSpace({ allTactics } : { allTactics : Tactic[]}) { + const nbRow = Math.floor(allTactics.length/3)+1; + let listTactic = Array(nbRow); + for (let i = 0; i < nbRow; i++) { + listTactic[i] = Array(0); + } + let i = 0; + let j = 0; + allTactics.forEach(tactic => { + listTactic[i].push(tactic); + j++; + if (j === 3) { + i++; + j = 0; + } + }) + + i = 0; + while (i < nbRow) { + listTactic[i] = listTactic[i].map((tactic : Tactic) => + <td key={tactic.id}>{tactic.name}</td> + ); + i++; + } + + const data = listTactic.map((tactic, rowIndex) => + <tr key={rowIndex+"row"}> + {tactic} + </tr> + ); + return ( + <div id="bodyPersonalSpace"> + <table> + <tbody key="tbody"> + {data} + </tbody> + </table> + </div> ) } diff --git a/src/App/Controller/UserController.php b/src/App/Controller/UserController.php index eaa0120..f292cb6 100644 --- a/src/App/Controller/UserController.php +++ b/src/App/Controller/UserController.php @@ -22,9 +22,11 @@ class UserController { */ public function home(SessionHandle $session): ViewHttpResponse { $limitNbTactics = 5; - $lastTactic = $this->tactics->getLast($limitNbTactics, $session->getAccount()->getId()); + $lastTactics = $this->tactics->getLast($limitNbTactics, $session->getAccount()->getId()); + $allTactics = $this->tactics->getAll($session->getAccount()->getId()); return ViewHttpResponse::react("views/Home.tsx", [ - "lastTactics" => $lastTactic + "lastTactics" => $lastTactics, + "allTactics" => $allTactics ]); // return ViewHttpResponse::react("views/Home.tsx", []); } diff --git a/src/Core/Gateway/TacticInfoGateway.php b/src/Core/Gateway/TacticInfoGateway.php index 5721f6f..a7f1f7b 100644 --- a/src/Core/Gateway/TacticInfoGateway.php +++ b/src/Core/Gateway/TacticInfoGateway.php @@ -48,8 +48,8 @@ class TacticInfoGateway { "SELECT * FROM Tactic WHERE owner = :ownerId - ORDER BY creation_date - DESC LIMIT :nb", + ORDER BY creation_date DESC + LIMIT :nb", [ ":ownerId" => [$ownerId, PDO::PARAM_INT],":nb" => [$nb, PDO::PARAM_INT] ] @@ -60,6 +60,27 @@ class TacticInfoGateway { return $res; } + /** + * Get all the tactics of the owner + * + * @return array<array<string,mixed>> + */ + public function getAll(int $ownerId): ?array { + $res = $this->con->fetch( + "SELECT * + FROM Tactic + WHERE owner = :ownerId + ORDER BY name DESC", + [ + ":ownerId" => [$ownerId, PDO::PARAM_INT] + ] + ); + if (count($res) == 0) { + return []; + } + return $res; + } + /** * @param string $name * @param int $owner diff --git a/src/Core/Model/TacticModel.php b/src/Core/Model/TacticModel.php index d9e783e..f605155 100644 --- a/src/Core/Model/TacticModel.php +++ b/src/Core/Model/TacticModel.php @@ -63,6 +63,15 @@ class TacticModel { return $this->tactics->getLast($nb, $ownerId); } + /** + * Get all the tactics of the owner + * + * @param integer $ownerId + * @return array|null + */ + public function getAll(int $ownerId): ?array { + return $this->tactics->getAll($ownerId); + } /** * Update the name of a tactic * @param int $id the tactic identifier From b4bbbbaad50067acac4c17097596fbd409746376 Mon Sep 17 00:00:00 2001 From: DahmaneYanis <dahmane.yanis.2004@gmail.com> Date: Tue, 19 Dec 2023 11:19:11 +0100 Subject: [PATCH 13/26] Open a tactic in the personal space --- front/style/home.css | 21 +++++++++++++++++++-- front/views/Home.tsx | 2 +- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/front/style/home.css b/front/style/home.css index 19067f8..c053198 100644 --- a/front/style/home.css +++ b/front/style/home.css @@ -27,6 +27,9 @@ #personal-space { background-color: orange; + display: flex; + flex-direction: column; + } #sideMenu { @@ -59,11 +62,25 @@ margin-bottom: 0px; } -table { +#bodyPersonalSpace { + width: 95%; + border : 1px red solid; + align-self: center; +} +#bodyPersonalSpace table{ width: 100%; + border-collapse : separate; + border-spacing : 1em; } td { - text-align: center; border : 3px solid black; + padding-bottom : 1%; + padding-top : 1%; + margin: 80px; + text-align: center; +} + +td:hover { + background-color: red; } \ No newline at end of file diff --git a/front/views/Home.tsx b/front/views/Home.tsx index b0442ef..4792f5f 100644 --- a/front/views/Home.tsx +++ b/front/views/Home.tsx @@ -88,7 +88,7 @@ function BodyPersonalSpace({ allTactics } : { allTactics : Tactic[]}) { i = 0; while (i < nbRow) { listTactic[i] = listTactic[i].map((tactic : Tactic) => - <td key={tactic.id}>{tactic.name}</td> + <td key={tactic.id} onClick={() => {location.pathname="/tactic/"+tactic.id+"/edit"}}>{tactic.name}</td> ); i++; } From 5d10ec8c47383254157bc94588a2fbb071671bc3 Mon Sep 17 00:00:00 2001 From: d_yanis <dahmane.yanis.2004@gmail.com> Date: Tue, 19 Dec 2023 21:37:59 +0100 Subject: [PATCH 14/26] WIP --- public/index.php | 2 +- src/App/Controller/UserController.php | 12 +++++++++++- src/Core/Gateway/TeamGateway.php | 3 +++ src/Core/Model/TeamModel.php | 6 ++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/public/index.php b/public/index.php index 8b375d0..b3205ab 100644 --- a/public/index.php +++ b/public/index.php @@ -38,7 +38,7 @@ function getConnection(): Connection { } function getUserController(): UserController { - return new UserController(new TacticModel(new TacticInfoGateway(getConnection()))); + return new UserController(new TacticModel(new TacticInfoGateway(getConnection())), new TeamModel( new TeamGateway(getConnection()), new MemberGateway(getConnection()), new AccountGateway(getConnection()))); } function getVisualizerController(): VisualizerController { diff --git a/src/App/Controller/UserController.php b/src/App/Controller/UserController.php index 0af4214..f2444a5 100644 --- a/src/App/Controller/UserController.php +++ b/src/App/Controller/UserController.php @@ -7,15 +7,19 @@ use IQBall\App\Session\SessionHandle; use IQBall\App\ViewHttpResponse; use IQBall\Core\Http\HttpResponse; use IQBall\Core\Model\TacticModel; +use IQBall\Core\Model\TeamModel; class UserController { private TacticModel $tactics; + private ?TeamModel $teams; + /** * @param TacticModel $tactics */ - public function __construct(TacticModel $tactics) { + public function __construct(TacticModel $tactics, ?TeamModel $teams = NULL) { $this->tactics = $tactics; + $this->teams = $teams; } /** @@ -26,6 +30,12 @@ class UserController { $limitNbTactics = 5; $lastTactics = $this->tactics->getLast($limitNbTactics, $session->getAccount()->getId()); $allTactics = $this->tactics->getAll($session->getAccount()->getId()); + + //TODO + if ($this->teams != NULL) { + $teams = $this->teams->getAll($session->getAccount()->getId()); + } + return ViewHttpResponse::react("views/Home.tsx", [ "lastTactics" => $lastTactics, "allTactics" => $allTactics diff --git a/src/Core/Gateway/TeamGateway.php b/src/Core/Gateway/TeamGateway.php index d775eda..cfadd89 100644 --- a/src/Core/Gateway/TeamGateway.php +++ b/src/Core/Gateway/TeamGateway.php @@ -81,5 +81,8 @@ class TeamGateway { )[0]['id'] ?? null; } + public function getAll(int $user) : array { + return $this->con->fetch("SELECT * FROM Team", []); + } } diff --git a/src/Core/Model/TeamModel.php b/src/Core/Model/TeamModel.php index f6af837..c2df190 100644 --- a/src/Core/Model/TeamModel.php +++ b/src/Core/Model/TeamModel.php @@ -79,4 +79,10 @@ class TeamModel { return $teamId; } + public function getAll(int $user) { + $res = $this->teams->getAll($user); + var_dump($res); + return $res; + } + } From 6a5bd8deee9c7f6841c552be35d8a3c11401f752 Mon Sep 17 00:00:00 2001 From: DahmaneYanis <dahmane.yanis.2004@gmail.com> Date: Wed, 20 Dec 2023 09:17:35 +0100 Subject: [PATCH 15/26] Home page fonctionnelle --- front/style/home.css | 8 +++-- front/views/Home.tsx | 46 ++++++++++++++++++++------- src/App/Controller/UserController.php | 6 +++- 3 files changed, 44 insertions(+), 16 deletions(-) diff --git a/front/style/home.css b/front/style/home.css index c053198..56fcb8f 100644 --- a/front/style/home.css +++ b/front/style/home.css @@ -5,7 +5,8 @@ border : solid 2px purple; display: flex; flex-direction: column; - font-family: Helvetica,; + font-family: Helvetica; + height: 100%; } .new { @@ -22,7 +23,8 @@ display: flex; flex-direction: row; border : solid 10px violet; - margin:0px + margin:0px; + height: 100%; } #personal-space { @@ -52,7 +54,7 @@ } #sideMenu .title { - font-size: 13px; + font-size: 12px; font-weight: bold; color : #FFFFFF; letter-spacing: 1px; diff --git a/front/views/Home.tsx b/front/views/Home.tsx index 4792f5f..6801e2d 100644 --- a/front/views/Home.tsx +++ b/front/views/Home.tsx @@ -7,11 +7,20 @@ interface Tactic { creation_date : string } -export default function Home({ lastTactics, allTactics } : { lastTactics : Tactic[] , allTactics : Tactic[]}) { +interface Team { + id : number + name : string + picture : string + main_color : string + second_color : string +} + +export default function Home({ lastTactics, allTactics, teams } : { lastTactics : Tactic[] , allTactics : Tactic[], teams : Team[]}) { + console.log(teams); return ( <div id="main"> <Title/> - <Body lastTactics={lastTactics} allTactics={allTactics}/> + <Body lastTactics={lastTactics} allTactics={allTactics} teams={teams}/> </div> ) } @@ -24,25 +33,25 @@ export function Title() { ) } -export function Body({ lastTactics, allTactics } : { lastTactics : Tactic[], allTactics : Tactic[]}) { - const widthPersonalSpace = 67.5; +export function Body({ lastTactics, allTactics, teams } : { lastTactics : Tactic[], allTactics : Tactic[], teams : Team[]}) { + const widthPersonalSpace = 80; const widthSideMenu = 100-widthPersonalSpace return ( <div id="body"> <PersonalSpace width = {widthPersonalSpace} allTactics = {allTactics}/> - <SideMenu width = {widthSideMenu} lastTactics={lastTactics} /> + <SideMenu width = {widthSideMenu} lastTactics={lastTactics} teams={teams} /> </div> ) } -export function SideMenu({ width, lastTactics } : { width : number, lastTactics : Tactic[] }) { +export function SideMenu({ width, lastTactics, teams } : { width : number, lastTactics : Tactic[], teams : Team[]}) { return ( <div id="sideMenu" style={{ width : width + "%", }}> - <Team/> + <Team teams={teams}/> <Tactic lastTactics={lastTactics}/> </div> ) @@ -110,11 +119,24 @@ function BodyPersonalSpace({ allTactics } : { allTactics : Tactic[]}) { ) } -export function Team() { +export function Team({teams} : {teams : Team[]}) { + const listTeam = teams.map((team, rowIndex) => + <li + key={"team" + rowIndex} + > + {team.name} + <button onClick={() => location.pathname="/team/"+team.id}>open</button> + </li> + ); return ( - <div className="titreSideMenu"> - <h2 className="title">Mes équipes</h2> - <button className="new" onClick={() => location.pathname="/tactic/new"}>+</button> + <div id="teams"> + <div className="titreSideMenu"> + <h2 className="title">Mes équipes</h2> + <button className="new" onClick={() => location.pathname="/team/new"}>+</button> + </div> + <ul> + {listTeam} + </ul> </div> ) } @@ -132,7 +154,7 @@ export function Tactic({lastTactics} : { lastTactics : Tactic[]}) { return ( <div id="tactic"> <div className="titreSideMenu"> - <h2 className="title">Mes cinq dernières stratégies</h2> + <h2 className="title">Mes dernières stratégies</h2> <button className="new" id="createTactic" onClick={() => (location.pathname = "/tactic/new")}>+</button> </div> <ul> diff --git a/src/App/Controller/UserController.php b/src/App/Controller/UserController.php index f2444a5..9dcfad5 100644 --- a/src/App/Controller/UserController.php +++ b/src/App/Controller/UserController.php @@ -35,10 +35,14 @@ class UserController { if ($this->teams != NULL) { $teams = $this->teams->getAll($session->getAccount()->getId()); } + else { + $teams = []; + } return ViewHttpResponse::react("views/Home.tsx", [ "lastTactics" => $lastTactics, - "allTactics" => $allTactics + "allTactics" => $allTactics, + "teams" => $teams ]); // return ViewHttpResponse::react("views/Home.tsx", []); } From 792c47537ba3e8f6f3193c4dfdc217d220bd5145 Mon Sep 17 00:00:00 2001 From: DahmaneYanis <dahmane.yanis.2004@gmail.com> Date: Wed, 20 Dec 2023 09:19:25 +0100 Subject: [PATCH 16/26] Remove var_dump --- public/index.php | 2 -- src/Core/Model/TeamModel.php | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/public/index.php b/public/index.php index b3205ab..e43010c 100644 --- a/public/index.php +++ b/public/index.php @@ -107,8 +107,6 @@ function getRoutes(): AltoRouter { $ar->map("GET", "/team/members/remove", Action::auth(fn(SessionHandle $s) => getTeamController()->displayDeleteMember($s))); $ar->map("POST", "/team/members/remove", Action::auth(fn(SessionHandle $s) => getTeamController()->deleteMember($_POST, $s))); - //temp - $ar->map("GET", "/test", Action::auth(fn(SessionHandle $s) => getUserController()->homeTwig($s))); return $ar; } diff --git a/src/Core/Model/TeamModel.php b/src/Core/Model/TeamModel.php index c2df190..3357553 100644 --- a/src/Core/Model/TeamModel.php +++ b/src/Core/Model/TeamModel.php @@ -80,9 +80,7 @@ class TeamModel { } public function getAll(int $user) { - $res = $this->teams->getAll($user); - var_dump($res); - return $res; + return $this->teams->getAll($user); } } From 3edb7f9fc00117dff1115c8960c680d3559b232a Mon Sep 17 00:00:00 2001 From: DahmaneYanis <dahmane.yanis.2004@gmail.com> Date: Wed, 20 Dec 2023 09:52:20 +0100 Subject: [PATCH 17/26] Overflow --- front/style/home.css | 16 ++++++++++++---- front/views/Home.tsx | 11 ++++++++++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/front/style/home.css b/front/style/home.css index 56fcb8f..63795eb 100644 --- a/front/style/home.css +++ b/front/style/home.css @@ -36,6 +36,8 @@ #sideMenu { background-color: grey; + + overflow: hidden; } #titlePersonalSpace h2 { @@ -73,16 +75,22 @@ width: 100%; border-collapse : separate; border-spacing : 1em; + table-layout: fixed; + overflow: hidden; } -td { - border : 3px solid black; +#bodyPersonalSpace td { + width: 80px !important; padding-bottom : 1%; padding-top : 1%; - margin: 80px; + height: fit-content; text-align: center; + overflow: hidden ; +} +.dataTactic { + border : 3px solid black; } -td:hover { +.dataTactic:hover { background-color: red; } \ No newline at end of file diff --git a/front/views/Home.tsx b/front/views/Home.tsx index 6801e2d..6bebef3 100644 --- a/front/views/Home.tsx +++ b/front/views/Home.tsx @@ -97,10 +97,19 @@ function BodyPersonalSpace({ allTactics } : { allTactics : Tactic[]}) { i = 0; while (i < nbRow) { listTactic[i] = listTactic[i].map((tactic : Tactic) => - <td key={tactic.id} onClick={() => {location.pathname="/tactic/"+tactic.id+"/edit"}}>{tactic.name}</td> + <td key={tactic.id} className="dataTactic" onClick={() => {location.pathname="/tactic/"+tactic.id+"/edit"}}>{tactic.name}</td> ); i++; } + if (nbRow == 1) { + if (listTactic[0].length < 3) { + for (let i = 0; i <= 3-listTactic[0].length; i++) { + listTactic[0].push(<td key={"tdNone"+i}></td>); + } + } + } + + console.log(listTactic); const data = listTactic.map((tactic, rowIndex) => <tr key={rowIndex+"row"}> From 7b4b80770caf653b0e3cd4009142acb4f7c944ab Mon Sep 17 00:00:00 2001 From: DahmaneYanis <dahmane.yanis.2004@gmail.com> Date: Wed, 20 Dec 2023 12:34:02 +0100 Subject: [PATCH 18/26] WIP --- front/style/home.css | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/front/style/home.css b/front/style/home.css index 63795eb..1194514 100644 --- a/front/style/home.css +++ b/front/style/home.css @@ -88,9 +88,11 @@ overflow: hidden ; } .dataTactic { - border : 3px solid black; + border : 2px solid black; + /* border-radius: 10%; */ } .dataTactic:hover { background-color: red; + cursor : pointer; } \ No newline at end of file From 0d10717133405f68072862b91c627d8a27c895db Mon Sep 17 00:00:00 2001 From: DahmaneYanis <dahmane.yanis.2004@gmail.com> Date: Wed, 20 Dec 2023 14:41:28 +0100 Subject: [PATCH 19/26] Creation component ButtonTactic --- front/style/home.css | 50 +++++++++++++++++++++++++++++++++++++++----- front/views/Home.tsx | 44 +++++++++++++++++++++++++------------- 2 files changed, 74 insertions(+), 20 deletions(-) diff --git a/front/style/home.css b/front/style/home.css index 1194514..642c9c3 100644 --- a/front/style/home.css +++ b/front/style/home.css @@ -36,7 +36,9 @@ #sideMenu { background-color: grey; - + display: flex; + flex-direction: column; + align-items: center; overflow: hidden; } @@ -49,9 +51,14 @@ margin-right : 5%; } +#sideMenuContent { + width: 90%; +} .titreSideMenu { border-bottom: black solid 2px; - width: 95%; + width: 100%; + margin-bottom: 3%; + } @@ -62,8 +69,10 @@ letter-spacing: 1px; text-transform: uppercase; background-color: black; - padding : 1.5%; + padding : 1.5%; margin-bottom: 0px; + margin-right: 3%; + } #bodyPersonalSpace { @@ -89,10 +98,41 @@ } .dataTactic { border : 2px solid black; - /* border-radius: 10%; */ + border-radius: 0.75cap; } .dataTactic:hover { background-color: red; cursor : pointer; -} \ No newline at end of file +} + +.listTactic { + border: 2px solid green; + display: block; +} + +ul { + border : pink solid 1px; +} + +#SetButtonTactic { + border: 0px solid brown; + width: 80%; + margin-left : 5%; + margin-top : 5%; +} + + +.ButtonLastTactic { + border : black solid 1px; + border-radius :0.5cap; + width :fit-content; + padding: 2%; + margin-top: 3%; + overflow: hidden; +} + +.ButtonLastTactic:hover { + background-color: red; + cursor : pointer; +} diff --git a/front/views/Home.tsx b/front/views/Home.tsx index 6bebef3..ff33df6 100644 --- a/front/views/Home.tsx +++ b/front/views/Home.tsx @@ -51,8 +51,10 @@ export function SideMenu({ width, lastTactics, teams } : { width : number, lastT <div id="sideMenu" style={{ width : width + "%", }}> - <Team teams={teams}/> - <Tactic lastTactics={lastTactics}/> + <div id="sideMenuContent"> + <Team teams={teams}/> + <Tactic lastTactics={lastTactics}/> + </div> </div> ) } @@ -151,24 +153,36 @@ export function Team({teams} : {teams : Team[]}) { } export function Tactic({lastTactics} : { lastTactics : Tactic[]}) { - - const listTactic = lastTactics.map(tactic => - <li - key = {tactic.id} - > - {tactic.name} : {tactic.creation_date} - <button onClick={() => {location.pathname="/tactic/"+tactic.id+"/edit"}}>open</button> - </li> - ); return ( <div id="tactic"> <div className="titreSideMenu"> <h2 className="title">Mes dernières stratégies</h2> <button className="new" id="createTactic" onClick={() => (location.pathname = "/tactic/new")}>+</button> </div> - <ul> - {listTactic} - </ul> + <SetButtonTactic tactics={lastTactics}/> </div> ) -} \ No newline at end of file +} + + +function SetButtonTactic ({tactics} : {tactics : Tactic[]}) { + const lastTactics = tactics.map(tactic => + <ButtonLastTactic tactic={tactic} /> + ); + return ( + <div id="SetButtonTactic"> + {lastTactics} + </div> + ); +} +function ButtonLastTactic ({tactic} : {tactic : Tactic}) { + return ( + <div + id={"Button"+tactic.id} + className="ButtonLastTactic" + onClick={() => {location.pathname="/tactic/"+tactic.id+"/edit"}} + > + {tactic.name} + </div> + ); +} From 0aba5f2c3887ae13ad3828eaa55bc5b56cb39a1a Mon Sep 17 00:00:00 2001 From: DahmaneYanis <dahmane.yanis.2004@gmail.com> Date: Wed, 20 Dec 2023 15:10:18 +0100 Subject: [PATCH 20/26] TroncName function and improve code structure --- front/style/home.css | 6 +++--- front/views/Home.tsx | 49 +++++++++++++++++++++++++++++++++++++------- 2 files changed, 45 insertions(+), 10 deletions(-) diff --git a/front/style/home.css b/front/style/home.css index 642c9c3..9188257 100644 --- a/front/style/home.css +++ b/front/style/home.css @@ -115,7 +115,7 @@ ul { border : pink solid 1px; } -#SetButtonTactic { +.SetButton { border: 0px solid brown; width: 80%; margin-left : 5%; @@ -123,7 +123,7 @@ ul { } -.ButtonLastTactic { +.ButtonSideMenu { border : black solid 1px; border-radius :0.5cap; width :fit-content; @@ -132,7 +132,7 @@ ul { overflow: hidden; } -.ButtonLastTactic:hover { +.ButtonSideMenu:hover { background-color: red; cursor : pointer; } diff --git a/front/views/Home.tsx b/front/views/Home.tsx index ff33df6..07f44a8 100644 --- a/front/views/Home.tsx +++ b/front/views/Home.tsx @@ -99,7 +99,7 @@ function BodyPersonalSpace({ allTactics } : { allTactics : Tactic[]}) { i = 0; while (i < nbRow) { listTactic[i] = listTactic[i].map((tactic : Tactic) => - <td key={tactic.id} className="dataTactic" onClick={() => {location.pathname="/tactic/"+tactic.id+"/edit"}}>{tactic.name}</td> + <td key={tactic.id} className="dataTactic" onClick={() => {location.pathname="/tactic/"+tactic.id+"/edit"}}>{troncName(tactic.name, 25)}</td> ); i++; } @@ -145,9 +145,7 @@ export function Team({teams} : {teams : Team[]}) { <h2 className="title">Mes équipes</h2> <button className="new" onClick={() => location.pathname="/team/new"}>+</button> </div> - <ul> - {listTeam} - </ul> + <SetButtonTeam teams={teams}/> </div> ) } @@ -170,19 +168,56 @@ function SetButtonTactic ({tactics} : {tactics : Tactic[]}) { <ButtonLastTactic tactic={tactic} /> ); return ( - <div id="SetButtonTactic"> + <div className="SetButton"> {lastTactics} </div> ); } + +function SetButtonTeam({teams} : {teams : Team[]}) { + const listTeam = teams.map(teams => + <ButtonTeam team={teams} /> + ); + return ( + <div className="SetButton"> + {listTeam} + </div> + ); +} + +function ButtonTeam ({team} : {team : Team}) { + const name = troncName(team.name, 20); + return ( + <div> + <div + id={"ButtonTeam"+team.id} + className="ButtonSideMenu" + onClick={() => {location.pathname="/team/"+team.id}} + > + {name} + </div> + </div> + ) +} + function ButtonLastTactic ({tactic} : {tactic : Tactic}) { + const name = troncName(tactic.name, 20); return ( <div id={"Button"+tactic.id} - className="ButtonLastTactic" + className="ButtonSideMenu" onClick={() => {location.pathname="/tactic/"+tactic.id+"/edit"}} > - {tactic.name} + {name} </div> ); } + +function troncName(name: string, limit: number) : string { + if (name.length > limit) { + name = name.substring(0, limit) + "..."; + } else { + name = name; + } + return name; +} \ No newline at end of file From ad500d694aade3dc7c952b1b5b906622774718e2 Mon Sep 17 00:00:00 2001 From: DahmaneYanis <dahmane.yanis.2004@gmail.com> Date: Wed, 20 Dec 2023 15:35:41 +0100 Subject: [PATCH 21/26] Add some color and style --- front/style/home.css | 18 +++++++++++++----- front/views/Home.tsx | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/front/style/home.css b/front/style/home.css index 9188257..156e3f4 100644 --- a/front/style/home.css +++ b/front/style/home.css @@ -1,4 +1,7 @@ +body { + background-color: #f8f8f1; +} #main { margin-left : 10%; margin-right: 10%; @@ -15,20 +18,25 @@ #header { text-align: center; - background-color: green; + background-color: #303030; margin : 0px; + /* border-radius: 0.75cap; */ } +#IQBall { + color : #ffa238; + font-weight: bold; + font-size : 45px; +} #body { display: flex; flex-direction: row; - border : solid 10px violet; margin:0px; height: 100%; + background-color: #fff3e5; } #personal-space { - background-color: orange; display: flex; flex-direction: column; @@ -102,7 +110,7 @@ } .dataTactic:hover { - background-color: red; + background-color: #c9d1e0; cursor : pointer; } @@ -133,6 +141,6 @@ ul { } .ButtonSideMenu:hover { - background-color: red; + background-color: #c9d1e0; cursor : pointer; } diff --git a/front/views/Home.tsx b/front/views/Home.tsx index 07f44a8..605e0e3 100644 --- a/front/views/Home.tsx +++ b/front/views/Home.tsx @@ -28,7 +28,7 @@ export default function Home({ lastTactics, allTactics, teams } : { lastTactics export function Title() { return ( <div id="header"> - <h1 id="IQBall"><span id="IQ">IQ</span><span id="B">B</span>all</h1> + <h1 id="IQBall"><span id="IQ">IQ</span><span id="Ball">Ball</span></h1> </div> ) } From 4a185449b5a850c01f5ca9fba210592c45faa6af Mon Sep 17 00:00:00 2001 From: d_yanis <dahmane.yanis.2004@gmail.com> Date: Wed, 20 Dec 2023 23:07:13 +0100 Subject: [PATCH 22/26] Home Page ready, some Css added --- front/style/home.css | 23 +++++++++++++---------- front/views/Home.tsx | 20 +++++++++++++++++--- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/front/style/home.css b/front/style/home.css index 156e3f4..965f880 100644 --- a/front/style/home.css +++ b/front/style/home.css @@ -1,11 +1,11 @@ body { - background-color: #f8f8f1; + /* background-color: #303030; */ } #main { - margin-left : 10%; - margin-right: 10%; - border : solid 2px purple; + /* margin-left : 10%; + margin-right: 10%; */ + border : solid 1px #303030; display: flex; flex-direction: column; font-family: Helvetica; @@ -43,7 +43,7 @@ body { } #sideMenu { - background-color: grey; + background-color: #a7a7a7; display: flex; flex-direction: column; align-items: center; @@ -63,7 +63,7 @@ body { width: 90%; } .titreSideMenu { - border-bottom: black solid 2px; + border-bottom: black solid 3px; width: 100%; margin-bottom: 3%; @@ -77,7 +77,7 @@ body { letter-spacing: 1px; text-transform: uppercase; background-color: black; - padding : 1.5%; + padding : 3%; margin-bottom: 0px; margin-right: 3%; @@ -85,7 +85,9 @@ body { #bodyPersonalSpace { width: 95%; - border : 1px red solid; + background-color: #ccc2b7; + /* border : 2px #303030 solid; */ + border-radius: 0.5cap; align-self: center; } #bodyPersonalSpace table{ @@ -105,12 +107,14 @@ body { overflow: hidden ; } .dataTactic { - border : 2px solid black; + border : 1.5px solid black; + background-color: #ccc2b7; border-radius: 0.75cap; } .dataTactic:hover { background-color: #c9d1e0; + /* color : #ffa238; */ cursor : pointer; } @@ -124,7 +128,6 @@ ul { } .SetButton { - border: 0px solid brown; width: 80%; margin-left : 5%; margin-top : 5%; diff --git a/front/views/Home.tsx b/front/views/Home.tsx index 605e0e3..307e016 100644 --- a/front/views/Home.tsx +++ b/front/views/Home.tsx @@ -16,7 +16,7 @@ interface Team { } export default function Home({ lastTactics, allTactics, teams } : { lastTactics : Tactic[] , allTactics : Tactic[], teams : Team[]}) { - console.log(teams); + console.log(allTactics); return ( <div id="main"> <Title/> @@ -34,7 +34,7 @@ export function Title() { } export function Body({ lastTactics, allTactics, teams } : { lastTactics : Tactic[], allTactics : Tactic[], teams : Team[]}) { - const widthPersonalSpace = 80; + const widthPersonalSpace = 78; const widthSideMenu = 100-widthPersonalSpace return ( <div id="body"> @@ -79,7 +79,7 @@ function TitlePersonalSpace() { ) } -function BodyPersonalSpace({ allTactics } : { allTactics : Tactic[]}) { +function TableData({allTactics} : {allTactics : Tactic[]} ) { const nbRow = Math.floor(allTactics.length/3)+1; let listTactic = Array(nbRow); for (let i = 0; i < nbRow; i++) { @@ -118,6 +118,20 @@ function BodyPersonalSpace({ allTactics } : { allTactics : Tactic[]}) { {tactic} </tr> ); + return data; +} + +function BodyPersonalSpace({ allTactics } : { allTactics : Tactic[]}) { + let data; + if (allTactics.length == 0) { + data = ( + <p>Aucune tactique créé !</p> + ); + } + else { + data = (<TableData allTactics={allTactics}/>); + } + return ( <div id="bodyPersonalSpace"> <table> From 09aaf2065a387c22c674bfaf63b51cd642aad0ec Mon Sep 17 00:00:00 2001 From: d_yanis <dahmane.yanis.2004@gmail.com> Date: Wed, 20 Dec 2023 23:22:10 +0100 Subject: [PATCH 23/26] lastCommit for the home-page's base --- front/style/home.css | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/front/style/home.css b/front/style/home.css index 965f880..2efbf87 100644 --- a/front/style/home.css +++ b/front/style/home.css @@ -76,7 +76,7 @@ body { color : #FFFFFF; letter-spacing: 1px; text-transform: uppercase; - background-color: black; + background-color: #303030; padding : 3%; margin-bottom: 0px; margin-right: 3%; @@ -107,7 +107,7 @@ body { overflow: hidden ; } .dataTactic { - border : 1.5px solid black; + border : 1.5px solid #303030; background-color: #ccc2b7; border-radius: 0.75cap; } @@ -147,3 +147,7 @@ ul { background-color: #c9d1e0; cursor : pointer; } + +tbody p { + text-align: center; +} \ No newline at end of file From cc06b7ec69034f1c7e8dfac949a7495701a0a045 Mon Sep 17 00:00:00 2001 From: d_yanis <dahmane.yanis.2004@gmail.com> Date: Sat, 6 Jan 2024 11:51:44 +0100 Subject: [PATCH 24/26] some changes --- front/assets/court/court.svg | 63 ++++++++++++++++++++++++++++++++++++ front/tactic/Ball.ts | 11 +++++++ 2 files changed, 74 insertions(+) create mode 100644 front/assets/court/court.svg create mode 100644 front/tactic/Ball.ts diff --git a/front/assets/court/court.svg b/front/assets/court/court.svg new file mode 100644 index 0000000..e01fd58 --- /dev/null +++ b/front/assets/court/court.svg @@ -0,0 +1,63 @@ +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + version="1.1" + width="100" + height="50" + viewBox="7.5 18.5 85.5 56" + style="enable-background:new 7.5 18.5 85.5 56;" + xml:space="preserve"> + + <style type="text/css"> + .st0{fill:none;stroke:#000000;stroke-miterlimit:10;} + .st1{fill:none;stroke:#000000;stroke-miterlimit:10;stroke-dasharray:1.4358,1.4358;} + .st2{fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:10;} + .st3{fill:none;stroke:#000000;stroke-miterlimit:10;stroke-dasharray:1.4407,1.4407;} + </style> + <polygon class="st0" points="92.1,72.1 50.1,72.1 8.1,72.1 8.1,21.2 50.1,21.2 92.1,21.2 "/> + <line class="st0" x1="50.1" y1="21.2" x2="50.1" y2="72.1"/> + <circle class="st0" cx="50.1" cy="46.6" r="6.4"/> + <path class="st0" d="M8.1,66h7.2c10.1,0,18.2-8.7,18.2-19.3s-8.2-19.3-18.2-19.3H8.1"/> + <path class="st0" d="M8.1,40.2h19c3.6,0,6.4,2.9,6.4,6.4s-2.9,6.4-6.4,6.4h-19"/> + <line class="st0" x1="27.1" y1="40.2" x2="27.1" y2="53.1"/> + <g> + <g><path class="st0" d="M27.4,40.3c-0.3,0-0.5,0-0.7,0"/> + <path class="st1" + d="M25.3,40.7c-2.5,0.9-4.3,3.3-4.3,6.1c0,3,2.2,5.6,5,6.2"/> + <path + class="st0" d="M26.7,53c0.2,0,0.5,0,0.7,0"/> + </g> + </g> + <line class="st0" x1="16.2" y1="53.1" x2="16.2" y2="54.1"/> + <line class="st2" x1="19.3" y1="53.1" x2="19.3" y2="54.1"/> + <line class="st2" x1="22.4" y1="53.1" x2="22.4" y2="54.1"/> + <line class="st2" x1="25.7" y1="53.1" x2="25.7" y2="54.1"/> + <line class="st0" x1="16.1" y1="39.2" x2="16.1" y2="40.2"/> + <line class="st2" x1="19.2" y1="39.2" x2="19.2" y2="40.2"/> + <line class="st2" x1="22.3" y1="39.2" x2="22.3" y2="40.2"/> + <line class="st2" x1="25.6" y1="39.2" x2="25.6" y2="40.2"/> + <line class="st0" x1="27.1" y1="40.2" x2="27.1" y2="53.1"/> + <path class="st0" d="M92.1,66.1h-7.2c-10.1,0-18.2-8.7-18.2-19.3s8.2-19.3,18.2-19.3h7.2"/> + <path class="st0" d="M92.1,40.3h-19c-3.6,0-6.4,2.9-6.4,6.4s2.9,6.4,6.4,6.4h19"/> + <line class="st0" x1="84" y1="53.2" x2="84" y2="54.1"/> + <line class="st2" x1="80.9" y1="53.2" x2="80.9" y2="54.1"/> + <line class="st2" x1="77.9" y1="53.2" x2="77.9" y2="54.1"/> + <line class="st2" x1="74.5" y1="53.2" x2="74.5" y2="54.1"/> + <line class="st0" x1="84.1" y1="39.3" x2="84.1" y2="40.3"/> + <line class="st2" x1="81" y1="39.3" x2="81" y2="40.3"/> + <line class="st2" x1="77.9" y1="39.3" x2="77.9" y2="40.3"/> + <line class="st2" x1="74.6" y1="39.3" x2="74.6" y2="40.3"/> + <line class="st0" x1="73.1" y1="40.3" x2="73.1" y2="53.2"/> + <line class="st2" x1="36.2" y1="70" x2="36.2" y2="74.1"/> + <line class="st2" x1="63.5" y1="70" x2="63.5" y2="74.1"/> + <line class="st2" x1="36.2" y1="19.1" x2="36.2" y2="23.2"/> + <line class="st2" x1="63.5" y1="19.1" x2="63.5" y2="23.2"/> + <g xmlns="http://www.w3.org/2000/svg"> + <g> + <path class="st0" d="M72.9,40.3c0.3,0,0.5,0,0.7,0"/> + <path class="st3" + d="M75,40.7c2.5,0.9,4.3,3.3,4.3,6.1c0,3-2.2,5.6-5.1,6.2"/> + <path + class="st0" d="M73.5,53.1c-0.2,0-0.5,0-0.7,0"/> + </g> + </g> +</svg> \ No newline at end of file diff --git a/front/tactic/Ball.ts b/front/tactic/Ball.ts new file mode 100644 index 0000000..443e4f9 --- /dev/null +++ b/front/tactic/Ball.ts @@ -0,0 +1,11 @@ +export interface Ball { + /** + * Percentage of the player's position to the bottom (0 means top, 1 means bottom, 0.5 means middle) + */ + bottom_percentage: number + + /** + * Percentage of the player's position to the right (0 means left, 1 means right, 0.5 means middle) + */ + right_percentage: number +} From 1ec5da649aab7a4a924b4cbe9fc7f5afae9ceab1 Mon Sep 17 00:00:00 2001 From: d_yanis <dahmane.yanis.2004@gmail.com> Date: Sat, 6 Jan 2024 13:33:47 +0100 Subject: [PATCH 25/26] Update title --- front/style/home.css | 43 ++++++++++++++++++++++--------------------- front/views/Home.tsx | 6 +++--- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/front/style/home.css b/front/style/home.css index 2efbf87..cabc769 100644 --- a/front/style/home.css +++ b/front/style/home.css @@ -18,7 +18,7 @@ body { #header { text-align: center; - background-color: #303030; + background-color: #191a21; margin : 0px; /* border-radius: 0.75cap; */ } @@ -33,7 +33,7 @@ body { flex-direction: row; margin:0px; height: 100%; - background-color: #fff3e5; + background-color: #282a36; } #personal-space { @@ -43,7 +43,7 @@ body { } #sideMenu { - background-color: #a7a7a7; + background-color: #303341; display: flex; flex-direction: column; align-items: center; @@ -52,6 +52,9 @@ body { #titlePersonalSpace h2 { text-align: center; + color : #e6edf3; + /* font-family: Helvetica; + font-weight: bold; */ } #sideMenu h2 { @@ -63,30 +66,27 @@ body { width: 90%; } .titreSideMenu { - border-bottom: black solid 3px; + border-bottom: #191a21 solid 3px; width: 100%; margin-bottom: 3%; - - } #sideMenu .title { font-size: 12px; font-weight: bold; - color : #FFFFFF; + color : #e6edf3; letter-spacing: 1px; text-transform: uppercase; - background-color: #303030; + background-color: #191a21; padding : 3%; margin-bottom: 0px; - margin-right: 3%; - + margin-right: 3%; } #bodyPersonalSpace { width: 95%; - background-color: #ccc2b7; - /* border : 2px #303030 solid; */ + /* background-color: #ccc2b7; */ + border : 2px #191a21 solid; border-radius: 0.5cap; align-self: center; } @@ -106,18 +106,19 @@ body { text-align: center; overflow: hidden ; } -.dataTactic { - border : 1.5px solid #303030; - background-color: #ccc2b7; +.data { + border : 1.5px solid #e6edf3; + background-color: #191a21; border-radius: 0.75cap; + color : #e6edf3; } -.dataTactic:hover { - background-color: #c9d1e0; - /* color : #ffa238; */ +.data:hover { + border-color: #ffa238 ; cursor : pointer; } + .listTactic { border: 2px solid green; display: block; @@ -134,8 +135,8 @@ ul { } -.ButtonSideMenu { - border : black solid 1px; +.buttonSideMenu { + /* border : black solid 1px; */ border-radius :0.5cap; width :fit-content; padding: 2%; @@ -144,7 +145,7 @@ ul { } .ButtonSideMenu:hover { - background-color: #c9d1e0; + /* background-color: #c9d1e0; */ cursor : pointer; } diff --git a/front/views/Home.tsx b/front/views/Home.tsx index 307e016..488a08c 100644 --- a/front/views/Home.tsx +++ b/front/views/Home.tsx @@ -99,7 +99,7 @@ function TableData({allTactics} : {allTactics : Tactic[]} ) { i = 0; while (i < nbRow) { listTactic[i] = listTactic[i].map((tactic : Tactic) => - <td key={tactic.id} className="dataTactic" onClick={() => {location.pathname="/tactic/"+tactic.id+"/edit"}}>{troncName(tactic.name, 25)}</td> + <td key={tactic.id} className="data" onClick={() => {location.pathname="/tactic/"+tactic.id+"/edit"}}>{troncName(tactic.name, 25)}</td> ); i++; } @@ -205,7 +205,7 @@ function ButtonTeam ({team} : {team : Team}) { <div> <div id={"ButtonTeam"+team.id} - className="ButtonSideMenu" + className="buttonSideMenu data" onClick={() => {location.pathname="/team/"+team.id}} > {name} @@ -219,7 +219,7 @@ function ButtonLastTactic ({tactic} : {tactic : Tactic}) { return ( <div id={"Button"+tactic.id} - className="ButtonSideMenu" + className="buttonSideMenu data" onClick={() => {location.pathname="/tactic/"+tactic.id+"/edit"}} > {name} From ac675cc5cdc61063a5cf598b379e4e64aba815cd Mon Sep 17 00:00:00 2001 From: d_yanis <dahmane.yanis.2004@gmail.com> Date: Sat, 6 Jan 2024 13:34:06 +0100 Subject: [PATCH 26/26] Update style --- front/style/home.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/style/home.css b/front/style/home.css index cabc769..937c4d2 100644 --- a/front/style/home.css +++ b/front/style/home.css @@ -38,7 +38,7 @@ body { #personal-space { display: flex; - flex-direction: column; + flex-direction: column; }