Remove welcome experience action
Make logo switch between light and dark co-authored-by: Nathan <nathan@zed.dev>
This commit is contained in:
+10
-11
@@ -36,6 +36,7 @@ use std::{
|
||||
path::PathBuf, sync::Arc, thread, time::Duration,
|
||||
};
|
||||
use terminal_view::{get_working_directory, TerminalView};
|
||||
use welcome::{show_welcome_experience, FIRST_OPEN};
|
||||
|
||||
use fs::RealFs;
|
||||
use settings::watched_json::WatchedJsonFile;
|
||||
@@ -46,10 +47,7 @@ use util::{channel::RELEASE_CHANNEL, paths, ResultExt, TryFutureExt};
|
||||
use workspace::{
|
||||
self, item::ItemHandle, notifications::NotifyResultExt, AppState, NewFile, OpenPaths, Workspace,
|
||||
};
|
||||
use zed::{
|
||||
self, build_window_options, initialize_workspace, languages, menus, WelcomeExperience,
|
||||
FIRST_OPEN,
|
||||
};
|
||||
use zed::{self, build_window_options, initialize_workspace, languages, menus};
|
||||
|
||||
fn main() {
|
||||
let http = http::client();
|
||||
@@ -206,7 +204,7 @@ fn main() {
|
||||
cx.platform().activate(true);
|
||||
let paths = collect_path_args();
|
||||
if paths.is_empty() {
|
||||
cx.spawn(|cx| async move { restore_or_create_workspace(cx).await })
|
||||
cx.spawn(|cx| async move { restore_or_create_workspace(&app_state, cx).await })
|
||||
.detach()
|
||||
} else {
|
||||
cx.dispatch_global_action(OpenPaths { paths });
|
||||
@@ -219,8 +217,11 @@ fn main() {
|
||||
cx.update(|cx| workspace::open_paths(&paths, &app_state, None, cx))
|
||||
.detach();
|
||||
} else {
|
||||
cx.spawn(|cx| async move { restore_or_create_workspace(cx).await })
|
||||
.detach()
|
||||
cx.spawn({
|
||||
let app_state = app_state.clone();
|
||||
|cx| async move { restore_or_create_workspace(&app_state, cx).await }
|
||||
})
|
||||
.detach()
|
||||
}
|
||||
|
||||
cx.spawn(|cx| {
|
||||
@@ -259,7 +260,7 @@ fn main() {
|
||||
});
|
||||
}
|
||||
|
||||
async fn restore_or_create_workspace(mut cx: AsyncAppContext) {
|
||||
async fn restore_or_create_workspace(app_state: &Arc<AppState>, mut cx: AsyncAppContext) {
|
||||
if let Some(location) = workspace::last_opened_workspace_paths().await {
|
||||
cx.update(|cx| {
|
||||
cx.dispatch_global_action(OpenPaths {
|
||||
@@ -267,9 +268,7 @@ async fn restore_or_create_workspace(mut cx: AsyncAppContext) {
|
||||
})
|
||||
});
|
||||
} else if matches!(KEY_VALUE_STORE.read_kvp(FIRST_OPEN), Ok(None)) {
|
||||
cx.update(|cx| {
|
||||
cx.dispatch_global_action(WelcomeExperience);
|
||||
});
|
||||
cx.update(|cx| show_welcome_experience(app_state, cx));
|
||||
} else {
|
||||
cx.update(|cx| {
|
||||
cx.dispatch_global_action(NewFile);
|
||||
|
||||
+1
-28
@@ -8,7 +8,6 @@ use breadcrumbs::Breadcrumbs;
|
||||
pub use client;
|
||||
use collab_ui::{CollabTitlebarItem, ToggleContactsMenu};
|
||||
use collections::VecDeque;
|
||||
use db::kvp::KEY_VALUE_STORE;
|
||||
pub use editor;
|
||||
use editor::{Editor, MultiBuffer};
|
||||
|
||||
@@ -35,9 +34,7 @@ use std::{borrow::Cow, env, path::Path, str, sync::Arc};
|
||||
use util::{channel::ReleaseChannel, paths, ResultExt, StaffMode};
|
||||
use uuid::Uuid;
|
||||
pub use workspace;
|
||||
use workspace::{open_new, sidebar::SidebarSide, AppState, Restart, Workspace};
|
||||
|
||||
pub const FIRST_OPEN: &str = "first_open";
|
||||
use workspace::{sidebar::SidebarSide, AppState, Restart, Workspace};
|
||||
|
||||
#[derive(Deserialize, Clone, PartialEq)]
|
||||
pub struct OpenBrowser {
|
||||
@@ -69,7 +66,6 @@ actions!(
|
||||
DecreaseBufferFontSize,
|
||||
ResetBufferFontSize,
|
||||
ResetDatabase,
|
||||
WelcomeExperience
|
||||
]
|
||||
);
|
||||
|
||||
@@ -258,29 +254,6 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut gpui::MutableAppContext) {
|
||||
workspace.toggle_sidebar_item_focus(SidebarSide::Left, 0, cx);
|
||||
},
|
||||
);
|
||||
|
||||
cx.add_global_action({
|
||||
let app_state = app_state.clone();
|
||||
move |_: &WelcomeExperience, cx| {
|
||||
if !matches!(KEY_VALUE_STORE.read_kvp(FIRST_OPEN), Ok(None)) {
|
||||
return; //noop, in case someone fires this from the command palette
|
||||
}
|
||||
|
||||
open_new(&app_state, cx, |workspace, cx| {
|
||||
workspace.toggle_sidebar(SidebarSide::Left, cx);
|
||||
let welcome_page = cx.add_view(|cx| welcome::WelcomePage::new(cx));
|
||||
workspace.add_item_to_center(Box::new(welcome_page.clone()), cx);
|
||||
cx.focus(welcome_page);
|
||||
cx.notify();
|
||||
})
|
||||
.detach();
|
||||
|
||||
db::write_and_log(cx, || {
|
||||
KEY_VALUE_STORE.write_kvp(FIRST_OPEN.to_string(), "false".to_string())
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
activity_indicator::init(cx);
|
||||
call::init(app_state.client.clone(), app_state.user_store.clone(), cx);
|
||||
settings::KeymapFileContent::load_defaults(cx);
|
||||
|
||||
Reference in New Issue
Block a user