@yogiswara/honcho-editor-ui 3.8.1 → 3.8.2
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.
|
@@ -12,14 +12,6 @@ export interface PhotoData {
|
|
|
12
12
|
isSelected: boolean;
|
|
13
13
|
adjustments?: Partial<AdjustmentValues>;
|
|
14
14
|
}
|
|
15
|
-
export interface GalleryDataProps {
|
|
16
|
-
photos: any[];
|
|
17
|
-
isLoading: boolean;
|
|
18
|
-
isLoadingMore: boolean;
|
|
19
|
-
hasMore: boolean;
|
|
20
|
-
loadMore: () => void;
|
|
21
|
-
reloadGallery: () => void;
|
|
22
|
-
}
|
|
23
15
|
export interface CopyCheckboxes {
|
|
24
16
|
color: {
|
|
25
17
|
temperature: boolean;
|
|
@@ -163,4 +155,4 @@ export interface UseHonchoEditorBulkReturn {
|
|
|
163
155
|
* - Automatic backend synchronization for all state changes
|
|
164
156
|
* - Comprehensive logging of multi-image operations
|
|
165
157
|
*/
|
|
166
|
-
export declare function useHonchoEditorBulk(controller: Controller, eventID: string, firebaseUid: string
|
|
158
|
+
export declare function useHonchoEditorBulk(controller: Controller, eventID: string, firebaseUid: string): UseHonchoEditorBulkReturn;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useState, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
3
3
|
import { useAdjustmentHistoryBatch } from '../useAdjustmentHistoryBatch';
|
|
4
|
+
import { usePaging } from "../usePaging";
|
|
4
5
|
import { usePreset } from "../usePreset";
|
|
5
6
|
import { mapAdjustmentStateToAdjustmentEditor } from "../../utils/adjustment";
|
|
6
7
|
import { log } from '../../utils/logger';
|
|
@@ -141,16 +142,13 @@ const getCurrentAdjustmentsForCopy = (selectedIds, currentBatch) => {
|
|
|
141
142
|
* - Automatic backend synchronization for all state changes
|
|
142
143
|
* - Comprehensive logging of multi-image operations
|
|
143
144
|
*/
|
|
144
|
-
export function useHonchoEditorBulk(controller, eventID, firebaseUid
|
|
145
|
+
export function useHonchoEditorBulk(controller, eventID, firebaseUid) {
|
|
145
146
|
const { state, actions: batchActions } = useAdjustmentHistoryBatch(controller, firebaseUid, eventID);
|
|
146
147
|
const { currentBatch, selectedIds } = state;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
const images = useMemo(() => {
|
|
152
|
-
return galleryHookData.photos.map(p => p.value || p);
|
|
153
|
-
}, [galleryHookData.photos]);
|
|
148
|
+
const { images, info, actions } = usePaging(controller, firebaseUid, eventID, {
|
|
149
|
+
autoLoad: true,
|
|
150
|
+
autoReset: false, // Prevent auto-reset to avoid loops
|
|
151
|
+
});
|
|
154
152
|
// Preset management
|
|
155
153
|
const { presets, info: presetInfo, actions: presetActions } = usePreset(controller, firebaseUid, {
|
|
156
154
|
autoLoad: true,
|
|
@@ -180,12 +178,12 @@ export function useHonchoEditorBulk(controller, eventID, firebaseUid, galleryHoo
|
|
|
180
178
|
};
|
|
181
179
|
const readyState = useMemo(() => {
|
|
182
180
|
const paging = {
|
|
183
|
-
isReady: !
|
|
184
|
-
isLoading:
|
|
181
|
+
isReady: info.isReady ?? (info.isInitialized && !info.isLoading && info.error === null),
|
|
182
|
+
isLoading: info.isLoading,
|
|
185
183
|
};
|
|
186
184
|
log.debug("[useHonchoEditorBulk] 📊 Paging state");
|
|
187
185
|
const history = {
|
|
188
|
-
isReady: state.isReady ?? true,
|
|
186
|
+
isReady: state.isReady ?? true, // History sync happens on-demand, not blocking
|
|
189
187
|
isLoading: state.isLoading ?? false
|
|
190
188
|
};
|
|
191
189
|
log.debug("[useHonchoEditorBulk] 📊 History state");
|
|
@@ -193,15 +191,26 @@ export function useHonchoEditorBulk(controller, eventID, firebaseUid, galleryHoo
|
|
|
193
191
|
isReady: presetInfo.isReady ?? (presetInfo.isInitialized && !presetInfo.isLoading),
|
|
194
192
|
isLoading: presetInfo.isLoading
|
|
195
193
|
};
|
|
194
|
+
log.debug("[useHonchoEditorBulk] 📊 Preset state");
|
|
196
195
|
const allReady = paging.isReady && history.isReady && presets.isReady;
|
|
197
196
|
const anyLoading = paging.isLoading || history.isLoading || presets.isLoading;
|
|
197
|
+
log.debug({
|
|
198
|
+
paging: { isReady: paging.isReady, isLoading: paging.isLoading },
|
|
199
|
+
history: { isReady: history.isReady, isLoading: history.isLoading },
|
|
200
|
+
presets: { isReady: presets.isReady, isLoading: presets.isLoading },
|
|
201
|
+
allReady,
|
|
202
|
+
anyLoading
|
|
203
|
+
}, '[useHonchoEditorBulk] 📊 Ready state computed');
|
|
198
204
|
return {
|
|
199
205
|
isReady: allReady,
|
|
200
206
|
isLoading: anyLoading,
|
|
201
207
|
operations: { paging, history, presets }
|
|
202
208
|
};
|
|
203
209
|
}, [
|
|
204
|
-
|
|
210
|
+
info.isReady,
|
|
211
|
+
info.isInitialized,
|
|
212
|
+
info.isLoading,
|
|
213
|
+
info.error,
|
|
205
214
|
state.isReady,
|
|
206
215
|
state.isLoading,
|
|
207
216
|
presetInfo.isReady,
|
|
@@ -287,9 +296,9 @@ export function useHonchoEditorBulk(controller, eventID, firebaseUid, galleryHoo
|
|
|
287
296
|
}, '[useHonchoEditorBulk] 🎨 Preset selection updated');
|
|
288
297
|
}, [activePreset]);
|
|
289
298
|
// Use loading states from usePaging instead of local state
|
|
290
|
-
const isLoading =
|
|
291
|
-
const error =
|
|
292
|
-
const hasMore =
|
|
299
|
+
const isLoading = info.isLoading;
|
|
300
|
+
const error = info.error;
|
|
301
|
+
const hasMore = info.hasMore;
|
|
293
302
|
const imageData = useMemo(() => {
|
|
294
303
|
const res = images.map(item => {
|
|
295
304
|
const basePhoto = mapGalleryToPhotoData(item, selectedIds);
|
|
@@ -527,7 +536,7 @@ export function useHonchoEditorBulk(controller, eventID, firebaseUid, galleryHoo
|
|
|
527
536
|
return {
|
|
528
537
|
imageData,
|
|
529
538
|
isLoading,
|
|
530
|
-
isLoadingMore:
|
|
539
|
+
isLoadingMore: info.isLoadingMore,
|
|
531
540
|
error,
|
|
532
541
|
selectedIds,
|
|
533
542
|
hasMore,
|
|
@@ -545,8 +554,8 @@ export function useHonchoEditorBulk(controller, eventID, firebaseUid, galleryHoo
|
|
|
545
554
|
// Preset creation handlers
|
|
546
555
|
presetActions, // Expose preset actions for create/rename/delete
|
|
547
556
|
handleToggleImageSelection: batchActions.toggleSelection,
|
|
548
|
-
handleLoadMore:
|
|
549
|
-
handleRefresh:
|
|
557
|
+
handleLoadMore: actions.loadMore,
|
|
558
|
+
handleRefresh: actions.refresh,
|
|
550
559
|
// Adjustment
|
|
551
560
|
handleBulkTempDecreaseMax,
|
|
552
561
|
handleBulkTempDecrease,
|