mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-04-19 14:08:45 -04:00
* first phase, basic sharding * improved API for sharding using a "thumbnailKey" * clean up param handling for custom_uri * added version manager with migrations for the thumbnail directory * remove redundant hash of a hash, silly * fix mobile * fix clippy --------- Co-authored-by: Utku Bakir <74243531+utkubakir@users.noreply.github.com>
24 lines
702 B
TypeScript
24 lines
702 B
TypeScript
import { useMemo } from 'react';
|
|
import { ExplorerItem } from '@sd/client';
|
|
import { getExplorerItemData } from '~/app/$libraryId/Explorer/util';
|
|
import { flattenThumbnailKey, useExplorerStore } from './useExplorerStore';
|
|
|
|
export function useExplorerItemData(explorerItem: ExplorerItem) {
|
|
const explorerStore = useExplorerStore();
|
|
|
|
const newThumbnail = !!(
|
|
explorerItem.thumbnail_key &&
|
|
explorerStore.newThumbnails.has(flattenThumbnailKey(explorerItem.thumbnail_key))
|
|
);
|
|
|
|
return useMemo(() => {
|
|
const itemData = getExplorerItemData(explorerItem);
|
|
|
|
if (!itemData.hasLocalThumbnail) {
|
|
itemData.hasLocalThumbnail = newThumbnail;
|
|
}
|
|
|
|
return itemData;
|
|
}, [explorerItem, newThumbnail]);
|
|
}
|