Cleanup debug code
parent
4828645c6d
commit
dfe045bdda
|
@ -30,7 +30,7 @@ export const unselectPlant = (dispatch: Function) => () => {
|
|||
|
||||
/** Unselect plant and close plant info or select panel if selected and open. */
|
||||
export const closePlantInfo = (dispatch: Function) => () => {
|
||||
const mode = getMode("closePlantInfo");
|
||||
const mode = getMode();
|
||||
if (mode == Mode.editPlant || mode == Mode.boxSelect) {
|
||||
unselectPlant(dispatch)();
|
||||
history.push("/app/designer/plants");
|
||||
|
|
|
@ -45,7 +45,7 @@ export const resizeBox = (props: {
|
|||
props.setMapState({ selectionBox: newSelectionBox });
|
||||
// Select all plants within the updated selection box
|
||||
const payload = getSelected(props.plants, newSelectionBox);
|
||||
if (payload && getMode("resizeBox") === Mode.none) {
|
||||
if (payload && getMode() === Mode.none) {
|
||||
history.push("/app/designer/plants/select");
|
||||
}
|
||||
props.dispatch({ type: Actions.SELECT_PLANT, payload });
|
||||
|
|
|
@ -56,7 +56,7 @@ export class GardenMap extends
|
|||
get xySwap() { return this.mapTransformProps.xySwap; }
|
||||
|
||||
/** Currently editing a plant? */
|
||||
get isEditing(): boolean { return getMode("isEditing") === Mode.editPlant; }
|
||||
get isEditing(): boolean { return getMode() === Mode.editPlant; }
|
||||
|
||||
/** Display plant animations? */
|
||||
get animate(): boolean {
|
||||
|
@ -93,7 +93,7 @@ export class GardenMap extends
|
|||
|
||||
/** Map drag start actions. */
|
||||
startDrag = (e: React.MouseEvent<SVGElement>): void => {
|
||||
switch (getMode("startDrag")) {
|
||||
switch (getMode()) {
|
||||
case Mode.editPlant:
|
||||
beginPlantDrag({
|
||||
plant: this.getPlant(),
|
||||
|
@ -123,7 +123,7 @@ export class GardenMap extends
|
|||
|
||||
/** Return the selected plant, mode-allowing. */
|
||||
getPlant = (): TaggedPlant | undefined => {
|
||||
switch (getMode("getPlant")) {
|
||||
switch (getMode()) {
|
||||
case Mode.boxSelect:
|
||||
case Mode.moveTo:
|
||||
case Mode.createPoint:
|
||||
|
@ -134,7 +134,7 @@ export class GardenMap extends
|
|||
}
|
||||
|
||||
handleDragOver = (e: React.DragEvent<HTMLElement>) => {
|
||||
switch (getMode("handleDragOver")) {
|
||||
switch (getMode()) {
|
||||
case Mode.addPlant:
|
||||
case Mode.clickToAdd:
|
||||
e.preventDefault(); // Allows dragged-in plants to be placed in the map
|
||||
|
@ -143,7 +143,7 @@ export class GardenMap extends
|
|||
}
|
||||
|
||||
handleDragEnter = (e: React.DragEvent<HTMLElement>) => {
|
||||
switch (getMode("handleDragEnter")) {
|
||||
switch (getMode()) {
|
||||
case Mode.addPlant:
|
||||
e.preventDefault();
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ export class GardenMap extends
|
|||
};
|
||||
|
||||
click = (e: React.MouseEvent<SVGElement>) => {
|
||||
switch (getMode("click")) {
|
||||
switch (getMode()) {
|
||||
case Mode.clickToAdd:
|
||||
// Create a new plant in the map
|
||||
this.handleDrop(e);
|
||||
|
@ -179,7 +179,7 @@ export class GardenMap extends
|
|||
|
||||
/** Map drag actions. */
|
||||
drag = (e: React.MouseEvent<SVGElement>) => {
|
||||
switch (getMode("drag")) {
|
||||
switch (getMode()) {
|
||||
case Mode.editPlant:
|
||||
dragPlant({
|
||||
getPlant: this.getPlant,
|
||||
|
@ -217,7 +217,7 @@ export class GardenMap extends
|
|||
|
||||
/** Return to garden (unless selecting more plants). */
|
||||
closePanel = () => {
|
||||
switch (getMode("closePanel")) {
|
||||
switch (getMode()) {
|
||||
case Mode.boxSelect:
|
||||
return this.props.designer.selectedPlants
|
||||
? () => { }
|
||||
|
|
|
@ -141,6 +141,5 @@ export enum Mode {
|
|||
addPlant = "addPlant",
|
||||
moveTo = "moveTo",
|
||||
createPoint = "createPoint",
|
||||
templateView = "templateView",
|
||||
addPointToGroup = "addPointToGroup"
|
||||
templateView = "templateView"
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ export const getPanelStatus = (): MapPanelStatus => {
|
|||
if (history.getCurrentLocation().pathname === "/app/designer") {
|
||||
return MapPanelStatus.closed;
|
||||
}
|
||||
const mode = getMode("getPanelStatus");
|
||||
const mode = getMode();
|
||||
if (window.innerWidth <= 450 &&
|
||||
(mode === Mode.moveTo || mode === Mode.clickToAdd)) {
|
||||
return MapPanelStatus.short;
|
||||
|
@ -286,8 +286,7 @@ export const transformForQuadrant =
|
|||
};
|
||||
|
||||
/** Determine the current map mode based on path. */
|
||||
export const getMode = (_why = "test"): Mode => {
|
||||
// console.log(why);
|
||||
export const getMode = (): Mode => {
|
||||
const pathArray = getPathArray();
|
||||
if (pathArray) {
|
||||
if ((pathArray[3] === "groups") && pathArray[4]) {
|
||||
|
@ -334,7 +333,7 @@ export const getGardenCoordinates = (props: {
|
|||
|
||||
export const maybeNoPointer =
|
||||
(defaultStyle: React.CSSProperties): React.SVGProps<SVGGElement>["style"] => {
|
||||
switch (getMode("maybeNoPointer")) {
|
||||
switch (getMode()) {
|
||||
case Mode.boxSelect:
|
||||
case Mode.clickToAdd:
|
||||
case Mode.moveTo:
|
||||
|
|
|
@ -152,17 +152,18 @@ export class GroupDetail extends React.Component<GroupDetailProps, State> {
|
|||
}
|
||||
|
||||
hasGroup = (group: TaggedPointGroup) => {
|
||||
const isSaved = group.specialStatus === SpecialStatus.SAVED;
|
||||
return <DesignerPanel panelName={"groups"} panelColor={"blue"}>
|
||||
<DesignerPanelHeader
|
||||
panelName={Panel.Groups}
|
||||
panelColor={"blue"}
|
||||
title={t("Edit Group")}
|
||||
backTo={"/app/designer/groups"}>
|
||||
backTo={isSaved ? "/app/designer/groups" : undefined}>
|
||||
<a
|
||||
className="right-button"
|
||||
title={t("Save Changes to Group")}
|
||||
onClick={this.saveGroup}>
|
||||
{t("Save")}{group.specialStatus === SpecialStatus.SAVED ? "" : "*"}
|
||||
{t("Save")}{isSaved ? "" : "*"}
|
||||
</a>
|
||||
</DesignerPanelHeader>
|
||||
<DesignerPanelContent
|
||||
|
|
Loading…
Reference in New Issue