mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-05-19 05:45:01 -04:00
- Create core/src/data/ module with SourceManager wrapping sd-archive Engine - Add Sources to GroupType and Source to ItemType enums - Add default Sources group to new library creation - Register source operations: create, list, get, delete, sync, list_items - Register adapter operations: list, config, update - Add bundled adapter sync from workspace adapters/ directory - Add adapter update system with BLAKE3 change detection and backup/rollback - Frontend: Sources home, source detail with virtualized list, adapters screen - Frontend: SourcesGroup sidebar, SpaceGroup dispatch, spaceItemUtils - Frontend: TopBar integration (path bar, search, sync, actions menu) - Frontend: Tab title sync, adapter icon lookup hook - Regenerate TypeScript types Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
24 lines
576 B
TypeScript
24 lines
576 B
TypeScript
import { useLibraryQuery } from "../contexts/SpacedriveContext";
|
|
import { useCallback } from "react";
|
|
|
|
/**
|
|
* Hook that provides adapter icon lookup by adapter ID.
|
|
* Fetches the adapters list once and caches via React Query.
|
|
*/
|
|
export function useAdapterIcons() {
|
|
const { data: adapters } = useLibraryQuery({
|
|
type: "adapters.list",
|
|
input: {},
|
|
});
|
|
|
|
const getIcon = useCallback(
|
|
(adapterId: string): string | null => {
|
|
if (!adapters) return null;
|
|
return adapters.find((a) => a.id === adapterId)?.icon_svg ?? null;
|
|
},
|
|
[adapters],
|
|
);
|
|
|
|
return { getIcon };
|
|
}
|