chore: update gpui-components

This commit is contained in:
2025-02-05 07:33:21 +07:00
parent c7d17ef90d
commit 72e42bf22a
16 changed files with 99 additions and 82 deletions

View File

@@ -16,9 +16,7 @@ use ui::{
Icon, IconName, Root, Sizable, TitleBar,
};
use super::{
chat, contacts, onboarding, profile, settings, sidebar::Sidebar, welcome::WelcomePanel,
};
use super::{chat, contacts, onboarding, profile, settings, sidebar, welcome};
#[derive(Clone, PartialEq, Eq, Deserialize)]
pub enum PanelKind {
@@ -65,11 +63,11 @@ impl AppView {
pub fn new(account: NostrProfile, window: &mut Window, cx: &mut Context<'_, Self>) -> AppView {
let dock = cx.new(|cx| DockArea::new(DOCK_AREA.id, Some(DOCK_AREA.version), window, cx));
let weak_dock = dock.downgrade();
let left_panel = DockItem::panel(Arc::new(Sidebar::new(window, cx)));
let left_panel = DockItem::panel(Arc::new(sidebar::init(window, cx)));
let center_panel = DockItem::split_with_sizes(
Axis::Vertical,
vec![DockItem::tabs(
vec![Arc::new(WelcomePanel::new(window, cx))],
vec![Arc::new(welcome::init(window, cx))],
None,
&weak_dock,
window,

View File

@@ -5,10 +5,10 @@ use common::{
utils::{compare, message_time, nip96_upload},
};
use gpui::{
div, img, list, px, white, AnyElement, App, AppContext, Context, Entity, EventEmitter, Flatten,
FocusHandle, Focusable, InteractiveElement, IntoElement, ListAlignment, ListState, ObjectFit,
ParentElement, PathPromptOptions, Pixels, Render, SharedString, StatefulInteractiveElement,
Styled, StyledImage, WeakEntity, Window,
div, img, list, prelude::FluentBuilder, px, white, AnyElement, App, AppContext, Context,
Entity, EventEmitter, Flatten, FocusHandle, Focusable, InteractiveElement, IntoElement,
ListAlignment, ListState, ObjectFit, ParentElement, PathPromptOptions, Pixels, Render,
SharedString, StatefulInteractiveElement, Styled, StyledImage, WeakEntity, Window,
};
use itertools::Itertools;
use message::Message;
@@ -21,7 +21,6 @@ use ui::{
dock_area::panel::{Panel, PanelEvent},
input::{InputEvent, TextInput},
popup_menu::PopupMenu,
prelude::FluentBuilder,
theme::{scale::ColorScaleStep, ActiveTheme},
v_flex, ContextModal, Icon, IconName, Sizable,
};

View File

@@ -1,8 +1,8 @@
use common::profile::NostrProfile;
use gpui::{
div, img, px, uniform_list, AnyElement, App, AppContext, Context, Entity, EventEmitter,
FocusHandle, Focusable, InteractiveElement, IntoElement, ParentElement, Render, SharedString,
Styled, Window,
div, img, prelude::FluentBuilder, px, uniform_list, AnyElement, App, AppContext, Context,
Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement, IntoElement, ParentElement,
Render, SharedString, Styled, Window,
};
use nostr_sdk::prelude::*;
use state::get_client;
@@ -12,7 +12,6 @@ use ui::{
dock_area::panel::{Panel, PanelEvent},
indicator::Indicator,
popup_menu::PopupMenu,
prelude::FluentBuilder,
theme::{scale::ColorScaleStep, ActiveTheme},
Sizable,
};

View File

@@ -1,8 +1,8 @@
use app_state::registry::AppRegistry;
use common::profile::NostrProfile;
use gpui::{
div, relative, svg, App, AppContext, BorrowAppContext, Context, Entity, IntoElement,
ParentElement, Render, Styled, Window,
div, prelude::FluentBuilder, relative, svg, App, AppContext, BorrowAppContext, Context, Entity,
IntoElement, ParentElement, Render, Styled, Window,
};
use nostr_connect::prelude::*;
use state::get_client;
@@ -12,7 +12,6 @@ use ui::{
button::{Button, ButtonVariants},
input::{InputEvent, TextInput},
notification::NotificationType,
prelude::FluentBuilder,
theme::{scale::ColorScaleStep, ActiveTheme},
ContextModal, Root, Size, StyledExt,
};

View File

@@ -5,9 +5,9 @@ use common::{
utils::{random_name, room_hash},
};
use gpui::{
div, img, impl_internal_actions, px, uniform_list, App, AppContext, Context, Entity,
FocusHandle, InteractiveElement, IntoElement, ParentElement, Render, SharedString,
StatefulInteractiveElement, Styled, Window,
div, img, impl_internal_actions, prelude::FluentBuilder, px, uniform_list, App, AppContext,
Context, Entity, FocusHandle, InteractiveElement, IntoElement, ParentElement, Render,
SharedString, StatefulInteractiveElement, Styled, Window,
};
use nostr_sdk::prelude::*;
use serde::Deserialize;
@@ -18,7 +18,6 @@ use ui::{
button::{Button, ButtonRounded},
indicator::Indicator,
input::{InputEvent, TextInput},
prelude::FluentBuilder,
theme::{scale::ColorScaleStep, ActiveTheme},
Icon, IconName, Sizable, Size, StyledExt,
};

View File

@@ -18,6 +18,10 @@ use ui::{
mod compose;
mod inbox;
pub fn init(window: &mut Window, cx: &mut App) -> Entity<Sidebar> {
Sidebar::new(window, cx)
}
pub struct Sidebar {
// Panel
name: SharedString,

View File

@@ -10,14 +10,18 @@ use ui::{
StyledExt,
};
pub struct WelcomePanel {
pub fn init(window: &mut Window, cx: &mut App) -> Entity<Welcome> {
Welcome::new(window, cx)
}
pub struct Welcome {
name: SharedString,
closable: bool,
zoomable: bool,
focus_handle: FocusHandle,
}
impl WelcomePanel {
impl Welcome {
pub fn new(window: &mut Window, cx: &mut App) -> Entity<Self> {
cx.new(|cx| Self::view(window, cx))
}
@@ -32,7 +36,7 @@ impl WelcomePanel {
}
}
impl Panel for WelcomePanel {
impl Panel for Welcome {
fn panel_id(&self) -> SharedString {
"WelcomePanel".into()
}
@@ -58,15 +62,15 @@ impl Panel for WelcomePanel {
}
}
impl EventEmitter<PanelEvent> for WelcomePanel {}
impl EventEmitter<PanelEvent> for Welcome {}
impl Focusable for WelcomePanel {
impl Focusable for Welcome {
fn focus_handle(&self, _: &App) -> gpui::FocusHandle {
self.focus_handle.clone()
}
}
impl Render for WelcomePanel {
impl Render for Welcome {
fn render(&mut self, _window: &mut gpui::Window, cx: &mut Context<Self>) -> impl IntoElement {
div()
.size_full()