wip: refactor

This commit is contained in:
2025-01-24 13:30:07 +07:00
parent 272259cd16
commit 3b6541b900
15 changed files with 99 additions and 93 deletions

View File

@@ -1,4 +1,5 @@
use crate::{constants::IMAGE_SERVICE, get_client, states::app::AppRegistry};
use crate::{get_client, states::app::AppRegistry};
use common::constants::IMAGE_SERVICE;
use gpui::prelude::FluentBuilder;
use gpui::{
actions, img, Context, IntoElement, Model, ObjectFit, ParentElement, Render, Styled,

View File

@@ -1,10 +1,8 @@
use crate::{
use async_utility::task::spawn;
use common::{
constants::IMAGE_SERVICE,
get_client,
states::chat::room::Room,
utils::{compare, message_time, nip96_upload},
};
use async_utility::task::spawn;
use gpui::{
div, img, list, px, white, AnyElement, AppContext, Context, EventEmitter, Flatten, FocusHandle,
FocusableView, InteractiveElement, IntoElement, ListAlignment, ListState, Model, ObjectFit,
@@ -29,6 +27,8 @@ use ui::{
v_flex, ContextModal, Icon, IconName, Sizable,
};
use crate::{get_client, states::chat::room::Room};
mod message;
#[derive(Clone)]
@@ -363,7 +363,9 @@ impl ChatPanel {
let (tx, rx) = oneshot::channel::<Url>();
spawn(async move {
if let Ok(url) = nip96_upload(file_data).await {
let client = get_client();
if let Ok(url) = nip96_upload(client, file_data).await {
_ = tx.send(url);
}
});

View File

@@ -1,8 +1,10 @@
use crate::{constants::KEYRING_SERVICE, get_client, states::app::AppRegistry};
use common::constants::KEYRING_SERVICE;
use gpui::{div, IntoElement, ParentElement, Render, Styled, View, ViewContext, VisualContext};
use nostr_sdk::prelude::*;
use ui::input::{InputEvent, TextInput};
use crate::{get_client, states::app::AppRegistry};
pub struct Onboarding {
input: View<TextInput>,
}

View File

@@ -4,8 +4,8 @@ use crate::{
app::AppRegistry,
chat::room::{Member, Room},
},
utils::{random_name, room_hash},
};
use common::utils::{random_name, room_hash};
use gpui::{
div, img, impl_internal_actions, px, uniform_list, Context, FocusHandle, InteractiveElement,
IntoElement, Model, ParentElement, Render, SharedString, StatefulInteractiveElement, Styled,

View File

@@ -1,8 +1,8 @@
use crate::{
states::chat::ChatRegistry,
utils::message_ago,
views::app::{AddPanel, PanelKind},
};
use common::utils::message_ago;
use gpui::{
div, img, percentage, prelude::FluentBuilder, px, InteractiveElement, IntoElement,
ParentElement, Render, SharedString, StatefulInteractiveElement, Styled, ViewContext,