update ui
This commit is contained in:
+185
-117
@@ -6,13 +6,15 @@ Ported from GitWorkshop's home screen, the `Dashboard` rendered at route `/` for
|
||||
> page. It is not. GitWorkshop's `Index` route (`src/pages/Index.tsx`) renders `<Dashboard />` when
|
||||
> an account is active, and that home screen is the inbox.
|
||||
|
||||
> **Status.** Phases 0-4 are implemented and green on `feat/inbox`:
|
||||
> **Status.** Phases 0-4 are implemented and green on `feat/inbox`, then the screen was redesigned to
|
||||
> group notifications and activity **by repository** (see the repository-grouping note in §7).
|
||||
> `cargo test -p signed_core` (68), `cargo test -p signed_state` (24),
|
||||
> `cargo test -p workspace` (7), `cargo clippy -p workspace --all-targets` clean,
|
||||
> `cargo check --workspace --all-targets` succeeds.
|
||||
> Phase 5 is not started. This document reflects the implementation as it stands, including the
|
||||
> Phase 1 refactors, the §4.3 split of the inbox into a thin global `Inbox` and a panel-owned
|
||||
> derivation, the Phase 3 bottom-dock sub-views, and the Phase 4 click-through.
|
||||
> `cargo test -p workspace` (7), `cargo test -p dock` (1), `cargo clippy -p workspace --all-targets`
|
||||
> clean, `cargo check --workspace --all-targets` succeeds.
|
||||
> Phase 5 is not started. This document reflects the implementation as it stands: the Phase 1
|
||||
> refactors, the §4.3 split of the inbox into a thin global `Inbox` and a panel-owned derivation, the
|
||||
> Phase 4 click-through, and the repository-grouped list. The Phase 3 bottom-dock sub-views were
|
||||
> removed before the redesign; their implementation notes in §7 are historical.
|
||||
|
||||
## 1. What the GitWorkshop home screen is
|
||||
|
||||
@@ -55,39 +57,48 @@ Data hooks:
|
||||
|
||||
| Priority | Section | Notes |
|
||||
|---|---|---|
|
||||
| **P0** | Inbox panel | Activity directed at you, grouped by thread root; unread badge; mark all read; all groups shown |
|
||||
| **P0** | Continue where you left off | Your own recent git activity, newest first |
|
||||
| **P1** | Unread / Archived sub-views | Open as **bottom-dock panels**, not tabs inside the inbox panel |
|
||||
| **P0** | Inbox panel | Activity directed at you and your own activity, **grouped by repository**; unread badge; mark all read; all groups shown |
|
||||
| **P1** | Click-through | Open the repo panel at the relevant PR/issue |
|
||||
| **P2 (defer)** | Standalone notifications page, NIP-65 relay discovery, pagination | Web-app concerns |
|
||||
| **Out of scope** | Greeting header, my repositories, followed repositories, private repositories, pinned repositories | Not needed in Signed |
|
||||
| **Out of scope** | Greeting header, my repositories, followed repositories, private repositories, pinned repositories, Unread/Archived sub-views | Not needed in Signed |
|
||||
|
||||
Notes:
|
||||
|
||||
- There is **no greeting header**. The screen starts with the inbox panel.
|
||||
- There is **no My repositories column**. The sidebar already lists the signed-in user's repositories, so the inbox is a single column.
|
||||
- Unread and Archived are separate panels opened in the bottom dock, not tabs in the inbox panel.
|
||||
- The Unread/Archived sub-view panels were removed: the panel is a single repository-grouped list instead.
|
||||
|
||||
## 3. The Signed screen
|
||||
|
||||
`InboxView` is a center panel, opened by the sidebar's existing **Inbox** nav item (currently a
|
||||
placeholder that opens Explore). It is two flexible bordered cards, each a virtual list:
|
||||
`InboxView` is a center panel, opened by the sidebar's existing **Inbox** nav item. It is one bordered
|
||||
card holding a single virtual list. Every row is either a **repository header** or one of that
|
||||
repository's **notifications / own activity**, newest first:
|
||||
The sections are **all of the user's own repositories**, seeded from `RepoListStore`, plus any other
|
||||
repository that has notifications or activity. Owned repositories with nothing to show render an
|
||||
empty state ("No activity yet.") under their header, and sort after the ones with activity (newest
|
||||
announcement first). Items with no repository address fall into a single "Other repository" section.
|
||||
|
||||
```
|
||||
+-------------------------------------------------------------------------+
|
||||
| Inbox (3 unread) [Unread] [Archived] [Mark all read] |
|
||||
| [avatar] issue opened on you/repo 2m (scroll) |
|
||||
| [avatar] commented on "Fix parser" 1h |
|
||||
| [avatar] PR update on you/repo 3h |
|
||||
+-------------------------------------------------------------------------+
|
||||
| Continue where you left off (scroll)|
|
||||
| [icon] "Fix parser bug" you/repo opened 3d |
|
||||
| [icon] "Add retry" you/repo PR 5d |
|
||||
+-------------------------------------------------------------------------+
|
||||
| bottom dock: Unread or Archived list (opened by the header buttons) |
|
||||
| Inbox (3 unread) [Mark all read] |
|
||||
|-------------------------------------------------------------------------|
|
||||
| [repo] you/repo-a (2) |
|
||||
| [avatar] issue opened issue 2m |
|
||||
| [avatar] commented on "..." comment 1h |
|
||||
| [icon] "Add retry" patch 3d |
|
||||
|-------------------------------------------------------------------------|
|
||||
| [repo] you/repo-b |
|
||||
| No activity yet. |
|
||||
|-------------------------------------------------------------------------|
|
||||
| [repo] you/repo-c |
|
||||
| No activity yet. |
|
||||
+-------------------------------------------------------------------------+
|
||||
```
|
||||
|
||||
The sections are the repositories that actually have notifications or activity, ordered by their
|
||||
newest row. A repository the user owns but that has no items is not shown. Items with no repository
|
||||
address fall into a single "Other repository" section.
|
||||
|
||||
## 4. Data layer
|
||||
|
||||
### 4.1 `signed_core`: pure logic
|
||||
@@ -265,8 +276,8 @@ The inbox is split in two, because the expensive derivation is only needed while
|
||||
open.
|
||||
|
||||
**`Inbox`** is a child `Entity<Inbox>` owned by `Backend` (`inbox: Entity<Inbox>`) and is
|
||||
deliberately thin: it owns only the read/archive state that must outlive the panel, the NIP-78
|
||||
load/save, and the unread count the sidebar badge reads.
|
||||
deliberately thin: it owns only the read/archive state that must outlive the panel and the NIP-78
|
||||
load/save.
|
||||
|
||||
```rust
|
||||
// backend.rs
|
||||
@@ -280,14 +291,11 @@ pub struct Backend {
|
||||
pub struct Inbox {
|
||||
state: InboxReadState,
|
||||
state_loaded: bool,
|
||||
/// Published by the inbox panel for the sidebar badge.
|
||||
pub unread_count: usize,
|
||||
}
|
||||
|
||||
impl Inbox {
|
||||
pub fn state(&self) -> &InboxReadState;
|
||||
pub fn is_loaded(&self) -> bool;
|
||||
pub fn set_unread_count(&mut self, count: usize, cx: &mut Context<Self>);
|
||||
pub fn mark_read(&mut self, group: &[Event], all: &[Event], me: PublicKey, cx);
|
||||
pub fn mark_archived(&mut self, group: &[Event], all: &[Event], me: PublicKey, cx);
|
||||
pub fn mark_all_read(&mut self, all: &[Event], me: PublicKey, cx);
|
||||
@@ -299,37 +307,44 @@ impl Inbox {
|
||||
**The panel owns the derivation.** `InboxView` itself holds the derived lists, the copy of the read
|
||||
state they were computed with, and the refresh coalescing. There is no separate store entity: the
|
||||
panel is the only consumer, so an `Entity<InboxStore>` would add an `update` indirection and a
|
||||
forwarding subscription without buying any sharing.
|
||||
forwarding subscription without buying any sharing. The panel's own `unread_count` feeds its header
|
||||
badge only; there is no global count and no sidebar badge.
|
||||
|
||||
```rust
|
||||
pub struct InboxView {
|
||||
focus_handle: FocusHandle,
|
||||
dock_area: WeakEntity<DockArea>,
|
||||
notifications: Arc<Vec<InboxItem>>,
|
||||
activity: Arc<Vec<Event>>,
|
||||
sections: Arc<Vec<InboxSection>>, // grouped by repository
|
||||
rows: Arc<Vec<InboxRow>>, // flattened list
|
||||
unread_count: usize,
|
||||
state: InboxReadState,
|
||||
state_loaded: bool,
|
||||
refresh: RefreshGate,
|
||||
list: ListState,
|
||||
_subscriptions: Vec<Subscription>,
|
||||
}
|
||||
|
||||
impl InboxView {
|
||||
pub fn new(cx: &mut Context<Self>) -> Self; // cx.defer(… sync_state)
|
||||
pub fn new(dock_area: WeakEntity<DockArea>, cx: &mut Context<Self>); // cx.defer(… sync_state)
|
||||
pub fn sync_state(&mut self, cx); // observes the global Inbox
|
||||
pub fn mark_read(&mut self, root: EventId, cx); // Phase 3
|
||||
pub fn mark_archived(&mut self, root: EventId, cx); // Phase 3
|
||||
pub fn mark_all_read(&mut self, cx);
|
||||
fn handle_backend_event(&mut self, event: &BackendEvent, cx);
|
||||
fn refresh(&mut self, cx);
|
||||
fn run_refresh(&mut self, cx);
|
||||
fn regroup(&mut self, cx); // re-apply read state
|
||||
fn rebuild(&mut self, cx); // group by repository, seed owned, flatten
|
||||
fn clear(&mut self);
|
||||
}
|
||||
```
|
||||
|
||||
The panel owns the two subscriptions that carry logic: it observes the global `Inbox`
|
||||
(`InboxView::sync_state`) and subscribes to `Backend` (`InboxView::handle_backend_event`).
|
||||
Re-rendering needs no subscription: GPUI invalidates a window for every entity it read during
|
||||
render, so the panel tracks `RepoListStore` and `ProfileStore` just by reading them in `render`.
|
||||
The panel writes back to `Backend` only to publish the unread count for the badge.
|
||||
The panel owns three subscriptions that carry logic: it observes the global `Inbox`
|
||||
(`InboxView::sync_state`), subscribes to `Backend` (`InboxView::handle_backend_event`), and observes
|
||||
`RepoListStore` to rebuild when the user's own repositories load. Re-rendering itself needs no
|
||||
subscription: GPUI invalidates a window for every entity it read during render, so the panel tracks
|
||||
`RepoListStore` and `ProfileStore` just by reading them in `render`. The panel does not write back
|
||||
to the global.
|
||||
|
||||
**`signed_state::query_inbox`.** The database work stays in `signed_state`, so the UI crate never
|
||||
queries LMDB directly. `query_inbox` returns the grouped notifications, the user's own git
|
||||
@@ -348,16 +363,17 @@ pub async fn query_inbox(
|
||||
derived lists live only as long as the panel. Nothing is wired from the `desktop` crate and
|
||||
`signed_state::init` gains no parameters.
|
||||
|
||||
**Badge trade-off.** The unread count is derived by the panel, so the sidebar badge is only current
|
||||
after the inbox has been opened once in the session. Keeping it always live would require the
|
||||
expensive derivation to run globally, which is exactly what this split avoids.
|
||||
**No sidebar badge.** The sidebar's inbox nav item has no unread suffix (an earlier global count
|
||||
derivation was removed with it). The unread count lives entirely in the panel, which shows it in
|
||||
its header and per repository section. The trade-off is that the count is only current while the
|
||||
panel is open, which is acceptable now that nothing outside it displays one.
|
||||
|
||||
The dependency chain is `Backend` → `Inbox` and `InboxView` → `query_inbox`; the panel reaches back
|
||||
only to publish the unread count.
|
||||
The dependency chain is `Backend` → `Inbox` and `InboxView` → `query_inbox`.
|
||||
|
||||
`Backend` does not funnel its events through the inbox: the panel subscribes to `Backend` directly.
|
||||
`BackendEvent::SignerChanged` and `SignerRequired` are still emitted and must stay: `CheckoutsStore`
|
||||
and `SidebarPanel` consume them. They no longer drive the inbox.
|
||||
`Backend` owns the inbox lifecycle (`sync_inbox`); the panel subscribes to `Backend` directly for
|
||||
its lists. `BackendEvent::SignerChanged` and `SignerRequired` are still emitted and must stay:
|
||||
`CheckoutsStore` and `SidebarPanel` consume them. They no longer drive the inbox's activation
|
||||
directly.
|
||||
|
||||
`InboxView::handle_backend_event` refreshes on:
|
||||
|
||||
@@ -412,7 +428,7 @@ lists and in-flight refresh when it sees the unloaded state, then refreshes once
|
||||
|
||||
```rust
|
||||
pub(crate) fn activate(&mut self, me: PublicKey, client: Client, cx: &mut Context<Self>) {
|
||||
// state = default; state_loaded = false; unread_count = 0; cx.notify();
|
||||
// state = default; state_loaded = false; cx.notify();
|
||||
// spawn load_state(client, me), then set state and state_loaded = true
|
||||
}
|
||||
```
|
||||
@@ -437,12 +453,12 @@ read, not a wait on the network; see the note below.
|
||||
their `K` tag is a git kind; sort newest first.
|
||||
- Cross back to the main thread: guard on `Backend::global(cx).read(cx).current_user() ==
|
||||
Some(me)`; if the signer changed while the query ran, `refresh.abort()` instead of applying, so a
|
||||
previous user's results never land. Then set `notifications`, `activity`, `unread_count`, publish
|
||||
the unread count to the global `Inbox`, `cx.notify()`, `refresh.finish()`.
|
||||
previous user's results never land. Then set `notifications`, `activity`, `unread_count`, rebuild the
|
||||
repository sections (`rebuild`), `cx.notify()`, `refresh.finish()`.
|
||||
|
||||
`InboxView::sync_state` reacts to the global `Inbox`: while the state is not loaded it clears the
|
||||
lists, on the first load it runs the initial refresh, and on a state change (a mark action) it
|
||||
re-derives the flags (`InboxItem::apply_state`) and publishes the new unread count.
|
||||
re-derives the flags (`InboxItem::apply_state`).
|
||||
|
||||
**Fetch vs. the immediate query.** `subscribe_bootstrap` / `connect_repo_relays` return immediately,
|
||||
so the query that follows them reads the local cache rather than waiting for the relays. That is
|
||||
@@ -452,11 +468,10 @@ timing: received events are written to LMDB and surfaced as `ClientNotification:
|
||||
`Backend`'s pump batches them into `BackendEvent::NostrUpdate` and the store refreshes. This was
|
||||
reviewed and left as-is.
|
||||
|
||||
**Actions**: `mark_read(root)`, `mark_archived(root)`, `mark_all_read()` live on the panel, which
|
||||
passes the group and every known notification event to the global `Inbox`. The global marks the
|
||||
group, advances the cutoffs against *all* notification events to bound the id sets, saves the state
|
||||
to LMDB (signed with a fresh random key, see 4.2), and notifies. The panel then re-derives and
|
||||
publishes the unread count.
|
||||
**Actions**: `mark_all_read()` lives on the panel, which passes every known notification event to the
|
||||
global `Inbox`. The global marks them, advances the cutoffs against *all* notification events to bound
|
||||
the id sets, saves the state to LMDB (signed with a fresh random key, see 4.2), and notifies. The
|
||||
panel then re-derives and publishes the unread count.
|
||||
|
||||
**Repository names need no new store**: `RepoListStore` already holds every announcement and
|
||||
`repo_name` resolves an address to a display name.
|
||||
@@ -470,78 +485,77 @@ publishes the unread count.
|
||||
|
||||
### 5.1 `InboxView` center panel
|
||||
|
||||
New `crates/workspace/src/views/inbox.rs`, a `BasePanel` + `Panel` + `Render`, like `RepoListView`.
|
||||
It owns the derived lists directly, so `cx.notify()` from an update re-renders it. The panel is a
|
||||
column of two flexible bordered cards (`flex_1`, `min_h_0`), each with a header bar and a scrolling
|
||||
body. Each body is a `gpui::list` virtual list (`ListState` + `ListAlignment::Top`, 400px
|
||||
overdraw) with a `vertical_scrollbar`; the panel itself does not scroll, so both lists get a
|
||||
definite viewport height. The list counts are reset from `render` whenever the rendered item count
|
||||
changes. Row ids are prefixed (`("inbox-row", ix)` / `("activity-row", ix)`) so the two lists do not
|
||||
collide.
|
||||
`crates/workspace/src/views/inbox.rs`, a `BasePanel` + `Panel` + `Render`, like `RepoListView`.
|
||||
It owns the derived lists directly, so `cx.notify()` from an update re-renders it. The panel is one
|
||||
bordered card (`flex_1`, `min_h_0`) with a header bar and a scrolling body. The body is a single
|
||||
`gpui::list` virtual list (`ListState` + `ListAlignment::Top`, 400px overdraw) with a
|
||||
`vertical_scrollbar`; the panel itself does not scroll, so the list gets a definite viewport height.
|
||||
The list count is reset from `render` whenever the rendered row count changes.
|
||||
|
||||
- **Inbox card**: header with the unread count badge, the **Unread** and **Archived** sub-view buttons
|
||||
(Phase 3) and **Mark all read**; then every non-archived notification item. Rows show the actor
|
||||
avatar, a kind icon, the subject, the kind label, the repo name, a relative time, and an unread dot
|
||||
(the subject is semibold while unread). Empty state: "You're all caught up." with
|
||||
`IconName::Inbox`.
|
||||
- **Continue where you left off**: every event in the activity list, each row a kind icon, subject,
|
||||
kind label, repo name, and relative time.
|
||||
- **Header**: the unread count badge and **Mark all read**.
|
||||
- **Body**: the flattened repository-grouped rows. A repository header is a muted bar with a git icon,
|
||||
the repository name (or "Other repository" when the address is unknown) and its unread badge. Rows
|
||||
under it show the actor avatar, a kind icon, the subject, the kind label, a relative time, and an
|
||||
unread dot (the subject is semibold while unread). A repository with nothing to show renders
|
||||
"No activity yet."; the panel-level "You're all caught up." empty state appears only when there are
|
||||
no sections at all (no owned repositories and no items).
|
||||
|
||||
No greeting header, and no **My repositories** column - the sidebar already lists the user's
|
||||
repositories. The **Unread** and **Archived** header buttons open the sub-views of 5.2 in the bottom
|
||||
dock.
|
||||
repositories.
|
||||
|
||||
### 5.2 Unread / Archived as bottom-dock panels
|
||||
### 5.2 Grouping by repository
|
||||
|
||||
Add a bottom-panel helper next to `add_center_panel` in `crates/dock/src/lib.rs`:
|
||||
The grouping is panel-owned derivation, done once per data change in `InboxView::rebuild` (called
|
||||
from `run_refresh` and `regroup`), never per frame:
|
||||
|
||||
```rust
|
||||
/// Add an already-wrapped panel handle to the bottom dock of `area`.
|
||||
pub fn add_bottom_panel(
|
||||
area: &mut DockArea,
|
||||
panel: Arc<dyn PanelView>,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<DockArea>,
|
||||
) {
|
||||
area.add_panel_view(panel, DockPlacement::Bottom, None, window, cx);
|
||||
struct InboxSection {
|
||||
address: Option<RepoAddr>, // repository, None for items without one
|
||||
unread: usize, // unread notification groups
|
||||
entries: Vec<InboxEntry>, // newest first
|
||||
latest: Timestamp, // orders the sections
|
||||
}
|
||||
|
||||
enum InboxEntry { // indices into the panel's own lists
|
||||
Notification(usize),
|
||||
Activity(usize),
|
||||
}
|
||||
|
||||
enum InboxRow { // the flattened list
|
||||
Repo(usize),
|
||||
Entry(usize, usize),
|
||||
Empty, // "No activity yet." under an empty section
|
||||
}
|
||||
```
|
||||
|
||||
The workspace already supports a bottom dock and prunes it when empty (`workspace.rs`). Then:
|
||||
The section list and the flattened rows are stored as `Arc`s and cloned into the `gpui::list`
|
||||
closure, which indexes the panel's `notifications` / `activity` lists - no per-frame deep copies.
|
||||
Notification groups carry their repository in `InboxItem::address`; activity events carry it in a
|
||||
`GitRepoAnnouncement` `a` tag (`repo_address`). Archived notification groups are left out.
|
||||
|
||||
- `InboxFilterView` is a bottom-dock panel holding an `Entity<InboxView>` and a mode
|
||||
`InboxFilter::Unread | InboxFilter::Archived`. It renders the matching subset of the panel's
|
||||
notifications as a `gpui::list`, with the same rows as the inbox card. The mode filters on
|
||||
`InboxItem::is_unread()` / `InboxItem::archived` and picks the tab title and empty state. It reads
|
||||
the inbox entity during render, so GPUI's render-time tracking re-renders it whenever the inbox
|
||||
re-derives; it needs no subscription of its own.
|
||||
- The **Unread** and **Archived** header buttons in `InboxView` call `InboxView::open_filter`, which
|
||||
keeps `filter_view: Option<WeakEntity<InboxFilterView>>`. When the panel already exists it updates
|
||||
its mode, focuses it, and reopens the bottom dock if the user collapsed it, instead of adding a
|
||||
duplicate. Otherwise it creates the panel and adds it to the bottom dock.
|
||||
- **Unread rows**: clicking a row marks that group read (`InboxView::mark_read`); a trailing ghost
|
||||
icon button archives it (`InboxView::mark_archived`). Both call back into the `InboxView` entity,
|
||||
which updates the global `Inbox`. **Archived rows** are display-only, since the read state has no
|
||||
un-archive operation.
|
||||
`rebuild` also seeds a section for every repository in `announcements_of(me)`. The panel observes
|
||||
`RepoListStore` so a repository that loads after the last refresh still appears (its own empty
|
||||
section, or with items if any arrived); this is the one logic subscription beyond the `Inbox` and
|
||||
`Backend` ones. Repository names are resolved per render through `repo_name` -> `RepoListStore`, so a
|
||||
late announcement still labels its section without re-deriving the grouping.
|
||||
|
||||
### 5.3 Sidebar
|
||||
|
||||
In `views/sidebar/mod.rs`:
|
||||
|
||||
- Add `inbox: Option<WeakEntity<InboxView>>` (mirrors `explore`) and `unread: usize`.
|
||||
- Add `inbox: Option<WeakEntity<InboxView>>` (mirrors `explore`).
|
||||
- Add `fn open_inbox(&mut self, window, cx)` that returns when the panel is already open, else adds
|
||||
a center panel (same shape as `open_explore`; there is no dock API to focus an existing tab).
|
||||
`InboxView::new` takes the sidebar's `WeakEntity<DockArea>` so the panel can open its sub-view.
|
||||
- Point the existing nav item at it and add an unread suffix:
|
||||
`InboxView::new` takes the sidebar's `WeakEntity<DockArea>` so the panel can open a repo for a row.
|
||||
- Point the existing nav item at it:
|
||||
|
||||
```rust
|
||||
NavItem::new("inbox", "Inbox", Icon::new(IconName::Inbox).small())
|
||||
.when(unread > 0, |this| this.suffix(...badge...))
|
||||
.on_click(cx.listener(|this, _ev, window, cx| this.open_inbox(window, cx))),
|
||||
```
|
||||
|
||||
- `cx.observe` `Backend::global(cx).read(cx).inbox()` so the badge follows the count the panel
|
||||
publishes.
|
||||
- No unread badge. The nav item carries no suffix, and the sidebar does not observe the global
|
||||
`Inbox`. The unread count lives in the panel only.
|
||||
|
||||
### 5.4 Click-through (P1)
|
||||
|
||||
@@ -592,10 +606,10 @@ whose root is not an issue/PR/patch, or whose repository is not in `RepoListStor
|
||||
| `crates/signed_state/src/backend.rs` | `inbox: Entity<Inbox>` field, construction, `inbox()` accessor, `sync_inbox`, `RepoListStore` import |
|
||||
| `crates/signed_state/src/refresh.rs` | doc comment lists `Inbox` among the `RefreshGate` users |
|
||||
| `crates/signed_state/src/lib.rs` | `mod inbox;`, re-export `Inbox` and `query_inbox`; re-export `RefreshGate` (no global install) |
|
||||
| `crates/dock/src/lib.rs` | `add_bottom_panel` helper |
|
||||
| `crates/workspace/src/views/inbox.rs` | **new**: `InboxView` home panel owning the derived lists directly, the `InboxFilterView` bottom-dock sub-view for Unread / Archived, and the notification click-through |
|
||||
| `crates/dock/src/lib.rs` | `add_bottom_panel` helper (currently unused; left over from the removed sub-views) |
|
||||
| `crates/workspace/src/views/inbox.rs` | `InboxView` home panel owning the derived lists, the repository grouping, and the notification click-through |
|
||||
| `crates/workspace/src/views/mod.rs` | `mod inbox; pub use inbox::InboxView;`; re-export `RepoItem`, `open_repo_item`, `open_repo_panel` |
|
||||
| `crates/workspace/src/views/sidebar/mod.rs` | `inbox`/`unread` fields, `open_inbox`, nav wiring and badge |
|
||||
| `crates/workspace/src/views/sidebar/mod.rs` | `inbox` field, `open_inbox`, nav wiring |
|
||||
| `crates/workspace/src/views/repo_detail/mod.rs` | `RepoItem`, `open_repo_item`, `RepoDetailView::store()` |
|
||||
|
||||
No changes to `desktop` or `signed_nostr`. `signed_state::init` gains no parameters; `Backend::sync_inbox`
|
||||
@@ -613,10 +627,11 @@ activates the `Inbox` child entity at each signer transition.
|
||||
2. **Phase 1 - store**: `Inbox` child entity, activated by `Backend::sync_inbox` once a signer
|
||||
exists; both queries, unread count, and NIP-78 load/save to LMDB. **DONE.** See the
|
||||
implementation notes below.
|
||||
3. **Phase 2 - screen**: `InboxView` (inbox + activity), sidebar nav and badge.
|
||||
3. **Phase 2 - screen**: `InboxView` (inbox + activity) and the sidebar nav item.
|
||||
**DONE.** See the implementation notes below.
|
||||
4. **Phase 3 - sub-views**: `add_bottom_panel` and `InboxFilterView` for Unread / Archived.
|
||||
**DONE.** See the implementation notes below.
|
||||
**Done, then reverted.** The sub-views were removed before the repository-grouping redesign; the
|
||||
notes below are historical.
|
||||
5. **Phase 4 - click-through**: `open_item` and announcement lookup. **DONE.** See the implementation
|
||||
notes below.
|
||||
6. **Phase 5 (optional)**: standalone notifications page, NIP-65 relays, pagination, patch detail
|
||||
@@ -692,9 +707,8 @@ Files: `crates/workspace/src/views/{inbox.rs, mod.rs, sidebar/mod.rs}`. No store
|
||||
- `kind_icon` / `kind_label` map a `Kind` to a `CustomIconName`/`IconName` and a short noun. The
|
||||
cover note is compared with `==` rather than matched, since `Kind` cannot appear in a pattern arm.
|
||||
- Sidebar: `open_inbox` mirrors `open_explore` (return if open, else add a center panel); the inbox
|
||||
nav item is repointed and carries a `CountBadge` suffix driven by the observed unread count. The
|
||||
screen is still opened by the nav item, not on app startup, matching the "idle until signer" rule;
|
||||
auto-opening it as the post-login home is a possible follow-up.
|
||||
nav item is repointed. The screen is still opened by the nav item, not on app startup, matching the
|
||||
"idle until signer" rule; auto-opening it as the post-login home is a possible follow-up.
|
||||
- The **My repositories** column (search `InputState`, **New** button, `open_repo_panel` rows) was
|
||||
removed after Phase 2 as redundant with the sidebar, along with the panel's `dock_area`,
|
||||
`open_repo` / `open_create_repo` helpers and the `create_repo_dialog` / `open_repo_panel` imports.
|
||||
@@ -708,8 +722,8 @@ Phases 0-2 kept all derivation in the global `Inbox`, so every notification and
|
||||
whether or not the home screen was open, and `Backend::emit` carried a deferred side effect just to
|
||||
feed it.
|
||||
|
||||
- The global `Inbox` is now thin: `state: InboxReadState`, `state_loaded`, and the `unread_count` the
|
||||
sidebar badge reads, plus the NIP-78 load/save and the mark actions.
|
||||
- The global `Inbox` is now thin: `state: InboxReadState`, `state_loaded`, plus the NIP-78 load/save
|
||||
and the mark actions.
|
||||
- `Backend::emit` is gone. All `BackendEvent`s are emitted with `cx.emit` again, and `sync_inbox`
|
||||
updates the inbox synchronously, passing the client in so nothing reads `Backend` mid-update.
|
||||
- The panel became the client-side owner of the derivation, initially through a panel-scoped
|
||||
@@ -731,11 +745,15 @@ The `InboxStore` entity was then folded into `InboxView`, since the panel was it
|
||||
- `cargo test -p signed_core` (68), `cargo test -p signed_state` (24) and `cargo test -p workspace`
|
||||
(7) pass; clippy and `cargo check --workspace --all-targets` are clean.
|
||||
|
||||
Trade-off: the sidebar badge is only current after the inbox is opened once, because the unread
|
||||
count is derived by the panel.
|
||||
Trade-off: the unread count is derived by the panel, so it is only current while the panel is open.
|
||||
(`publish_unread_count` fed a sidebar badge at the time; both were removed later - see "Sidebar
|
||||
badge removed" below.)
|
||||
|
||||
### Phase 3 implementation notes
|
||||
|
||||
> Historical: the Unread/Archived sub-views below were later removed; the panel is now a single
|
||||
> repository-grouped list. Kept for the `add_bottom_panel` / sub-view rationale.
|
||||
|
||||
Files: `crates/dock/src/lib.rs` and `crates/workspace/src/views/{inbox.rs, sidebar/mod.rs}`. No
|
||||
store changes.
|
||||
|
||||
@@ -784,13 +802,63 @@ Files: `crates/workspace/src/views/{inbox.rs, mod.rs, repo_detail/mod.rs}`. No s
|
||||
from the panel) because the `gpui::list` item closure only receives `&mut App`. It resolves
|
||||
`item.address` through `RepoListStore`, returns silently when the repository is unknown, opens the
|
||||
repo panel, then maps the root kind to a `RepoItem` and calls `open_repo_item`.
|
||||
- Only the main notification list is clickable. Unread rows keep their Phase 3 behaviour (click marks
|
||||
read, trailing button archives). Activity rows are unchanged.
|
||||
- Only the notification rows are clickable. Activity rows are display-only. The Phase 3 mark-read /
|
||||
archive row behaviour is gone with the sub-views.
|
||||
- `RepoItem::Patch` is a unit variant because the id would be unused: patches have no detail panel, so
|
||||
`open_repo_item` returns before doing anything and only the repository panel opens.
|
||||
- `cargo clippy -p workspace --all-targets` is clean, `cargo check --workspace --all-targets` succeeds,
|
||||
and `cargo test -p signed_core -p signed_state -p workspace -p dock` passes (68 / 24 / 7 / 1).
|
||||
|
||||
### Repository grouping redesign (after Phase 4)
|
||||
|
||||
Files: `crates/workspace/src/views/inbox.rs`. No store, no `signed_core` changes.
|
||||
|
||||
The two-card layout (notifications over activity) was replaced by a single repository-grouped list.
|
||||
|
||||
- The panel now derives `sections: Vec<InboxSection>` and a flattened `rows: Vec<InboxRow>` in
|
||||
`rebuild`, called from `run_refresh` and `regroup`. Both are stored as `Arc`s and cloned into the
|
||||
`gpui::list` closure, which indexes `notifications` / `activity` - no deep copies per frame and no
|
||||
data duplicated between the section list and the source lists.
|
||||
- `InboxSection` groups a repository's non-archived notification groups and the user's own activity,
|
||||
newest first; sections are ordered by their newest entry. `InboxEntry` holds indices into the
|
||||
panel's lists; `InboxRow::Repo` / `InboxRow::Entry` / `InboxRow::Empty` is the flattened shape the
|
||||
list renders.
|
||||
- All of the user's own repositories are seeded as sections from `RepoListStore::announcements_of`,
|
||||
so an owned repository with nothing to show gets an empty section ("No activity yet.") and sorts
|
||||
after the sections with activity. The panel observes `RepoListStore` to rebuild when the user's
|
||||
repositories load or change.
|
||||
- Activity is matched to a repository through a `GitRepoAnnouncement` `a` tag (`repo_address`).
|
||||
Items without an address share the "Other repository" section.
|
||||
- `notification_row` / `activity_row` no longer render the repository name - the section header does.
|
||||
That also drops one `RepoListStore` scan per row.
|
||||
- The single card has one `ListState`; the old `notifications_list` / `activity_list` and the
|
||||
`render_inbox_panel` / `render_activity_panel` / `section` helpers are gone. `notification_row` still
|
||||
takes an id prefix so rows stay unique within the list.
|
||||
- `cargo clippy -p workspace --all-targets` is clean and `cargo test -p signed_core -p signed_state
|
||||
-p workspace -p dock` passes (68 / 24 / 7 / 1).
|
||||
|
||||
### Sidebar badge removed (after the repository grouping redesign)
|
||||
|
||||
Files: `crates/signed_core/src/filters.rs`, `crates/signed_state/src/{inbox.rs,backend.rs}`,
|
||||
`crates/workspace/src/views/{inbox.rs,sidebar/mod.rs}`.
|
||||
|
||||
An intermediate change made the sidebar badge live by moving the unread count into the global
|
||||
`Inbox` (a `refresh_unread_count` driven by `Backend`). That was then reverted along with the badge
|
||||
itself, so the global is thin again.
|
||||
|
||||
- The sidebar nav item no longer renders a `CountBadge`; `SidebarPanel` lost its `unread` field and
|
||||
its observe of the global `Inbox`.
|
||||
- The global `Inbox` no longer stores an `unread_count` and has no `set_unread_count` /
|
||||
`refresh_unread_count`. `Backend` has no `refresh_inbox_unread` and no per-batch or per-sync count
|
||||
refresh. `filters::affects_inbox` and the `query_inbox` helper split were reverted with it.
|
||||
- `InboxView` keeps its local `unread_count` for its header badge and the per-section `unread` for
|
||||
the repository headers; `publish_unread_count` stays deleted.
|
||||
- Consequence: the unread count is only current while the panel is open, and there is no unread
|
||||
indication anywhere else in the app.
|
||||
- `cargo clippy -p signed_core -p signed_state -p workspace --all-targets` is clean,
|
||||
`cargo check -p signed_core -p signed_state -p workspace --all-targets` succeeds, and
|
||||
`cargo test -p signed_core -p signed_state -p workspace -p dock` passes (68 / 24 / 7 / 1).
|
||||
|
||||
## 8. Validation
|
||||
|
||||
- `cargo test -p signed_core` (68 tests): root resolution, grouping, read-state cutoff, serde round-trip.
|
||||
@@ -802,7 +870,7 @@ Files: `crates/workspace/src/views/{inbox.rs, mod.rs, repo_detail/mod.rs}`. No s
|
||||
- Manual: log in with a repo-owning identity; open the inbox from the sidebar and confirm the panel
|
||||
populates from another identity's issue/comment, the activity list shows your own items, and that no
|
||||
kind-30078 event is broadcast (watch the relays / `Published` events). Restart to confirm the read
|
||||
state is read back from LMDB.
|
||||
state is read back from LMDB. Confirm the sidebar has no unread badge.
|
||||
|
||||
## 9. SDK APIs used (verified in the pinned `5c669a4` checkout)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user