aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/imageEditor/ImageEditorButtons.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2025-01-21 10:16:51 -0500
committerbobzel <zzzman@gmail.com>2025-01-21 10:16:51 -0500
commitcaf384bb374c47118296aa397446e85d3121116b (patch)
treeda270043f88d6cfa0d6b8f1838a55f6faba35bfa /src/client/views/nodes/imageEditor/ImageEditorButtons.tsx
parent22daafa9c505eb9bffb8604be0924a7450d20113 (diff)
parenta6a6929501b7ce9b3ceed73c7e8141a8d8f0c7dc (diff)
Merge branch 'master' into alyssa-agent
Diffstat (limited to 'src/client/views/nodes/imageEditor/ImageEditorButtons.tsx')
-rw-r--r--src/client/views/nodes/imageEditor/ImageEditorButtons.tsx69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/client/views/nodes/imageEditor/ImageEditorButtons.tsx b/src/client/views/nodes/imageEditor/ImageEditorButtons.tsx
new file mode 100644
index 000000000..de2116253
--- /dev/null
+++ b/src/client/views/nodes/imageEditor/ImageEditorButtons.tsx
@@ -0,0 +1,69 @@
+import './GenerativeFillButtons.scss';
+import * as React from 'react';
+import ReactLoading from 'react-loading';
+import { Button, IconButton, Type } from '@dash/components';
+import { AiOutlineInfo } from 'react-icons/ai';
+import { bgColor } from './imageEditorUtils/imageEditorConstants';
+import { ImageEditTool, ImageToolType } from './imageEditorUtils/imageEditorInterfaces';
+import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
+import { SettingsManager } from '../../../util/SettingsManager';
+
+interface ButtonContainerProps {
+ onClick: () => Promise<void>;
+ loading: boolean;
+ onReset: () => void;
+ btnText: string;
+}
+
+export function ApplyFuncButtons({ loading, onClick: getEdit, onReset, btnText }: ButtonContainerProps) {
+ return (
+ <div className="generativeFillBtnContainer">
+ <Button text="RESET" type={Type.PRIM} color={SettingsManager.userVariantColor} onClick={onReset} />
+ {loading ? (
+ <Button
+ text={btnText}
+ type={Type.TERT}
+ color={SettingsManager.userVariantColor}
+ icon={<ReactLoading type="spin" color="#ffffff" width={20} height={20} />}
+ iconPlacement="right"
+ onClick={() => {
+ if (!loading) getEdit();
+ }}
+ />
+ ) : (
+ <Button
+ text={btnText}
+ type={Type.TERT}
+ color={SettingsManager.userVariantColor}
+ onClick={() => {
+ if (!loading) getEdit();
+ }}
+ />
+ )}
+ <IconButton
+ type={Type.SEC}
+ color={SettingsManager.userVariantColor}
+ tooltip="Open Documentation"
+ icon={<AiOutlineInfo size="16px" />}
+ onClick={() => window.open('https://brown-dash.github.io/Dash-Documentation/features/generativeai/#editing', '_blank')}
+ />
+ </div>
+ );
+}
+
+export function ImageToolButton(tool: ImageEditTool, isActive: boolean, selectTool: (type: ImageToolType) => void) {
+ return (
+ <div className="imageEditorButtonContainer">
+ <Button
+ style={{ width: '100%' }}
+ text={tool.name}
+ type={Type.TERT}
+ color={isActive ? SettingsManager.userVariantColor : bgColor}
+ icon={<FontAwesomeIcon icon={tool.icon} />}
+ onClick={() => {
+ selectTool(tool.type);
+ }}
+ />
+ </div>
+ );
+}