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 = (
|
childrenConditions = (
|
||||||
<Viewer
|
<Viewer
|
||||||
condition={condition}
|
condition={condition}
|
||||||
onChange={props.onUpdate}
|
onChange={updateCondition}
|
||||||
namer={ha.namer}
|
namer={ha.namer}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
.condition-node--settings {
|
.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 {
|
.condition-node--settings--icons {
|
||||||
@@ -21,6 +26,10 @@
|
|||||||
cursor: not-allowed;
|
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 {
|
.condition-node--settings .speed-dial--button {
|
||||||
max-width: 4em;
|
max-width: 4em;
|
||||||
|
|||||||
@@ -24,9 +24,6 @@ export type ConditionNodeViewMode = "edit" | "yaml" | "view";
|
|||||||
export const ConditionNodeSettings: FC<ConditionNodeSettingsProps> = (
|
export const ConditionNodeSettings: FC<ConditionNodeSettingsProps> = (
|
||||||
props
|
props
|
||||||
) => {
|
) => {
|
||||||
// state
|
|
||||||
const { isMobile } = useWindowSize();
|
|
||||||
|
|
||||||
// alias
|
// alias
|
||||||
const showDelete = !props.disableDelete && !!props.onDelete;
|
const showDelete = !props.disableDelete && !!props.onDelete;
|
||||||
const createModeSwitch = (m: ConditionNodeViewMode) => () => {
|
const createModeSwitch = (m: ConditionNodeViewMode) => () => {
|
||||||
@@ -48,12 +45,6 @@ export const ConditionNodeSettings: FC<ConditionNodeSettingsProps> = (
|
|||||||
onClick: createModeSwitch("yaml"),
|
onClick: createModeSwitch("yaml"),
|
||||||
color: "info",
|
color: "info",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
color: "success",
|
|
||||||
icon: <SaveIcon />,
|
|
||||||
disabled: !props.isEdited,
|
|
||||||
onClick: props.onSave,
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
if (showDelete) {
|
if (showDelete) {
|
||||||
buttons.push({
|
buttons.push({
|
||||||
@@ -66,23 +57,27 @@ export const ConditionNodeSettings: FC<ConditionNodeSettingsProps> = (
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={[
|
className={[
|
||||||
"condition-node--settings mobile",
|
"condition-node--settings",
|
||||||
props.isEdited ? "edited" : "",
|
props.isEdited ? "edited" : "",
|
||||||
].join(" ")}
|
].join(" ")}
|
||||||
>
|
>
|
||||||
<SpeedDial
|
<SpeedDial
|
||||||
icon={
|
icon={<ButtonIcon icon={<SettingsApplicationsIcon />} />}
|
||||||
<ButtonIcon
|
|
||||||
icon={<SettingsApplicationsIcon />}
|
|
||||||
color={props.isEdited ? "success" : "default"}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
direction="left"
|
direction="left"
|
||||||
>
|
>
|
||||||
{buttons.map((opt, i) => (
|
{buttons.map((opt, i) => (
|
||||||
<ButtonIcon key={i} {...opt} />
|
<ButtonIcon key={i} {...opt} />
|
||||||
))}
|
))}
|
||||||
</SpeedDial>
|
</SpeedDial>
|
||||||
|
{props.isEdited && (
|
||||||
|
<ButtonIcon
|
||||||
|
key={"save"}
|
||||||
|
icon={<SaveIcon />}
|
||||||
|
color="success"
|
||||||
|
disabled={!props.isEdited}
|
||||||
|
onClick={props.onSave}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -133,6 +133,7 @@ export const NodeEditor: FC<NodeEditorProps> = ({
|
|||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
className="node-editor--footer--save"
|
className="node-editor--footer--save"
|
||||||
|
disabled={!isModified}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
areYouSureNotReady("save").then((ok) => ok && onSave(state.data))
|
areYouSureNotReady("save").then((ok) => ok && onSave(state.data))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user