onSave
This commit is contained in:
1 parent
d99512d6e5
commit
7488ecc3ae
4 files changed
+23
-18
No files matched your search
@@ -54,7 +54,7 @@ export const ConditionNodeBase: FC<ConditionNodeBaseProps> = (props) => {
|
||||
childrenConditions = (
|
||||
<Viewer
|
||||
condition={condition}
|
||||
onChange={props.onUpdate}
|
||||
onChange={updateCondition}
|
||||
namer={ha.namer}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
.condition-node--settings {
|
||||
width: 3em;
|
||||
width: 4em;
|
||||
display: flex;
|
||||
gap: 0.5em;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.condition-node--settings--icons {
|
||||
@@ -21,6 +26,10 @@
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.condition-node--settings .speed-dial, .condition-node--settings .speed-dial--icon {
|
||||
min-height: 2.5em;
|
||||
height: 2.5em;
|
||||
}
|
||||
|
||||
.condition-node--settings .speed-dial--button {
|
||||
max-width: 4em;
|
||||
|
||||
@@ -24,9 +24,6 @@ export type ConditionNodeViewMode = "edit" | "yaml" | "view";
|
||||
export const ConditionNodeSettings: FC<ConditionNodeSettingsProps> = (
|
||||
props
|
||||
) => {
|
||||
// state
|
||||
const { isMobile } = useWindowSize();
|
||||
|
||||
// alias
|
||||
const showDelete = !props.disableDelete && !!props.onDelete;
|
||||
const createModeSwitch = (m: ConditionNodeViewMode) => () => {
|
||||
@@ -48,12 +45,6 @@ export const ConditionNodeSettings: FC<ConditionNodeSettingsProps> = (
|
||||
onClick: createModeSwitch("yaml"),
|
||||
color: "info",
|
||||
},
|
||||
{
|
||||
color: "success",
|
||||
icon: <SaveIcon />,
|
||||
disabled: !props.isEdited,
|
||||
onClick: props.onSave,
|
||||
},
|
||||
];
|
||||
if (showDelete) {
|
||||
buttons.push({
|
||||
@@ -66,23 +57,27 @@ export const ConditionNodeSettings: FC<ConditionNodeSettingsProps> = (
|
||||
return (
|
||||
<div
|
||||
className={[
|
||||
"condition-node--settings mobile",
|
||||
"condition-node--settings",
|
||||
props.isEdited ? "edited" : "",
|
||||
].join(" ")}
|
||||
>
|
||||
<SpeedDial
|
||||
icon={
|
||||
<ButtonIcon
|
||||
icon={<SettingsApplicationsIcon />}
|
||||
color={props.isEdited ? "success" : "default"}
|
||||
/>
|
||||
}
|
||||
icon={<ButtonIcon icon={<SettingsApplicationsIcon />} />}
|
||||
direction="left"
|
||||
>
|
||||
{buttons.map((opt, i) => (
|
||||
<ButtonIcon key={i} {...opt} />
|
||||
))}
|
||||
</SpeedDial>
|
||||
{props.isEdited && (
|
||||
<ButtonIcon
|
||||
key={"save"}
|
||||
icon={<SaveIcon />}
|
||||
color="success"
|
||||
disabled={!props.isEdited}
|
||||
onClick={props.onSave}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -133,6 +133,7 @@ export const NodeEditor: FC<NodeEditorProps> = ({
|
||||
</Button>
|
||||
<Button
|
||||
className="node-editor--footer--save"
|
||||
disabled={!isModified}
|
||||
onClick={() =>
|
||||
areYouSureNotReady("save").then((ok) => ok && onSave(state.data))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user