Implemtation in progress, UIX working , replacing in ContainerOperations.ts working but not properly need fix
This commit is contained in:
parent
62abd3ff03
commit
e789300090
9 changed files with 139 additions and 98 deletions
|
@ -16,6 +16,7 @@ import { AddContainers } from './AddContainer';
|
|||
import { DeleteContainer } from './ContainerOperations';
|
||||
import { DeleteSymbol } from './SymbolOperations';
|
||||
import { Text } from '../../Text/Text';
|
||||
import { IReplaceContainer } from '../../../Interfaces/IReplaceContainer';
|
||||
|
||||
export function InitActions(
|
||||
menuActions: Map<string, IMenuAction[]>,
|
||||
|
@ -23,7 +24,8 @@ export function InitActions(
|
|||
history: IHistoryState[],
|
||||
historyCurrentStep: number,
|
||||
setNewHistory: (newHistory: IHistoryState[]) => void,
|
||||
setHistoryCurrentStep: Dispatch<SetStateAction<number>>
|
||||
setHistoryCurrentStep: Dispatch<SetStateAction<number>>,
|
||||
setIsReplacingContainer: Dispatch<SetStateAction<IReplaceContainer>>
|
||||
): void {
|
||||
menuActions.set(
|
||||
'',
|
||||
|
@ -60,8 +62,14 @@ export function InitActions(
|
|||
title: Text({ textId: '@ReplaceByContainerTitle' }),
|
||||
shortcut: '<kbd>R</kbd>',
|
||||
action: (target: HTMLElement) => {
|
||||
const id = target.id;
|
||||
console.log('replace');
|
||||
const targetContainer = FindContainerById(history[historyCurrentStep].containers, target.id);
|
||||
const targetAvailableContainer = configuration.AvailableContainers.find((availableContainer) => availableContainer.Type === targetContainer?.properties.type);
|
||||
|
||||
if (targetAvailableContainer === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
setIsReplacingContainer({ isReplacing: true, id: target.id, category: targetAvailableContainer.Category });
|
||||
}
|
||||
}, {
|
||||
text: Text({ textId: '@DeleteContainer' }),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue