feat: add bottom bar
This commit is contained in:
@@ -1,34 +1,23 @@
|
||||
use components::theme::ActiveTheme;
|
||||
use gpui::*;
|
||||
|
||||
use super::{chat_space::ChatSpace, onboarding::Onboarding};
|
||||
use crate::state::AppState;
|
||||
|
||||
use super::{chatspace::ChatSpaceView, setup::SetupView};
|
||||
|
||||
pub struct AppView {
|
||||
onboarding: Model<Option<AnyView>>, // TODO: create onboarding view
|
||||
setup: View<SetupView>,
|
||||
chat_space: View<ChatSpaceView>,
|
||||
onboarding: View<Onboarding>,
|
||||
chat_space: View<ChatSpace>,
|
||||
}
|
||||
|
||||
impl AppView {
|
||||
pub fn new(cx: &mut ViewContext<'_, Self>) -> AppView {
|
||||
// Onboarding model
|
||||
let onboarding = cx.new_model(|_| None);
|
||||
// Setup view
|
||||
let setup = cx.new_view(SetupView::new);
|
||||
let onboarding = cx.new_view(Onboarding::new);
|
||||
// Chat Space view
|
||||
let chat_space = cx.new_view(ChatSpaceView::new);
|
||||
|
||||
cx.foreground_executor()
|
||||
.spawn(async move {
|
||||
// TODO: create onboarding view for the first time open app
|
||||
})
|
||||
.detach();
|
||||
let chat_space = cx.new_view(ChatSpace::new);
|
||||
|
||||
AppView {
|
||||
onboarding,
|
||||
setup,
|
||||
chat_space,
|
||||
}
|
||||
}
|
||||
@@ -39,18 +28,14 @@ impl Render for AppView {
|
||||
let mut content = div().size_full().flex().items_center().justify_center();
|
||||
|
||||
if cx.global::<AppState>().accounts.is_empty() {
|
||||
content = content.child(self.setup.clone())
|
||||
content = content.child(self.onboarding.clone())
|
||||
} else {
|
||||
content = content.child(self.chat_space.clone())
|
||||
}
|
||||
|
||||
if let Some(onboarding) = self.onboarding.read(cx).as_ref() {
|
||||
content = content.child(onboarding.clone())
|
||||
}
|
||||
|
||||
div()
|
||||
.bg(cx.theme().background)
|
||||
.text_color(rgb(0xFFFFFF))
|
||||
.text_color(cx.theme().foreground)
|
||||
.size_full()
|
||||
.child(content)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user