diff --git a/apps/mofa-ui-generator/src/lib.rs b/apps/mofa-ui-generator/src/lib.rs new file mode 100644 index 00000000..d0f5c597 --- /dev/null +++ b/apps/mofa-ui-generator/src/lib.rs @@ -0,0 +1,23 @@ +use mofa_widgets::{MofaApp, AppInfo, PageId}; +use makepad_widgets::*; + +pub mod screen; + +pub struct MoFaUIGeneratorApp; + +impl MofaApp for MoFaUIGeneratorApp { + fn info() -> AppInfo { + AppInfo { + name: "UI Generator", + id: "mofa-ui-generator", + description: "AI-powered Makepad UI Generator", + tab_id: Some(live_id!(ui_generator_tab)), + page_id: Some(live_id!(ui_generator_page)), + show_in_sidebar: true, + } + } + + fn live_design(cx: &mut Cx) { + crate::screen::live_design(cx); + } +} diff --git a/apps/mofa-ui-generator/src/screen/design.rs b/apps/mofa-ui-generator/src/screen/design.rs new file mode 100644 index 00000000..41535a9f --- /dev/null +++ b/apps/mofa-ui-generator/src/screen/design.rs @@ -0,0 +1,205 @@ +use makepad_widgets::*; +use mofa_ui::widgets::chat_panel::{ChatMessage, ChatPanelWidgetExt}; +use mofa_ui::widgets::chat_input::ChatInputWidgetExt; + +const SYSTEM_PROMPT: &str = "You are an expert Makepad UI developer. \ + Generate high-quality Makepad .ds code based on natural language descriptions. \ + Focus on modern aesthetics, responsiveness, and proper use of Makepad widgets."; + +live_design! { + use link::theme::*; + use link::shaders::*; + use link::widgets::*; + + use mofa_widgets::theme::*; + use mofa_ui::widgets::chat_panel::ChatPanel; + use mofa_ui::widgets::chat_input::ChatInput; + + pub MoFaUIGeneratorScreen = {{MoFaUIGeneratorScreen}} { + width: Fill, height: Fill + flow: Right + spacing: 12 + padding: 12 + show_bg: true + draw_bg: { + color: (DARK_BG) + } + + // Chat section on the left + left_column = { + width: 450, height: Fill + flow: Down + spacing: 10 + + chat_panel = { + height: Fill + empty_text: "Tell me what UI you want to build..." + } + chat_input = { + height: Fit + placeholder: "e.g. Create a profile card with an avatar and stats" + } + } + + // Preview section on the right + right_column = { + width: Fill, height: Fill + show_bg: true + draw_bg: { + instance dark_mode: 1.0 + color: (PANEL_BG) + border_radius: 8.0 + } + padding: 20 + flow: Down + spacing: 0 + + header = { + width: Fill, height: Fit + flow: Right + align: {y: 0.5} + padding: {bottom: 15} + +