@yogiswara/honcho-editor-ui 2.1.6 → 2.1.8

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.
@@ -7,7 +7,7 @@ export interface PhotoData {
7
7
  original: string;
8
8
  width: number;
9
9
  height: number;
10
- alt: string;
10
+ alt?: string;
11
11
  isSelected: boolean;
12
12
  originalData: Gallery;
13
13
  }
@@ -4,15 +4,16 @@ import { useAdjustmentHistory } from '../useAdjustmentHistory';
4
4
  import { useAdjustmentHistoryBatch } from '../useAdjustmentHistoryBatch';
5
5
  // Helper function to map the API response to the format our UI component needs
6
6
  const mapGalleryToPhotoData = (gallery) => {
7
- const bestAvailableImage = gallery.thumbnail || gallery.download || { path: '', width: 1, height: 1, key: gallery.id, size: 0 };
7
+ // Use thumbnail as the primary source, with fallbacks for safety
8
+ const bestImage = gallery.thumbnail || gallery.download || { path: '', width: 1, height: 1, key: gallery.id, size: 0 };
8
9
  return {
9
10
  key: gallery.id,
10
- src: bestAvailableImage.path,
11
- original: gallery.download?.path || bestAvailableImage.path,
12
- width: bestAvailableImage.width || 1,
13
- height: bestAvailableImage.height || 1,
11
+ src: bestImage.path,
12
+ original: gallery.download?.path || bestImage.path,
13
+ width: bestImage.width || 1,
14
+ height: bestImage.height || 1,
14
15
  alt: gallery.id || 'gallery image',
15
- isSelected: false,
16
+ isSelected: false, // Default to not selected
16
17
  originalData: gallery,
17
18
  };
18
19
  };
@@ -162,28 +163,18 @@ export function useHonchoEditorBulk(controllerBulk, eventID, firebaseUid) {
162
163
  setError(null);
163
164
  controllerBulk.getImageList(firebaseUid, eventID, 1)
164
165
  .then(response => {
165
- const images = response.gallery;
166
- // Prepare the initial data for the batch history hook
167
- const imageConfigs = images.map(img => ({
168
- imageId: img.id,
169
- adjustment: img.editor_config?.color_adjustment
170
- ? mapColorAdjustmentToAdjustmentState(img.editor_config.color_adjustment)
171
- : initialAdjustments
172
- }));
173
- // Populate the batch history with all fetched images
174
- batchActions.setSelection(imageConfigs);
175
- // Immediately clear the selection so no images are selected by default
176
- batchActions.clearSelection();
166
+ const mappedData = response.gallery.map(mapGalleryToPhotoData);
167
+ setImageCollection(mappedData);
177
168
  })
178
169
  .catch(err => {
179
- console.error("Failed to fetch gallery:", err);
180
- setError(err.message || "Could not load images.");
170
+ console.error("Failed to fetch image list:", err);
171
+ setError("Could not load images.");
181
172
  })
182
173
  .finally(() => {
183
174
  setIsLoading(false);
184
175
  });
185
176
  }
186
- }, [eventID, firebaseUid, controllerBulk, batchActions]);
177
+ }, [eventID, firebaseUid, controllerBulk]);
187
178
  return {
188
179
  imageCollection,
189
180
  isSelectedMode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yogiswara/honcho-editor-ui",
3
- "version": "2.1.6",
3
+ "version": "2.1.8",
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",