wip: refactor

This commit is contained in:
2025-01-08 08:02:24 +07:00
parent 402786ec3c
commit fe24f84b02
24 changed files with 521 additions and 945 deletions

View File

@@ -1,5 +1,13 @@
use gpui::*;
use prelude::FluentBuilder;
use super::{
account::Account, chat::ChatPanel, onboarding::Onboarding, sidebar::Sidebar,
welcome::WelcomePanel,
};
use crate::states::{account::AccountRegistry, chat::Room};
use gpui::prelude::FluentBuilder;
use gpui::{
div, impl_actions, px, Axis, Context, Edges, InteractiveElement, IntoElement, Model,
ParentElement, Render, Styled, View, ViewContext, VisualContext, WeakView, WindowContext,
};
use serde::Deserialize;
use std::sync::Arc;
use ui::{
@@ -9,16 +17,9 @@ use ui::{
Root, Sizable, TitleBar,
};
use super::{
account::Account, chat::ChatPanel, contact::ContactPanel, onboarding::Onboarding,
sidebar::Sidebar, welcome::WelcomePanel,
};
use crate::states::{account::AccountRegistry, chat::Room};
#[derive(Clone, PartialEq, Eq, Deserialize)]
pub enum PanelKind {
Room(Arc<Room>),
Contact,
}
#[derive(Clone, PartialEq, Eq, Deserialize)]
@@ -125,13 +126,6 @@ impl AppView {
PanelKind::Room(room) => {
let panel = Arc::new(ChatPanel::new(room, cx));
self.dock.update(cx, |dock_area, cx| {
dock_area.add_panel(panel, action.position, cx);
});
}
PanelKind::Contact => {
let panel = Arc::new(ContactPanel::new(cx));
self.dock.update(cx, |dock_area, cx| {
dock_area.add_panel(panel, action.position, cx);
});