refactor: Update ActionsGroup component to improve readability and maintainability

master
Tudor Stanciu 2024-07-13 18:38:26 +03:00
parent e2f724dd97
commit b695cd6014
1 changed files with 17 additions and 16 deletions

View File

@ -27,25 +27,26 @@ const ActionsGroup = ({ machine, actions, addLog }) => {
return ( return (
<> <>
<WakeComponent machine={machine} addLog={addLog} disabled={!canOperateMachines} /> <div style={{ display: "flex", flexDirection: "row", justifyContent: "flex-end" }}>
{mainActions.map(action => ( <WakeComponent machine={machine} addLog={addLog} disabled={!canOperateMachines} />
{mainActions.map(action => (
<ActionButton
key={`machine-item-${machine.machineId}-${action.code}`}
action={action}
machine={machine}
disabled={!canOperateMachines}
/>
))}
<ActionButton <ActionButton
key={`machine-item-${machine.machineId}-${action.code}`} action={{
action={action} code: "more",
effect: handleMenuOpen,
icon: MoreHoriz,
tooltip: t("Machine.Actions.More")
}}
machine={machine} machine={machine}
disabled={!canOperateMachines}
/> />
))} </div>
<ActionButton
action={{
code: "more",
effect: handleMenuOpen,
icon: MoreHoriz,
tooltip: t("Machine.Actions.More")
}}
machine={machine}
/>
<Menu <Menu
id="secondary-actions-menu" id="secondary-actions-menu"
anchorEl={menuAnchor} anchorEl={menuAnchor}