@yogiswara/honcho-editor-ui 2.1.4 → 2.1.5
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.
|
@@ -44,6 +44,13 @@ export interface EditorConfig {
|
|
|
44
44
|
transformation_adjustment: TransformationAdjustment[];
|
|
45
45
|
watermarks: Watermark[];
|
|
46
46
|
}
|
|
47
|
+
export interface Content {
|
|
48
|
+
key: string;
|
|
49
|
+
path: string;
|
|
50
|
+
size: number;
|
|
51
|
+
width: number;
|
|
52
|
+
height: number;
|
|
53
|
+
}
|
|
47
54
|
export interface GallerySetup {
|
|
48
55
|
src: string;
|
|
49
56
|
original: string;
|
|
@@ -3,15 +3,19 @@ import { useState, useCallback, useEffect, useMemo } from 'react';
|
|
|
3
3
|
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
|
-
const mapGalleryToPhotoData = (gallery) =>
|
|
7
|
-
key: gallery.id,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
const mapGalleryToPhotoData = (gallery) => {
|
|
7
|
+
const bestAvailableImage = gallery.thumbnail || gallery.download || { path: '', width: 1, height: 1, key: gallery.id, size: 0 };
|
|
8
|
+
return {
|
|
9
|
+
key: gallery.id,
|
|
10
|
+
src: bestAvailableImage.path,
|
|
11
|
+
original: gallery.download?.path || bestAvailableImage.path,
|
|
12
|
+
width: bestAvailableImage.width || 1,
|
|
13
|
+
height: bestAvailableImage.height || 1,
|
|
14
|
+
alt: gallery.id || 'gallery image',
|
|
15
|
+
isSelected: false,
|
|
16
|
+
originalData: gallery,
|
|
17
|
+
};
|
|
18
|
+
};
|
|
15
19
|
const initialAdjustments = {
|
|
16
20
|
tempScore: 0, tintScore: 0, vibranceScore: 0, exposureScore: 0, highlightsScore: 0, shadowsScore: 0,
|
|
17
21
|
whitesScore: 0, blacksScore: 0, saturationScore: 0, contrastScore: 0, clarityScore: 0, sharpnessScore: 0,
|
|
@@ -52,17 +56,11 @@ export function useHonchoEditorBulk(controllerBulk, eventID, firebaseUid) {
|
|
|
52
56
|
const lastSelectedId = selectedImageIds.length > 0 ? selectedImageIds[selectedImageIds.length - 1] : eventID;
|
|
53
57
|
controllerBulk.handleBack(firebaseUid, lastSelectedId);
|
|
54
58
|
}, [controllerBulk, firebaseUid, selectedImageIds, eventID]);
|
|
55
|
-
const handleSelectedMode = useCallback(() =>
|
|
56
|
-
setIsSelectedMode(true);
|
|
57
|
-
}, []);
|
|
59
|
+
const handleSelectedMode = useCallback(() => setIsSelectedMode(true), []);
|
|
58
60
|
const handleToggleSelect = useCallback((photoToToggle) => () => {
|
|
59
|
-
setImageCollection(
|
|
60
|
-
|
|
61
|
-
: photo));
|
|
62
|
-
// Automatically enter selection mode on first selection
|
|
63
|
-
if (!isSelectedMode) {
|
|
61
|
+
setImageCollection(current => current.map(p => p.key === photoToToggle.key ? { ...p, isSelected: !p.isSelected } : p));
|
|
62
|
+
if (!isSelectedMode)
|
|
64
63
|
setIsSelectedMode(true);
|
|
65
|
-
}
|
|
66
64
|
}, [isSelectedMode]);
|
|
67
65
|
const handlePreview = useCallback((photo) => () => {
|
|
68
66
|
console.log("Previewing image:", photo.key);
|