feat: add album info and transfer to duplicate finder
Show album badges on each asset in the duplicate finder. When deduplicating, album memberships from discarded assets can be transferred to kept assets with three modes: Always, Ask, or Never. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
a263905ddf
commit
8b394a253a
7 files changed
+327
-15
No files matched your search
@@ -0,0 +1,86 @@
|
||||
import React, { useState } from 'react'
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogDescription,
|
||||
DialogFooter,
|
||||
} from '@/components/ui/dialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Checkbox } from '@/components/ui/checkbox'
|
||||
import { FolderOpen } from 'lucide-react'
|
||||
import { IAssetAlbumInfo } from '@/handlers/api/asset.handler'
|
||||
|
||||
interface AlbumTransferDialogProps {
|
||||
open: boolean
|
||||
onClose: () => void
|
||||
albums: IAssetAlbumInfo[]
|
||||
onSkip: () => void
|
||||
onTransfer: (albumIds: string[]) => void
|
||||
}
|
||||
|
||||
export default function AlbumTransferDialog({
|
||||
open,
|
||||
onClose,
|
||||
albums,
|
||||
onSkip,
|
||||
onTransfer,
|
||||
}: AlbumTransferDialogProps) {
|
||||
const [selectedAlbumIds, setSelectedAlbumIds] = useState<Set<string>>(
|
||||
() => new Set(albums.map((a) => a.albumId))
|
||||
)
|
||||
|
||||
const handleToggle = (albumId: string) => {
|
||||
setSelectedAlbumIds((prev) => {
|
||||
const next = new Set(prev)
|
||||
if (next.has(albumId)) {
|
||||
next.delete(albumId)
|
||||
} else {
|
||||
next.add(albumId)
|
||||
}
|
||||
return next
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={(isOpen) => { if (!isOpen) onClose() }}>
|
||||
<DialogContent className="max-w-md">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Move Album Memberships</DialogTitle>
|
||||
<DialogDescription>
|
||||
Select which albums to transfer to the kept asset before deleting.
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="space-y-2 max-h-60 overflow-y-auto py-2">
|
||||
{albums.map((album) => (
|
||||
<label
|
||||
key={album.albumId}
|
||||
className="flex items-center gap-2 p-2 rounded hover:bg-gray-100 dark:hover:bg-gray-800 cursor-pointer"
|
||||
>
|
||||
<Checkbox
|
||||
checked={selectedAlbumIds.has(album.albumId)}
|
||||
onCheckedChange={() => handleToggle(album.albumId)}
|
||||
/>
|
||||
<FolderOpen size={14} className="text-gray-500" />
|
||||
<span className="text-sm">{album.albumName}</span>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<DialogFooter>
|
||||
<Button variant="outline" onClick={onSkip}>
|
||||
Skip & Delete
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => onTransfer(Array.from(selectedAlbumIds))}
|
||||
disabled={selectedAlbumIds.size === 0}
|
||||
>
|
||||
Transfer & Delete
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
)
|
||||
}
|
||||
@@ -5,9 +5,11 @@ import LazyImage from '@/components/ui/lazy-image'
|
||||
import { Checkbox } from '@/components/ui/checkbox'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { AlertDialog } from '@/components/ui/alert-dialog'
|
||||
import { Badge } from '@/components/ui/badge'
|
||||
import { humanizeBytes, humanizeNumber } from '@/helpers/string.helper'
|
||||
import { formatDate } from '@/helpers/date.helper'
|
||||
import { Camera, Calendar, HardDrive, MapPin, Trash2, Check, X, Shield } from 'lucide-react'
|
||||
import { Camera, Calendar, FolderOpen, HardDrive, MapPin, Trash2, Check, X, Shield } from 'lucide-react'
|
||||
import { IAssetAlbumInfo } from '@/handlers/api/asset.handler'
|
||||
|
||||
interface DuplicateAssetRecordProps {
|
||||
record: IDuplicateAssetRecord
|
||||
@@ -17,6 +19,7 @@ interface DuplicateAssetRecordProps {
|
||||
onKeepSelected: (record: IDuplicateAssetRecord, selectedIds: string[], unselectedIds: string[]) => void
|
||||
onKeepAllInRecord: (record: IDuplicateAssetRecord) => void
|
||||
selectionMode: 'keep' | 'discard'
|
||||
assetAlbums: Record<string, IAssetAlbumInfo[]>
|
||||
}
|
||||
|
||||
interface DuplicateAssetItemProps {
|
||||
@@ -24,9 +27,10 @@ interface DuplicateAssetItemProps {
|
||||
isSelected: boolean
|
||||
onSelect: (assetId: string, isShiftClick?: boolean) => void
|
||||
selectionMode: 'keep' | 'discard'
|
||||
albums: IAssetAlbumInfo[]
|
||||
}
|
||||
|
||||
function DuplicateAssetItem({ asset, isSelected, onSelect, selectionMode }: DuplicateAssetItemProps) {
|
||||
function DuplicateAssetItem({ asset, isSelected, onSelect, selectionMode, albums }: DuplicateAssetItemProps) {
|
||||
const handleCheckboxChange = (event: React.MouseEvent) => {
|
||||
const isShiftClick = event.shiftKey
|
||||
onSelect(asset.id, isShiftClick)
|
||||
@@ -124,6 +128,21 @@ function DuplicateAssetItem({ asset, isSelected, onSelect, selectionMode }: Dupl
|
||||
{asset.exifInfo.make} {asset.exifInfo.model}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{albums.length > 0 && (
|
||||
<div className="flex flex-wrap gap-1 mt-1">
|
||||
{albums.map((album) => (
|
||||
<Badge
|
||||
key={album.albumId}
|
||||
variant="secondary"
|
||||
className="text-[10px] px-1.5 py-0 gap-0.5"
|
||||
>
|
||||
<FolderOpen size={10} />
|
||||
{album.albumName}
|
||||
</Badge>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -137,7 +156,8 @@ export default function DuplicateAssetRecord({
|
||||
onDeleteRecord,
|
||||
onKeepSelected,
|
||||
onKeepAllInRecord,
|
||||
selectionMode
|
||||
selectionMode,
|
||||
assetAlbums
|
||||
}: DuplicateAssetRecordProps) {
|
||||
const recordAssetIds = record.assets.map(asset => asset.id)
|
||||
const selectedInRecord = recordAssetIds.filter(id => selectedAssets.has(id)).length
|
||||
@@ -302,6 +322,7 @@ export default function DuplicateAssetRecord({
|
||||
isSelected={selectedAssets.has(asset.id)}
|
||||
onSelect={onAssetSelect}
|
||||
selectionMode={selectionMode}
|
||||
albums={assetAlbums[asset.id] || []}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React, { useMemo } from 'react'
|
||||
import { VariableSizeList as List } from 'react-window'
|
||||
import { IDuplicateAssetRecord } from '@/types/asset'
|
||||
import { IAssetAlbumInfo } from '@/handlers/api/asset.handler'
|
||||
import DuplicateAssetRecord from './DuplicateAssetRecord'
|
||||
|
||||
interface VirtualizedDuplicateListProps {
|
||||
@@ -12,6 +13,7 @@ interface VirtualizedDuplicateListProps {
|
||||
onKeepAllInRecord: (record: IDuplicateAssetRecord) => void
|
||||
height: number
|
||||
selectionMode: 'keep' | 'discard'
|
||||
assetAlbums: Record<string, IAssetAlbumInfo[]>
|
||||
}
|
||||
|
||||
interface ListItemProps {
|
||||
@@ -25,11 +27,12 @@ interface ListItemProps {
|
||||
onKeepSelected: (record: IDuplicateAssetRecord, selectedIds: string[], unselectedIds: string[]) => void
|
||||
onKeepAllInRecord: (record: IDuplicateAssetRecord) => void
|
||||
selectionMode: 'keep' | 'discard'
|
||||
assetAlbums: Record<string, IAssetAlbumInfo[]>
|
||||
}
|
||||
}
|
||||
|
||||
const ListItem: React.FC<ListItemProps> = ({ index, style, data }) => {
|
||||
const { duplicates, selectedAssets, onAssetSelect, onDeleteRecord, onKeepSelected, onKeepAllInRecord, selectionMode } = data
|
||||
const { duplicates, selectedAssets, onAssetSelect, onDeleteRecord, onKeepSelected, onKeepAllInRecord, selectionMode, assetAlbums } = data
|
||||
const record = duplicates[index]
|
||||
|
||||
return (
|
||||
@@ -43,6 +46,7 @@ const ListItem: React.FC<ListItemProps> = ({ index, style, data }) => {
|
||||
onKeepSelected={onKeepSelected}
|
||||
onKeepAllInRecord={onKeepAllInRecord}
|
||||
selectionMode={selectionMode}
|
||||
assetAlbums={assetAlbums}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -72,7 +76,8 @@ export default function VirtualizedDuplicateList({
|
||||
onKeepSelected,
|
||||
onKeepAllInRecord,
|
||||
height,
|
||||
selectionMode
|
||||
selectionMode,
|
||||
assetAlbums
|
||||
}: VirtualizedDuplicateListProps) {
|
||||
// Custom item size getter for VariableSizeList
|
||||
const getItemHeight = (index: number) => {
|
||||
@@ -88,7 +93,8 @@ export default function VirtualizedDuplicateList({
|
||||
onDeleteRecord,
|
||||
onKeepSelected,
|
||||
onKeepAllInRecord,
|
||||
selectionMode
|
||||
selectionMode,
|
||||
assetAlbums
|
||||
}
|
||||
|
||||
// For better performance with many items, we'll use a custom implementation
|
||||
|
||||
@@ -34,6 +34,7 @@ export const DELETE_ALBUMS_PATH = BASE_API_ENDPOINT + "/albums/delete";
|
||||
export const ADD_ASSETS_TO_ALBUM_PATH = (id: string) => BASE_PROXY_ENDPOINT + "/albums/" + id + "/assets";
|
||||
export const MERGE_ALBUMS_PATH = BASE_API_ENDPOINT + "/albums/merge";
|
||||
// Assets
|
||||
export const ASSET_ALBUMS_BY_ASSETS_PATH = BASE_API_ENDPOINT + "/assets/albums-by-assets";
|
||||
export const LIST_MISSING_LOCATION_DATES_PATH = BASE_API_ENDPOINT + "/assets/missing-location-dates";
|
||||
export const LIST_MISSING_LOCATION_ALBUMS_PATH = BASE_API_ENDPOINT + "/assets/missing-location-albums";
|
||||
export const LIST_MISSING_LOCATION_ASSETS_PATH = BASE_API_ENDPOINT + "/assets/missing-location-assets";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
ASSET_ALBUMS_BY_ASSETS_PATH,
|
||||
ASSET_GEO_HEATMAP_PATH,
|
||||
LIST_EMPTY_VIDEOS_PATH,
|
||||
FIND_ASSETS,
|
||||
@@ -90,4 +91,13 @@ export const listEmptyVideos = async (filters: IEmptyVideosParams) => {
|
||||
|
||||
export const listDuplicates = async () => {
|
||||
return API.get(LIST_DUPLICATES_PATH);
|
||||
}
|
||||
}
|
||||
|
||||
export interface IAssetAlbumInfo {
|
||||
albumId: string;
|
||||
albumName: string;
|
||||
}
|
||||
|
||||
export const getAlbumsByAssetIds = async (assetIds: string[]): Promise<Record<string, IAssetAlbumInfo[]>> => {
|
||||
return API.post(ASSET_ALBUMS_BY_ASSETS_PATH, { assetIds });
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
import { db } from "@/config/db";
|
||||
import { getCurrentUser } from "@/handlers/serverUtils/user.utils";
|
||||
import { albums } from "@/schema/albums.schema";
|
||||
import { albumsAssetsAssets } from "@/schema/albumAssetsAssets.schema";
|
||||
import { eq, inArray, and } from "drizzle-orm";
|
||||
|
||||
export default async function handler(
|
||||
req: NextApiRequest,
|
||||
res: NextApiResponse
|
||||
) {
|
||||
if (req.method !== "POST") {
|
||||
return res.status(405).json({ error: "Method not allowed" });
|
||||
}
|
||||
|
||||
const currentUser = await getCurrentUser(req);
|
||||
if (!currentUser) {
|
||||
return res.status(401).json({ error: "Unauthorized" });
|
||||
}
|
||||
|
||||
const { assetIds } = req.body as { assetIds: string[] };
|
||||
if (!assetIds || assetIds.length === 0) {
|
||||
return res.status(200).json({});
|
||||
}
|
||||
|
||||
const rows = await db
|
||||
.select({
|
||||
assetId: albumsAssetsAssets.assetId,
|
||||
albumId: albums.id,
|
||||
albumName: albums.albumName,
|
||||
})
|
||||
.from(albumsAssetsAssets)
|
||||
.innerJoin(albums, eq(albumsAssetsAssets.albumId, albums.id))
|
||||
.where(
|
||||
and(
|
||||
inArray(albumsAssetsAssets.assetId, assetIds),
|
||||
eq(albums.ownerId, currentUser.id)
|
||||
)
|
||||
);
|
||||
|
||||
const result: Record<string, Array<{ albumId: string; albumName: string }>> = {};
|
||||
for (const row of rows) {
|
||||
if (!result[row.assetId]) {
|
||||
result[row.assetId] = [];
|
||||
}
|
||||
result[row.assetId].push({ albumId: row.albumId, albumName: row.albumName });
|
||||
}
|
||||
|
||||
return res.status(200).json(result);
|
||||
}
|
||||
@@ -1,12 +1,14 @@
|
||||
import { listDuplicates, deleteAssets, updateAssets } from "@/handlers/api/asset.handler";
|
||||
import { listDuplicates, deleteAssets, updateAssets, getAlbumsByAssetIds, IAssetAlbumInfo } from "@/handlers/api/asset.handler";
|
||||
import { addAssetToAlbum } from "@/handlers/api/album.handler";
|
||||
import { IDuplicateAssetRecord } from "@/types/asset";
|
||||
import React, { useCallback, useEffect, useMemo, useState, useRef } from 'react'
|
||||
import PageLayout from '@/components/layouts/PageLayout'
|
||||
import Header from '@/components/shared/Header'
|
||||
import VirtualizedDuplicateList from '@/components/assets/duplicate-assets/VirtualizedDuplicateList'
|
||||
import AlbumTransferDialog from '@/components/assets/duplicate-assets/AlbumTransferDialog'
|
||||
import Loader from '@/components/ui/loader'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { RefreshCw, Search, Shield, Trash2, Zap } from 'lucide-react'
|
||||
import { FolderSync, RefreshCw, Search, Shield, Trash2, Zap } from 'lucide-react'
|
||||
import FloatingBar from '@/components/shared/FloatingBar'
|
||||
import { AlertDialog } from '@/components/ui/alert-dialog'
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
|
||||
@@ -14,6 +16,14 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@
|
||||
import { toast } from '@/components/ui/use-toast'
|
||||
import { humanizeBytes } from '@/helpers/string.helper'
|
||||
|
||||
type AlbumTransferMode = 'always' | 'never' | 'ask';
|
||||
|
||||
interface PendingDedup {
|
||||
keptIds: string[];
|
||||
discardedIds: string[];
|
||||
albumsToTransfer: IAssetAlbumInfo[];
|
||||
}
|
||||
|
||||
export default function BulkDuplicatePage() {
|
||||
const [duplicates, setDuplicates] = useState<IDuplicateAssetRecord[]>([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -23,8 +33,24 @@ export default function BulkDuplicatePage() {
|
||||
const [lastSelectedIndex, setLastSelectedIndex] = useState<number>(-1);
|
||||
const [containerHeight, setContainerHeight] = useState<number>(600);
|
||||
const [selectionMode, setSelectionMode] = useState<'keep' | 'discard'>('keep');
|
||||
const [assetAlbums, setAssetAlbums] = useState<Record<string, IAssetAlbumInfo[]>>({});
|
||||
const [albumTransferMode, setAlbumTransferMode] = useState<AlbumTransferMode>('always');
|
||||
const [pendingDedup, setPendingDedup] = useState<PendingDedup | null>(null);
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
// Load album move mode from localStorage
|
||||
useEffect(() => {
|
||||
const saved = localStorage.getItem('duplicateFinderAlbumTransfer');
|
||||
if (saved === 'always' || saved === 'never' || saved === 'ask') {
|
||||
setAlbumTransferMode(saved);
|
||||
}
|
||||
}, []);
|
||||
|
||||
const handleAlbumTransferModeChange = (mode: AlbumTransferMode) => {
|
||||
setAlbumTransferMode(mode);
|
||||
localStorage.setItem('duplicateFinderAlbumTransfer', mode);
|
||||
};
|
||||
|
||||
const fetchDuplicates = async () => {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
@@ -32,6 +58,15 @@ export default function BulkDuplicatePage() {
|
||||
const duplicates = await listDuplicates();
|
||||
setDuplicates(duplicates);
|
||||
setSelectedAssets(new Set()); // Clear selection when refetching
|
||||
|
||||
// Fetch album data for all assets
|
||||
const allIds = duplicates.flatMap((r: IDuplicateAssetRecord) => r.assets.map(a => a.id));
|
||||
if (allIds.length > 0) {
|
||||
const albums = await getAlbumsByAssetIds(allIds);
|
||||
setAssetAlbums(albums);
|
||||
} else {
|
||||
setAssetAlbums({});
|
||||
}
|
||||
} catch (error: any) {
|
||||
setError(error.message || 'Failed to load duplicate assets');
|
||||
toast({
|
||||
@@ -259,13 +294,39 @@ export default function BulkDuplicatePage() {
|
||||
});
|
||||
};
|
||||
|
||||
// Core dedup execution: mark kept assets as non-duplicate, delete discarded assets
|
||||
// Compute albums that are only on discarded assets (not already on kept assets)
|
||||
const getAlbumsToTransfer = useCallback((keptIds: string[], discardedIds: string[]): IAssetAlbumInfo[] => {
|
||||
const keptAlbumIds = new Set<string>();
|
||||
keptIds.forEach(id => {
|
||||
(assetAlbums[id] || []).forEach(a => keptAlbumIds.add(a.albumId));
|
||||
});
|
||||
|
||||
const seen = new Set<string>();
|
||||
const result: IAssetAlbumInfo[] = [];
|
||||
discardedIds.forEach(id => {
|
||||
(assetAlbums[id] || []).forEach(a => {
|
||||
if (!keptAlbumIds.has(a.albumId) && !seen.has(a.albumId)) {
|
||||
seen.add(a.albumId);
|
||||
result.push(a);
|
||||
}
|
||||
});
|
||||
});
|
||||
return result;
|
||||
}, [assetAlbums]);
|
||||
|
||||
// Core dedup execution: move albums then delete
|
||||
const executeDedup = async (
|
||||
keptIds: string[],
|
||||
discardedIds: string[]
|
||||
discardedIds: string[],
|
||||
albumIdsToTransfer: string[]
|
||||
) => {
|
||||
setIsDeleting(true);
|
||||
try {
|
||||
// Move albums to kept assets
|
||||
await Promise.all(
|
||||
albumIdsToTransfer.map(albumId => addAssetToAlbum(albumId, keptIds))
|
||||
);
|
||||
|
||||
// Mark kept assets as non-duplicate
|
||||
if (keptIds.length > 0) {
|
||||
await updateAssets({ ids: keptIds, duplicateId: null });
|
||||
@@ -297,9 +358,13 @@ export default function BulkDuplicatePage() {
|
||||
});
|
||||
setLastSelectedIndex(-1);
|
||||
|
||||
const transferMsg = albumIdsToTransfer.length > 0
|
||||
? ` Moved ${albumIdsToTransfer.length} album(s).`
|
||||
: '';
|
||||
|
||||
toast({
|
||||
title: "Success",
|
||||
description: `Kept ${keptIds.length} asset(s), deleted ${discardedIds.length}.${discardedSize > 0 ? ` Saved ${humanizeBytes(discardedSize)}.` : ''}`,
|
||||
description: `Kept ${keptIds.length} asset(s), deleted ${discardedIds.length}.${transferMsg}${discardedSize > 0 ? ` Saved ${humanizeBytes(discardedSize)}.` : ''}`,
|
||||
});
|
||||
} catch (error: any) {
|
||||
toast({
|
||||
@@ -312,6 +377,26 @@ export default function BulkDuplicatePage() {
|
||||
}
|
||||
};
|
||||
|
||||
// Core dedup execution wrapped in useCallback to avoid stale closures
|
||||
const executeDedupCb = useCallback(executeDedup, []);
|
||||
|
||||
// Initiate dedup with album move logic
|
||||
const initiateDedup = useCallback((
|
||||
keptIds: string[],
|
||||
discardedIds: string[]
|
||||
) => {
|
||||
const albumsToTransfer = getAlbumsToTransfer(keptIds, discardedIds);
|
||||
|
||||
if (albumsToTransfer.length === 0 || albumTransferMode === 'never') {
|
||||
executeDedupCb(keptIds, discardedIds, []);
|
||||
} else if (albumTransferMode === 'always') {
|
||||
executeDedupCb(keptIds, discardedIds, albumsToTransfer.map(a => a.albumId));
|
||||
} else {
|
||||
// 'ask' mode
|
||||
setPendingDedup({ keptIds, discardedIds, albumsToTransfer });
|
||||
}
|
||||
}, [albumTransferMode, getAlbumsToTransfer, executeDedupCb]);
|
||||
|
||||
const handleDeleteAllSelected = async () => {
|
||||
if (selectedAssets.size === 0 || selectionMode !== 'discard') return;
|
||||
|
||||
@@ -327,11 +412,11 @@ export default function BulkDuplicatePage() {
|
||||
});
|
||||
});
|
||||
|
||||
executeDedup(keptIds, selectedAssetIds);
|
||||
initiateDedup(keptIds, selectedAssetIds);
|
||||
};
|
||||
|
||||
const handleKeepSelected = async (_record: IDuplicateAssetRecord, keptIds: string[], discardedIds: string[]) => {
|
||||
executeDedup(keptIds, discardedIds);
|
||||
initiateDedup(keptIds, discardedIds);
|
||||
};
|
||||
|
||||
|
||||
@@ -377,7 +462,41 @@ export default function BulkDuplicatePage() {
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{/* Album Move Mode Button Group */}
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
<FolderSync size={14} className="inline mr-1" />
|
||||
Move Albums:
|
||||
</span>
|
||||
<div className="flex rounded-lg border border-gray-300 dark:border-gray-600 overflow-hidden">
|
||||
<Button
|
||||
variant={albumTransferMode === 'always' ? 'default' : 'ghost'}
|
||||
size="sm"
|
||||
onClick={() => handleAlbumTransferModeChange('always')}
|
||||
className="rounded-none border-0"
|
||||
>
|
||||
Always
|
||||
</Button>
|
||||
<Button
|
||||
variant={albumTransferMode === 'ask' ? 'default' : 'ghost'}
|
||||
size="sm"
|
||||
onClick={() => handleAlbumTransferModeChange('ask')}
|
||||
className="rounded-none border-0"
|
||||
>
|
||||
Ask
|
||||
</Button>
|
||||
<Button
|
||||
variant={albumTransferMode === 'never' ? 'default' : 'ghost'}
|
||||
size="sm"
|
||||
onClick={() => handleAlbumTransferModeChange('never')}
|
||||
className="rounded-none border-0"
|
||||
>
|
||||
Never
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Refresh Button */}
|
||||
<Button
|
||||
onClick={fetchDuplicates}
|
||||
@@ -452,6 +571,7 @@ export default function BulkDuplicatePage() {
|
||||
onKeepAllInRecord={handleKeepAllInRecord}
|
||||
height={containerHeight}
|
||||
selectionMode={selectionMode}
|
||||
assetAlbums={assetAlbums}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
@@ -536,6 +656,24 @@ export default function BulkDuplicatePage() {
|
||||
</div>
|
||||
</FloatingBar>
|
||||
)}
|
||||
|
||||
{pendingDedup && (
|
||||
<AlbumTransferDialog
|
||||
open={true}
|
||||
onClose={() => setPendingDedup(null)}
|
||||
albums={pendingDedup.albumsToTransfer}
|
||||
onSkip={() => {
|
||||
const { keptIds, discardedIds } = pendingDedup;
|
||||
setPendingDedup(null);
|
||||
executeDedup(keptIds, discardedIds, []);
|
||||
}}
|
||||
onTransfer={(albumIds) => {
|
||||
const { keptIds, discardedIds } = pendingDedup;
|
||||
setPendingDedup(null);
|
||||
executeDedup(keptIds, discardedIds, albumIds);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</PageLayout>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user