@yogiswara/honcho-editor-ui 2.3.1 → 2.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,7 @@ interface Props {
5
5
  modalTitle: string;
6
6
  modalInformation: string;
7
7
  children: React.ReactNode;
8
+ action?: React.ReactNode;
8
9
  modalClose: () => void;
9
10
  onConfirm: () => void;
10
11
  }
@@ -3,5 +3,5 @@ import { Modal, Box, Typography, Button, Stack, IconButton, CardMedia } from "@m
3
3
  import useColors from '../../themes/colors';
4
4
  export default function HModalMobile(props) {
5
5
  const colors = useColors();
6
- return (_jsx(_Fragment, { children: _jsx(Modal, { open: props.modalOpen, onClose: props.modalClose, children: _jsxs(Stack, { direction: "column", spacing: 2, height: "100%", sx: { p: "10px", backgroundColor: colors.surface }, children: [_jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [_jsxs(Stack, { direction: "row", justifyContent: "flex-start", alignItems: "center", spacing: 1, children: [_jsx(IconButton, { "aria-label": "close", onClick: props.modalClose, children: _jsx(CardMedia, { component: "img", image: "/v1/svg/exit-button-modal-mobile.svg" }) }), _jsx(Typography, { variant: "h6", color: "initial", children: props.modalTitle })] }), _jsx(Button, { onClick: props.onConfirm, children: "Save" })] }), _jsx(Typography, { variant: "inherit", color: "initial", children: props.modalInformation }), _jsx(Box, { sx: { mt: 2 }, children: props.children })] }) }) }));
6
+ return (_jsx(_Fragment, { children: _jsx(Modal, { open: props.modalOpen, onClose: props.modalClose, children: _jsxs(Stack, { direction: "column", spacing: 2, height: "100%", sx: { p: "10px", backgroundColor: colors.surface }, children: [_jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [_jsxs(Stack, { direction: "row", justifyContent: "flex-start", alignItems: "center", spacing: 1, children: [_jsx(IconButton, { "aria-label": "close", onClick: props.modalClose, children: _jsx(CardMedia, { component: "img", image: "/v1/svg/exit-button-modal-mobile.svg" }) }), _jsx(Typography, { variant: "h6", color: "initial", children: props.modalTitle })] }), _jsx(Button, { onClick: props.onConfirm, children: "Save" })] }), _jsx(Typography, { variant: "inherit", color: "initial", children: props.modalInformation }), _jsx(Box, { sx: { mt: 2 }, children: props.children }), _jsx(Box, { children: props.action })] }) }) }));
7
7
  }
@@ -131,13 +131,33 @@ export function usePreset(controller, firebaseUid, options = {}) {
131
131
  // Fire the create request but don't wait for preset data in response
132
132
  await controllerRef.current.createPreset(firebaseUidRef.current, name, settings);
133
133
  debugLog('Preset creation request completed');
134
+ const newPreset = {
135
+ id: `temp-${Date.now()}`, // Use a temporary ID
136
+ name: name,
137
+ is_default: false,
138
+ temperature: settings.tempScore,
139
+ tint: settings.tintScore,
140
+ saturation: settings.saturationScore,
141
+ vibrance: settings.vibranceScore,
142
+ exposure: settings.exposureScore,
143
+ contrast: settings.contrastScore,
144
+ highlights: settings.highlightsScore,
145
+ shadows: settings.shadowsScore,
146
+ whites: settings.whitesScore,
147
+ blacks: settings.blacksScore,
148
+ clarity: settings.clarityScore,
149
+ sharpness: settings.sharpnessScore,
150
+ };
151
+ // Add the new preset to the local state immediately
152
+ setPresets(prev => [...prev, newPreset]);
134
153
  // Fire and forget: Schedule a delayed refresh to get updated preset list
135
- setTimeout(() => {
136
- debugLog('Refreshing presets after create (fire and forget)');
137
- loadInBackground();
138
- }, 500); // 500ms delay to allow backend processing
154
+ // setTimeout(() => {
155
+ // debugLog('Refreshing presets after create (fire and forget)');
156
+ // loadInBackground();
157
+ // }, 500); // 500ms delay to allow backend processing
139
158
  // Return a minimal success indicator since we don't have the actual preset data
140
- return { id: 'pending', name, is_default: false };
159
+ // return { id: 'pending', name, is_default: false } as Preset;
160
+ return newPreset;
141
161
  }
142
162
  catch (err) {
143
163
  handleError('create preset', err);
@@ -146,7 +166,8 @@ export function usePreset(controller, firebaseUid, options = {}) {
146
166
  finally {
147
167
  setIsLoading(false);
148
168
  }
149
- }, [presets, debugLog, handleError, loadInBackground]);
169
+ // loadInBackground
170
+ }, [presets, debugLog, handleError]);
150
171
  // Rename an existing preset
151
172
  const rename = useCallback(async (presetId, newName) => {
152
173
  if (!controllerRef.current || !firebaseUidRef.current) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yogiswara/honcho-editor-ui",
3
- "version": "2.3.1",
3
+ "version": "2.3.3",
4
4
  "description": "A complete UI component library for the Honcho photo editor.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",