This commit is contained in:
2026-07-25 10:38:37 +07:00
parent addd834995
commit ea6b642210
2 changed files with 223 additions and 211 deletions

View File

@@ -11,7 +11,7 @@ use state::{CoopAuthUrlHandler, NostrRegistry, USER_KEYRING};
use theme::ActiveTheme;
use ui::button::{Button, ButtonVariants};
use ui::input::{Input, InputEvent, InputState};
use ui::{Disableable, WindowExtension, v_flex};
use ui::{Disableable, StyledExt, WindowExtension, v_flex};
#[derive(Debug)]
pub struct ImportIdentity {
@@ -36,7 +36,7 @@ pub struct ImportIdentity {
impl ImportIdentity {
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
let key_input = cx.new(|cx| InputState::new(window, cx).masked(true));
let key_input = cx.new(|cx| InputState::new(window, cx));
let pass_input = cx.new(|cx| InputState::new(window, cx).masked(true));
let error = cx.new(|_| None);
@@ -202,7 +202,7 @@ impl ImportIdentity {
impl Render for ImportIdentity {
fn render(&mut self, _window: &mut gpui::Window, cx: &mut Context<Self>) -> impl IntoElement {
const MSG: &str = "Coop won't stored your identity key on the local device. Use Nostr Connect for persistent login.";
const MSG: &str = "Coop won't store your identity key on the local device. You need to re-login again in the next session. You can use Nostr Connect for persistent login.";
let require_password = self.key_input.read(cx).value().starts_with("ncryptsec1");
let key_warning = self.key_input.read(cx).value().starts_with("nsec1") || require_password;
@@ -213,7 +213,6 @@ impl Render for ImportIdentity {
.child(
v_flex()
.gap_1()
.text_sm()
.text_color(cx.theme().text_muted)
.child("Continue with existing key or bunker connection")
.child(Input::new(&self.key_input)),
@@ -222,7 +221,6 @@ impl Render for ImportIdentity {
this.child(
v_flex()
.gap_1()
.text_sm()
.text_color(cx.theme().text_muted)
.child("Decrypt Password:")
.child(Input::new(&self.pass_input)),
@@ -231,9 +229,11 @@ impl Render for ImportIdentity {
.when(key_warning, |this| {
this.child(
div()
.v_flex()
.text_xs()
.text_color(cx.theme().text_warning)
.child(MSG),
.child(div().font_semibold().child("Warning"))
.child(div().child(MSG)),
)
})
.child(