Initial commit: ArchiTools modular dashboard platform
Complete Next.js 16 application with 13 fully implemented modules: Email Signature, Word XML Generator, Registratura, Dashboard, Tag Manager, IT Inventory, Address Book, Password Vault, Mini Utilities, Prompt Generator, Digital Signatures, Word Templates, and AI Chat. Includes core platform systems (module registry, feature flags, storage abstraction, i18n, theming, auth stub, tagging), 16 technical documentation files, Docker deployment config, and legacy HTML tool reference. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
9
src/core/module-registry/index.ts
Normal file
9
src/core/module-registry/index.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export type { ModuleConfig, ModuleCategory, Visibility } from './types';
|
||||
export { MODULE_CATEGORY_LABELS } from './types';
|
||||
export {
|
||||
registerModules,
|
||||
getAllModules,
|
||||
getModuleById,
|
||||
getModuleByRoute,
|
||||
getModulesByCategory,
|
||||
} from './registry';
|
||||
45
src/core/module-registry/registry.ts
Normal file
45
src/core/module-registry/registry.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import type { ModuleConfig, ModuleCategory } from './types';
|
||||
|
||||
let registeredModules: ModuleConfig[] = [];
|
||||
let moduleMap: Map<string, ModuleConfig> = new Map();
|
||||
|
||||
export function registerModules(configs: ModuleConfig[]): void {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
validateRegistry(configs);
|
||||
}
|
||||
registeredModules = [...configs].sort((a, b) => {
|
||||
if (a.category !== b.category) return a.category.localeCompare(b.category);
|
||||
return a.navOrder - b.navOrder;
|
||||
});
|
||||
moduleMap = new Map(registeredModules.map((c) => [c.id, c]));
|
||||
}
|
||||
|
||||
export function getAllModules(): ModuleConfig[] {
|
||||
return registeredModules;
|
||||
}
|
||||
|
||||
export function getModuleById(id: string): ModuleConfig | undefined {
|
||||
return moduleMap.get(id);
|
||||
}
|
||||
|
||||
export function getModuleByRoute(route: string): ModuleConfig | undefined {
|
||||
return registeredModules.find((m) => m.route === route);
|
||||
}
|
||||
|
||||
export function getModulesByCategory(category: ModuleCategory): ModuleConfig[] {
|
||||
return registeredModules.filter((m) => m.category === category);
|
||||
}
|
||||
|
||||
function validateRegistry(configs: ModuleConfig[]): void {
|
||||
const ids = configs.map((m) => m.id);
|
||||
const duplicateIds = ids.filter((id, i) => ids.indexOf(id) !== i);
|
||||
if (duplicateIds.length > 0) {
|
||||
throw new Error(`Duplicate module IDs: ${duplicateIds.join(', ')}`);
|
||||
}
|
||||
|
||||
const routes = configs.map((m) => m.route);
|
||||
const duplicateRoutes = routes.filter((r, i) => routes.indexOf(r) !== i);
|
||||
if (duplicateRoutes.length > 0) {
|
||||
throw new Error(`Duplicate module routes: ${duplicateRoutes.join(', ')}`);
|
||||
}
|
||||
}
|
||||
32
src/core/module-registry/types.ts
Normal file
32
src/core/module-registry/types.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
export type ModuleCategory =
|
||||
| 'operations'
|
||||
| 'generators'
|
||||
| 'management'
|
||||
| 'tools'
|
||||
| 'ai';
|
||||
|
||||
export type Visibility = 'all' | 'internal' | 'admin' | 'guest-safe';
|
||||
|
||||
export interface ModuleConfig {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
icon: string;
|
||||
route: string;
|
||||
category: ModuleCategory;
|
||||
featureFlag: string;
|
||||
visibility: Visibility;
|
||||
version: string;
|
||||
dependencies?: string[];
|
||||
storageNamespace: string;
|
||||
navOrder: number;
|
||||
tags?: string[];
|
||||
}
|
||||
|
||||
export const MODULE_CATEGORY_LABELS: Record<ModuleCategory, string> = {
|
||||
operations: 'Operațiuni',
|
||||
generators: 'Generatoare',
|
||||
management: 'Management',
|
||||
tools: 'Instrumente',
|
||||
ai: 'AI & Automatizări',
|
||||
};
|
||||
Reference in New Issue
Block a user