Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
Fix frontend build problems.
Browse files Browse the repository at this point in the history
  • Loading branch information
horenso committed Mar 10, 2024
1 parent 5221457 commit 426eedd
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@ import { KonvaEventListener, KonvaEventObject, Node } from 'konva/lib/Node';
import { useCallback, useEffect, useRef } from 'react';
import { Layer } from 'react-konva';
import * as uuid from 'uuid';
import { LayerType, PlantingDto, PlantsSummaryDto, SeedDto } from '@/api_types/definitions';
import {
LayerType,
MovePlantActionPayload,
PlantingDto,
PlantsSummaryDto,
SeedDto,
TransformPlantActionPayload,
} from '@/api_types/definitions';
import IconButton from '@/components/Button/IconButton';
import {
KEYBINDINGS_SCOPE_PLANTS_LAYER,
Expand Down
1 change: 0 additions & 1 deletion frontend/src/features/map_planning/layers/plant/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export class CreatePlantAction
return this._ids;
}

// TODO: Sollte hier beim constructor nicht NewPlantingDto verwendet werden?
constructor(private readonly _data: PlantingDto[], public actionId = v4()) {
this._ids = _data.map(({ id }) => id);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { PlantLabel } from '../PlantLabel';
import { usePlanting } from './hooks';
import { placeTooltip } from './utils';

export type PlantingElementProps = {
export type PlantingProps = {
planting: PlantingDto;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export type SinglePlantingAttributeFormProps = EditPlantingAttributesProps & {
planting: PlantingDto;
};

export type EditMultiplePlantingsProps = EditPlantingAttributesProps & {
export type MultiplePlantingsAttributeFormProps = EditPlantingAttributesProps & {
plantings: PlantingDto[];
};

Expand Down
3 changes: 2 additions & 1 deletion frontend/src/features/map_planning/store/MapStoreTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import { FrontendOnlyLayerType } from '@/features/map_planning/layers/_frontend_only';
import { PolygonGeometry } from '@/features/map_planning/types/PolygonTypes';
import { convertToDateString } from '../utils/date-utils';
import { TransformerStore } from './transformer/TransformerStore';

import Vector2d = Konva.Vector2d;

Expand Down Expand Up @@ -171,7 +172,7 @@ export interface UntrackedMapSlice {
) => void;
lastActions: LastAction[];
selectPlantForPlanting: (plant: PlantForPlanting | null) => void;
selectPlantings: (plantings: PlantingDto[] | null) => void;
selectPlantings: (plantings: PlantingDto[] | null, transformerStore?: TransformerStore) => void;
toggleShowPlantLabel: () => void;
baseLayerActivateMeasurement: () => void;
baseLayerDeactivateMeasurement: () => void;
Expand Down
19 changes: 0 additions & 19 deletions frontend/src/features/map_planning/store/TrackedMapStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,6 @@ export const createTrackedMapSlice: StateCreator<
undo: () => undo(set, get),
redo: () => redo(set, get),
__applyRemoteAction: (action: Action<unknown, unknown>) => applyAction(action, set, get),
setSingleNodeInTransformer: (node: Node) => {
get().transformer?.current?.nodes([node]);
},
addNodeToTransformer: (node: Node) => {
const currentNodes = get().transformer.current?.nodes() ?? [];
if (!currentNodes.includes(node)) {
get().transformer?.current?.nodes([...currentNodes, node]);
}
},
removeNodeFromTransformer: (node: Node) => {
const currentNodes = get().transformer.current?.nodes() ?? [];
const nodeToRemove = currentNodes.indexOf(node);

if (nodeToRemove !== -1) {
const newNodes = currentNodes.slice();
newNodes.splice(nodeToRemove, 1);
get().transformer.current?.nodes(newNodes);
}
},
initPlantLayer: (plants: PlantingDto[]) => {
set((state) => ({
...state,
Expand Down

0 comments on commit 426eedd

Please sign in to comment.