fix new tactic panel
continuous-integration/drone/push Build is passing Details

pull/37/head
maxime.batista 1 year ago
parent 4c684e27a8
commit 940d87930a

@ -1,8 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg" <svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.1" version="1.1"
width="100%" width="100"
height="100%" height="50"
viewBox="7.5 18.5 85.5 56" viewBox="7.5 18.5 85.5 56"
style="enable-background:new 7.5 18.5 85.5 56;" style="enable-background:new 7.5 18.5 85.5 56;"
xml:space="preserve"> xml:space="preserve">

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

@ -1,4 +1,4 @@
<svg width="80" height="58" viewBox="0 0 80 58" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="100" height="50" viewBox="0 0 80 58" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2.74466 0.676824V28.6768V56.6768L76.7447 56.6768V28.6768V0.676824L2.74466 0.676824Z" stroke="black" stroke-miterlimit="10"/> <path d="M2.74466 0.676824V28.6768V56.6768L76.7447 56.6768V28.6768V0.676824L2.74466 0.676824Z" stroke="black" stroke-miterlimit="10"/>
<path d="M76.8393 0.876801L3.21608 0.876801" stroke="black" stroke-miterlimit="10"/> <path d="M76.8393 0.876801L3.21608 0.876801" stroke="black" stroke-miterlimit="10"/>
<path d="M12.0393 56.8768V47.2768C12.0393 33.8101 24.6232 23.0101 39.9554 23.0101C55.2875 23.0101 67.8715 33.9435 67.8715 47.2768V56.8768" stroke="black" stroke-miterlimit="10"/> <path d="M12.0393 56.8768V47.2768C12.0393 33.8101 24.6232 23.0101 39.9554 23.0101C55.2875 23.0101 67.8715 33.9435 67.8715 47.2768V56.8768" stroke="black" stroke-miterlimit="10"/>

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

@ -9,7 +9,7 @@
} }
#court-svg { #court-svg {
margin: 35px; margin: 35px 0 35px 0;
height: 87%; height: 87%;
user-select: none; user-select: none;
-webkit-user-drag: none; -webkit-user-drag: none;

@ -27,7 +27,7 @@
#panel-buttons { #panel-buttons {
width: 75%; width: 75%;
height: 30%; height: 20%;
display: flex; display: flex;
justify-content: space-evenly; justify-content: space-evenly;
align-items: stretch; align-items: stretch;
@ -45,17 +45,15 @@
cursor: pointer; cursor: pointer;
transition: scale 1s; transition: scale 0.5s ease-out;
width: auto;
} }
.court-kind-button-bottom, .court-kind-button-bottom,
.court-kind-button-top { .court-kind-button-top {
width: 100%;
height: 100%;
border: solid; border: solid;
border-color: var(--border-color); border-color: var(--border-color);
} }
.court-kind-button-bottom { .court-kind-button-bottom {
display: flex; display: flex;
justify-content: center; justify-content: center;
@ -63,14 +61,15 @@
align-content: center; align-content: center;
height: 25%; height: 25%;
width: 100%;
background-color: var(--editor-court-selection-buttons); background-color: var(--editor-court-selection-buttons);
border-radius: 0 0 20px 20px; border-radius: 0 0 20px 20px;
border-width: 3px; border-width: 3px;
} }
.court-kind-button-top { .court-kind-button-top {
height: 75%; height: 30%;
overflow: hidden;
background-color: var(--main-color); background-color: var(--main-color);
border-radius: 20px 20px 0 0; border-radius: 20px 20px 0 0;
border-width: 3px 3px 0 3px; border-width: 3px 3px 0 3px;
@ -82,21 +81,25 @@
.court-kind-button-top, .court-kind-button-top,
.court-kind-button-image-div { .court-kind-button-image-div {
overflow: hidden;
display: flex; display: flex;
height: 100%;
width: 100%;
justify-content: center; justify-content: center;
align-items: stretch; align-items: center;
align-content: stretch; align-content: center;
} }
.court-kind-button-image { .court-kind-button-image {
height: 100%; height: 100%;
width: 150px;
user-select: none; user-select: none;
-webkit-user-drag: none; -webkit-user-drag: none;
} }
.court-kind-button-image-div { .court-kind-button-image-div {
width: 100%;
height: 100%; height: 100%;
padding: 0 10px 0 10px; padding: 0 10px 0 10px;
background-color: var(--second-color); background-color: var(--second-color);
} }

@ -58,12 +58,9 @@ interface RackedPlayer {
export default function Editor({ export default function Editor({
id, id,
name, name,
courtType,
content, content,
}: { }: EditorProps) {
id: number
name: string
content: string
}) {
const isInGuestMode = id == -1 const isInGuestMode = id == -1
const storage_content = localStorage.getItem(GUEST_MODE_CONTENT_STORAGE_KEY) const storage_content = localStorage.getItem(GUEST_MODE_CONTENT_STORAGE_KEY)
@ -97,7 +94,7 @@ export default function Editor({
(r) => r.ok, (r) => r.ok,
) )
}} }}
/> courtType={courtType}/>
) )
} }

@ -56,7 +56,7 @@ function CourtKindButton({
</div> </div>
</div> </div>
<div className="court-kind-button-bottom"> <div className="court-kind-button-bottom">
<p className={"court-kind-button-name"}>{name}</p> <p className="court-kind-button-name">{name}</p>
</div> </div>
</div> </div>
) )

@ -38,11 +38,12 @@ class EditorController {
/** /**
* @return ViewHttpResponse the editor view for a test tactic. * @return ViewHttpResponse the editor view for a test tactic.
*/ */
private function openTestEditor(): ViewHttpResponse { private function openTestEditor(CourtType $courtType): ViewHttpResponse {
return ViewHttpResponse::react("views/Editor.tsx", [ return ViewHttpResponse::react("views/Editor.tsx", [
"id" => -1, //-1 id means that the editor will not support saves "id" => -1, //-1 id means that the editor will not support saves
"content" => '{"players": []}',
"name" => TacticModel::TACTIC_DEFAULT_NAME, "name" => TacticModel::TACTIC_DEFAULT_NAME,
"content" => '{"players": []}',
"courtType" => $courtType->name()
]); ]);
} }
@ -55,6 +56,13 @@ class EditorController {
* @return ViewHttpResponse the editor view * @return ViewHttpResponse the editor view
*/ */
public function createNewOfKind(CourtType $type, SessionHandle $session): ViewHttpResponse { public function createNewOfKind(CourtType $type, SessionHandle $session): ViewHttpResponse {
$action = $session->getAccount();
if ($action == null) {
return $this->openTestEditor($type);
}
$tactic = $this->model->makeNewDefault($session->getAccount()->getId(), $type); $tactic = $this->model->makeNewDefault($session->getAccount()->getId(), $type);
return $this->openEditorFor($tactic); return $this->openEditorFor($tactic);
} }

Loading…
Cancel
Save