-
+
+
+
+
-
- overlaps(
- courtBounds(),
- div.getBoundingClientRect(),
- ),
- [courtBounds],
- )}
- onElementDetached={useCallback(
- (r, e: RackedCourtObject) =>
- setContent((content) =>
- placeObjectAt(
- r.getBoundingClientRect(),
+
+ overlaps(
courtBounds(),
- e,
- content,
+ div.getBoundingClientRect(),
),
- ),
- [courtBounds, setContent],
- )}
- render={renderCourtObject}
- />
+ [courtBounds],
+ )}
+ onElementDetached={useCallback(
+ (r, e: RackedCourtObject) =>
+ setContent((content) =>
+ placeObjectAt(
+ r.getBoundingClientRect(),
+ courtBounds(),
+ e,
+ content,
+ ),
+ ),
+ [courtBounds, setContent],
+ )}
+ render={renderCourtObject}
+ />
-
-
-
-
+
+
+ }
+ courtRef={courtRef}
+ previewAction={previewAction}
+ renderComponent={renderComponent}
+ renderActions={renderActions}
+ />
+
+
+
)
}
+interface EditorStepsTreeProps {
+ isVisible: boolean
+ root: StepInfoNode
+}
+
+function EditorStepsTree({isVisible, root}: EditorStepsTreeProps) {
+ const fakeRoot: StepInfoNode = {
+ id: 0,
+ children: [
+ {
+ id: 1,
+ children: [
+ {
+ id: 2,
+ children: []
+ },
+ {
+ id: 3,
+ children: [{
+ id: 4,
+ children: []
+ }]
+ }
+ ]
+ },
+ {
+ id: 5,
+ children: [
+ {
+ id: 6,
+ children: []
+ },
+ {
+ id: 7,
+ children: []
+ }
+ ]
+ },
+ {
+ id: 8,
+ children: [
+ {
+ id: 9,
+ children: [
+ {
+ id: 10,
+ children: []
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ return (
+
+
+
+ )
+}
+
interface PlayerRackProps {
id: string
objects: RackedPlayer[]
@@ -607,12 +695,12 @@ interface PlayerRackProps {
}
function PlayerRack({
- id,
- objects,
- setObjects,
- courtRef,
- setComponents,
-}: PlayerRackProps) {
+ id,
+ objects,
+ setObjects,
+ courtRef,
+ setComponents,
+ }: PlayerRackProps) {
const courtBounds = useCallback(
() => courtRef.current!.getBoundingClientRect(),
[courtRef],
@@ -640,7 +728,7 @@ function PlayerRack({
[courtBounds, setComponents],
)}
render={useCallback(
- ({ team, key }: { team: PlayerTeam; key: string }) => (
+ ({team, key}: { team: PlayerTeam; key: string }) => (
) => void
+ content: StepContent
+ setContent: (state: SetStateAction) => void
setPreviewAction: (state: SetStateAction) => void
courtRef: RefObject
}
function CourtPlayerArrowAction({
- playerInfo,
- player,
- isInvalid,
-
- content,
- setContent,
- setPreviewAction,
- courtRef,
-}: CourtPlayerArrowActionProps) {
+ playerInfo,
+ player,
+ isInvalid,
+
+ content,
+ setContent,
+ setPreviewAction,
+ courtRef,
+ }: CourtPlayerArrowActionProps) {
const courtBounds = useCallback(
() => courtRef.current!.getBoundingClientRect(),
[courtRef],
@@ -729,7 +817,7 @@ function CourtPlayerArrowAction({
}
setContent((content) => {
- let { createdAction, newContent } = createAction(
+ let {createdAction, newContent} = createAction(
player,
courtBounds(),
headRect,
@@ -768,7 +856,7 @@ function CourtPlayerArrowAction({
)
}
-function isBallOnCourt(content: TacticContent) {
+function isBallOnCourt(content: StepContent) {
return (
content.components.findIndex(
(c) =>
@@ -782,18 +870,18 @@ function isBallOnCourt(content: TacticContent) {
function renderCourtObject(courtObject: RackedCourtObject) {
if (courtObject.key == "ball") {
- return
+ return
}
throw new Error("unknown racked court object " + courtObject.key)
}
-function Court({ courtType }: { courtType: string }) {
+function Court({courtType}: { courtType: string }) {
return (
{courtType == "PLAIN" ? (
-
+
) : (
-
+
)}
)
diff --git a/src/style/editor.css b/src/style/editor.css
index b6a8ea4..8f506b2 100644
--- a/src/style/editor.css
+++ b/src/style/editor.css
@@ -26,13 +26,13 @@
width: 100%;
display: flex;
background-color: var(--main-color);
- margin-bottom: 3px;
justify-content: space-between;
align-items: stretch;
}
#racks {
+ margin: 3px 6px 0 6px;
display: flex;
justify-content: space-between;
align-items: center;
@@ -44,8 +44,28 @@
align-self: center;
}
-#edit-div {
+#editor-div {
+ display: flex;
+ flex-direction: row;
+}
+
+#content-div,
+#editor-div {
height: 100%;
+ width: 100%;
+}
+
+#content-div {
+ width: 100%;
+}
+
+#steps-div {
+ background-color: var(--editor-tree-background);
+ overflow: hidden;
+ width: 20%;
+
+ transform: translateX(100%);
+ transition: transform 500ms;
}
#allies-rack,
diff --git a/src/style/steps-tree.css b/src/style/steps-tree.css
new file mode 100644
index 0000000..28e3f4f
--- /dev/null
+++ b/src/style/steps-tree.css
@@ -0,0 +1,48 @@
+.step-piece {
+ font-family: monospace;
+ pointer-events: all;
+
+ background-color: var(--editor-tree-step-piece);
+ color: var(--selected-team-secondarycolor);
+
+ border-radius: 100px;
+
+ width: 20px;
+ height: 20px;
+
+ display: flex;
+
+ align-items: center;
+ justify-content: center;
+
+ user-select: none;
+}
+
+.step-children {
+ margin-top: 10vh;
+ display: flex;
+ flex-direction: row;
+ width: 100%;
+ height: 100%;
+}
+
+.step-group {
+ position: relative;
+
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+
+ width: 100%;
+ height: 100%;
+}
+
+.steps-tree {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ padding-top: 10%;
+
+ height: 100%;
+}
\ No newline at end of file
diff --git a/src/style/theme/default.css b/src/style/theme/default.css
index caa5162..62bf848 100644
--- a/src/style/theme/default.css
+++ b/src/style/theme/default.css
@@ -29,4 +29,6 @@
--main-contrast-color: #e6edf3;
--font-title: Helvetica;
--font-content: Helvetica;
+ --editor-tree-background: #503636;
+ --editor-tree-step-piece: #0bd9d9;
}