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:
@@ -7,7 +7,6 @@ use gpui::{
|
||||
Styled as _, Task, UniformListScrollHandle, WeakEntity, Window, div, uniform_list,
|
||||
};
|
||||
use gpui_native_kit::common::v_flex;
|
||||
use gpui_native_kit::layout::dock::DockState;
|
||||
use gpui_native_kit::scrollbar::Scrollbar;
|
||||
use gpui_native_kit::spinner::Spinner;
|
||||
use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _};
|
||||
@@ -16,12 +15,12 @@ use signed_state::RepoStore;
|
||||
|
||||
use super::commit_diff::CommitDiffView;
|
||||
use super::helpers::commit_row;
|
||||
use super::helpers::repo_display_name;
|
||||
use crate::shared::panels;
|
||||
use crate::workspace::Workspace;
|
||||
|
||||
pub struct RepoHistoryView {
|
||||
store: Entity<RepoStore>,
|
||||
dock: WeakEntity<DockState>,
|
||||
workspace: WeakEntity<Workspace>,
|
||||
worktree: Option<PathBuf>,
|
||||
all_commits: Option<CommitList>,
|
||||
loading_all_commits: bool,
|
||||
@@ -30,10 +29,10 @@ pub struct RepoHistoryView {
|
||||
}
|
||||
|
||||
impl RepoHistoryView {
|
||||
pub fn new(store: Entity<RepoStore>, dock: WeakEntity<DockState>) -> Self {
|
||||
pub fn new(store: Entity<RepoStore>, workspace: WeakEntity<Workspace>) -> Self {
|
||||
Self {
|
||||
store,
|
||||
dock,
|
||||
workspace,
|
||||
worktree: None,
|
||||
all_commits: None,
|
||||
loading_all_commits: false,
|
||||
@@ -100,30 +99,22 @@ impl RepoHistoryView {
|
||||
return;
|
||||
};
|
||||
|
||||
// Same display name as the repo detail panel's title.
|
||||
let repo_name = repo_display_name(self.store.read(cx));
|
||||
let store = self.store.clone();
|
||||
let short = commit_id.get(..8).unwrap_or(commit_id);
|
||||
let label = SharedString::from(format!("Commit {short}"));
|
||||
let commit_id = commit_id.to_owned();
|
||||
let id = match store.read(cx).addr() {
|
||||
Some(addr) => SharedString::from(format!("commit:{addr}:{commit_id}")),
|
||||
None => SharedString::from(format!("commit:{}:{}", worktree.display(), commit_id)),
|
||||
};
|
||||
let dock = self.dock.clone();
|
||||
let workspace = self.workspace.clone();
|
||||
|
||||
panels::open(
|
||||
&dock,
|
||||
panels::open_detail(
|
||||
&workspace,
|
||||
id,
|
||||
label,
|
||||
move |window, cx| {
|
||||
cx.new(|cx| {
|
||||
CommitDiffView::new(
|
||||
store.clone(),
|
||||
worktree.clone(),
|
||||
repo_name.clone(),
|
||||
commit_id.clone(),
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
})
|
||||
cx.new(|cx| CommitDiffView::new(worktree.clone(), commit_id.clone(), window, cx))
|
||||
},
|
||||
window,
|
||||
cx,
|
||||
|
||||
Reference in New Issue
Block a user