update
This commit is contained in:
+126
-103
@@ -11,8 +11,8 @@ Ported from GitWorkshop's home screen, the `Dashboard` rendered at route `/` for
|
||||
> `cargo test -p workspace` (7), `cargo clippy -p workspace --all-targets` clean,
|
||||
> `cargo check --workspace --all-targets` succeeds.
|
||||
> Phases 3-5 are not started. This document reflects the implementation as it stands, including the
|
||||
> Phase 1 refactors and the §4.3 split of the inbox into a thin global `Inbox` and a panel-scoped
|
||||
> `InboxStore`.
|
||||
> Phase 1 refactors and the §4.3 split of the inbox into a thin global `Inbox` and a
|
||||
> panel-owned derivation.
|
||||
|
||||
## 1. What the GitWorkshop home screen is
|
||||
|
||||
@@ -55,47 +55,37 @@ Data hooks:
|
||||
|
||||
| Priority | Section | Notes |
|
||||
|---|---|---|
|
||||
| **P0** | Inbox panel | Activity directed at you, grouped by thread root; unread badge; mark all read; top N + show all |
|
||||
| **P0** | My repositories | Reuse `RepoListStore::announcements_of(me)`; search filter; existing New-repo dialog |
|
||||
| **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 |
|
||||
| **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, followed repositories, private repositories, pinned repositories | Not needed in Signed |
|
||||
| **Out of scope** | Greeting header, my repositories, followed repositories, private repositories, pinned repositories | 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.
|
||||
|
||||
## 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 one scrollable two-column flex row:
|
||||
placeholder that opens Explore). It is two flexible bordered cards, each a virtual list:
|
||||
|
||||
```
|
||||
+--------------------------------------------------+-----------------------+
|
||||
| Inbox (3 unread) [Unread] [Archived] [Mark all read] |
|
||||
| [avatar] issue opened on you/repo 2m |
|
||||
+-------------------------------------------------------------------------+
|
||||
| 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 |
|
||||
| [Show all] |
|
||||
| |
|
||||
| Continue where you left off |
|
||||
+-------------------------------------------------------------------------+
|
||||
| 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) |
|
||||
+--------------------------------------------------+-----------------------+
|
||||
```
|
||||
|
||||
The right column is **My repositories**, mirroring the sidebar's signed-in repo list:
|
||||
|
||||
```
|
||||
| My repositories |
|
||||
| [search] [New] |
|
||||
| repo row |
|
||||
| repo row |
|
||||
+-------------------------------------------------------------------------+
|
||||
```
|
||||
|
||||
## 4. Data layer
|
||||
@@ -269,7 +259,7 @@ key in the store (see §4.3). An earlier implementation deleted the previous eve
|
||||
id across saves; that was removed as more derived state than it was worth.
|
||||
`NostrDatabase::{save_event, query}` and `Client::database()` are existing SDK APIs.
|
||||
|
||||
### 4.3 `signed_state`: a thin global `Inbox` and a panel-scoped `InboxStore`
|
||||
### 4.3 Data layer: a thin global `Inbox`, a panel-owned derivation
|
||||
|
||||
The inbox is split in two, because the expensive derivation is only needed while the home screen is
|
||||
open.
|
||||
@@ -290,7 +280,7 @@ pub struct Backend {
|
||||
pub struct Inbox {
|
||||
state: InboxReadState,
|
||||
state_loaded: bool,
|
||||
/// Published by `InboxStore` for the sidebar badge.
|
||||
/// Published by the inbox panel for the sidebar badge.
|
||||
pub unread_count: usize,
|
||||
}
|
||||
|
||||
@@ -306,53 +296,70 @@ impl Inbox {
|
||||
}
|
||||
```
|
||||
|
||||
**`InboxStore`** is created by `InboxView` and therefore only exists while the panel is open. It
|
||||
derives the notification groups and the activity list, coalesces refreshes and applies the read
|
||||
state for rendering.
|
||||
**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.
|
||||
|
||||
```rust
|
||||
pub struct InboxStore {
|
||||
pub notifications: Arc<Vec<InboxItem>>,
|
||||
pub activity: Arc<Vec<Event>>,
|
||||
pub unread_count: usize,
|
||||
pub struct InboxView {
|
||||
focus_handle: FocusHandle,
|
||||
notifications: Arc<Vec<InboxItem>>,
|
||||
activity: Arc<Vec<Event>>,
|
||||
unread_count: usize,
|
||||
state: InboxReadState,
|
||||
state_loaded: bool,
|
||||
refresh: RefreshGate,
|
||||
_subscriptions: Vec<Subscription>,
|
||||
}
|
||||
|
||||
impl InboxStore {
|
||||
pub fn new(cx: &mut Context<Self>) -> Self;
|
||||
pub fn refresh(&mut self, cx: &mut Context<Self>);
|
||||
pub fn mark_read(&mut self, root: EventId, cx);
|
||||
pub fn mark_archived(&mut self, root: EventId, cx);
|
||||
impl InboxView {
|
||||
pub fn new(cx: &mut Context<Self>) -> 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);
|
||||
}
|
||||
```
|
||||
|
||||
`InboxStore` has no subscriptions of its own. The panel owns the two subscriptions that carry
|
||||
logic: it observes the global `Inbox` (`InboxStore::sync_state`) and subscribes to `Backend`
|
||||
(`InboxStore::handle_backend_event`, plus resetting `show_all` on a signer change). Re-rendering
|
||||
needs no subscription: GPUI invalidates a window for every entity it read during render, so the
|
||||
panel tracks the store, the search `InputState` and `RepoListStore` just by reading them in
|
||||
`render`. The store never writes derived data back to `Backend` except the unread count.
|
||||
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.
|
||||
|
||||
**Lifespan.** `Inbox` is created with the backend but idles until the user has a signer. `InboxStore`
|
||||
is created and dropped with the panel. Neither is wired from the `desktop` crate and
|
||||
**`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
|
||||
activity and the unread count; the panel applies the results on the main thread. `RefreshGate` is
|
||||
re-exported for the panel's debounce.
|
||||
|
||||
```rust
|
||||
pub async fn query_inbox(
|
||||
client: &Client,
|
||||
me: PublicKey,
|
||||
state: &InboxReadState,
|
||||
) -> Result<(Vec<InboxItem>, Vec<Event>, usize), Error>;
|
||||
```
|
||||
|
||||
**Lifespan.** `Inbox` is created with the backend but idles until the user has a signer. The
|
||||
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 store, so the sidebar badge is only current
|
||||
**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.
|
||||
|
||||
The dependency chain is `Backend` → `Inbox` and `InboxView` → `InboxStore`; the store reaches back
|
||||
The dependency chain is `Backend` → `Inbox` and `InboxView` → `query_inbox`; the panel reaches back
|
||||
only to publish the unread count.
|
||||
|
||||
`Backend` no longer funnels its events through the inbox: `InboxStore` 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` 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.
|
||||
|
||||
`InboxStore::handle_backend_event` refreshes on:
|
||||
`InboxView::handle_backend_event` refreshes on:
|
||||
|
||||
- `NostrUpdate(updates)`: when any update kind is in `NOTIFICATION_KINDS`, is `Kind::Comment`, or is
|
||||
a deletion (`EventDeletion` / `RequestToVanish`).
|
||||
@@ -400,7 +407,7 @@ time and never cached. (NIP-65 outbox relay discovery is deferred; Signed does n
|
||||
10002 yet.) `Inbox::activate` and `Inbox::reset` are `pub(crate)`; `Inbox` has no `subscribe_remote`
|
||||
/ `connect_own_repo_relays`.
|
||||
|
||||
**Activation** clears the state and loads the NIP-78 state from LMDB. `InboxStore` clears its own
|
||||
**Activation** clears the state and loads the NIP-78 state from LMDB. The panel clears its own
|
||||
lists and in-flight refresh when it sees the unloaded state, then refreshes once it is loaded:
|
||||
|
||||
```rust
|
||||
@@ -416,10 +423,10 @@ Reading the state event needs no signer at all (the `d` tag carries the identity
|
||||
still gated on the signer because the fetch filters need the user's pubkey.
|
||||
|
||||
**Fetch** reuses `Backend::subscribe_bootstrap` and `Backend::connect_repo_relays` through
|
||||
`Backend::sync_inbox` (see above). The query the store runs is intentionally the offline-first cache
|
||||
`Backend::sync_inbox` (see above). The query the panel runs is intentionally the offline-first cache
|
||||
read, not a wait on the network; see the note below.
|
||||
|
||||
**Refresh** (`InboxStore::run_refresh`, mirrors `RepoListStore::run_refresh`):
|
||||
**Refresh** (`InboxView::run_refresh`, mirrors `RepoListStore::run_refresh`):
|
||||
|
||||
- `cx.background_spawn`: query the notification filters and the activity filter from
|
||||
`client.database()`.
|
||||
@@ -427,13 +434,13 @@ read, not a wait on the network; see the note below.
|
||||
- Build `HashMap<EventId, Event>` for root walking; group the notification events with
|
||||
`inbox::group`.
|
||||
- Filter the activity events: keep issues/PRs/patches/statuses/cover notes, and comments only when
|
||||
their `K` tag is a git kind; sort newest first; take the top N.
|
||||
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()`.
|
||||
|
||||
The store's `sync_state` reacts to the global `Inbox`: while the state is not loaded it clears the
|
||||
`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.
|
||||
|
||||
@@ -445,14 +452,14 @@ 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 `InboxStore`, which
|
||||
**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 store then re-derives and
|
||||
to LMDB (signed with a fresh random key, see 4.2), and notifies. The panel then re-derives and
|
||||
publishes the unread count.
|
||||
|
||||
**My repositories needs no new store**: `RepoListStore` already holds every announcement and exposes
|
||||
`announcements_of(user)`.
|
||||
**Repository names need no new store**: `RepoListStore` already holds every announcement and
|
||||
`repo_name` resolves an address to a display name.
|
||||
|
||||
### 4.4 `Cargo.toml`
|
||||
|
||||
@@ -464,23 +471,23 @@ publishes the unread count.
|
||||
### 5.1 `InboxView` center panel
|
||||
|
||||
New `crates/workspace/src/views/inbox.rs`, a `BasePanel` + `Panel` + `Render`, like `RepoListView`.
|
||||
It owns an `Entity<InboxStore>`; GPUI re-renders the panel when the store changes because the panel
|
||||
reads it during render. One `overflow_y_scrollbar` container holding a two-column flex row, left
|
||||
column flexible and right column fixed at 300px. Both columns are bordered cards with a header bar.
|
||||
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.
|
||||
|
||||
- **Inbox column**: header with the unread count badge and **Mark all read**; then the non-archived
|
||||
notification items (top 5, with a **Show all** toggle expanding inline). 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**: `Inbox::activity`, top 15, each row a kind icon, subject, kind
|
||||
label, repo name, and relative time.
|
||||
- **My repositories**: `RepoListStore::announcements_of(me)` with a search `InputState` (same
|
||||
pattern as `RepoListView`) and a **New** button opening the existing `create_repo_dialog`. Rows
|
||||
open `open_repo_panel`. Empty state "No repositories yet."; without a signer it says
|
||||
"Sign in to see your repositories.".
|
||||
- **Inbox card**: header with the unread count badge 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.
|
||||
|
||||
No greeting header. The **Unread** and **Archived** header buttons belong to Phase 3 and are not
|
||||
No greeting header, and no **My repositories** column - the sidebar already lists the user's
|
||||
repositories. The **Unread** and **Archived** header buttons belong to Phase 3 and are not
|
||||
rendered until `add_bottom_panel` / `InboxFilterView` exist (see 5.2).
|
||||
|
||||
### 5.2 Unread / Archived as bottom-dock panels
|
||||
@@ -502,7 +509,7 @@ pub fn add_bottom_panel(
|
||||
The workspace already supports a bottom dock and prunes it when empty (`workspace.rs`). Then:
|
||||
|
||||
- New `InboxFilterView` panel taking a mode `InboxFilter::Unread | InboxFilter::Archived` and the
|
||||
`Entity<InboxStore>`. It renders the matching subset of `InboxStore::notifications` as a list.
|
||||
`Entity<InboxView>`. It renders the matching subset of the panel's notifications as a list.
|
||||
- The **Unread** and **Archived** header buttons in `InboxView` (added in Phase 3) call
|
||||
`add_bottom_panel` with the requested mode. `InboxView` keeps
|
||||
`filter_view: Option<WeakEntity<InboxFilterView>>`; when it already exists, update its mode and
|
||||
@@ -523,7 +530,7 @@ In `views/sidebar/mod.rs`:
|
||||
.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 store
|
||||
- `cx.observe` `Backend::global(cx).read(cx).inbox()` so the badge follows the count the panel
|
||||
publishes.
|
||||
|
||||
### 5.4 Click-through (P1)
|
||||
@@ -566,12 +573,12 @@ patch-root click opens the repo panel. Note as a known limitation.
|
||||
| `crates/signed_core/src/inbox.rs` | **new**: `InboxItem`, `notification_root`, `group`, `InboxReadState`, tests |
|
||||
| `crates/signed_core/src/lib.rs` | `mod inbox;` and re-exports |
|
||||
| `crates/signed_state/Cargo.toml` | add `serde_json` |
|
||||
| `crates/signed_state/src/inbox.rs` | thin global `Inbox` (NIP-78 read state) and panel-scoped `InboxStore` (query, grouping, activity, actions) |
|
||||
| `crates/signed_state/src/inbox.rs` | thin global `Inbox` (NIP-78 read state, mark actions) and `query_inbox` (query, grouping, activity) |
|
||||
| `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` (no global install) |
|
||||
| `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 `Entity<InboxStore>` (`InboxFilterView` is Phase 3) |
|
||||
| `crates/workspace/src/views/inbox.rs` | **new**: `InboxView` home panel owning the derived lists directly (`InboxFilterView` is Phase 3) |
|
||||
| `crates/workspace/src/views/mod.rs` | `mod inbox; pub use inbox::InboxView;` |
|
||||
| `crates/workspace/src/views/sidebar/mod.rs` | `inbox`/`unread` fields, `open_inbox`, nav wiring and badge, `create_repo_dialog` visibility |
|
||||
| `crates/workspace/src/views/repo_detail/mod.rs` | `RepoItem`, `RepoDetailView::open_item` (P1) |
|
||||
@@ -594,7 +601,7 @@ 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 + my repositories), sidebar nav and badge.
|
||||
3. **Phase 2 - screen**: `InboxView` (inbox + activity), sidebar nav and badge.
|
||||
**DONE.** See the implementation notes below.
|
||||
4. **Phase 3 - sub-views**: `add_bottom_panel` and `InboxFilterView` for Unread / Archived.
|
||||
5. **Phase 4 - click-through**: `open_item` and announcement lookup.
|
||||
@@ -641,7 +648,7 @@ and two additions to `crates/signed_core/src/inbox.rs`.
|
||||
- Actions: `mark_read(root)`, `mark_archived(root)`, `mark_all_read()`. Each marks the group, advances
|
||||
the relevant cutoffs against **all** notification events (matching GitWorkshop's use of `allEvents`),
|
||||
re-derives the groups locally so the UI updates immediately, then persists in the background.
|
||||
- The store keeps no derived state. The signing key is generated per save, the current user is read
|
||||
- The global `Inbox` keeps no derived state. The signing key is generated per save, the current user is read
|
||||
from `Backend::current_user()` where needed, and the relays of the user's own repositories are
|
||||
queried from `RepoListStore` in `Backend::sync_inbox` rather than cached. There is no prune logic
|
||||
either: the newest state event is selected by `created_at`.
|
||||
@@ -654,26 +661,30 @@ and two additions to `crates/signed_core/src/inbox.rs`.
|
||||
|
||||
Files: `crates/workspace/src/views/{inbox.rs, mod.rs, sidebar/mod.rs}`. No store changes.
|
||||
|
||||
- `InboxView` is a plain center panel like `RepoListView`. It owns an `Entity<InboxStore>` and
|
||||
drives it; the sidebar holds a `WeakEntity<InboxView>` so there is no cycle. The panel's `Backend`
|
||||
subscription also resets `show_all` on a signer change. Re-rendering relies on GPUI's render-time
|
||||
entity tracking rather than explicit observations.
|
||||
- The layout is one `overflow_y_scrollbar` container with a two-column `h_flex`. The left column
|
||||
(`flex_1`, `min_w_0`) stacks the inbox card over the activity card; the right column is fixed at
|
||||
300px. Each card is a bordered rounded `v_flex` with a header bar (`section`).
|
||||
- `InboxView` is a plain center panel like `RepoListView`; the sidebar holds a
|
||||
`WeakEntity<InboxView>` so there is no cycle. Re-rendering relies on GPUI's render-time entity
|
||||
tracking rather than explicit observations. (Phase 2 introduced an `Entity<InboxStore>` here; it
|
||||
was later folded into the panel - see the store-merge note below.)
|
||||
- The layout is a column of two flexible bordered cards (`gap_4`, `p_4`, each `flex_1`/`min_h_0`),
|
||||
inbox over activity. Each card is a rounded `v_flex` with a header bar (`section`) and a
|
||||
`gpui::list` body. There is no **My repositories** column: the sidebar already lists the user's
|
||||
repositories, so the panel is a single column.
|
||||
- Notification rows read the newest event of each group for the actor, subject and time, and the
|
||||
root's kind for the icon. The repo name is resolved from `item.address` through a linear scan of
|
||||
`RepoListStore::announcements` (`repo_name`); the list is small and this keeps the store unchanged.
|
||||
- The **Unread** / **Archived** header buttons are intentionally absent: they need
|
||||
`add_bottom_panel` / `InboxFilterView`, which are Phase 3. The header is **Mark all read** plus the
|
||||
inline **Show all** toggle, so the panel is fully usable on its own.
|
||||
`add_bottom_panel` / `InboxFilterView`, which are Phase 3. The header is only **Mark all read**,
|
||||
so the panel is fully usable on its own.
|
||||
- `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.
|
||||
- `create_repo_dialog` became `pub(crate) mod` in `sidebar` so the inbox New button reuses it.
|
||||
- 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.
|
||||
`InboxView::new` now takes only `cx`. `create_repo_dialog` is private again.
|
||||
- `cargo clippy -p workspace --all-targets` is clean and `cargo check --workspace --all-targets`
|
||||
succeeds. `cargo test -p signed_core` (68) and `cargo test -p signed_state` (24) still pass.
|
||||
|
||||
@@ -685,30 +696,42 @@ 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.
|
||||
- `InboxStore` is created by `InboxView` and owns the query, grouping, activity list, refresh gate
|
||||
and actions. It holds no subscriptions: the panel observes the global `Inbox` and subscribes to
|
||||
`Backend`, driving the store. Re-renders rely on GPUI's render-time entity tracking.
|
||||
- `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.
|
||||
- `InboxView` observes only its store; the two observations it used to hold moved into the store.
|
||||
- `signed_core` is unchanged. `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.
|
||||
- The panel became the client-side owner of the derivation, initially through a panel-scoped
|
||||
`Entity<InboxStore>`.
|
||||
- `signed_core` is unchanged.
|
||||
|
||||
### Store merged into the panel (after Phase 2)
|
||||
|
||||
The `InboxStore` entity was then folded into `InboxView`, since the panel was its only consumer.
|
||||
|
||||
- `InboxView` holds `notifications`, `activity`, `unread_count`, `state`, `state_loaded` and
|
||||
`RefreshGate` as fields, and the store's methods (`sync_state`, `handle_backend_event`,
|
||||
`refresh`/`run_refresh`, `regroup`, `publish_unread_count`, `clear`, the mark actions) became panel
|
||||
methods. The two subscriptions call them directly, with no `update` indirection.
|
||||
- The database work stayed in `signed_state` as `pub async fn query_inbox(...)`; `RefreshGate` and
|
||||
`RefreshRequest` are re-exported. The UI crate never queries LMDB directly.
|
||||
- `mark_read`, `mark_archived` and their `group_events` helper carry a scoped `#[allow(dead_code)]`
|
||||
until the Phase 3 sub-views wire them up.
|
||||
- `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-scoped store.
|
||||
count is derived by the panel.
|
||||
|
||||
## 8. Validation
|
||||
|
||||
- `cargo test -p signed_core` (68 tests): root resolution, grouping, read-state cutoff, serde round-trip.
|
||||
- `cargo test -p signed_state` (24 tests): the `Inbox` / `InboxStore` paths that do not need GPUI
|
||||
- `cargo test -p signed_state` (24 tests): the `Inbox` / `query_inbox` paths that do not need GPUI
|
||||
(state round-trip, grouping helpers).
|
||||
- `cargo test -p workspace` (7 tests): repository-detail helpers.
|
||||
- `cargo clippy -p signed_state --all-targets`, `cargo clippy -p workspace --all-targets` and
|
||||
`cargo check --workspace --all-targets` after each phase.
|
||||
- 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, the
|
||||
repositories panel matches the sidebar, and that no kind-30078 event is broadcast (watch the
|
||||
relays / `Published` events). Restart to confirm the read state is read back from LMDB.
|
||||
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.
|
||||
|
||||
## 9. SDK APIs used (verified in the pinned `5c669a4` checkout)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user