forked from 1b-agent/opencadstudio-upstream
feat(ui): shared in-canvas modal overlay; migrate About (Plan B)
Start Plan B — replace the daemon's pop-up OS windows with in-canvas modal overlays so dialogs work identically on native (one main window) and web (canvas only). - New `ui::modal::modal(base, content, on_close)`: dims the view behind a backdrop that blocks clicks but does NOT dismiss, frames the content, and adds a top-right ✕ as the sole close affordance. Sizes to the content (no `Fill`), so dialogs shrink to fit. - view_main stacks the active modal on top, so both run paths show it. - Migrate About as the pilot: `about_open` bool + AboutOpen/AboutClose instead of an OS window; About's view shrinks to content. Remaining dialogs migrate to the same pattern next. Native + 75 tests OK. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
9d378a0533
commit
e6213eafbb
6 files changed
+127
-21
No files matched your search
+3
-7
@@ -1,6 +1,6 @@
|
||||
use crate::app::Message;
|
||||
use iced::widget::{button, column, container, row, text, Space};
|
||||
use iced::{Background, Border, Color, Element, Fill, Theme};
|
||||
use iced::widget::{button, column, container, row, text};
|
||||
use iced::{Background, Border, Color, Element, Theme};
|
||||
|
||||
const BG: Color = Color {
|
||||
r: 0.15,
|
||||
@@ -65,7 +65,6 @@ pub fn view_window<'a>() -> Element<'a, Message> {
|
||||
.spacing(4)
|
||||
.align_x(iced::Center),
|
||||
)
|
||||
.width(Fill)
|
||||
.padding(iced::Padding {
|
||||
top: 20.0,
|
||||
right: 0.0,
|
||||
@@ -83,7 +82,6 @@ pub fn view_window<'a>() -> Element<'a, Message> {
|
||||
.spacing(2)
|
||||
.padding([12, 16]),
|
||||
)
|
||||
.width(Fill)
|
||||
.style(|_: &Theme| container::Style {
|
||||
background: Some(Background::Color(PANEL)),
|
||||
border: Border {
|
||||
@@ -115,7 +113,7 @@ pub fn view_window<'a>() -> Element<'a, Message> {
|
||||
})
|
||||
.padding([6, 16]);
|
||||
|
||||
let footer = row![Space::new().width(Fill), copy_btn,]
|
||||
let footer = row![copy_btn]
|
||||
.align_y(iced::Center)
|
||||
.padding(iced::Padding {
|
||||
top: 12.0,
|
||||
@@ -138,7 +136,5 @@ pub fn view_window<'a>() -> Element<'a, Message> {
|
||||
background: Some(Background::Color(BG)),
|
||||
..Default::default()
|
||||
})
|
||||
.width(Fill)
|
||||
.height(Fill)
|
||||
.into()
|
||||
}
|
||||
Reference in new issue
Block a user