chore: move new issue/pull form into a split panel
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//! The shared issue and pull-request lists: toolbar, uniform rows, scrollbar
|
||||
//! overlay, and empty state, plus the scrollable commit list.
|
||||
//! The shared issue and pull-request lists: uniform rows, scrollbar overlay, and
|
||||
//! empty state, plus the scrollable commit list.
|
||||
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
@@ -189,19 +189,6 @@ impl EventList {
|
||||
}
|
||||
}
|
||||
|
||||
/// The toolbar above the issue and pull-request lists: a filter and its actions.
|
||||
pub fn filter_toolbar(cx: &App, children: impl IntoIterator<Item = AnyElement>) -> AnyElement {
|
||||
h_flex()
|
||||
.px_4()
|
||||
.w_full()
|
||||
.gap_3()
|
||||
.border_b_1()
|
||||
.border_color(cx.theme().colors.border)
|
||||
.bg(cx.theme().colors.muted)
|
||||
.children(children)
|
||||
.into_any_element()
|
||||
}
|
||||
|
||||
/// A scrollable commit list: uniform `commit_row`s under a scrollbar overlay.
|
||||
pub fn commit_list(
|
||||
id: &'static str,
|
||||
|
||||
@@ -3,7 +3,6 @@ use metadata::ProfileDirectory;
|
||||
use nostr::prelude::PublicKey;
|
||||
|
||||
pub mod event_list;
|
||||
pub mod panels;
|
||||
pub mod progress;
|
||||
|
||||
pub mod widgets;
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
use gpui::{App, AppContext, Entity, SharedString, WeakEntity, Window};
|
||||
use ui::layout::panel::{Panel, PanelSlot};
|
||||
|
||||
use crate::app::AppRoot;
|
||||
use crate::shared::log_dropped;
|
||||
|
||||
/// Opens a panel in `slot`, reusing it when it is already open.
|
||||
fn open_slot<P, F>(
|
||||
slot: PanelSlot,
|
||||
workspace: &WeakEntity<AppRoot>,
|
||||
id: impl Into<SharedString>,
|
||||
build: F,
|
||||
window: &mut Window,
|
||||
cx: &mut App,
|
||||
) where
|
||||
P: Panel + 'static,
|
||||
F: Fn(&mut Window, &mut App) -> Entity<P> + 'static,
|
||||
{
|
||||
let result = workspace.update(cx, |workspace, cx| {
|
||||
workspace
|
||||
.panels()
|
||||
.clone()
|
||||
.update(cx, |panels, cx| panels.open(slot, id, build, window, cx))
|
||||
});
|
||||
if let Err(error) = result {
|
||||
log::warn!("failed to open panel: {error}");
|
||||
}
|
||||
}
|
||||
|
||||
/// Opens a repository in the main panel, reusing it when it is already open.
|
||||
pub fn open_primary<P, F>(
|
||||
workspace: &WeakEntity<AppRoot>,
|
||||
id: impl Into<SharedString>,
|
||||
build: F,
|
||||
window: &mut Window,
|
||||
cx: &mut App,
|
||||
) where
|
||||
P: Panel + 'static,
|
||||
F: Fn(&mut Window, &mut App) -> Entity<P> + 'static,
|
||||
{
|
||||
open_slot(PanelSlot::Main, workspace, id, build, window, cx);
|
||||
}
|
||||
|
||||
/// Opens a detail panel beside the main panel, reusing it when it is already open.
|
||||
pub fn open_detail<P, F>(
|
||||
workspace: &WeakEntity<AppRoot>,
|
||||
id: impl Into<SharedString>,
|
||||
build: F,
|
||||
window: &mut Window,
|
||||
cx: &mut App,
|
||||
) where
|
||||
P: Panel + 'static,
|
||||
F: Fn(&mut Window, &mut App) -> Entity<P> + 'static,
|
||||
{
|
||||
open_slot(PanelSlot::Split, workspace, id, build, window, cx);
|
||||
}
|
||||
|
||||
/// Closes the detail panel open under `id`.
|
||||
pub fn close_detail(workspace: &WeakEntity<AppRoot>, id: &SharedString, cx: &mut impl AppContext) {
|
||||
let result = workspace.update(cx, |workspace, cx| {
|
||||
workspace
|
||||
.panels()
|
||||
.clone()
|
||||
.update(cx, |panels, cx| panels.close(PanelSlot::Split, id, cx))
|
||||
});
|
||||
log_dropped(result);
|
||||
}
|
||||
Reference in New Issue
Block a user