From 208d835a1f05139b7c9a4a99e275a280740022d2 Mon Sep 17 00:00:00 2001 From: Override-6 Date: Sun, 26 Nov 2023 21:46:31 +0100 Subject: [PATCH] fix BasketCourt margins --- front/components/editor/BasketCourt.tsx | 19 +++++++++++-------- front/style/basket_court.css | 5 ++--- front/style/new_tactic_panel.css | 12 +++++++----- front/style/player.css | 5 ++--- front/style/theme/default.css | 6 +++--- front/views/Editor.tsx | 3 ++- front/views/NewTacticPanel.tsx | 3 +-- src/App/Controller/EditorController.php | 2 +- src/Core/Gateway/TacticInfoGateway.php | 2 +- 9 files changed, 30 insertions(+), 27 deletions(-) diff --git a/front/components/editor/BasketCourt.tsx b/front/components/editor/BasketCourt.tsx index 5305f6f..cd4774e 100644 --- a/front/components/editor/BasketCourt.tsx +++ b/front/components/editor/BasketCourt.tsx @@ -1,5 +1,5 @@ import "../../style/basket_court.css" -import { useRef } from "react" +import { RefObject, useRef } from "react" import CourtPlayer from "./CourtPlayer" import { Player } from "../../tactic/Player" @@ -7,20 +7,23 @@ export interface BasketCourtProps { players: Player[] onPlayerRemove: (p: Player) => void onPlayerChange: (p: Player) => void - courtImage: string, + courtImage: string + courtRef: RefObject } export function BasketCourt({ players, onPlayerRemove, onPlayerChange, - courtImage + courtImage, + courtRef, }: BasketCourtProps) { - const divRef = useRef(null) - return ( -
- {"court"} +
+ {"court"} {players.map((player) => { return ( onPlayerRemove(player)} - parentRef={divRef} + parentRef={courtRef} /> ) })} diff --git a/front/style/basket_court.css b/front/style/basket_court.css index 353d519..859d00f 100644 --- a/front/style/basket_court.css +++ b/front/style/basket_court.css @@ -5,13 +5,12 @@ justify-content: center; height: 100%; - padding: 20px 40px 20px 40px; - background-color: var(--main-color); } #court-svg { - height: 100%; + margin: 35px; + height: 87%; user-select: none; -webkit-user-drag: none; } diff --git a/front/style/new_tactic_panel.css b/front/style/new_tactic_panel.css index e5640b6..5f151d9 100644 --- a/front/style/new_tactic_panel.css +++ b/front/style/new_tactic_panel.css @@ -1,4 +1,3 @@ - #panel-root { width: 100%; height: 100%; @@ -49,7 +48,8 @@ transition: scale 1s; } -.court-kind-button-bottom, .court-kind-button-top { +.court-kind-button-bottom, +.court-kind-button-top { width: 100%; height: 100%; border: solid; @@ -80,7 +80,8 @@ scale: 1.1; } -.court-kind-button-top, .court-kind-button-image-div { +.court-kind-button-top, +.court-kind-button-image-div { display: flex; justify-content: center; align-items: stretch; @@ -100,7 +101,8 @@ background-color: var(--second-color); } -.court-kind-button-name, .court-kind-button-details { +.court-kind-button-name, +.court-kind-button-details { user-select: none; font-family: var(--text-main-font); } @@ -114,4 +116,4 @@ .court-kind-button:hover .court-kind-button-details { top: -20px; -} \ No newline at end of file +} diff --git a/front/style/player.css b/front/style/player.css index 7bea36e..71baddb 100644 --- a/front/style/player.css +++ b/front/style/player.css @@ -39,12 +39,11 @@ on the court. } .player-selection-tab { - display: flex; + display: none; position: absolute; margin-bottom: 10%; justify-content: center; - visibility: hidden; width: 100%; transform: translateY(-20px); @@ -67,7 +66,7 @@ on the court. } .player:focus-within .player-selection-tab { - visibility: visible; + display: flex; } .player:focus-within .player-piece { diff --git a/front/style/theme/default.css b/front/style/theme/default.css index 0baa9b9..a2894ee 100644 --- a/front/style/theme/default.css +++ b/front/style/theme/default.css @@ -1,4 +1,4 @@ -@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400&display=swap'); +@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@300;400&display=swap"); :root { --main-color: #ffffff; --second-color: #e8e8e8; @@ -12,10 +12,10 @@ --selection-color: #3f7fc4; - --border-color: #FFFFFF; + --border-color: #ffffff; --editor-court-selection-background: #5f8fee; --editor-court-selection-buttons: #acc4f3; - --text-main-font: 'Roboto', sans-serif; + --text-main-font: "Roboto", sans-serif; } diff --git a/front/views/Editor.tsx b/front/views/Editor.tsx index 4c4c725..6b5dbd7 100644 --- a/front/views/Editor.tsx +++ b/front/views/Editor.tsx @@ -203,12 +203,13 @@ function EditorView({ />
-
+
{ setContent((content) => ({ players: toSplicedPlayers( diff --git a/front/views/NewTacticPanel.tsx b/front/views/NewTacticPanel.tsx index 0f72c37..2b7165b 100644 --- a/front/views/NewTacticPanel.tsx +++ b/front/views/NewTacticPanel.tsx @@ -44,8 +44,7 @@ function CourtKindButton({ return (
location.href = redirect} - > + onClick={() => (location.href = redirect)}>
{details}
diff --git a/src/App/Controller/EditorController.php b/src/App/Controller/EditorController.php index 238ae83..64de063 100644 --- a/src/App/Controller/EditorController.php +++ b/src/App/Controller/EditorController.php @@ -27,7 +27,7 @@ class EditorController { "id" => $tactic->getId(), "name" => $tactic->getName(), "content" => $tactic->getContent(), - "courtType" => $tactic->getCourtType()->name() + "courtType" => $tactic->getCourtType()->name(), ]); } diff --git a/src/Core/Gateway/TacticInfoGateway.php b/src/Core/Gateway/TacticInfoGateway.php index abd0541..67cffc4 100644 --- a/src/Core/Gateway/TacticInfoGateway.php +++ b/src/Core/Gateway/TacticInfoGateway.php @@ -68,7 +68,7 @@ class TacticInfoGateway { [ ":name" => [$name, PDO::PARAM_STR], ":owner" => [$owner, PDO::PARAM_INT], - ":court_type" => [$type->name(), PDO::PARAM_STR] + ":court_type" => [$type->name(), PDO::PARAM_STR], ] ); return intval($this->con->lastInsertId());