.
This commit is contained in:
@@ -144,6 +144,7 @@ impl Sidebar {
|
|||||||
section: TreeSection::Requests,
|
section: TreeSection::Requests,
|
||||||
count: requests.len(),
|
count: requests.len(),
|
||||||
});
|
});
|
||||||
|
|
||||||
if self.is_expanded(TreeSection::Requests) {
|
if self.is_expanded(TreeSection::Requests) {
|
||||||
if requests.is_empty() {
|
if requests.is_empty() {
|
||||||
rows.push(SidebarRow::Hint {
|
rows.push(SidebarRow::Hint {
|
||||||
@@ -167,19 +168,28 @@ impl Sidebar {
|
|||||||
section: TreeSection::Community,
|
section: TreeSection::Community,
|
||||||
count: communities.len(),
|
count: communities.len(),
|
||||||
});
|
});
|
||||||
|
|
||||||
if self.is_expanded(TreeSection::Community) {
|
if self.is_expanded(TreeSection::Community) {
|
||||||
|
if communities.is_empty() {
|
||||||
|
rows.push(SidebarRow::Hint {
|
||||||
|
text: "No communities yet".into(),
|
||||||
|
depth: 1,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
rows.extend(
|
rows.extend(
|
||||||
communities
|
communities
|
||||||
.iter()
|
.iter()
|
||||||
.map(|entry| SidebarRow::Community { entry, depth: 1 }),
|
.map(|entry| SidebarRow::Community { entry, depth: 1 }),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let messages = chat.rooms(&RoomKind::Ongoing, cx);
|
let messages = chat.rooms(&RoomKind::Ongoing, cx);
|
||||||
rows.push(SidebarRow::Section {
|
rows.push(SidebarRow::Section {
|
||||||
section: TreeSection::Messages,
|
section: TreeSection::Messages,
|
||||||
count: messages.len(),
|
count: messages.len(),
|
||||||
});
|
});
|
||||||
|
|
||||||
if self.is_expanded(TreeSection::Messages) {
|
if self.is_expanded(TreeSection::Messages) {
|
||||||
if messages.is_empty() {
|
if messages.is_empty() {
|
||||||
rows.push(SidebarRow::Hint {
|
rows.push(SidebarRow::Hint {
|
||||||
@@ -450,8 +460,9 @@ impl Focusable for Sidebar {
|
|||||||
impl Render for Sidebar {
|
impl Render for Sidebar {
|
||||||
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 nostr = NostrRegistry::global(cx);
|
let nostr = NostrRegistry::global(cx);
|
||||||
let chat = ChatRegistry::global(cx);
|
|
||||||
let logged_in = nostr.read(cx).current_user().is_some();
|
let logged_in = nostr.read(cx).current_user().is_some();
|
||||||
|
|
||||||
|
let chat = ChatRegistry::global(cx);
|
||||||
let loading = chat.read(cx).loading() && logged_in;
|
let loading = chat.read(cx).loading() && logged_in;
|
||||||
|
|
||||||
let rows = Rc::new(self.tree_rows(cx));
|
let rows = Rc::new(self.tree_rows(cx));
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
# Sidebar tree redesign
|
# Sidebar tree redesign
|
||||||
|
|
||||||
Status: steps 1-6 implemented. Search lives in `panels/search.rs`; the sidebar
|
Status: steps 1-7 implemented. Search lives in `panels/search.rs`; the sidebar
|
||||||
renders the nav rail, the flattened tree, and per-row pin/unpin menus. Remaining:
|
renders the nav rail, the flattened tree, per-row pin/unpin menus, and the
|
||||||
step 7 (confirm the placeholder community names), optional step 8 (persistence),
|
Community section from placeholder data (`TODO(concord)`). Remaining: optional
|
||||||
step 9 (remove the unused `TreeRow::selected` and run the final cleanup).
|
step 8 (persistence), step 9 (remove the unused `TreeRow::selected` and run the
|
||||||
|
final cleanup).
|
||||||
|
|
||||||
Scope: `crates/workspace/src/sidebar` (`mod.rs`, `entry.rs`, new `tree.rs`),
|
Scope: `crates/workspace/src/sidebar` (`mod.rs`, `entry.rs`, new `tree.rs`),
|
||||||
new panel shells in `crates/workspace/src/panels/`, and the `Command` wiring in
|
new panel shells in `crates/workspace/src/panels/`, and the `Command` wiring in
|
||||||
@@ -343,10 +344,11 @@ unused until step 5 consumes them. Run the checks in §15 after each step.
|
|||||||
element's `on_click` when that element recorded the matching mouse-down, so the
|
element's `on_click` when that element recorded the matching mouse-down, so the
|
||||||
row's `emit_room` click does not fire when the menu trigger is clicked. No extra
|
row's `emit_room` click does not fire when the menu trigger is clicked. No extra
|
||||||
handling was needed.
|
handling was needed.
|
||||||
- [ ] **Step 7 — community section.** Render dummy entries and hint; add the
|
- [x] **Step 7 — community section.** Dummy entries and the empty-state hint are
|
||||||
`TODO(concord)` marker. The flattening and rendering landed with step 5
|
rendered; the `TODO(concord)` marker sits on `dummy_communities()`. The
|
||||||
(`SidebarRow::Community` -> `TreeRow`, dummy data from `dummy_communities()`),
|
flattening and rendering landed with step 5 (`SidebarRow::Community` ->
|
||||||
so this step is effectively complete once the names in §10 are confirmed.
|
`TreeRow`), so this step added the missing hint branch and confirmed the §10
|
||||||
|
placeholder names.
|
||||||
- [ ] **Step 8 (optional) — persistence.** Add
|
- [ ] **Step 8 (optional) — persistence.** Add
|
||||||
`#[serde(default)] pinned_rooms: Vec<u64>` (and optionally
|
`#[serde(default)] pinned_rooms: Vec<u64>` (and optionally
|
||||||
`expanded_sections: Vec<String>`) to `settings::Settings`, register accessors
|
`expanded_sections: Vec<String>`) to `settings::Settings`, register accessors
|
||||||
|
|||||||
Reference in New Issue
Block a user