update
Rust / build (macos-latest, stable) (push) Waiting to run
Rust / build (ubuntu-latest, stable) (push) Waiting to run
Rust / build (windows-latest, stable) (push) Waiting to run
Rust / build (macos-latest, stable) (pull_request) Waiting to run
Rust / build (ubuntu-latest, stable) (pull_request) Waiting to run
Rust / build (windows-latest, stable) (pull_request) Waiting to run

This commit is contained in:
2026-11-19 10:37:22 +07:00
parent c7c1d0c741
commit 2a9d42a612
29 changed files with 532 additions and 425 deletions
+24 -14
View File
@@ -1,25 +1,32 @@
use gpui::{
AnyElement, Context, IntoElement, ParentElement as _, Render, Styled as _, Window, div,
AnyElement, App, AppContext as _, Context, Entity, IntoElement, ParentElement as _, Render,
Styled as _, Window, div,
};
use signed_state::Backend;
use ui::button::{Button, ButtonVariant};
use ui::common::v_flex;
use ui::dialog::Dialog;
use ui::dialog::{Dialog, DialogHandle};
use ui::theme::{ActiveTheme as _, TextRole, Typeset as _};
use crate::shared::dialogs::close_global;
pub struct ExitDialog {
handle: DialogHandle,
}
pub struct ExitDialog;
impl ExitDialog {
pub fn new(cx: &mut App) -> Entity<Self> {
cx.new(|_| Self {
handle: DialogHandle::new(true),
})
}
}
impl Render for ExitDialog {
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
let cancel_close = self.handle.clone();
let confirm_close = self.handle.clone();
Dialog::new("exit-dialog")
.open(true)
.on_change(|open, _, cx| {
if !open {
close_global(cx);
}
})
.handle(self.handle.clone())
.title("Exit Signed?")
.content(|_, cx| {
v_flex()
@@ -33,20 +40,23 @@ impl Render for ExitDialog {
)
.into_any_element()
})
.actions(|_, _| {
.actions(move |_, _| {
let cancel_close = cancel_close.clone();
let confirm_close = confirm_close.clone();
let cancel: AnyElement = Button::new("cancel-exit")
.label("Cancel")
.variant(ButtonVariant::Secondary)
.on_click(|_, _, cx| close_global(cx))
.on_click(move |_, _, cx| cancel_close.close(cx))
.into_any_element();
let exit: AnyElement = Button::new("confirm-exit")
.label("Exit")
.variant(ButtonVariant::Destructive)
.on_click(|_, _, cx| {
.on_click(move |_, _, cx| {
let backend = Backend::global(cx);
backend.update(cx, |backend, cx| backend.sign_out(cx));
close_global(cx);
confirm_close.close(cx);
})
.into_any_element();