onboarding: Fix keybindings showing up after a delay (#35342)
This fixes an issue where keybinds would only show up after a delay on the welcome page upon re-opening it. It also binds one of the buttons to the corresponding action. Release Notes: - N/A
This commit is contained in:
parent
45af1fcc2f
commit
f8d1062484
2 changed files with 10 additions and 9 deletions
|
@ -81,7 +81,7 @@ pub fn init(cx: &mut App) {
|
||||||
if let Some(existing) = existing {
|
if let Some(existing) = existing {
|
||||||
workspace.activate_item(&existing, true, true, window, cx);
|
workspace.activate_item(&existing, true, true, window, cx);
|
||||||
} else {
|
} else {
|
||||||
let settings_page = WelcomePage::new(cx);
|
let settings_page = WelcomePage::new(window, cx);
|
||||||
workspace.add_item_to_active_pane(
|
workspace.add_item_to_active_pane(
|
||||||
Box::new(settings_page),
|
Box::new(settings_page),
|
||||||
None,
|
None,
|
||||||
|
|
|
@ -7,7 +7,7 @@ use workspace::{
|
||||||
NewFile, Open, Workspace, WorkspaceId,
|
NewFile, Open, Workspace, WorkspaceId,
|
||||||
item::{Item, ItemEvent},
|
item::{Item, ItemEvent},
|
||||||
};
|
};
|
||||||
use zed_actions::{Extensions, OpenSettings, command_palette};
|
use zed_actions::{Extensions, OpenSettings, agent, command_palette};
|
||||||
|
|
||||||
actions!(
|
actions!(
|
||||||
zed,
|
zed,
|
||||||
|
@ -55,8 +55,7 @@ const CONTENT: (Section<4>, Section<3>) = (
|
||||||
SectionEntry {
|
SectionEntry {
|
||||||
icon: IconName::ZedAssistant,
|
icon: IconName::ZedAssistant,
|
||||||
title: "View AI Settings",
|
title: "View AI Settings",
|
||||||
// TODO: use proper action
|
action: &agent::OpenSettings,
|
||||||
action: &NoAction,
|
|
||||||
},
|
},
|
||||||
SectionEntry {
|
SectionEntry {
|
||||||
icon: IconName::Blocks,
|
icon: IconName::Blocks,
|
||||||
|
@ -228,12 +227,14 @@ impl Render for WelcomePage {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WelcomePage {
|
impl WelcomePage {
|
||||||
pub fn new(cx: &mut Context<Workspace>) -> Entity<Self> {
|
pub fn new(window: &mut Window, cx: &mut Context<Workspace>) -> Entity<Self> {
|
||||||
let this = cx.new(|cx| WelcomePage {
|
cx.new(|cx| {
|
||||||
focus_handle: cx.focus_handle(),
|
let focus_handle = cx.focus_handle();
|
||||||
});
|
cx.on_focus(&focus_handle, window, |_, _, cx| cx.notify())
|
||||||
|
.detach();
|
||||||
|
|
||||||
this
|
WelcomePage { focus_handle }
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue