update gpui-native-kit and adopt file icon roles
Rust / build (macos-latest, stable) (push) Canceled after 0s
Rust / build (ubuntu-latest, stable) (push) Canceled after 0s
Rust / build (windows-latest, stable) (push) Canceled after 0s
Rust / build (macos-latest, stable) (pull_request) Canceled after 0s
Rust / build (ubuntu-latest, stable) (pull_request) Canceled after 0s
Rust / build (windows-latest, stable) (pull_request) Canceled after 0s
Rust / build (macos-latest, stable) (push) Canceled after 0s
Rust / build (ubuntu-latest, stable) (push) Canceled after 0s
Rust / build (windows-latest, stable) (push) Canceled after 0s
Rust / build (macos-latest, stable) (pull_request) Canceled after 0s
Rust / build (ubuntu-latest, stable) (pull_request) Canceled after 0s
Rust / build (windows-latest, stable) (pull_request) Canceled after 0s
This commit is contained in:
@@ -76,6 +76,22 @@ impl AppRoot {
|
||||
apply_appearance(&settings, cx);
|
||||
}));
|
||||
|
||||
subscriptions.push(cx.observe(&dock, |this, dock, cx| {
|
||||
let Some(panel) = dock.read(cx).active_panel() else {
|
||||
return;
|
||||
};
|
||||
|
||||
if !panel.starts_with("repo:") && !panel.starts_with("repo-local:") {
|
||||
return;
|
||||
}
|
||||
|
||||
this.layout.update(cx, |layout, cx| {
|
||||
if !layout.is_right_sidebar_visible() {
|
||||
layout.set_right_sidebar_visible(true, cx);
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
window.defer(cx, move |_window, cx| {
|
||||
if backend.read(cx).passphrase_required() {
|
||||
identity::helpers::open_passphrase(cx);
|
||||
@@ -128,6 +144,7 @@ impl Render for AppRoot {
|
||||
.child(
|
||||
Shell::new("signed-shell", self.layout.clone())
|
||||
.left_sidebar(self.sidebar.read(cx).build(cx))
|
||||
.right_sidebar(div())
|
||||
.center(
|
||||
Dock::new("signed-dock", self.dock.clone())
|
||||
.window_controls(true)
|
||||
|
||||
@@ -127,11 +127,11 @@ impl ExploreView {
|
||||
Segmented::new("explore-filter", self.filter)
|
||||
.options(vec![
|
||||
SegmentedOption::new(RepoFilter::All, "All")
|
||||
.icon(Icon::named(CustomIconName::Grid).small().color(muted)),
|
||||
.icon(Icon::named(IconRole::Grid).small().color(muted)),
|
||||
SegmentedOption::new(RepoFilter::Popular, "Popular")
|
||||
.icon(Icon::named(CustomIconName::Trending).small().color(muted)),
|
||||
SegmentedOption::new(RepoFilter::Recent, "Recent")
|
||||
.icon(Icon::named(CustomIconName::Recent).small().color(muted)),
|
||||
.icon(Icon::named(IconRole::Clock).small().color(muted)),
|
||||
])
|
||||
.on_change(move |filter, _, cx| {
|
||||
if let Err(error) = weak.update(cx, |this, cx| {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
use assets::CustomIconName;
|
||||
use gpui::prelude::FluentBuilder as _;
|
||||
use gpui::{
|
||||
AnyElement, App, AppContext as _, Context, Entity, IntoElement, ParentElement as _, Render,
|
||||
@@ -8,7 +7,7 @@ use gpui_native_kit::button::Button;
|
||||
use gpui_native_kit::common::v_flex;
|
||||
use gpui_native_kit::dialog::Dialog;
|
||||
use gpui_native_kit::field::Field;
|
||||
use gpui_native_kit::icons::Icon;
|
||||
use gpui_native_kit::icons::{Icon, IconRole};
|
||||
use gpui_native_kit::input::{Input, InputState, InputStateEvent};
|
||||
use signed_state::Backend;
|
||||
|
||||
@@ -116,7 +115,7 @@ impl Render for PassphraseDialog {
|
||||
|
||||
let unlock: AnyElement = Button::new("unlock")
|
||||
.label("Unlock")
|
||||
.icon(Icon::named(CustomIconName::Unlock))
|
||||
.icon(Icon::named(IconRole::Unlock))
|
||||
.loading(busy)
|
||||
.disabled(busy)
|
||||
.on_click(move |_, _, cx| {
|
||||
|
||||
@@ -341,7 +341,7 @@ impl NewPullRequestView {
|
||||
.when_some(refresh_fork, |this, fork| {
|
||||
this.child(
|
||||
Button::new("refresh-fork")
|
||||
.icon(Icon::named(CustomIconName::Refresh))
|
||||
.icon(Icon::named(IconRole::Refresh))
|
||||
.on_click(cx.listener(move |this, _, window, cx| {
|
||||
this.choose_fork(fork.clone(), window, cx);
|
||||
})),
|
||||
|
||||
@@ -157,7 +157,7 @@ impl DiffPane {
|
||||
if row.expandable {
|
||||
item.icon(Icon::named(IconRole::Folder))
|
||||
} else {
|
||||
item
|
||||
item.icon(Icon::named(IconRole::File))
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
|
||||
@@ -272,7 +272,7 @@ impl RepoFilesView {
|
||||
if row.expandable {
|
||||
item.icon(Icon::named(IconRole::Folder))
|
||||
} else {
|
||||
item
|
||||
item.icon(Icon::named(IconRole::File))
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
|
||||
@@ -1019,7 +1019,7 @@ impl RepoDetailView {
|
||||
.gap_1()
|
||||
.child(
|
||||
Button::new("sync-banner")
|
||||
.icon(Icon::named(CustomIconName::Refresh))
|
||||
.icon(Icon::named(IconRole::Refresh))
|
||||
.label("Sync now")
|
||||
.small()
|
||||
.loading(pushing)
|
||||
|
||||
@@ -2,7 +2,6 @@ use std::time::{SystemTime, UNIX_EPOCH};
|
||||
|
||||
use gpui::{AnyElement, App, IntoElement, SharedString};
|
||||
use gpui_native_kit::avatar::Avatar;
|
||||
use gpui_native_kit::common::Sizable as _;
|
||||
use metadata::ProfileDirectory;
|
||||
use signed_state::{Nip34Binding, ResolvedLocalRepo};
|
||||
|
||||
@@ -36,9 +35,7 @@ pub(super) fn local_avatar(
|
||||
cx: &App,
|
||||
) -> AnyElement {
|
||||
let Some(owner) = entry.nip34.as_ref().and_then(|binding| binding.owner) else {
|
||||
return Avatar::new(entry.path.to_string_lossy())
|
||||
.small()
|
||||
.into_any_element();
|
||||
return Avatar::new(entry.path.to_string_lossy()).into_any_element();
|
||||
};
|
||||
|
||||
let profile = directory.read(cx).profile(&owner, cx);
|
||||
@@ -46,6 +43,5 @@ pub(super) fn local_avatar(
|
||||
Avatar::new(owner)
|
||||
.name(profile.name())
|
||||
.picture(profile.picture())
|
||||
.small()
|
||||
.into_any_element()
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ use gpui::{
|
||||
use gpui_native_kit::avatar::Avatar;
|
||||
use gpui_native_kit::badge::{Badge, BadgeVariant};
|
||||
use gpui_native_kit::button::{Button, ButtonVariant};
|
||||
use gpui_native_kit::common::{Sizable as _, h_flex, v_flex};
|
||||
use gpui_native_kit::common::{h_flex, v_flex};
|
||||
use gpui_native_kit::data::sidebar::{Sidebar, SidebarEntry};
|
||||
use gpui_native_kit::icons::{Icon, IconRole};
|
||||
use gpui_native_kit::layout::dock::DockState;
|
||||
@@ -28,6 +28,7 @@ use signed_state::{
|
||||
use crate::explore::ExploreView;
|
||||
use crate::inbox::InboxView;
|
||||
use crate::repo::dialogs;
|
||||
use crate::shared::log_dropped;
|
||||
use crate::{identity, settings};
|
||||
|
||||
mod helpers;
|
||||
@@ -232,56 +233,49 @@ impl SidebarView {
|
||||
.footer(self.render_footer(cx))
|
||||
.entries(move |_, cx| {
|
||||
let muted = cx.theme().colors.muted_foreground;
|
||||
|
||||
let mut entries = vec![
|
||||
SidebarEntry::row("inbox", "Inbox")
|
||||
.prefix(Icon::named(CustomIconName::Inbox).small().color(muted)),
|
||||
.prefix(Icon::named(CustomIconName::Inbox).color(muted)),
|
||||
SidebarEntry::row("browse", "Browse")
|
||||
.prefix(Icon::named(CustomIconName::Globe).small().color(muted)),
|
||||
.prefix(Icon::named(CustomIconName::Globe).color(muted)),
|
||||
SidebarEntry::row("search", "Search")
|
||||
.prefix(Icon::named(IconRole::Search).small().color(muted)),
|
||||
SidebarEntry::header("All Repositories"),
|
||||
.prefix(Icon::named(IconRole::Search).color(muted)),
|
||||
SidebarEntry::header("Repositories"),
|
||||
];
|
||||
|
||||
for announcement in announcements.iter() {
|
||||
let addr = announcement.addr();
|
||||
let owner = directory.read(cx).profile(&announcement.owner, cx);
|
||||
|
||||
let count = unpushed.get(&addr).copied().unwrap_or(0);
|
||||
let unsynced = sync_directory.read(cx).unsynced(&addr, cx);
|
||||
|
||||
let name = announcement
|
||||
.name
|
||||
.as_deref()
|
||||
.map(SharedString::from)
|
||||
.unwrap_or_else(|| SharedString::from(announcement.id.clone()));
|
||||
let addr = announcement.addr();
|
||||
let mut row = SidebarEntry::row(
|
||||
SharedString::from(format!("repo:{}", announcement.id)),
|
||||
name,
|
||||
)
|
||||
.prefix(
|
||||
Avatar::new(announcement.owner)
|
||||
.name(owner.name())
|
||||
.picture(owner.picture())
|
||||
.small(),
|
||||
);
|
||||
|
||||
let count = unpushed.get(&addr).copied().unwrap_or(0);
|
||||
let unsynced = sync_directory.read(cx).unsynced(&addr, cx);
|
||||
let mut row = SidebarEntry::row(format!("repo:{}", announcement.id), name)
|
||||
.prefix(
|
||||
Avatar::new(announcement.owner)
|
||||
.name(owner.name())
|
||||
.picture(owner.picture()),
|
||||
);
|
||||
|
||||
if count > 0 || unsynced > 0 {
|
||||
let mut badges = h_flex().gap_1();
|
||||
if count > 0 {
|
||||
badges = badges.child(
|
||||
Badge::new(
|
||||
SharedString::from(format!("unpushed:{addr}")),
|
||||
count.to_string(),
|
||||
)
|
||||
.variant(BadgeVariant::Danger),
|
||||
Badge::new(format!("unpushed:{addr}"), count.to_string())
|
||||
.variant(BadgeVariant::Warning),
|
||||
);
|
||||
}
|
||||
if unsynced > 0 {
|
||||
badges = badges.child(
|
||||
Badge::new(
|
||||
SharedString::from(format!("unsynced:{addr}")),
|
||||
unsynced.to_string(),
|
||||
)
|
||||
.variant(BadgeVariant::Accent),
|
||||
Badge::new(format!("unsynced:{addr}"), unsynced.to_string())
|
||||
.variant(BadgeVariant::Accent),
|
||||
);
|
||||
}
|
||||
row = row.suffix(badges);
|
||||
@@ -301,31 +295,19 @@ impl SidebarView {
|
||||
Nip34Kind::Cloned => ("Cloned", "Cloned but not initialized"),
|
||||
Nip34Kind::ToolingOnly => ("Tooling", "Grasp tooling only"),
|
||||
};
|
||||
Badge::new(
|
||||
SharedString::from(format!("local-badge:{}", entry.path.display())),
|
||||
label,
|
||||
)
|
||||
.tooltip(Tooltip::text(note))
|
||||
.into_any_element()
|
||||
Badge::new(format!("lbadge:{}", entry.path.display()), label)
|
||||
.tooltip(Tooltip::text(note))
|
||||
.into_any_element()
|
||||
}
|
||||
None => Badge::new(
|
||||
SharedString::from(format!(
|
||||
"local-unpublished:{}",
|
||||
entry.path.display()
|
||||
)),
|
||||
"Unpublished",
|
||||
)
|
||||
.variant(BadgeVariant::Warning)
|
||||
.into_any_element(),
|
||||
None => Badge::new(format!("un-{}", entry.path.display()), "Unpublished")
|
||||
.variant(BadgeVariant::Outline)
|
||||
.into_any_element(),
|
||||
};
|
||||
|
||||
entries.push(
|
||||
SidebarEntry::row(
|
||||
SharedString::from(format!("local-repo:{}", entry.path.display())),
|
||||
entry.name(),
|
||||
)
|
||||
.prefix(local_avatar(entry, &directory, cx))
|
||||
.suffix(suffix),
|
||||
SidebarEntry::row(format!("lrepo:{}", entry.path.display()), entry.name())
|
||||
.prefix(local_avatar(entry, &directory, cx))
|
||||
.suffix(suffix),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -417,6 +399,7 @@ impl SidebarView {
|
||||
let id = SharedString::from(format!("repo-local:{}", path.display()));
|
||||
let dock = self.dock.clone();
|
||||
let dock_for_build = dock.clone();
|
||||
|
||||
crate::shared::panels::open(
|
||||
&dock,
|
||||
id,
|
||||
@@ -438,9 +421,6 @@ impl SidebarView {
|
||||
|
||||
fn render_footer(&self, _cx: &App) -> impl IntoElement {
|
||||
let guide_weak = self.weak.clone();
|
||||
let settings_click = |_: &gpui::ClickEvent, _: &mut Window, cx: &mut gpui::App| {
|
||||
settings::open(cx);
|
||||
};
|
||||
|
||||
v_flex()
|
||||
.p_2()
|
||||
@@ -448,19 +428,25 @@ impl SidebarView {
|
||||
.w_full()
|
||||
.child(
|
||||
Button::new("guide")
|
||||
.icon(IconRole::Info)
|
||||
.label("Guide")
|
||||
.side(gpui_native_kit::button::ButtonSide::Left)
|
||||
.variant(ButtonVariant::Ghost)
|
||||
.on_click(move |_, window, cx| {
|
||||
crate::shared::log_dropped(guide_weak.update(cx, |this, cx| {
|
||||
log_dropped(guide_weak.update(cx, |this, cx| {
|
||||
this.open_explore(window, cx);
|
||||
}));
|
||||
}),
|
||||
)
|
||||
.child(
|
||||
Button::new("settings")
|
||||
.icon(IconRole::Settings)
|
||||
.label("Settings")
|
||||
.side(gpui_native_kit::button::ButtonSide::Left)
|
||||
.variant(ButtonVariant::Ghost)
|
||||
.on_click(settings_click),
|
||||
.on_click(|_, _, cx| {
|
||||
settings::open(cx);
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user