import * as React from "react";
import { Play, Bug, StepForward, RotateCcw, Square, ChevronUp, ChevronDown, LayoutGrid } from "lucide-react";
import { CodeBlockContainer, INIT_CODEBLOCKS, CodeBlock, INSERT_CODEBLOCK, REMOVE_CODEBLOCK, SET_DROPZONE_Z_INDEX } from "../store/codeBlocks/types";
import { LevelInitializer, IPlayerData } from "../game/levels";
import { initCodeBlocks, insertCodeBlock, removeCodeBlock } from "../store/codeBlocks/actions";
import { AppState } from "../store";
import game from "../game/game"
import { connect } from "react-redux";
import { Link } from "react-router-dom";
import { START_EXECUTING, STEP_EXECUTION, TOGGLE_AUTOSTEP, TOGGLE_SPEED } from "../store/executionState/types";
const CodeBlockComponent = ({ type, blockIdx, remove, container, setDropZoneZIdx }) => {
return (
e.preventDefault()}
onDragStart={(e) => {
// e.preventDefault()
for (let e of document.getElementsByClassName("opdropzone")) {
(e as HTMLElement).style.background = ""
}
// console.log("BOOM START DRAGGOING");
(e.target as HTMLElement).style.zIndex = "3"
setDropZoneZIdx(2)
dragged = type
}}
onDragEnd={(e) => {
e.preventDefault()
for (let e of document.getElementsByClassName("opdropzone")) {
(e as HTMLElement).style.background = ""
}
(e.target as HTMLElement).style.zIndex = ""
setDropZoneZIdx(-1)
remove(container, blockIdx)
// console.log("LE END OF DRAG")
}}
>
)
}
// show how many operations are possible
const OpIndicators = ({ n }) => {
let ops = []
for (let i = 0; i < n; i++) {
ops.push()
}
return (
{ops}
)
}
// dropzones which determine how to insert
const OpDropZones = ({ n, cidx, insert, style }) => {
let dropZones = []
for (let i = 0; i < n; i++) {
dropZones.push(
{
e.preventDefault();
(e.target as HTMLElement).style.background = "purple"
}}
onDragLeave={(e) => {
e.preventDefault();
(e.target as HTMLElement).style.background = ""
}}
onDragOver={(e) => { e.preventDefault() }}
onDrop={(e) => {
e.preventDefault()
let dragOver = ((e.target as HTMLElement).className);
// console.log(dragOver)
// console.log("DRAGGED", dragged)
insert({ name: dragged }, cidx, i, true)
}}>
{
(e.target as HTMLElement).style.background = "purple"
}}
onDragOver={e => { e.preventDefault() }}
onDragLeave={e => {
(e.target as HTMLElement).style.background = ""
}}
onDrop={e => {
(e.target as HTMLElement).style.background = ""
insert({ name: dragged }, cidx, i, false)
}}>