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::{
|
||||
use gpui_native_kit::avatar::Avatar;
|
||||
use gpui_native_kit::common::{Sizable as _, h_flex, v_flex};
|
||||
use gpui_native_kit::icons::Icon;
|
||||
use gpui_native_kit::layout::dock::DockState;
|
||||
use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _};
|
||||
use metadata::ProfileDirectory;
|
||||
use signed_core::Announcement;
|
||||
@@ -15,6 +14,7 @@ use signed_state::{RepoListStore, Timestamp};
|
||||
use utils::relative_time;
|
||||
|
||||
use crate::repo::actions::open_repo_panel;
|
||||
use crate::workspace::Workspace;
|
||||
|
||||
const RECENT_COUNT: usize = 10;
|
||||
|
||||
@@ -64,12 +64,12 @@ pub(super) fn render_card(
|
||||
last_activity: Option<Timestamp>,
|
||||
announcements: &[Announcement],
|
||||
directory: &Entity<ProfileDirectory>,
|
||||
dock: &WeakEntity<DockState>,
|
||||
workspace: &WeakEntity<Workspace>,
|
||||
cx: &mut gpui::App,
|
||||
) -> AnyElement {
|
||||
let owner = directory.read(cx).profile(&announcement.owner, cx);
|
||||
let owner_name = owner.name();
|
||||
let dock = dock.clone();
|
||||
let workspace = workspace.clone();
|
||||
let announcement = announcement.clone();
|
||||
|
||||
let name = announcement
|
||||
@@ -184,7 +184,13 @@ pub(super) fn render_card(
|
||||
),
|
||||
)
|
||||
.on_click(move |_, window, cx| {
|
||||
open_repo_panel(&dock, &announcement.addr(), Some(&announcement), window, cx);
|
||||
open_repo_panel(
|
||||
&workspace,
|
||||
&announcement.addr(),
|
||||
Some(&announcement),
|
||||
window,
|
||||
cx,
|
||||
);
|
||||
})
|
||||
.into_any_element()
|
||||
}
|
||||
|
||||
@@ -3,15 +3,15 @@ mod helpers;
|
||||
use assets::CustomIconName;
|
||||
use gpui::prelude::FluentBuilder as _;
|
||||
use gpui::{
|
||||
AnyElement, App, Context, Entity, InteractiveElement as _, IntoElement, ParentElement as _,
|
||||
Render, SharedString, Styled as _, Subscription, UniformListScrollHandle, WeakEntity, Window,
|
||||
div, px, uniform_list,
|
||||
AnyElement, Context, Entity, InteractiveElement as _, IntoElement, ParentElement as _, Render,
|
||||
SharedString, Styled as _, Subscription, UniformListScrollHandle, WeakEntity, Window, div, px,
|
||||
uniform_list,
|
||||
};
|
||||
use gpui_native_kit::common::{h_flex, v_flex};
|
||||
use gpui_native_kit::empty_state::EmptyState;
|
||||
use gpui_native_kit::icons::{Icon, IconRole};
|
||||
use gpui_native_kit::input::{Input, InputState, InputStateEvent};
|
||||
use gpui_native_kit::layout::dock::{DockState, Panel};
|
||||
use gpui_native_kit::layout::panel::Panel;
|
||||
use gpui_native_kit::scrollbar::Scrollbar;
|
||||
use gpui_native_kit::segmented::{Segmented, SegmentedOption};
|
||||
use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _};
|
||||
@@ -20,12 +20,14 @@ use metadata::ProfileDirectory;
|
||||
use nostr::prelude::PublicKey;
|
||||
use signed_state::RepoListStore;
|
||||
|
||||
use crate::workspace::Workspace;
|
||||
|
||||
const COLUMNS: usize = 2;
|
||||
const CARD_HEIGHT: f32 = 40. + 64. + 48. + 2. + 6.;
|
||||
|
||||
pub struct ExploreView {
|
||||
store: Entity<RepoListStore>,
|
||||
dock: WeakEntity<DockState>,
|
||||
workspace: WeakEntity<Workspace>,
|
||||
scroll_handle: UniformListScrollHandle,
|
||||
filter: RepoFilter,
|
||||
/// Indices matching [`Self::filter`] into the store's `announcements`.
|
||||
@@ -38,7 +40,7 @@ pub struct ExploreView {
|
||||
}
|
||||
|
||||
impl ExploreView {
|
||||
pub fn new(dock: WeakEntity<DockState>, cx: &mut Context<Self>) -> Self {
|
||||
pub fn new(workspace: WeakEntity<Workspace>, cx: &mut Context<Self>) -> Self {
|
||||
let store = RepoListStore::global(cx);
|
||||
let directory = ProfileDirectory::new(cx);
|
||||
|
||||
@@ -63,7 +65,7 @@ impl ExploreView {
|
||||
|
||||
Self {
|
||||
store,
|
||||
dock,
|
||||
workspace,
|
||||
scroll_handle: UniformListScrollHandle::new(),
|
||||
filter: RepoFilter::default(),
|
||||
visible: Vec::new(),
|
||||
@@ -146,20 +148,7 @@ impl ExploreView {
|
||||
}
|
||||
}
|
||||
|
||||
impl Panel for ExploreView {
|
||||
fn title(&self, _cx: &App) -> Option<SharedString> {
|
||||
Some(SharedString::from("Explore"))
|
||||
}
|
||||
|
||||
fn lead(&self, cx: &App) -> Option<AnyElement> {
|
||||
Some(
|
||||
Icon::named(CustomIconName::Globe)
|
||||
.small()
|
||||
.color(cx.theme().colors.muted_foreground)
|
||||
.into_any_element(),
|
||||
)
|
||||
}
|
||||
}
|
||||
impl Panel for ExploreView {}
|
||||
|
||||
impl Render for ExploreView {
|
||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||
@@ -169,7 +158,7 @@ impl Render for ExploreView {
|
||||
let count = self.visible.len();
|
||||
let visible = self.visible.clone();
|
||||
let directory = self.directory.clone();
|
||||
let dock = self.dock.clone();
|
||||
let workspace = self.workspace.clone();
|
||||
let has_repos = count > 0;
|
||||
let rows = visible.len().div_ceil(COLUMNS);
|
||||
|
||||
@@ -207,7 +196,7 @@ impl Render for ExploreView {
|
||||
activity,
|
||||
&announcements,
|
||||
&directory,
|
||||
&dock,
|
||||
&workspace,
|
||||
cx,
|
||||
));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user