56 lines
1.3 KiB
Rust
56 lines
1.3 KiB
Rust
|
|
/// UI components module
|
||
|
|
mod components;
|
||
|
|
mod entity_browser;
|
||
|
|
mod file_editor;
|
||
|
|
mod main_editor;
|
||
|
|
mod menu_bar;
|
||
|
|
mod quick_actions;
|
||
|
|
mod tabs;
|
||
|
|
|
||
|
|
use iced::{
|
||
|
|
Element,
|
||
|
|
Length,
|
||
|
|
widget::{
|
||
|
|
column,
|
||
|
|
row,
|
||
|
|
},
|
||
|
|
};
|
||
|
|
|
||
|
|
use crate::app::{
|
||
|
|
Editor,
|
||
|
|
Message,
|
||
|
|
};
|
||
|
|
|
||
|
|
pub fn view(editor: &Editor) -> Element<'_, Message> {
|
||
|
|
let menu_bar = menu_bar::view(editor);
|
||
|
|
let tab_bar = tabs::tab_bar(editor);
|
||
|
|
let main_editor = main_editor::view(editor);
|
||
|
|
|
||
|
|
let editor_with_tabs = column![tab_bar, main_editor]
|
||
|
|
.spacing(0)
|
||
|
|
.width(Length::Fill)
|
||
|
|
.height(Length::Fill);
|
||
|
|
|
||
|
|
// Zed-like layout: file tree + editor (only show file tree when project is
|
||
|
|
// open)
|
||
|
|
let main_content = if editor.project.is_some() {
|
||
|
|
let entity_browser = entity_browser::view(editor);
|
||
|
|
row![entity_browser, editor_with_tabs]
|
||
|
|
.spacing(0)
|
||
|
|
.width(Length::Fill)
|
||
|
|
.height(Length::Fill)
|
||
|
|
} else {
|
||
|
|
// No project - just show editor area (welcome screen)
|
||
|
|
row![editor_with_tabs]
|
||
|
|
.spacing(0)
|
||
|
|
.width(Length::Fill)
|
||
|
|
.height(Length::Fill)
|
||
|
|
};
|
||
|
|
|
||
|
|
column![menu_bar, main_content]
|
||
|
|
.spacing(0)
|
||
|
|
.width(Length::Fill)
|
||
|
|
.height(Length::Fill)
|
||
|
|
.into()
|
||
|
|
}
|