Do not show the Presentation share link when the board has no frames #198
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_whiteboard#198
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The share dialog always offers a "Presentation link" row even when the board has no frames. A presentation link for a frameless board presents nothing, so it should not be shown.
Confirmed current behavior
crates/hero_whiteboard_admin/templates/web/home.htmlrenderRows(viewUrl, editUrl)(~lines 762-788) unconditionally builds three rows — View link, Edit link, and Presentation link (viewUrl + '?present=1'). There is no check for whether the board contains any frames before rendering the Presentation row.Expected
?present=1link must apply the same rule — audit and cover them all (e.g. a presenter control-bar "copy presentation link" action if present).Requirements
frameCount > 0.Notes
shareUrlsCache, the RPC it issues) to find the cheapest way to know the frame count.frame; the client may already have them via the loaded board (when opened from the board) or may need a count when sharing from the boards list (home page) where the board is not open — handle both entry points.touch crates/hero_whiteboard_admin/src/assets.rsbeforecargo build --release -p hero_whiteboard_admin, and verify the served asset changed before testing.Implementation Spec for Issue #198
Objective
Stop advertising a Presentation share link (
viewUrl + '?present=1') for boards with zero frames (a presentation with no frames is non-functional). View and Edit rows always render and render immediately; the Presentation row is gated on the board having >= 1 frame (object withtype === 'frame'). Boards with frames keep today's exact behavior.Requirements
object.listclient-side, countingtype === 'frame'(no server/schema change).shareUrlsCacheso reopening for the same board is instant (no re-fetch, no flicker).?present=1emitters audited and gated with the same rule.Files to Modify/Create
crates/hero_whiteboard_admin/templates/web/home.html- gate the Presentation row in the home-page share modal; add frame-count fetch + cache.crates/hero_whiteboard_admin/templates/web/board.html- gate the Presentation row in the in-board "Share Board" dialog (shareReadonly, ~460-464) and audit the presenter control-bar "Copy presentation link" button (pres-share, ~573-596).crates/hero_whiteboard_admin/src/assets.rs- not edited; onlytouched so rust-embed re-embeds the changed templates.Implementation Plan
Step 1: Frame-count helper + cache field (home.html)
Files:
crates/hero_whiteboard_admin/templates/web/home.htmlshareUrlsCache[boardId]entries may carry aframeCountnumber (no structural change).async function getFrameCount(boardId)nearopenShareModal(~before :751): return cachedframeCountif present; elsevar objs = await rpcCall('object.list', { board_id: boardId });thenobjs.filter(o => o && o.type === 'frame').length, store it back on the cache entry, return it. On RPC failure returnnull(treated as omit the row).Dependencies: none
Step 2: Split renderRows so the Presentation row is separately injectable (home.html ~762-788)
Files:
crates/hero_whiteboard_admin/templates/web/home.htmlrenderRows(viewUrl, editUrl)renders only View (~764-771) + Edit (~772-779) then appends a stable placeholder<div id="share-present-slot"></div>where the Presentation row OR hint goes; remove the unconditional Presentation block (~780-787).function renderPresentRow(viewUrl, frameCount)targeting#share-present-slot: ifframeCount >= 1set slot innerHTML to the original Presentation block markup byte-for-byte (label + readonlyviewUrl + '?present=1'input + Copy); else a single muted line "Add a frame to enable presentation." Reserving the slot up front prevents layout shift.Dependencies: Step 1
Step 3: Wire async resolution into openShareModal (home.html ~751-816)
Files:
crates/hero_whiteboard_admin/templates/web/home.htmlrenderRows(cached.viewUrl, cached.editUrl)do not early-return; iftypeof cached.frameCount === 'number'callrenderPresentRow(cached.viewUrl, cached.frameCount)synchronously, elsegetFrameCount(boardId).then(n => renderPresentRow(cached.viewUrl, n)).renderRows(viewUrl, editUrl)(View/Edit visible immediately) rungetFrameCount(boardId).then(n => renderPresentRow(viewUrl, n)).catch(() => renderPresentRow(viewUrl, null));— not awaited before rows show.renderPresentRowre-readsdocument.getElementById('share-present-slot')and no-ops if missing (modal closed / different board).Dependencies: Steps 1, 2
Step 4: Gate the in-board "Share Board" dialog (board.html shareReadonly ~437-473)
Files:
crates/hero_whiteboard_admin/templates/web/board.htmlWhiteboardObjects.getAllObjects()entries withtype === 'frame'(in-memory frame entries are taggedtype:'frame', objects.js:1245; pattern used at sync.js:169); fall back to anobject.listcount only if the objects API is unavailable.Dependencies: none
Step 5: Audit the presenter control-bar "Copy presentation link" button (board.html pres-share ~573-596)
Files:
crates/hero_whiteboard_admin/templates/web/board.htmlpres-sharebutton only exists while presentation mode runs (body.wb-presenting), which requires >= 1 frame. ConfirmWhiteboardFrames.startPresentationcannot start with zero frames (it returns early on no frames). If confirmed, add a one-line comment noting thestate.total >= 1invariant — no behavioral change. If it CAN start with zero frames, guard the click handler to toast "Add a frame to enable presentation." and return.Dependencies: none (parallel)
Step 6: Re-embed and verify
Files:
crates/hero_whiteboard_admin/src/assets.rstouch crates/hero_whiteboard_admin/src/assets.rs;cargo build --release -p hero_whiteboard_admin; verify the served HTML contains the new slot/gating before testing (rust-embed embeds at compile time).Dependencies: Steps 1-5
Acceptance Criteria
shareUrlsCache[boardId]so reopening for the same board is instant (no extra RPC, no flicker/layout shift).?present=1emitters covered: home-page modal, in-board Share dialog, presenter control-bar copy button.Notes
object.list({board_id})returning all objects. Frames are objects withtype === 'frame'(sync.js:169, objects.js:1245). Filter client-side. Payload concern on dense boards is acceptable: one-shot on share-modal open, cached after first open, comparable to existing fullobject.listflows (home.html:621 duplicateBoard); no lighter alternative without a new server method (forbidden). In-board surfaces use the already-loaded in-memory model (no RPC).renderPresentRowno-ops if the slot is gone (stale late response).?present=1emitters: (1) home.html renderRows (~783-785), (2) board.html shareReadonly (~460-464), (3) board.html pres-share control bar (~573-596, builds/s/<token>?present=1).board_view.htmlreferences are read-side audience detection, not link emission.frameCountto the existingshareUrlsCache[boardId]object; existingif (cached)readers unaffected; frames>=1 emits byte-identical markup. Unknown (RPC fail) → omit + hint, per the issue.touch crates/hero_whiteboard_admin/src/assets.rsthencargo build --release -p hero_whiteboard_admin, verify served HTML changed before testing.Test Results
cargo test --workspace --lib: ok - all 4 lib targets compiled and passed (0 tests defined; suite is the regression gate)
inline script syntax (home.html, board.html): ok
Note: #198 is a template/JS-only change (gate the Presentation share link on board frame count). No JS unit harness exists in this repo; the Rust suite is the regression gate and the share-dialog gating is verified manually in-browser.
Implementation Summary
Template/JS-only. The Presentation share link is now gated on the board having at least one frame; View and Edit links always render and are never blocked on the frame count. No server or schema change.
Changes
home.html (home-page share modal)
board.html (in-board "Share Board" dialog)
Frame-having boards render byte-identical markup to before.
Behavior after change
Tests