mirror of
https://github.com/immich-app/immich.git
synced 2026-05-27 18:12:31 -04:00
feat: improve asset-viewer next/prev perf and standardize preloading behavior (#24422)
Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
@@ -557,6 +557,14 @@ export const delay = async (ms: number) => {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
};
|
||||
|
||||
export const getNextAsset = (assets: AssetResponseDto[], currentAsset: AssetResponseDto | undefined) => {
|
||||
return currentAsset && assets[assets.indexOf(currentAsset) + 1];
|
||||
};
|
||||
|
||||
export const getPreviousAsset = (assets: AssetResponseDto[], currentAsset: AssetResponseDto | undefined) => {
|
||||
return currentAsset && assets[assets.indexOf(currentAsset) - 1];
|
||||
};
|
||||
|
||||
export const canCopyImageToClipboard = (): boolean => {
|
||||
return !!(navigator.clipboard && globalThis.ClipboardItem);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user