feat: make tryIt presets, limits, badges and buttons completely dynamic from JSON configs
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user