mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-29 21:49:33 +00:00
WIP
This commit is contained in:
parent
9401ef223d
commit
a0637a769c
3 changed files with 33 additions and 12 deletions
|
@ -1,15 +1,13 @@
|
|||
use gpui::{
|
||||
actions,
|
||||
elements::{Flex, Label, ParentElement},
|
||||
color::Color,
|
||||
elements::{Flex, Label, ParentElement, Svg},
|
||||
Element, Entity, MutableAppContext, View,
|
||||
};
|
||||
use settings::Settings;
|
||||
use workspace::{item::Item, Workspace};
|
||||
|
||||
actions!(welcome, [ShowWelcome]);
|
||||
use workspace::{item::Item, Welcome, Workspace};
|
||||
|
||||
pub fn init(cx: &mut MutableAppContext) {
|
||||
cx.add_action(|workspace: &mut Workspace, _: &ShowWelcome, cx| {
|
||||
cx.add_action(|workspace: &mut Workspace, _: &Welcome, cx| {
|
||||
let welcome_page = cx.add_view(|_cx| WelcomePage);
|
||||
workspace.add_item(Box::new(welcome_page), cx)
|
||||
})
|
||||
|
@ -28,7 +26,29 @@ impl View for WelcomePage {
|
|||
|
||||
fn render(&mut self, cx: &mut gpui::RenderContext<'_, Self>) -> gpui::ElementBox {
|
||||
let theme = &cx.global::<Settings>().theme;
|
||||
Label::new("Welcome page", theme.editor.hover_popover.prose.clone()).boxed()
|
||||
|
||||
Flex::new(gpui::Axis::Vertical)
|
||||
.with_children([
|
||||
Flex::new(gpui::Axis::Horizontal)
|
||||
.with_children([
|
||||
Svg::new("icons/terminal_16.svg")
|
||||
.with_color(Color::red())
|
||||
.constrained()
|
||||
.with_width(100.)
|
||||
.with_height(100.)
|
||||
.aligned()
|
||||
.contained()
|
||||
.boxed(),
|
||||
Label::new("Zed", theme.editor.hover_popover.prose.clone()).boxed(),
|
||||
])
|
||||
.boxed(),
|
||||
Label::new(
|
||||
"Code at the speed of thought",
|
||||
theme.editor.hover_popover.prose.clone(),
|
||||
)
|
||||
.boxed(),
|
||||
])
|
||||
.boxed()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,8 @@ actions!(
|
|||
NewTerminal,
|
||||
NewSearch,
|
||||
Feedback,
|
||||
Restart
|
||||
Restart,
|
||||
Welcome
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -198,7 +199,7 @@ pub fn init(app_state: Arc<AppState>, cx: &mut MutableAppContext) {
|
|||
});
|
||||
cx.add_global_action({
|
||||
let app_state = Arc::downgrade(&app_state);
|
||||
move |_: &NewFile, cx: &mut MutableAppContext| {
|
||||
move |_: &Welcome, cx: &mut MutableAppContext| {
|
||||
if let Some(app_state) = app_state.upgrade() {
|
||||
open_new(&app_state, cx).detach();
|
||||
}
|
||||
|
@ -2865,7 +2866,7 @@ pub fn open_new(app_state: &Arc<AppState>, cx: &mut MutableAppContext) -> Task<(
|
|||
|
||||
workspace.update(&mut cx, |_, cx| {
|
||||
if opened_paths.is_empty() {
|
||||
cx.dispatch_action(NewFile);
|
||||
cx.dispatch_action(Welcome);
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
|
@ -43,7 +43,7 @@ use theme::ThemeRegistry;
|
|||
use util::StaffMode;
|
||||
use util::{channel::RELEASE_CHANNEL, paths, ResultExt, TryFutureExt};
|
||||
use workspace::{
|
||||
self, item::ItemHandle, notifications::NotifyResultExt, AppState, NewFile, OpenPaths, Workspace,
|
||||
self, item::ItemHandle, notifications::NotifyResultExt, AppState, OpenPaths, Welcome, Workspace,
|
||||
};
|
||||
use zed::{self, build_window_options, initialize_workspace, languages, menus};
|
||||
|
||||
|
@ -260,7 +260,7 @@ async fn restore_or_create_workspace(mut cx: AsyncAppContext) {
|
|||
});
|
||||
} else {
|
||||
cx.update(|cx| {
|
||||
cx.dispatch_global_action(NewFile);
|
||||
cx.dispatch_global_action(Welcome);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue