parent
e22cb91ba2
commit
0bf4461008
@ -0,0 +1,22 @@
|
||||
#main {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background-color: var(--background-color);
|
||||
}
|
||||
|
||||
#topbar {
|
||||
display: flex;
|
||||
background-color: var(--main-color);
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.h1 {
|
||||
text-align: center;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.id {
|
||||
width: 1000px;
|
||||
height: 1000px;
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
import React, { CSSProperties, useState } from "react";
|
||||
import "../style/visualizer.css";
|
||||
import Court from "../assets/basketball_court.svg";
|
||||
|
||||
export default function Visualizer({ id, name }: { id: number; name: string }) {
|
||||
const [style, setStyle] = useState<CSSProperties>({});
|
||||
|
||||
return (
|
||||
<div id="main">
|
||||
<div id="topbar">
|
||||
<h1>{name}</h1>
|
||||
</div>
|
||||
<img id="court" src={Court} style={style} alt="Basketball Court" />
|
||||
</div>
|
||||
);
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Data\TacticInfo;
|
||||
use App\Http\HttpCodes;
|
||||
use App\Http\HttpResponse;
|
||||
use App\Http\JsonHttpResponse;
|
||||
use App\Http\ViewHttpResponse;
|
||||
use App\Model\TacticModel;
|
||||
|
||||
class VisualizerController {
|
||||
private TacticModel $tacticModel;
|
||||
|
||||
/**
|
||||
* @param TacticModel $tacticModel
|
||||
*/
|
||||
public function __construct(TacticModel $tacticModel)
|
||||
{
|
||||
$this->tacticModel = $tacticModel;
|
||||
}
|
||||
|
||||
public function openVisualizer(int $id): HttpResponse {
|
||||
$tactic = $this->tacticModel->get($id);
|
||||
|
||||
if ($tactic == null) {
|
||||
return new JsonHttpResponse("la tactique " . $id . " n'existe pas", HttpCodes::NOT_FOUND);
|
||||
}
|
||||
|
||||
return ViewHttpResponse::react("views/Visualizer.tsx", ["name" => $tactic->getName()]);
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue