chore: re-add inbox panel
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

This commit is contained in:
2026-11-28 10:06:29 +07:00
parent 71bbcfaf51
commit 3c5fb68f7e
8 changed files with 98 additions and 46 deletions
+58 -7
View File
@@ -9,6 +9,7 @@ use nostr::prelude::EventId;
use settings::{AppearanceMode, SettingsStore}; use settings::{AppearanceMode, SettingsStore};
use signed_core::{Announcement, RepoAddr}; use signed_core::{Announcement, RepoAddr};
use signed_state::{Backend, BackendEvent, RepoStore}; use signed_state::{Backend, BackendEvent, RepoStore};
use ui::button::{Button, ButtonVariant};
use ui::common::{h_flex, v_flex}; use ui::common::{h_flex, v_flex};
use ui::icons::IconRole; use ui::icons::IconRole;
use ui::layout::panel::{PanelSlot, PanelStack}; use ui::layout::panel::{PanelSlot, PanelStack};
@@ -16,12 +17,14 @@ use ui::layout::root::{Root, RootContext as _};
use ui::layout::titlebar::Titlebar; use ui::layout::titlebar::Titlebar;
use ui::theme::{ThemeEngine, ThemeVariant}; use ui::theme::{ThemeEngine, ThemeVariant};
use ui::toast::Toast; use ui::toast::Toast;
use ui::tooltip::Tooltip;
use crate::app::placeholder::PlaceholderView; use crate::app::placeholder::PlaceholderView;
use crate::explore::ExploreView; use crate::explore::ExploreView;
use crate::identity::import::ImportDialog; use crate::identity::import::ImportDialog;
use crate::identity::onboarding::OnboardingDialog; use crate::identity::onboarding::OnboardingDialog;
use crate::identity::passphrase::PassphraseDialog; use crate::identity::passphrase::PassphraseDialog;
use crate::inbox::InboxView;
use crate::issues::IssuesView; use crate::issues::IssuesView;
use crate::issues::detail::IssueDetailView; use crate::issues::detail::IssueDetailView;
use crate::pull_requests::{PullRequestDetailView, PullRequestsView}; use crate::pull_requests::{PullRequestDetailView, PullRequestsView};
@@ -232,6 +235,23 @@ impl AppRoot {
} }
} }
/// Opens the explore panel in the main stack.
fn open_explore(&mut self, window: &mut Window, cx: &mut Context<Self>) {
ExploreView::open(&self.panels, cx.weak_entity(), window, cx);
}
/// Opens the inbox panel in the main stack.
fn open_inbox(&mut self, window: &mut Window, cx: &mut Context<Self>) {
InboxView::open_panel(&self.panels, cx.weak_entity(), window, cx);
}
/// Opens the dialog that creates a repository.
fn open_create_repository(&mut self, window: &mut Window, cx: &mut Context<Self>) {
self.titlebar.update(cx, |titlebar, cx| {
titlebar.open_create(window, cx);
});
}
/// Opens the dialog that imports an identity from a secret. /// Opens the dialog that imports an identity from a secret.
pub(crate) fn open_import_dialog(&mut self, _window: &mut Window, cx: &mut Context<Self>) { pub(crate) fn open_import_dialog(&mut self, _window: &mut Window, cx: &mut Context<Self>) {
let dialog = ImportDialog::new(cx); let dialog = ImportDialog::new(cx);
@@ -248,7 +268,8 @@ impl AppRoot {
impl Render for AppRoot { impl Render for AppRoot {
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement { fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
let repo_tabs = PanelStack::main_tabs(self.panels.clone(), cx); let repo_tabs = PanelStack::main_tabs(self.panels.clone(), cx);
let titlebar_view = self.titlebar.read(cx); let repository_switcher = self.titlebar.read(cx).repository_switcher();
let user_menu = self.titlebar.read(cx).render_user_menu(cx);
div() div()
.relative() .relative()
@@ -277,18 +298,48 @@ impl Render for AppRoot {
.prefix( .prefix(
h_flex() h_flex()
.gap_1() .gap_1()
.child(titlebar_view.render_new_repository()) .child(
.child(titlebar_view.render_explore()) Button::new("open-explore")
.child(titlebar_view.repository_switcher()), .icon(IconRole::Grid)
.variant(ButtonVariant::Ghost)
.fully_rounded(true)
.tooltip(Tooltip::text("Explore repositories"))
.on_click(cx.listener(|this, _, window, cx| {
this.open_explore(window, cx);
})),
)
.child(repository_switcher),
) )
.tab_bar( .tab_bar(
h_flex() h_flex()
.gap_1() .gap_1()
.when_some(repo_tabs, |bar, tabs| bar.child(tabs)), .when_some(repo_tabs, |bar, tabs| bar.child(tabs)),
) )
.when_some(titlebar_view.render_user_menu(cx), |titlebar, menu| { .suffix(
titlebar.suffix(menu) h_flex()
}), .gap_1()
.child(
Button::new("add-repo")
.icon(IconRole::Plus)
.variant(ButtonVariant::Ghost)
.fully_rounded(true)
.tooltip(Tooltip::text("Create repository"))
.on_click(cx.listener(|this, _, window, cx| {
this.open_create_repository(window, cx);
})),
)
.child(
Button::new("open-inbox")
.icon(IconRole::Bell)
.variant(ButtonVariant::Ghost)
.fully_rounded(true)
.tooltip(Tooltip::text("Inbox"))
.on_click(cx.listener(|this, _, window, cx| {
this.open_inbox(window, cx);
})),
)
.when_some(user_menu, |bar, menu| bar.child(menu)),
),
) )
.child(self.panels.clone()), .child(self.panels.clone()),
) )
+1 -2
View File
@@ -320,8 +320,7 @@ impl Panel for ExploreView {
fn prefix(&self, cx: &App) -> Option<AnyElement> { fn prefix(&self, cx: &App) -> Option<AnyElement> {
Some( Some(
Icon::named(IconRole::Grid) Icon::named(IconRole::Grid)
.small() .color(cx.theme().colors.foreground)
.color(cx.theme().colors.muted_foreground)
.into_any_element(), .into_any_element(),
) )
} }
+31 -2
View File
@@ -18,7 +18,8 @@ use ui::button::Button;
use ui::common::{StyledExt as _, h_flex, v_flex}; use ui::common::{StyledExt as _, h_flex, v_flex};
use ui::empty_state::EmptyState; use ui::empty_state::EmptyState;
use ui::icons::{Icon, IconRole}; use ui::icons::{Icon, IconRole};
use ui::layout::panel::Panel; use ui::layout::panel::{Panel, PanelSlot, PanelStack};
use ui::theme::ActiveTheme;
mod helpers; mod helpers;
@@ -81,6 +82,26 @@ pub struct InboxView {
} }
impl InboxView { impl InboxView {
pub(crate) const PANEL_ID: &'static str = "Inbox";
/// Opens the inbox panel in the main panel, reusing it when it is already cached.
pub(crate) fn open_panel(
panels: &Entity<PanelStack>,
workspace: WeakEntity<AppRoot>,
window: &mut Window,
cx: &mut App,
) {
panels.update(cx, |panels, cx| {
panels.open(
PanelSlot::Main,
Self::PANEL_ID,
move |_, cx| cx.new(|cx| Self::new(workspace.clone(), cx)),
window,
cx,
);
});
}
pub fn new(workspace: WeakEntity<AppRoot>, cx: &mut Context<Self>) -> Self { pub fn new(workspace: WeakEntity<AppRoot>, cx: &mut Context<Self>) -> Self {
let backend = Backend::global(cx); let backend = Backend::global(cx);
let inbox = backend.read(cx).inbox(); let inbox = backend.read(cx).inbox();
@@ -434,7 +455,15 @@ impl InboxView {
impl Panel for InboxView { impl Panel for InboxView {
fn title(&self, _cx: &App) -> SharedString { fn title(&self, _cx: &App) -> SharedString {
SharedString::from("Inbox") SharedString::from(Self::PANEL_ID)
}
fn prefix(&self, cx: &App) -> Option<AnyElement> {
Some(
Icon::named(IconRole::Bell)
.color(cx.theme().colors.foreground)
.into_any_element(),
)
} }
} }
-1
View File
@@ -1,7 +1,6 @@
mod app; mod app;
mod explore; mod explore;
mod identity; mod identity;
#[expect(dead_code, reason = "unlinked while the shell migrates")]
mod inbox; mod inbox;
mod issues; mod issues;
mod pull_requests; mod pull_requests;
+1 -33
View File
@@ -18,10 +18,8 @@ use ui::icons::{Icon, IconRole};
use ui::layout::panel::PanelSlot; use ui::layout::panel::PanelSlot;
use ui::layout::root::RootContext as _; use ui::layout::root::RootContext as _;
use ui::menu::{Menu, MenuItem}; use ui::menu::{Menu, MenuItem};
use ui::tooltip::Tooltip;
use crate::app::AppRoot; use crate::app::AppRoot;
use crate::explore::ExploreView;
use crate::identity::exit::ExitDialog; use crate::identity::exit::ExitDialog;
use crate::repo::RepoDetailView; use crate::repo::RepoDetailView;
use crate::repo::dialogs::create::CreateRepoDialog; use crate::repo::dialogs::create::CreateRepoDialog;
@@ -328,7 +326,7 @@ impl TitlebarView {
cx.open_dialog(dialog); cx.open_dialog(dialog);
} }
fn open_create(&mut self, window: &mut Window, cx: &mut Context<Self>) { pub(crate) fn open_create(&mut self, window: &mut Window, cx: &mut Context<Self>) {
let view = CreateRepoDialog::new(self.app.clone(), window, cx); let view = CreateRepoDialog::new(self.app.clone(), window, cx);
cx.open_dialog(view); cx.open_dialog(view);
} }
@@ -432,36 +430,6 @@ impl TitlebarView {
Some(self.render_user(&profile, cx).into_any_element()) Some(self.render_user(&profile, cx).into_any_element())
} }
pub fn render_explore(&self) -> Button {
let workspace = self.app.clone();
Button::new("open-explore")
.icon(IconRole::Grid)
.variant(ButtonVariant::Ghost)
.fully_rounded(true)
.tooltip(Tooltip::text("Explore repositories"))
.on_click(move |_, window, cx| {
let panels = workspace.read_with(cx, |root, _| root.panels().clone());
let Ok(panels) = panels else {
return;
};
ExploreView::open(&panels, workspace.clone(), window, cx);
})
}
pub fn render_new_repository(&self) -> Button {
let weak = self.weak.clone();
Button::new("add-repo")
.icon(IconRole::Plus)
.variant(ButtonVariant::Ghost)
.fully_rounded(true)
.tooltip(Tooltip::text("Create repository"))
.on_click(move |_, window, cx| {
log_dropped(weak.update(cx, |this, cx| this.open_create(window, cx)));
})
}
fn render_user(&self, profile: &Profile, _cx: &App) -> impl IntoElement { fn render_user(&self, profile: &Profile, _cx: &App) -> impl IntoElement {
let name = profile.name(); let name = profile.name();
let picture = profile.picture(); let picture = profile.picture();
+1 -1
View File
@@ -410,6 +410,7 @@ impl Tab {
.map(|on_close| self.render_tab_close(&ctx.id, index, on_close)); .map(|on_close| self.render_tab_close(&ctx.id, index, on_close));
div() div()
.when_some(self.lead.take(), |strip_tab, lead| strip_tab.child(lead))
.child( .child(
div() div()
.flex_grow(1.0) .flex_grow(1.0)
@@ -505,7 +506,6 @@ impl Tab {
.max_w(TAB_MAX_WIDTH) .max_w(TAB_MAX_WIDTH)
.when(titlebar, |strip_tab| strip_tab.min_w(TAB_MIN_WIDTH)) .when(titlebar, |strip_tab| strip_tab.min_w(TAB_MIN_WIDTH))
}) })
.when_some(self.lead.take(), |strip_tab, lead| strip_tab.child(lead))
.when(ctx.variant == TabsVariant::Pill, |strip_tab| { .when(ctx.variant == TabsVariant::Pill, |strip_tab| {
strip_tab.child(div().flex_none().w_4()) strip_tab.child(div().flex_none().w_4())
}) })
+3
View File
@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none">
<path d="M20.25 16.2441C20.25 16.7996 19.7996 17.25 19.2441 17.25H4.75593C4.20037 17.25 3.75 16.7996 3.75 16.2441C3.75 16.0837 3.78835 15.9256 3.86186 15.7831L4.9998 13.5761C5.19559 13.1964 5.30802 12.7793 5.32957 12.3526L5.50351 8.90897C5.6766 5.45882 8.53386 2.75 12 2.75C15.4661 2.75 18.3234 5.45882 18.4965 8.90897L18.6704 12.3526C18.692 12.7793 18.8044 13.1964 19.0002 13.5761L20.1381 15.7831C20.2116 15.9256 20.25 16.0837 20.25 16.2441Z" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M16 17.25C16 19.4591 14.2091 21.25 12 21.25C9.79086 21.25 8 19.4591 8 17.25" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 775 B

+3
View File
@@ -59,6 +59,7 @@ pub enum IconRole {
EllipsisVertical, EllipsisVertical,
ArrowUp, ArrowUp,
Inbox, Inbox,
Bell,
Stack, Stack,
Message, Message,
PanelLeft, PanelLeft,
@@ -112,6 +113,7 @@ impl IconRole {
Self::EllipsisVertical => "ellipsis-vertical", Self::EllipsisVertical => "ellipsis-vertical",
Self::ArrowUp => "arrow-up", Self::ArrowUp => "arrow-up",
Self::Inbox => "inbox", Self::Inbox => "inbox",
Self::Bell => "bell",
Self::Stack => "stack", Self::Stack => "stack",
Self::Message => "message", Self::Message => "message",
Self::PanelLeft => "panel-left", Self::PanelLeft => "panel-left",
@@ -165,6 +167,7 @@ impl IconRole {
Self::EllipsisVertical => "icons/ellipsis-vertical.svg", Self::EllipsisVertical => "icons/ellipsis-vertical.svg",
Self::ArrowUp => "icons/arrow-up.svg", Self::ArrowUp => "icons/arrow-up.svg",
Self::Inbox => "icons/inbox.svg", Self::Inbox => "icons/inbox.svg",
Self::Bell => "icons/bell.svg",
Self::Stack => "icons/stack.svg", Self::Stack => "icons/stack.svg",
Self::Message => "icons/message.svg", Self::Message => "icons/message.svg",
Self::PanelLeft => "icons/panel-left.svg", Self::PanelLeft => "icons/panel-left.svg",