feat: make tryIt presets, limits, badges and buttons completely dynamic from JSON configs

This commit is contained in:
2026-11-04 15:36:30 +05:30
parent de20dd4c7e
commit e5c318099d
21 changed files with 881 additions and 250 deletions
+3
View File
@@ -67,6 +67,9 @@ export function isSectionVisible(
section: SectionConfig,
currentContext: { device?: 'mobile' | 'desktop'; locale?: string; flags?: Record<string, boolean> }
): boolean {
if ((section as any).disabled === true || (section as any).enabled === false) {
return false;
}
if (!section.visibleWhen) return true;
const { device, locale, flag } = section.visibleWhen;
+2
View File
@@ -50,6 +50,7 @@ export function getPageConfig(slug: string): PageConfig | null {
}
export function getAllTools(): ToolItem[] {
toolsCache.clear();
// 1. Prioritize management/pages/tools/[slug]/tool.config.json
const mgmtToolsDir = path.join(MANAGEMENT_DIR, 'pages', 'tools');
if (fs.existsSync(mgmtToolsDir)) {
@@ -103,6 +104,7 @@ export function getToolById(id: string): ToolItem | null {
}
export function getAllApps(): AppItem[] {
appsCache.clear();
// 1. Prioritize management/apps/[slug]/app.config.json
const mgmtAppsDir = path.join(MANAGEMENT_DIR, 'apps');
if (fs.existsSync(mgmtAppsDir)) {