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:
@@ -14,7 +14,7 @@ use gpui_native_kit::badge::Badge;
|
||||
use gpui_native_kit::button::{Button, ButtonVariant};
|
||||
use gpui_native_kit::common::{Sizable as _, h_flex, v_flex};
|
||||
use gpui_native_kit::icons::{Icon, IconRole};
|
||||
use gpui_native_kit::layout::dock::{DockState, Panel};
|
||||
use gpui_native_kit::layout::panel::Panel;
|
||||
use gpui_native_kit::spinner::Spinner;
|
||||
use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _};
|
||||
use metadata::ProfileDirectory;
|
||||
@@ -38,12 +38,12 @@ pub mod refs;
|
||||
|
||||
use banners::Banners;
|
||||
use files::RepoFilesView;
|
||||
use helpers::{RepoData, load_repo_data, repo_display_name};
|
||||
use helpers::{RepoData, load_repo_data};
|
||||
use history::RepoHistoryView;
|
||||
use refs::RefSwitcher;
|
||||
|
||||
use crate::shared::tree::{build_tree_items, sorted_worktree_paths};
|
||||
use crate::shared::widgets::repo_tab_avatar;
|
||||
use crate::workspace::Workspace;
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||
pub enum RefKind {
|
||||
@@ -54,7 +54,7 @@ pub enum RefKind {
|
||||
}
|
||||
|
||||
pub struct RepoDetailView {
|
||||
pub(super) dock: WeakEntity<DockState>,
|
||||
pub(super) workspace: WeakEntity<Workspace>,
|
||||
pub(super) store: Entity<RepoStore>,
|
||||
/// A repository opened by address alone starts without an announcement.
|
||||
repo_started: bool,
|
||||
@@ -86,30 +86,30 @@ pub struct RepoDetailView {
|
||||
|
||||
impl RepoDetailView {
|
||||
pub fn new(
|
||||
dock: WeakEntity<DockState>,
|
||||
workspace: WeakEntity<Workspace>,
|
||||
addr: RepoAddr,
|
||||
hint: Option<Announcement>,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) -> Self {
|
||||
let store = cx.new(|cx| RepoStore::new(addr, hint, cx));
|
||||
Self::new_common(dock, store, window, cx)
|
||||
Self::new_common(workspace, store, window, cx)
|
||||
}
|
||||
|
||||
pub fn new_local(
|
||||
dock: WeakEntity<DockState>,
|
||||
workspace: WeakEntity<Workspace>,
|
||||
local_path: PathBuf,
|
||||
nip34: Option<Nip34Binding>,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) -> Self {
|
||||
let store = cx.new(move |_cx| RepoStore::new_local(local_path, nip34));
|
||||
Self::new_common(dock, store, window, cx)
|
||||
Self::new_common(workspace, store, window, cx)
|
||||
}
|
||||
|
||||
/// A local repository whose detected binding matches an announcement.
|
||||
pub fn new_local_announced(
|
||||
dock: WeakEntity<DockState>,
|
||||
workspace: WeakEntity<Workspace>,
|
||||
announcement: Announcement,
|
||||
local_path: PathBuf,
|
||||
window: &mut Window,
|
||||
@@ -117,18 +117,18 @@ impl RepoDetailView {
|
||||
) -> Self {
|
||||
let addr = announcement.addr();
|
||||
let store = cx.new(move |cx| RepoStore::from_worktree(addr, announcement, local_path, cx));
|
||||
Self::new_common(dock, store, window, cx)
|
||||
Self::new_common(workspace, store, window, cx)
|
||||
}
|
||||
|
||||
fn new_common(
|
||||
dock: WeakEntity<DockState>,
|
||||
workspace: WeakEntity<Workspace>,
|
||||
store: Entity<RepoStore>,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) -> Self {
|
||||
let checkouts = CheckoutsStore::global(cx);
|
||||
let files = cx.new(RepoFilesView::new);
|
||||
let history = cx.new(|_| RepoHistoryView::new(store.clone(), dock.clone()));
|
||||
let history = cx.new(|_| RepoHistoryView::new(store.clone(), workspace.clone()));
|
||||
let weak = cx.entity().downgrade();
|
||||
let refs = RefSwitcher::new(weak.clone(), window, cx);
|
||||
|
||||
@@ -147,7 +147,7 @@ impl RepoDetailView {
|
||||
});
|
||||
|
||||
Self {
|
||||
dock,
|
||||
workspace,
|
||||
store: store.clone(),
|
||||
repo_started: false,
|
||||
files,
|
||||
@@ -1185,15 +1185,7 @@ impl RepoDetailView {
|
||||
}
|
||||
}
|
||||
|
||||
impl Panel for RepoDetailView {
|
||||
fn title(&self, cx: &App) -> Option<SharedString> {
|
||||
Some(repo_display_name(self.store.read(cx)))
|
||||
}
|
||||
|
||||
fn lead(&self, cx: &App) -> Option<AnyElement> {
|
||||
Some(repo_tab_avatar(self.store.read(cx), &self.directory, cx))
|
||||
}
|
||||
}
|
||||
impl Panel for RepoDetailView {}
|
||||
|
||||
impl Render for RepoDetailView {
|
||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||
|
||||
Reference in New Issue
Block a user