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 BallSvg from "../../assets/icon/ball.svg?react"
import { Ball } from "../../tactic/CourtObjects" import { Ball } from "../../tactic/CourtObjects"
export interface CourtBallProps {
onMoved: (rect: DOMRect) => void
onRemove: () => void
ball: Ball
}
export function BallPiece() { export function BallPiece() {
return <BallSvg className={"ball"} /> return <BallSvg className={"ball"} />
} }

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

@ -1,6 +1,13 @@
import React, { useRef } from "react" import React, { useRef } from "react"
import Draggable from "react-draggable" 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) { export function CourtBall({ onMoved, ball, onRemove }: CourtBallProps) {
const pieceRef = useRef<HTMLDivElement>(null) 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 * A player that is placed on the court, which can be selected, and moved in the associated bounds
* */ * */
export default function CourtPlayer({ export default function CourtPlayer({
player, player,
onChange, onChange,
onRemove, onRemove,
onBallDrop, onBallDrop,
parentRef, parentRef,
}: PlayerProps) { }: PlayerProps) {
const pieceRef = useRef<HTMLDivElement>(null) const pieceRef = useRef<HTMLDivElement>(null)
const ballPiece = useRef<HTMLDivElement>(null) const ballPiece = useRef<HTMLDivElement>(null)

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

@ -45,21 +45,20 @@
height: 100%; height: 100%;
} }
#allies-rack { #allies-rack,
#opponent-rack {
width: 125px; width: 125px;
min-width: 125px; min-width: 125px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: flex-end; align-items: flex-end;
}
#allies-rack {
justify-content: flex-start; justify-content: flex-start;
} }
#opponent-rack { #opponent-rack {
width: 125px;
min-width: 125px;
display: flex;
flex-direction: row;
align-items: flex-end;
justify-content: flex-end; justify-content: flex-end;
} }

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

@ -64,7 +64,7 @@ class AuthModel {
public function login(string $email, string $password, array &$failures): ?Account { public function login(string $email, string $password, array &$failures): ?Account {
$hash = $this->gateway->getHash($email); $hash = $this->gateway->getHash($email);
if ($hash == null or (!password_verify($password, $hash))) { 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 null;
} }
return $this->gateway->getAccountFromMail($email); return $this->gateway->getAccountFromMail($email);

Loading…
Cancel
Save