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:
@@ -1,11 +1,11 @@
|
||||
use gpui::{App, AppContext as _, SharedString, WeakEntity, Window};
|
||||
use gpui_native_kit::layout::dock::DockState;
|
||||
use nostr::prelude::EventId;
|
||||
use signed_core::{Announcement, RepoAddr};
|
||||
use signed_state::RepoStore;
|
||||
|
||||
use crate::repo::RepoDetailView;
|
||||
use crate::shared::panels;
|
||||
use crate::workspace::Workspace;
|
||||
|
||||
/// An item of a repository to open from outside its detail panel.
|
||||
pub enum RepoItem {
|
||||
@@ -14,9 +14,9 @@ pub enum RepoItem {
|
||||
Patch,
|
||||
}
|
||||
|
||||
/// Opens a repository as a dock panel, keyed by its address.
|
||||
/// Opens a repository as the main panel, keyed by its address.
|
||||
pub fn open_repo_panel(
|
||||
dock: &WeakEntity<DockState>,
|
||||
workspace: &WeakEntity<Workspace>,
|
||||
addr: &RepoAddr,
|
||||
hint: Option<&Announcement>,
|
||||
window: &mut Window,
|
||||
@@ -25,15 +25,15 @@ pub fn open_repo_panel(
|
||||
let id = SharedString::from(format!("repo:{addr}"));
|
||||
let addr = addr.clone();
|
||||
let hint = hint.cloned();
|
||||
let dock_for_build = dock.clone();
|
||||
let workspace_for_build = workspace.clone();
|
||||
|
||||
panels::open(
|
||||
dock,
|
||||
panels::open_primary(
|
||||
workspace,
|
||||
id,
|
||||
move |window, cx| {
|
||||
let addr = addr.clone();
|
||||
let hint = hint.clone();
|
||||
cx.new(|cx| RepoDetailView::new(dock_for_build.clone(), addr, hint, window, cx))
|
||||
cx.new(|cx| RepoDetailView::new(workspace_for_build.clone(), addr, hint, window, cx))
|
||||
},
|
||||
window,
|
||||
cx,
|
||||
@@ -42,7 +42,7 @@ pub fn open_repo_panel(
|
||||
|
||||
/// Opens an issue or pull request using a store built here.
|
||||
pub fn open_repo_item(
|
||||
dock: &WeakEntity<DockState>,
|
||||
workspace: &WeakEntity<Workspace>,
|
||||
addr: &RepoAddr,
|
||||
hint: Option<&Announcement>,
|
||||
item: RepoItem,
|
||||
@@ -53,10 +53,14 @@ pub fn open_repo_item(
|
||||
match item {
|
||||
RepoItem::Issue(issue_id) => {
|
||||
let id = SharedString::from(format!("issue:{issue_id}"));
|
||||
let hex = issue_id.to_hex();
|
||||
let short = hex.get(..8).unwrap_or(&hex);
|
||||
let label = SharedString::from(format!("Issue {short}"));
|
||||
let store = store.clone();
|
||||
panels::open(
|
||||
dock,
|
||||
panels::open_detail(
|
||||
workspace,
|
||||
id,
|
||||
label,
|
||||
move |_, cx| {
|
||||
cx.new(|cx| {
|
||||
crate::issues::detail::IssueDetailView::new(store.clone(), issue_id, cx)
|
||||
@@ -68,15 +72,19 @@ pub fn open_repo_item(
|
||||
}
|
||||
RepoItem::PullRequest(pr_id) => {
|
||||
let id = SharedString::from(format!("pr:{pr_id}"));
|
||||
let dock_for_build = dock.clone();
|
||||
let hex = pr_id.to_hex();
|
||||
let short = hex.get(..8).unwrap_or(&hex);
|
||||
let label = SharedString::from(format!("PR {short}"));
|
||||
let workspace_for_build = workspace.clone();
|
||||
let store = store.clone();
|
||||
panels::open(
|
||||
dock,
|
||||
panels::open_detail(
|
||||
workspace,
|
||||
id,
|
||||
label,
|
||||
move |window, cx| {
|
||||
cx.new(|cx| {
|
||||
crate::pull_requests::PullRequestDetailView::new(
|
||||
dock_for_build.clone(),
|
||||
workspace_for_build.clone(),
|
||||
store.clone(),
|
||||
pr_id,
|
||||
window,
|
||||
|
||||
Reference in New Issue
Block a user