apply modifications
continuous-integration/drone/push Build is passing Details

pull/77/head
Vivien DUFOUR 1 year ago
parent a025844528
commit 0c73aa9418

@ -3,13 +3,6 @@ import "../../style/ball.css"
import BallSvg from "../../assets/icon/ball.svg?react"
import { Ball } from "../../tactic/CourtObjects"
export interface CourtBallProps {
onMoved: (rect: DOMRect) => void
onRemove: () => void
ball: Ball
}
export function BallPiece() {
return <BallSvg className={"ball"} />
}

@ -22,15 +22,15 @@ export interface BasketCourtProps {
}
export function BasketCourt({
players,
objects,
onPlayerRemove,
onBallRemove,
onBallMoved,
onPlayerChange,
courtImage,
courtRef,
}: BasketCourtProps) {
players,
objects,
onPlayerRemove,
onBallRemove,
onBallMoved,
onPlayerChange,
courtImage,
courtRef,
}: BasketCourtProps) {
return (
<div
id="court-container"
@ -65,4 +65,4 @@ export function BasketCourt({
})}
</div>
)
}
}

@ -1,6 +1,13 @@
import React, { useRef } from "react"
import Draggable from "react-draggable"
import { BallPiece, CourtBallProps } from "./BallPiece"
import { BallPiece } from "./BallPiece"
import { Ball } from "../../tactic/CourtObjects"
export interface CourtBallProps {
onMoved: (rect: DOMRect) => void
onRemove: () => void
ball: Ball
}
export function CourtBall({ onMoved, ball, onRemove }: CourtBallProps) {
const pieceRef = useRef<HTMLDivElement>(null)

@ -18,12 +18,12 @@ export interface PlayerProps {
* A player that is placed on the court, which can be selected, and moved in the associated bounds
* */
export default function CourtPlayer({
player,
onChange,
onRemove,
onBallDrop,
parentRef,
}: PlayerProps) {
player,
onChange,
onRemove,
onBallDrop,
parentRef,
}: PlayerProps) {
const pieceRef = useRef<HTMLDivElement>(null)
const ballPiece = useRef<HTMLDivElement>(null)
@ -91,4 +91,4 @@ export default function CourtPlayer({
</div>
</Draggable>
)
}
}

@ -9,8 +9,3 @@
height: 20px;
cursor: pointer;
}
.ball-div:focus-within {
}

@ -45,21 +45,20 @@
height: 100%;
}
#allies-rack {
#allies-rack,
#opponent-rack {
width: 125px;
min-width: 125px;
display: flex;
flex-direction: row;
align-items: flex-end;
}
#allies-rack {
justify-content: flex-start;
}
#opponent-rack {
width: 125px;
min-width: 125px;
display: flex;
flex-direction: row;
align-items: flex-end;
justify-content: flex-end;
}
@ -116,4 +115,4 @@
.save-state-saving,
.save-state-guest {
color: gray;
}
}

@ -14,4 +14,4 @@ export interface Ball {
* Percentage of the player's position to the right (0 means left, 1 means right, 0.5 means middle)
*/
readonly rightRatio: number
}
}

@ -10,4 +10,4 @@ export interface Tactic {
export interface TacticContent {
players: Player[]
objects: CourtObject[]
}
}

@ -13,7 +13,6 @@ import { BasketCourt } from "../components/editor/BasketCourt"
import plainCourt from "../assets/court/full_court.svg"
import halfCourt from "../assets/court/half_court.svg"
import { BallPiece } from "../components/editor/BallPiece"
import { Rack } from "../components/Rack"
@ -30,8 +29,7 @@ import SavingState, {
SaveStates,
} from "../components/editor/SavingState"
import {CourtObject} from "../tactic/CourtObjects";
import { CourtObject } from "../tactic/CourtObjects"
const ERROR_STYLE: CSSProperties = {
borderColor: "red",
@ -64,14 +62,7 @@ interface RackedPlayer {
type RackedCourtObject = { key: "ball" }
export default function Editor({
id,
name,
courtType,
content,
}: EditorProps) {
export default function Editor({ id, name, courtType, content }: EditorProps) {
const isInGuestMode = id == -1
const storage_content = localStorage.getItem(GUEST_MODE_CONTENT_STORAGE_KEY)
@ -116,11 +107,11 @@ export default function Editor({
}
function EditorView({
tactic: { id, name, content: initialContent },
onContentChange,
onNameChange,
courtType,
}: EditorViewProps) {
tactic: { id, name, content: initialContent },
onContentChange,
onNameChange,
courtType,
}: EditorViewProps) {
const isInGuestMode = id == -1
const [titleStyle, setTitleStyle] = useState<CSSProperties>({})
@ -143,7 +134,6 @@ function EditorView({
const courtDivContentRef = useRef<HTMLDivElement>(null)
const isBoundsOnCourt = (bounds: DOMRect) => {
const courtBounds = courtDivContentRef.current!.getBoundingClientRect()
@ -209,12 +199,12 @@ function EditorView({
}
})
return
} else {
courtObject = {
type: "ball",
rightRatio: x,
bottomRatio: y,
}
}
courtObject = {
type: "ball",
rightRatio: x,
bottomRatio: y,
}
break
@ -359,9 +349,7 @@ function EditorView({
<div id="main-div">
<div id="topbar-div">
<div id="topbar-left">
<SavingState state={saveState}/>
<SavingState state={saveState} />
</div>
<div id="title-input-div">
<TitleInput
@ -530,4 +518,4 @@ function toSplicedPlayers(
)
return players.toSpliced(idx, 1, ...(replace ? [player] : []))
}
}

@ -64,7 +64,7 @@ class AuthModel {
public function login(string $email, string $password, array &$failures): ?Account {
$hash = $this->gateway->getHash($email);
if ($hash == null or (!password_verify($password, $hash))) {
$failures[] = new ValidationFail("email","Adresse email ou mot de passe invalide");
$failures[] = new ValidationFail("email", "Adresse email ou mot de passe invalide");
return null;
}
return $this->gateway->getAccountFromMail($email);

Loading…
Cancel
Save