+
+ {/* === PAGE TAB === */}
+ {activeTab === 'page' && (
+ <>
+
+
+
+
+
+ setShowCategoryManager(true)}
+ iconColor="text-yellow-600 dark:text-yellow-400"
+ />
+
+
+
+
+
+
+
+
+
+
+
+ {onDelete && (
+
+ )}
+
+
+
+ {templates?.map(t => (
+ onLoadTemplate?.(t)}
+ iconColor="text-indigo-500 dark:text-indigo-400"
+ />
+ ))}
+ {(!templates || templates.length === 0) && (
+ No Layouts
+ )}
+
+ >
+ )}
+
+ {/* === INSERT TAB === */}
+ {activeTab === 'insert' && (
+ <>
+
+
+
+
+ {/* Dynamic Widget Groups */}
+ {Array.from(new Set(widgetRegistry.getAll().map(w => w.metadata.category)))
+ .filter(cat => cat !== 'system' && cat !== 'hidden') // Filter internal categories if needed
+ .sort((a, b) => {
+ // Custom sort order: display, chart, control, others
+ const order = { display: 1, chart: 2, control: 3, custom: 4 };
+ return (order[a as keyof typeof order] || 99) - (order[b as keyof typeof order] || 99);
+ })
+ .map(category => {
+ const widgets = widgetRegistry.getByCategory(category);
+ if (widgets.length === 0) return null;
+
+ return (
+
+
+ {/* If we have many items, use small items in grid/column, else large */}
+ {widgets.length <= 2 ? (
+ widgets.map(widget => (
+
onAddWidget?.(widget.metadata.id)}
+ iconColor="text-blue-600 dark:text-blue-400"
+ />
+ ))
+ ) : (
+
+ {widgets.map(widget => (
+ onAddWidget?.(widget.metadata.id)}
+ iconColor="text-blue-600 dark:text-blue-400"
+ />
+ ))}
+
+ )}
+
+
+ );
+ })
+ }
+ >
+ )}
+
+ {/* === VIEW TAB === */}
+ {activeTab === 'view' && (
+ <>
+
+
+
+ >
+ )}
+
+ {/* === ADVANCED TAB === */}
+ {activeTab === 'advanced' && (
+ <>
+
+
+
+ >
+ )}
+
+ {/* Always visible 'Finish' on far right? Or just in View tab. Fusion has 'Finish Sketch' big checkmark */}
+
+
+
+
+