Add Phantoms #95

Merged
maxime.batista merged 7 commits from editor/phantoms into master 1 year ago

This pull request adds phantoms to the Editor

example : image

This pull request adds phantoms to the Editor example : ![image](/attachments/91cd6dfc-40ca-465a-bb8d-b91d0c713977)
maxime.batista added 6 commits 1 year ago
maxime.batista requested review from clement.freville2 1 year ago
maxime.batista requested review from yanis.dahmane-bounoua 1 year ago
maxime.batista requested review from vivien.dufour 1 year ago
maxime.batista requested review from mael.daim 1 year ago
maxime.batista requested review from samuel.berion 1 year ago
maxime.batista force-pushed editor/phantoms from 1328fa50c6 to 9a6103e78a 1 year ago
maxime.batista changed title from Add Phantoms to WIP: Add Phantoms 1 year ago
maxime.batista changed title from WIP: Add Phantoms to Add Phantoms 1 year ago
clement.freville2 requested changes 1 year ago
if (areInSamePath(origin, target)) return false
if (alreadyHasAnAnteriorActionWith(origin, target, components)) {
console.log("e")
maxime.batista marked this conversation as resolved
}
const originIdx = originOriginPath.indexOf(origin.id)
for (let i = 0; i <= originIdx; i++) {
-    for (let i = 0; i <= originIdx; i++) {
+    for (let i = 0; i < originIdx; i++) {
```diff - for (let i = 0; i <= originIdx; i++) { + for (let i = 0; i < originIdx; i++) { ```
return {
...content,
components: content.components.toSpliced(componentIdx, 1),
-    const componentIdx = content.components.findIndex(
-        (c) => c.id == componentId,
-    )
-
-    return {
-        ...content,
-        components: content.components.toSpliced(componentIdx, 1),
+    return {
+        components: content.components.filter((c) => c.id != componentId),
```diff - const componentIdx = content.components.findIndex( - (c) => c.id == componentId, - ) - - return { - ...content, - components: content.components.toSpliced(componentIdx, 1), + return { + components: content.components.filter((c) => c.id != componentId), ```
maxime.batista marked this conversation as resolved
return {
...content,
components: content.components.toSpliced(componentIdx, 1, component),
}
-    const componentIdx = content.components.findIndex(
-        (c) => c.id == component.id,
-    )
     return {
-        ...content,
-        components: content.components.toSpliced(componentIdx, 1, component),
+        components: content.components.map((c) =>
+            c.id === component.id ? component : c,
+        ),
     }
```diff - const componentIdx = content.components.findIndex( - (c) => c.id == component.id, - ) return { - ...content, - components: content.components.toSpliced(componentIdx, 1, component), + components: content.components.map((c) => + c.id === component.id ? component : c, + ), } ```
maxime.batista marked this conversation as resolved
import { Component, ComponentId } from "./Tactic"
export type PlayerId = string

Might be better adding a type PlayerLike = Player | PlayerPhantom union since it is often used.

Might be better adding a `type PlayerLike = Player | PlayerPhantom` union since it is often used.
maxime.batista marked this conversation as resolved
}))
}}
onHeadPicked={(headPos) => {
;(document.activeElement as HTMLElement).blur()
-                ;(document.activeElement as HTMLElement).blur() 
+                (document.activeElement as HTMLElement).blur() 
```diff - ;(document.activeElement as HTMLElement).blur() + (document.activeElement as HTMLElement).blur() ```
maxime.batista marked this conversation as resolved
maxime.batista added 1 commit 1 year ago
continuous-integration/drone/push Build is passing Details
1b435d4469
apply suggestions
maxime.batista merged commit 00da8d7f54 into master 1 year ago
maxime.batista deleted branch editor/phantoms 1 year ago

Reviewers

vivien.dufour was requested for review 1 year ago
mael.daim was requested for review 1 year ago
yanis.dahmane-bounoua was requested for review 1 year ago
samuel.berion was requested for review 1 year ago
clement.freville2 requested changes 1 year ago
continuous-integration/drone/push Build is passing
The pull request has been merged as 00da8d7f54.
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: IQBall/Application-Web#95
Loading…
There is no content yet.