Panics · P37 Onboarding: handlers in new; gone articles, steps and topics hold

This commit is contained in:
ZacharyZhang-NY committed 2026-10-07 06:18:15 -04:00
1 parent e7aec1651e
commit 8db6cecd5a
12 files changed
+253 -229

No files matched your search

+30 -24
View File
@@ -88,13 +88,17 @@ pub fn wizard(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
}),
)
.into_any_element(),
false => OnboardingWizard::new("onboarding-wizard", steps, step)
.content(content)
.ready(ready)
.on_step(move |to, _, cx| change(&walk, cx, |welcome| welcome.step = to))
.on_finish(move |_, cx| change(&finish, cx, |welcome| welcome.finished = true))
.on_skip(move |_, cx| change(&skip, cx, |welcome| welcome.finished = true))
.into_any_element(),
false => OnboardingWizard::new(
"onboarding-wizard",
steps,
step,
move |to, _, cx| change(&walk, cx, |welcome| welcome.step = to),
move |_, cx| change(&finish, cx, |welcome| welcome.finished = true),
)
.content(content)
.ready(ready)
.on_skip(move |_, cx| change(&skip, cx, |welcome| welcome.finished = true))
.into_any_element(),
};
section(
"OnboardingWizard · WelcomeTour",
@@ -122,17 +126,15 @@ pub fn highlights(window: &mut Window, cx: &mut App) -> impl IntoElement + use<>
.relative()
.child(tool("onboarding-pin", IconName::Pin))
.when(!spot_seen, |pin| {
pin.child(
div().absolute().top_neg_1p5().right_neg_1p5().child(probe(
pin.child(div().absolute().top_neg_1p5().right_neg_1p5().child(probe(
"onboarding-hotspot",
Hotspot::new(
"onboarding-hotspot",
Hotspot::new(
"onboarding-hotspot",
"Pin a view",
"Keep the views you use most one press away.",
)
.on_dismiss(move |_, cx| change(&spot, cx, |seen| seen.hotspot = true)),
)),
)
"Pin a view",
"Keep the views you use most one press away.",
move |_, cx| change(&spot, cx, |seen| seen.hotspot = true),
),
)))
});
let toolbar = div()
.flex()
@@ -151,9 +153,9 @@ pub fn highlights(window: &mut Window, cx: &mut App) -> impl IntoElement + use<>
IconName::Columns2,
"Split view",
"Work on two files side by side, each with its own history.",
|_, _| log::info!("gallery: split view tried"),
move |_, cx| change(&card, cx, |seen| seen.highlight = true),
)
.on_try(|_, _| log::info!("gallery: split view tried"))
.on_dismiss(move |_, cx| change(&card, cx, |seen| seen.highlight = true))
});
let menu = List::new()
.child(
@@ -247,16 +249,20 @@ pub fn checklist(window: &mut Window, cx: &mut App) -> impl IntoElement + use<>
})
})
.into_any_element(),
false => SetupChecklist::new("onboarding-setup", "Get started", tasks)
.on_start(move |key, _, cx| {
false => SetupChecklist::new(
"onboarding-setup",
"Get started",
tasks,
move |key, _, cx| {
let at = TASKS
.iter()
.position(|(each, _, _)| *each == key.as_ref())
.expect("a setup task");
change(&start, cx, |setup| setup.done[at] = true)
})
.on_dismiss(move |_, cx| change(&hide, cx, |setup| setup.hidden = true))
.into_any_element(),
},
)
.on_dismiss(move |_, cx| change(&hide, cx, |setup| setup.hidden = true))
.into_any_element(),
};
section(
"Checklist (first-run tasks)",
+17 -14
View File
@@ -176,16 +176,21 @@ pub fn panel(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
.border_color(theme.colors.border)
.bg(theme.colors.surface)
.child(
HelpPanel::new("onboarding-help-panel", articles(), &search, open)
.on_open(move |key, _, cx| {
HelpPanel::new(
"onboarding-help-panel",
articles(),
&search,
open,
move |key, _, cx| {
let key = key.cloned();
change(&opener, cx, |help| help.open = key)
})
.on_contact(|_, _| log::info!("gallery: contact support"))
.on_shortcuts(move |_, cx| {
change(&keys, cx, |help| help.dialog = Some(Dialog::Shortcuts))
})
.on_close(move |_, cx| change(&close, cx, |help| help.hidden = true)),
},
)
.on_contact(|_, _| log::info!("gallery: contact support"))
.on_shortcuts(move |_, cx| {
change(&keys, cx, |help| help.dialog = Some(Dialog::Shortcuts))
})
.on_close(move |_, cx| change(&close, cx, |help| help.hidden = true)),
)
.into_any_element(),
};
@@ -290,8 +295,7 @@ pub fn feedback(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
.gap_6()
.child(probe(
"onboarding-feedback",
FeedbackWidget::new("onboarding-feedback")
.on_send(|sentiment, note, _, _| log::info!("gallery: feedback {} {note}", sentiment.key())),
FeedbackWidget::new("onboarding-feedback", |sentiment, note, _, _| log::info!("gallery: feedback {} {note}", sentiment.key())),
))
.child(
div()
@@ -300,12 +304,11 @@ pub fn feedback(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
.flex_col()
.gap_3()
.child(
ContactSupport::new("onboarding-support", topics)
.address("help@example.com")
.on_send(move |topic, _, _, cx| {
ContactSupport::new("onboarding-support", topics, move |topic, _, _, cx| {
log::info!("gallery: support about {topic}");
change(&done, cx, |help| help.sent = true)
}),
})
.address("help@example.com"),
)
.when(sent, |column| column.child(div().text_sm().child("Sent. We answer within a day."))),
),