add save button

This commit is contained in:
cristhianzl 2024-02-09 12:21:24 -03:00
commit 75ae908922

View file

@ -203,7 +203,7 @@ export default function NodeToolbarComponent({
<> <>
<div className="w-26 h-10"> <div className="w-26 h-10">
<span className="isolate inline-flex rounded-md shadow-sm"> <span className="isolate inline-flex rounded-md shadow-sm">
{hasCode && ( {hasCode ? (
<ShadTooltip content="Code" side="top"> <ShadTooltip content="Code" side="top">
<button <button
className="relative inline-flex items-center rounded-l-md bg-background px-2 py-2 text-foreground shadow-md ring-1 ring-inset ring-ring transition-all duration-500 ease-in-out hover:bg-muted focus:z-10" className="relative inline-flex items-center rounded-l-md bg-background px-2 py-2 text-foreground shadow-md ring-1 ring-inset ring-ring transition-all duration-500 ease-in-out hover:bg-muted focus:z-10"
@ -232,13 +232,28 @@ export default function NodeToolbarComponent({
<IconComponent name="Code2" className="h-4 w-4" /> <IconComponent name="Code2" className="h-4 w-4" />
</button> </button>
</ShadTooltip> </ShadTooltip>
) : (
<ShadTooltip content="Save" side="top">
<button
className={classNames(
"relative -ml-px inline-flex items-center bg-background px-2 py-2 text-foreground shadow-md ring-1 ring-inset ring-ring transition-all duration-500 ease-in-out hover:bg-muted focus:z-10",
hasCode ? "" : "rounded-l-md"
)}
onClick={() => {
isSaved
? setShowOverrideModal(true)
: saveComponent(cloneDeep(data), false);
}}
>
<IconComponent name="SaveAll" className=" h-4 w-4" />
</button>
</ShadTooltip>
)} )}
<ShadTooltip content="Duplicate" side="top"> <ShadTooltip content="Duplicate" side="top">
<button <button
className={classNames( className={classNames(
"relative -ml-px inline-flex items-center bg-background px-2 py-2 text-foreground shadow-md ring-1 ring-inset ring-ring transition-all duration-500 ease-in-out hover:bg-muted focus:z-10", "relative -ml-px inline-flex items-center bg-background px-2 py-2 text-foreground shadow-md ring-1 ring-inset ring-ring transition-all duration-500 ease-in-out hover:bg-muted focus:z-10"
hasCode ? "" : "rounded-l-md"
)} )}
onClick={(event) => { onClick={(event) => {
event.preventDefault(); event.preventDefault();
@ -320,15 +335,17 @@ export default function NodeToolbarComponent({
</div>{" "} </div>{" "}
</SelectItem> </SelectItem>
) : ( ) : (
<SelectItem value={"SaveAll"}> hasCode && (
<div className="flex" data-testid="save-button-modal"> <SelectItem value={"SaveAll"}>
<IconComponent <div className="flex" data-testid="save-button-modal">
name="SaveAll" <IconComponent
className="relative top-0.5 mr-2 h-4 w-4" name="SaveAll"
/>{" "} className="relative top-0.5 mr-2 h-4 w-4"
Save{" "} />{" "}
</div>{" "} Save{" "}
</SelectItem> </div>{" "}
</SelectItem>
)
)} )}
{!hasStore && ( {!hasStore && (
<SelectItem value={"Download"}> <SelectItem value={"Download"}>