mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-14 10:34:06 +02:00
# Description of Changes Move frontend code into `core` folder and add infrastructure for `proprietary` folder to include premium, non-OSS features
31 lines
848 B
TypeScript
31 lines
848 B
TypeScript
import { createContext, useContext } from 'react';
|
|
|
|
import type {
|
|
ToolRegistryEntry,
|
|
ToolRegistry,
|
|
RegularToolRegistry,
|
|
SuperToolRegistry,
|
|
LinkToolRegistry,
|
|
} from '@app/data/toolsTaxonomy';
|
|
import type { ToolId } from '@app/types/toolId';
|
|
|
|
export interface ToolRegistryCatalog {
|
|
regularTools: RegularToolRegistry;
|
|
superTools: SuperToolRegistry;
|
|
linkTools: LinkToolRegistry;
|
|
allTools: ToolRegistry;
|
|
getToolById: (toolId: ToolId | null) => ToolRegistryEntry | null;
|
|
}
|
|
|
|
const ToolRegistryContext = createContext<ToolRegistryCatalog | null>(null);
|
|
|
|
export const useToolRegistry = (): ToolRegistryCatalog => {
|
|
const context = useContext(ToolRegistryContext);
|
|
if (context === null) {
|
|
throw new Error('useToolRegistry must be used within a ToolRegistryProvider');
|
|
}
|
|
return context;
|
|
};
|
|
|
|
export default ToolRegistryContext;
|