Phase 0: Add frontend module config and update settings store
- Created modules.config.ts with module definitions - Added ModuleEnableSettings API functions - Updated settingsStore with module enable settings support - Added isModuleEnabled helper method
This commit is contained in:
110
frontend/src/config/modules.config.ts
Normal file
110
frontend/src/config/modules.config.ts
Normal file
@@ -0,0 +1,110 @@
|
||||
/**
|
||||
* Module Configuration
|
||||
* Defines all available modules and their properties
|
||||
*/
|
||||
|
||||
export interface ModuleConfig {
|
||||
name: string;
|
||||
route: string;
|
||||
icon?: string;
|
||||
description?: string;
|
||||
enabled: boolean; // Will be checked from API
|
||||
}
|
||||
|
||||
export const MODULES: Record<string, ModuleConfig> = {
|
||||
planner: {
|
||||
name: 'Planner',
|
||||
route: '/planner',
|
||||
icon: '📊',
|
||||
description: 'Keyword research and clustering',
|
||||
enabled: true, // Default, will be checked from API
|
||||
},
|
||||
writer: {
|
||||
name: 'Writer',
|
||||
route: '/writer',
|
||||
icon: '✍️',
|
||||
description: 'Content generation and management',
|
||||
enabled: true,
|
||||
},
|
||||
thinker: {
|
||||
name: 'Thinker',
|
||||
route: '/thinker',
|
||||
icon: '🧠',
|
||||
description: 'AI prompts and strategies',
|
||||
enabled: true,
|
||||
},
|
||||
automation: {
|
||||
name: 'Automation',
|
||||
route: '/automation',
|
||||
icon: '⚙️',
|
||||
description: 'Automated workflows and tasks',
|
||||
enabled: true,
|
||||
},
|
||||
site_builder: {
|
||||
name: 'Site Builder',
|
||||
route: '/site-builder',
|
||||
icon: '🏗️',
|
||||
description: 'Build and manage sites',
|
||||
enabled: true,
|
||||
},
|
||||
linker: {
|
||||
name: 'Linker',
|
||||
route: '/linker',
|
||||
icon: '🔗',
|
||||
description: 'Internal linking optimization',
|
||||
enabled: true,
|
||||
},
|
||||
optimizer: {
|
||||
name: 'Optimizer',
|
||||
route: '/optimizer',
|
||||
icon: '⚡',
|
||||
description: 'Content optimization',
|
||||
enabled: true,
|
||||
},
|
||||
publisher: {
|
||||
name: 'Publisher',
|
||||
route: '/publisher',
|
||||
icon: '📤',
|
||||
description: 'Content publishing',
|
||||
enabled: true,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Get module config by name
|
||||
*/
|
||||
export function getModuleConfig(moduleName: string): ModuleConfig | undefined {
|
||||
return MODULES[moduleName];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all enabled modules
|
||||
*/
|
||||
export function getEnabledModules(moduleEnableSettings?: Record<string, boolean>): ModuleConfig[] {
|
||||
return Object.entries(MODULES)
|
||||
.filter(([key, module]) => {
|
||||
// If moduleEnableSettings provided, use it; otherwise default to enabled
|
||||
if (moduleEnableSettings) {
|
||||
const enabledKey = `${key}_enabled` as keyof typeof moduleEnableSettings;
|
||||
return moduleEnableSettings[enabledKey] !== false; // Default to true if not set
|
||||
}
|
||||
return module.enabled;
|
||||
})
|
||||
.map(([, module]) => module);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a module is enabled
|
||||
*/
|
||||
export function isModuleEnabled(moduleName: string, moduleEnableSettings?: Record<string, boolean>): boolean {
|
||||
const module = MODULES[moduleName];
|
||||
if (!module) return false;
|
||||
|
||||
if (moduleEnableSettings) {
|
||||
const enabledKey = `${moduleName}_enabled` as keyof typeof moduleEnableSettings;
|
||||
return moduleEnableSettings[enabledKey] !== false; // Default to true if not set
|
||||
}
|
||||
|
||||
return module.enabled;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user