fixes #1

Closed
opened 2026-03-19 10:07:04 +00:00 by despiegk · 3 comments
Owner

image

if we click on a thread, we don't see the right side changes, where we have the messages per thread

image

can;t open the top is that a workspace?
needs to be a dropdown

![image](/attachments/12747ece-a906-4132-a8d2-30370344e58d) if we click on a thread, we don't see the right side changes, where we have the messages per thread ![image](/attachments/9975a3db-65f2-435e-bf38-9bb89d96580d) can;t open the top is that a workspace? needs to be a dropdown
504 KiB
149 KiB
Author
Owner

Implementation Spec for Issue #1 — Fixes

Objective

Fix two UI bugs in the hero_collab_web Slack-like UI:

  1. Thread panel doesn't show replies when clicking on a thread
  2. Workspace selector doesn't open as a dropdown

Root Causes

Bug 1 — Thread replies not loading:

  • In openThread() (line 2100 of hero_collab_web/src/main.rs), the JS sends { message_id: msgId } but the server's thread::replies() expects { thread_id: ... } — parameter name mismatch causes silent failure
  • Additionally, renderMessages() never renders thread reply count previews on messages (CSS .msg-thread-preview exists but is unused)

Bug 2 — Workspace selector is not a dropdown:

  • toggleWorkspaceSwitcher() just cycles to the next workspace with no visual dropdown
  • User expects a proper dropdown menu listing all workspaces

Files to Modify

  • crates/hero_collab_web/src/main.rs — All changes are in this single file (embedded HTML/CSS/JS)

Implementation Plan

Step 1: Fix thread.replies parameter mismatch

Files: crates/hero_collab_web/src/main.rs

  • Change openThread() to send { thread_id: msgId } instead of { message_id: msgId }
  • This fixes the silent RPC error that prevented replies from loading
    Dependencies: none

Step 2: Add thread reply count preview to messages

Files: crates/hero_collab_web/src/main.rs

  • In renderMessages(), after rendering reactions, add thread reply count preview using existing .msg-thread-preview CSS class
  • Need to fetch thread data: call thread.list(channel_id) alongside message.list() in loadMessages(), store reply counts in a map
  • Show "N replies" clickable link below messages that have replies
    Dependencies: Step 1

Step 3: Replace workspace cycling with dropdown menu

Files: crates/hero_collab_web/src/main.rs

  • Add CSS for a .ws-dropdown menu (positioned below workspace header)
  • Add HTML for dropdown container
  • Replace toggleWorkspaceSwitcher() with a function that shows/hides dropdown
  • Populate dropdown with all workspaces, clicking one calls selectWorkspace(ws) and closes dropdown
  • Close dropdown when clicking outside
    Dependencies: none

Acceptance Criteria

  • Clicking "Reply in thread" on a message opens thread panel and shows existing replies
  • Messages with thread replies show "N replies" preview link in the main channel view
  • Clicking the reply count preview also opens the thread panel
  • Workspace header click opens a dropdown listing all workspaces
  • Selecting a workspace from dropdown switches workspace and closes dropdown
  • Clicking outside dropdown closes it

Notes

  • All HTML/CSS/JS is embedded in the Rust source file as string constants
  • The .msg-thread-preview CSS already exists (lines 694-707) — just needs to be rendered
  • Messages are fetched with ORDER BY created_at DESC from the server
## Implementation Spec for Issue #1 — Fixes ### Objective Fix two UI bugs in the hero_collab_web Slack-like UI: 1. Thread panel doesn't show replies when clicking on a thread 2. Workspace selector doesn't open as a dropdown ### Root Causes **Bug 1 — Thread replies not loading:** - In `openThread()` (line 2100 of `hero_collab_web/src/main.rs`), the JS sends `{ message_id: msgId }` but the server's `thread::replies()` expects `{ thread_id: ... }` — parameter name mismatch causes silent failure - Additionally, `renderMessages()` never renders thread reply count previews on messages (CSS `.msg-thread-preview` exists but is unused) **Bug 2 — Workspace selector is not a dropdown:** - `toggleWorkspaceSwitcher()` just cycles to the next workspace with no visual dropdown - User expects a proper dropdown menu listing all workspaces ### Files to Modify - `crates/hero_collab_web/src/main.rs` — All changes are in this single file (embedded HTML/CSS/JS) ### Implementation Plan #### Step 1: Fix thread.replies parameter mismatch Files: `crates/hero_collab_web/src/main.rs` - Change `openThread()` to send `{ thread_id: msgId }` instead of `{ message_id: msgId }` - This fixes the silent RPC error that prevented replies from loading Dependencies: none #### Step 2: Add thread reply count preview to messages Files: `crates/hero_collab_web/src/main.rs` - In `renderMessages()`, after rendering reactions, add thread reply count preview using existing `.msg-thread-preview` CSS class - Need to fetch thread data: call `thread.list(channel_id)` alongside `message.list()` in `loadMessages()`, store reply counts in a map - Show "N replies" clickable link below messages that have replies Dependencies: Step 1 #### Step 3: Replace workspace cycling with dropdown menu Files: `crates/hero_collab_web/src/main.rs` - Add CSS for a `.ws-dropdown` menu (positioned below workspace header) - Add HTML for dropdown container - Replace `toggleWorkspaceSwitcher()` with a function that shows/hides dropdown - Populate dropdown with all workspaces, clicking one calls `selectWorkspace(ws)` and closes dropdown - Close dropdown when clicking outside Dependencies: none ### Acceptance Criteria - [ ] Clicking "Reply in thread" on a message opens thread panel and shows existing replies - [ ] Messages with thread replies show "N replies" preview link in the main channel view - [ ] Clicking the reply count preview also opens the thread panel - [ ] Workspace header click opens a dropdown listing all workspaces - [ ] Selecting a workspace from dropdown switches workspace and closes dropdown - [ ] Clicking outside dropdown closes it ### Notes - All HTML/CSS/JS is embedded in the Rust source file as string constants - The `.msg-thread-preview` CSS already exists (lines 694-707) — just needs to be rendered - Messages are fetched with `ORDER BY created_at DESC` from the server
Author
Owner

Test Results

  • Build: Passed (cargo build successful)
  • Tests: All passed
    • test_server_health — ok
    • test_rpc_discover — ok
    • test_client_creation — ok
    • doc-test hero_collab_sdk — ok
  • Total: 4 passed, 0 failed

Changes Made

Bug 1: Thread panel not showing replies

  • Root cause: Parameter mismatch — JS sent message_id but server expected thread_id
  • Fix: Changed openThread() to send { thread_id: msgId } instead of { message_id: msgId }
  • Enhancement: Added thread reply count previews on messages in the main channel view (e.g., "3 replies" link below messages with threads)

Bug 2: Workspace selector not working as dropdown

  • Root cause: toggleWorkspaceSwitcher() only cycled through workspaces sequentially
  • Fix: Replaced with proper dropdown menu listing all workspaces, with click-outside-to-close behavior

Files Modified

  • crates/hero_collab_web/src/main.rs — All changes (embedded HTML/CSS/JS)
## Test Results - **Build:** ✅ Passed (cargo build successful) - **Tests:** ✅ All passed - `test_server_health` — ok - `test_rpc_discover` — ok - `test_client_creation` — ok - `doc-test hero_collab_sdk` — ok - **Total:** 4 passed, 0 failed ## Changes Made ### Bug 1: Thread panel not showing replies - **Root cause:** Parameter mismatch — JS sent `message_id` but server expected `thread_id` - **Fix:** Changed `openThread()` to send `{ thread_id: msgId }` instead of `{ message_id: msgId }` - **Enhancement:** Added thread reply count previews on messages in the main channel view (e.g., "3 replies" link below messages with threads) ### Bug 2: Workspace selector not working as dropdown - **Root cause:** `toggleWorkspaceSwitcher()` only cycled through workspaces sequentially - **Fix:** Replaced with proper dropdown menu listing all workspaces, with click-outside-to-close behavior ### Files Modified - `crates/hero_collab_web/src/main.rs` — All changes (embedded HTML/CSS/JS)
Author
Owner

Implementation committed: 38a8d27

Browse: 38a8d27

Implementation committed: `38a8d27` Browse: https://forge.ourworld.tf/lhumina_code/hero_collab/commit/38a8d27
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_collab#1
No description provided.