Replace dock shell with titlebar repository tabs

- Move repository navigation from the dock sidebar to titlebar tabs.
- Route main and detail panels through Workspace.
- Move sign-in into the main panel and remove unlinked navigation.
This commit is contained in:
2026-11-15 13:37:32 +07:00
parent d79d2c7a27
commit 5bd289b418
29 changed files with 1041 additions and 1242 deletions
+59 -9
View File
@@ -1,9 +1,13 @@
use gpui::{App, Entity, SharedString, WeakEntity, Window};
use gpui_native_kit::layout::dock::{DockState, Panel};
use std::sync::Arc;
/// Registers a panel builder under `id` and opens it in the dock.
pub fn open<P, F>(
dock: &WeakEntity<DockState>,
use gpui::{App, Entity, SharedString, WeakEntity, Window};
use gpui_native_kit::layout::panel::{Panel, PanelView};
use crate::workspace::Workspace;
/// Opens a repository in the main panel, reusing it when it is already cached.
pub fn open_primary<P, F>(
workspace: &WeakEntity<Workspace>,
id: impl Into<SharedString>,
build: F,
window: &mut Window,
@@ -14,10 +18,56 @@ pub fn open<P, F>(
{
let id = id.into();
if let Err(error) = dock.update(cx, |dock, cx| {
dock.register_panel(id.clone(), build);
dock.open_panel(&id, window, cx);
if workspace
.read_with(cx, |workspace, _| workspace.has_main(&id))
.unwrap_or(false)
{
if let Err(error) = workspace.update(cx, |workspace, cx| workspace.activate_main(&id, cx)) {
log::warn!("failed to activate repository {id}: {error}");
}
return;
}
let view: Arc<dyn PanelView> = Arc::new(build(window, cx));
if let Err(error) = workspace.update(cx, |workspace, cx| {
workspace.show_main(id.clone(), view, cx)
}) {
log::warn!("failed to open panel {id}: {error}");
log::warn!("failed to open repository {id}: {error}");
}
}
/// Opens a detail panel beside the main panel, reusing it when it is already cached.
pub fn open_detail<P, F>(
workspace: &WeakEntity<Workspace>,
id: impl Into<SharedString>,
label: 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 id = id.into();
let label = label.into();
if workspace
.read_with(cx, |workspace, _| workspace.has_detail(&id))
.unwrap_or(false)
{
if let Err(error) = workspace.update(cx, |workspace, cx| workspace.activate_detail(&id, cx))
{
log::warn!("failed to activate detail panel {id}: {error}");
}
return;
}
let view: Arc<dyn PanelView> = Arc::new(build(window, cx));
if let Err(error) = workspace.update(cx, |workspace, cx| {
workspace.show_detail(id.clone(), label, view, cx)
}) {
log::warn!("failed to open detail panel {id}: {error}");
}
}
+1 -43
View File
@@ -1,17 +1,11 @@
use assets::CustomIconName;
use gpui::{
AnyElement, App, Entity, IntoElement, ParentElement as _, SharedString, Styled as _, div,
};
use gpui_native_kit::avatar::Avatar;
use gpui::{AnyElement, App, IntoElement, ParentElement as _, SharedString, Styled as _, div};
use gpui_native_kit::badge::{Badge, BadgeVariant};
use gpui_native_kit::common::Sizable as _;
use gpui_native_kit::empty_state::EmptyState;
use gpui_native_kit::icons::Icon;
use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _};
use gpui_native_kit::tooltip::Tooltip;
use metadata::ProfileDirectory;
use signed_core::RepoStatus;
use signed_state::RepoStore;
/// The status pill shown on issue and pull-request rows.
pub fn status_badge(status: RepoStatus) -> Badge {
@@ -51,42 +45,6 @@ pub fn empty_state(message: impl Into<SharedString>) -> AnyElement {
.into_any_element()
}
/// The profile avatar shown on a repository's panel tab.
pub fn repo_tab_avatar(
store: &RepoStore,
directory: &Entity<ProfileDirectory>,
cx: &App,
) -> AnyElement {
let seed = store
.announcement
.as_ref()
.map(|announcement| format!("{}:{}", announcement.owner, announcement.id))
.or_else(|| store.addr().map(|addr| addr.to_string()))
.or_else(|| {
store
.path
.as_ref()
.map(|path| path.to_string_lossy().into_owned())
})
.unwrap_or_default();
let owner = store
.announcement
.as_ref()
.map(|announcement| directory.read(cx).profile(&announcement.owner, cx));
let (name, picture) = owner
.map(|profile| (Some(profile.name()), profile.picture()))
.unwrap_or((None, None));
let avatar = match name {
Some(name) => Avatar::new(seed).name(name),
None => Avatar::new(seed),
};
avatar.picture(picture).small().into_any_element()
}
/// A one-line muted label used by section headers.
pub fn section_label(text: impl Into<SharedString>, cx: &App) -> AnyElement {
div()