Remove welcome experience action

Make logo switch between light and dark

co-authored-by: Nathan <nathan@zed.dev>
This commit is contained in:
Mikayla Maki
2023-03-08 14:49:48 -08:00
co-authored by Nathan
parent 344f59adf7
commit f62e0b502a
8 changed files with 51 additions and 67 deletions
+23 -2
View File
@@ -1,7 +1,8 @@
mod base_keymap_picker;
use std::borrow::Cow;
use std::{borrow::Cow, sync::Arc};
use db::kvp::KEY_VALUE_STORE;
use gpui::{
elements::{Empty, Flex, Label, MouseEventHandler, ParentElement, Svg},
Action, Element, ElementBox, Entity, MouseButton, MutableAppContext, RenderContext,
@@ -9,10 +10,15 @@ use gpui::{
};
use settings::{settings_file::SettingsFile, Settings, SettingsFileContent};
use theme::CheckboxStyle;
use workspace::{item::Item, PaneBackdrop, Welcome, Workspace, WorkspaceId};
use workspace::{
item::Item, open_new, sidebar::SidebarSide, AppState, PaneBackdrop, Welcome, Workspace,
WorkspaceId,
};
use crate::base_keymap_picker::ToggleBaseKeymapSelector;
pub const FIRST_OPEN: &str = "first_open";
pub fn init(cx: &mut MutableAppContext) {
cx.add_action(|workspace: &mut Workspace, _: &Welcome, cx| {
let welcome_page = cx.add_view(WelcomePage::new);
@@ -22,6 +28,21 @@ pub fn init(cx: &mut MutableAppContext) {
base_keymap_picker::init(cx);
}
pub fn show_welcome_experience(app_state: &Arc<AppState>, cx: &mut MutableAppContext) {
open_new(&app_state, cx, |workspace, cx| {
workspace.toggle_sidebar(SidebarSide::Left, cx);
let welcome_page = cx.add_view(|cx| 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())
});
}
pub struct WelcomePage {
_settings_subscription: Subscription,
}