feat: Reference Manager help window with web shortcomings

The toolbar Help button was a disabled tip that could never be clicked. It now opens a modal window explaining the manager on the web build: read-only reference list, disabled Attach/Refresh/Change Path (no filesystem access or native file pickers, so no add/reload/repath and no previews), nested read-only rows, and saved-drawing requirement for relative paths.

Includes a Report-an-issue button opening the GitHub issues page and a Close button; wired as ModalKind::XrefHelp through the shared modal frame so dismissal works on native and web.
This commit is contained in:
Karim Jerbi committed 2026-09-17 15:40:39 +01:00
1 parent 8e05ed552c
commit ef0c6bf403
6 files changed
+122 -2

No files matched your search

+4
View File
@@ -1854,6 +1854,8 @@ pub enum ModalKind {
/// means and what usually fixes it. Queued once per verdict; the status
/// bar's ⚠ pill reopens it.
GpuWarning,
/// Reference Manager help window (toolbar Help button).
XrefHelp,
}
/// A property group controlled by a layer state's restore mask.
@@ -2473,6 +2475,8 @@ pub enum Message {
XrefManagerRefreshMenu,
/// Toggle the Change Path dropdown menu.
XrefManagerPathMenu,
/// Open the Reference Manager help window.
XrefHelpOpen,
/// Close all palette dropdown menus (overlay dismissal).
XrefManagerDismissMenus,
/// Open the file picker for Select New Path (anchor entry).
+4
View File
@@ -2395,6 +2395,10 @@ impl OpenCADStudio {
self.xref_manager.refresh_open = false;
Task::none()
}
Message::XrefHelpOpen => {
self.active_modal = Some(super::ModalKind::XrefHelp);
Task::none()
}
Message::XrefManagerDismissMenus => {
self.xref_manager.attach_open = false;
self.xref_manager.refresh_open = false;
+4
View File
@@ -56,6 +56,7 @@ impl OpenCADStudio {
Some(K::MissingFonts) => crate::t!("Missing fonts").into_owned(),
Some(K::RecoveryPrompt) => crate::tr!("modal", "recovery-prompt"),
Some(K::GpuWarning) => crate::tr!("gpu", "title"),
Some(K::XrefHelp) => crate::t!("Reference Manager Help").into_owned(),
None => String::new(),
}
}
@@ -85,6 +86,9 @@ impl OpenCADStudio {
super::super::ModalKind::About => {
automatic_flow(ex, crate::ui::window::about::view_window)
}
super::super::ModalKind::XrefHelp => {
automatic_flow(ex, crate::ui::window::xref_help::view_window)
}
super::super::ModalKind::Shortcuts => {
// Keys claimed by two rows — the cells turn red and a
// persistent warning names the command already using each
+1
View File
@@ -22,4 +22,5 @@ pub mod annotation_data;
pub mod alias_editor;
pub mod find_replace;
pub mod named_parameters;
pub mod xref_help;
pub mod xref_manager;
+102
View File
@@ -0,0 +1,102 @@
//! Reference Manager help window: how the manager works on the web build
//! (read-only list, disabled mutations, no previews) and where to report
//! issues. Rendered as a modal like About/DSettings so the text gets a
//! proper window width — an anchored toolbar dropdown squeezed it into an
//! unreadable sliver.
use crate::app::Message;
use iced::widget::{button, column, container, row, text, Space};
use iced::{Background, Element, Fill, Length, Theme};
/// GitHub issues page linked from the help window, so web users can report
/// missing or broken behavior where it will be seen.
pub const XREF_ISSUES_URL: &str = "https://github.com/HakanSeven12/OpenCADStudio/issues";
fn muted_style(theme: &Theme) -> iced::widget::text::Style {
iced::widget::text::Style {
color: Some(theme.palette().background.base.text.scale_alpha(0.68)),
}
}
pub fn view_window(sizing: crate::ui::modal::ModalSizing) -> Element<'static, Message> {
// Fixed window width: paragraphs wrap against this instead of the
// toolbar, which is what made the dropdown unreadable.
let body_w = Length::Fixed(460.0);
let para = |label: String| -> Element<'static, Message> {
text(label).size(12).width(Fill).into()
};
let intro = para(crate::t!("How the Reference Manager works on web").into_owned());
let list = para(
crate::t!(
"This panel lists the drawing's references read-only: status, type, size, date and saved path, plus the Details pane. Select rows to inspect them; List and Tree switch the presentation."
)
.into_owned(),
);
let limits = para(
crate::t!(
"Attach, Refresh and Change Path stay disabled here: the web build has no filesystem access and no native file pickers, so references can be neither added, reloaded nor repathed — and previews stay unavailable. Nested references are read-only on every platform, and relative paths need the drawing saved first."
)
.into_owned(),
);
let report_hint = para(
crate::t!(
"Hit something broken or missing? Report it on the GitHub issues page so it can be fixed."
)
.into_owned(),
);
let report_button = button(text(crate::t!("Report an issue")).size(12))
.on_press(Message::OpenUrl(XREF_ISSUES_URL.to_string()))
.style(button::primary)
.padding([6, 18]);
let close_button = button(text(crate::t!("Close")).size(12))
.on_press(Message::CloseModal)
.style(button::secondary)
.padding([6, 18]);
let action_row: Element<'static, Message> = row![
Space::new().width(Fill),
report_button,
close_button,
]
.spacing(8)
.align_y(iced::Center)
.into();
let content = column![
text(crate::t!("Reference Manager — Web").into_owned())
.size(14),
text(crate::t!("EXTERNALREFERENCES on the web build").into_owned())
.size(11)
.style(muted_style),
intro,
list,
limits,
report_hint,
Space::new().height(4),
action_row,
]
.spacing(10)
.padding(16)
.width(body_w);
container(content)
.width(sizing.width)
.height(sizing.height)
.style(|theme: &Theme| container::Style {
background: Some(Background::Color(
theme.palette().background.base.color,
)),
..Default::default()
})
.into()
}
#[cfg(test)]
mod tests {
#[test]
fn issues_url_points_at_github_issues() {
assert!(super::XREF_ISSUES_URL.starts_with("https://github.com/"));
assert!(super::XREF_ISSUES_URL.contains("/issues"));
}
}
+7 -2
View File
@@ -22,6 +22,8 @@ use std::time::{SystemTime, UNIX_EPOCH};
/// read-only list renders everywhere.
const IS_WASM: bool = cfg!(target_arch = "wasm32");
/// Font size for table cells (mirrors `layers.rs`).
const FONT_SZ: f32 = ROW_H * 0.42; // ≈11 px at ROW_H=26
/// Fixed table height so the details pane below keeps stable space.
@@ -784,9 +786,12 @@ impl XrefManagerPanel {
)
}
};
let help = toolbar_tip(
// Help opens a modal window explaining the manager (and its web
// shortcomings): the old disabled tip could never be clicked, and
// an anchored dropdown squeezes the text into the toolbar's width.
let help = toolbar_btn(
crate::t!("Help").into_owned(),
crate::t!("Reference Manager — select rows, then Detach, Unload, Reload, Bind, Overlay, or a Change Path mode.").into_owned(),
Some(Message::XrefHelpOpen),
false,
);
let toolbar = container(