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:
@@ -12,19 +12,17 @@ use gpui_native_kit::clipboard::ClipboardButton;
|
||||
use gpui_native_kit::common::{h_flex, v_flex};
|
||||
use gpui_native_kit::data::tree::{Tree, TreeItem};
|
||||
use gpui_native_kit::icons::{Icon, IconRole};
|
||||
use gpui_native_kit::layout::dock::Panel;
|
||||
use gpui_native_kit::layout::panel::Panel;
|
||||
use gpui_native_kit::layout::resizable::{Resizable, ResizableState};
|
||||
use gpui_native_kit::scrollbar::Scrollbar;
|
||||
use gpui_native_kit::spinner::Spinner;
|
||||
use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _};
|
||||
use metadata::ProfileDirectory;
|
||||
use signed_git::{CommitDiff, DiffStatus, FileCommit, FileDiff, Repo};
|
||||
use signed_state::RepoStore;
|
||||
use utils::relative_time_secs;
|
||||
|
||||
use super::helpers::{DiffRow, diff_rows, render_diff_row};
|
||||
use crate::shared::tree::{TreeItemSeed, TreeRow, build_tree_items, collect_expanded, flatten};
|
||||
use crate::shared::widgets::{empty_state, repo_tab_avatar};
|
||||
use crate::shared::widgets::empty_state;
|
||||
|
||||
pub struct DiffPane {
|
||||
diff: Option<CommitDiff>,
|
||||
@@ -340,36 +338,23 @@ impl Render for DiffPane {
|
||||
}
|
||||
|
||||
pub struct CommitDiffView {
|
||||
store: Entity<RepoStore>,
|
||||
worktree: PathBuf,
|
||||
repo_name: SharedString,
|
||||
commit: FileCommit,
|
||||
/// The diff is being computed on a background task.
|
||||
loading: bool,
|
||||
error: Option<SharedString>,
|
||||
pane: Entity<DiffPane>,
|
||||
/// Profile for the repository owner in the tab title.
|
||||
directory: Entity<ProfileDirectory>,
|
||||
tasks: Vec<Task<Result<(), anyhow::Error>>>,
|
||||
}
|
||||
|
||||
impl CommitDiffView {
|
||||
pub fn new(
|
||||
store: Entity<RepoStore>,
|
||||
worktree: PathBuf,
|
||||
repo_name: SharedString,
|
||||
commit_id: String,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) -> Self {
|
||||
let pane = cx.new(DiffPane::new);
|
||||
let directory = ProfileDirectory::new(cx);
|
||||
|
||||
if let Some(owner) = store.read(cx).announcement.as_ref().map(|a| a.owner) {
|
||||
directory.update(cx, |directory, cx| {
|
||||
directory.track([owner], cx);
|
||||
});
|
||||
}
|
||||
|
||||
let weak = cx.entity().downgrade();
|
||||
window.defer(cx, move |window, cx| {
|
||||
@@ -379,9 +364,7 @@ impl CommitDiffView {
|
||||
});
|
||||
|
||||
Self {
|
||||
store,
|
||||
worktree,
|
||||
repo_name,
|
||||
commit: FileCommit {
|
||||
id: commit_id,
|
||||
summary: String::new(),
|
||||
@@ -392,7 +375,6 @@ impl CommitDiffView {
|
||||
loading: true,
|
||||
error: None,
|
||||
pane,
|
||||
directory,
|
||||
tasks: Vec::new(),
|
||||
}
|
||||
}
|
||||
@@ -518,18 +500,7 @@ impl CommitDiffView {
|
||||
}
|
||||
}
|
||||
|
||||
impl Panel for CommitDiffView {
|
||||
fn title(&self, _cx: &App) -> Option<SharedString> {
|
||||
Some(SharedString::from(format!(
|
||||
"{}/{}",
|
||||
self.repo_name, self.commit.id
|
||||
)))
|
||||
}
|
||||
|
||||
fn lead(&self, cx: &App) -> Option<AnyElement> {
|
||||
Some(repo_tab_avatar(self.store.read(cx), &self.directory, cx))
|
||||
}
|
||||
}
|
||||
impl Panel for CommitDiffView {}
|
||||
|
||||
impl Render for CommitDiffView {
|
||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||
|
||||
Reference in New Issue
Block a user