@yogiswara/honcho-editor-ui 2.0.6 → 2.0.7
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,7 +5,7 @@ export interface ControllerBulk {
|
|
|
5
5
|
onGetImage(firebaseUid: string, imageID: string): Promise<Gallery>;
|
|
6
6
|
getImageList(firebaseUid: string, eventID: string, page: number): Promise<ResponseGalleryPaging>;
|
|
7
7
|
syncConfig(firebaseUid: string): Promise<void>;
|
|
8
|
-
handleBack(firebaseUid: string,
|
|
8
|
+
handleBack(firebaseUid: string, lastImageID: string): void;
|
|
9
9
|
getPresets(firebaseUid: string): Promise<Preset[]>;
|
|
10
10
|
createPreset(firebaseUid: string, name: string, settings: AdjustmentState): Promise<Preset>;
|
|
11
11
|
deletePreset(firebaseUid: string, presetId: string): Promise<void>;
|
|
@@ -21,10 +21,23 @@ export function useHonchoEditorBulk(controllerBulk, eventID, firebaseUid) {
|
|
|
21
21
|
const [adjustmentsMap, setAdjustmentsMap] = useState(new Map());
|
|
22
22
|
const [selectedBulkPreset, setSelectedBulkPreset] = useState('preset1');
|
|
23
23
|
const handleBackCallbackBulk = useCallback(() => {
|
|
24
|
-
|
|
24
|
+
// 1. Convert the Set of selected IDs into an array to get the last item.
|
|
25
|
+
const selectedIdsArray = Array.from(selectedImageIds);
|
|
26
|
+
// 2. Determine which ID to send back.
|
|
27
|
+
// - If any images are selected, get the ID of the LAST one in the array.
|
|
28
|
+
// - If no images are selected, fall back to using the eventID.
|
|
29
|
+
const idToSendBack = selectedIdsArray.length > 0
|
|
30
|
+
? selectedIdsArray[selectedIdsArray.length - 1]
|
|
31
|
+
: eventID;
|
|
32
|
+
// 3. Check if we have an ID to send, otherwise log a warning.
|
|
33
|
+
if (!idToSendBack) {
|
|
34
|
+
console.warn("handleBack called, but no selected image ID or eventID was available.");
|
|
35
|
+
window.history.back();
|
|
25
36
|
return;
|
|
26
|
-
|
|
27
|
-
|
|
37
|
+
}
|
|
38
|
+
// 4. Call the controller with the chosen ID (either the last imageId or the eventId).
|
|
39
|
+
controllerBulk.handleBack(firebaseUid, idToSendBack);
|
|
40
|
+
}, [controllerBulk, firebaseUid, selectedImageIds, eventID]);
|
|
28
41
|
const handleFileChangeBulk = (event) => {
|
|
29
42
|
const files = event.target?.files;
|
|
30
43
|
if (!files || files.length <= 1) {
|