mirror of
https://github.com/zed-industries/zed.git
synced 2024-10-23 06:56:33 +00:00
starter modal
This commit is contained in:
parent
38f10fe8b4
commit
7d5b6c6705
1 changed files with 63 additions and 2 deletions
|
@ -1,5 +1,66 @@
|
|||
use gpui::{
|
||||
Action, AnyElement, AppContext, DismissEvent, EventEmitter, FocusHandle, FocusableView,
|
||||
Subscription, Task, View, ViewContext, WeakView,
|
||||
div, prelude::*, AppContext, DismissEvent, EventEmitter, FocusHandle, FocusableView,
|
||||
Refineable, Render, ScrollHandle, ViewContext, WeakView,
|
||||
};
|
||||
use ui::{ActiveTheme, IntoElement};
|
||||
use workspace::{ModalView, Workspace};
|
||||
|
||||
gpui::actions!(repl, [ConnectJupyterServer]);
|
||||
|
||||
struct JupyterServers {
|
||||
focus_handle: FocusHandle,
|
||||
scroll_handle: ScrollHandle,
|
||||
workspace: WeakView<Workspace>,
|
||||
}
|
||||
|
||||
impl JupyterServers {
|
||||
pub fn register(workspace: &mut Workspace, _: &mut ViewContext<Workspace>) {
|
||||
//
|
||||
workspace.register_action(|workspace, _: &ConnectJupyterServer, cx| {
|
||||
let handle = cx.view().downgrade();
|
||||
workspace.toggle_modal(cx, |cx| Self::new(cx, handle));
|
||||
});
|
||||
}
|
||||
|
||||
pub fn new(cx: &mut ViewContext<Self>, workspace: WeakView<Workspace>) -> Self {
|
||||
let focus_handle = cx.focus_handle();
|
||||
// let dev_server_store = dev_server_projects::Store::global(cx);
|
||||
|
||||
// let subscription = cx.observe(&dev_server_store, |_, _, cx| {
|
||||
// cx.notify();
|
||||
// });
|
||||
|
||||
let mut base_style = cx.text_style();
|
||||
base_style.refine(&gpui::TextStyleRefinement {
|
||||
color: Some(cx.theme().colors().editor_foreground),
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
Self {
|
||||
// mode: Mode::Default,
|
||||
focus_handle,
|
||||
scroll_handle: ScrollHandle::new(),
|
||||
// dev_server_store,
|
||||
workspace,
|
||||
// _dev_server_subscription: subscription,
|
||||
// selectable_items: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ModalView for JupyterServers {}
|
||||
|
||||
impl EventEmitter<DismissEvent> for JupyterServers {}
|
||||
|
||||
impl FocusableView for JupyterServers {
|
||||
fn focus_handle(&self, _cx: &AppContext) -> FocusHandle {
|
||||
self.focus_handle.clone()
|
||||
}
|
||||
}
|
||||
|
||||
impl Render for JupyterServers {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
div().child("test")
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue