Home page: replace inline share-links panel with a proper modal #82
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#82
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?
Bug / Improvement
Clicking the share icon on a board card on the home page expands an inline panel inside the card containing two share URLs (View / Edit). The panel:
onclick="copyLink(...)").×glyph) that doesn't match the rest of the page's modal patterns (rename / new board / new workspace / delete board).share.createRPC calls per click; if the user toggles repeatedly the loading state isn't cleared cleanly.A proper themed modal would match the rest of the page's modals, give each link a clear Copy button + a single Close button, and decouple the share UI from the card layout.
Reproduction
Observed: an inline panel expands inside the card with two URLs styled as
<code>and a×close glyph.Expected: a centered, themed modal opens with the View and Edit URLs, each with a Copy button, and a single Close button.
Root cause / current implementation
crates/hero_whiteboard_ui/templates/web/home.html:onclick="event.stopPropagation();toggleShareLinks(...)").<div class="board-card-links" id="links-...">).toggleShareLinks(boardId)at lines 487-543, which:share.list, then creates missingviewer/editorshares viashare.create.<code>elements.copyLink(url)helper at lines 545-554 writes to the clipboard and pops a small green toast.Affected file
crates/hero_whiteboard_ui/templates/web/home.html-- replace the inline panel +toggleShareLinkswith a modal-driven flow.No server / SDK / openrpc / DB changes -- pure UI refactor; the same
share.listandshare.createRPCs are used.Expected behavior
Clicking the share icon on a board card opens an in-page themed modal that:
Share "Sprint planning").alert).var(--wb-...)CSS variables (matches rename / new-board / new-workspace / delete-board modals).<div class="board-card-links">placeholder and the inline-render code are removed (the cards no longer expand on share).Reference modals
The same file already has four modals to model after:
rename-modal(lines 108-128)new-board-modal(lines 60-88)new-workspace-modal(lines 11-29)delete-board-modal(lines 90-106)Follow the same conventions: centered card on
var(--wb-surface)withpadding:24px,border-radius:12px, inline error region usingvar(--wb-error), action buttons aligned right withdisplay:flex;gap:8px;justify-content:flex-end.Acceptance criteria
×glyph button).alert).board-card-linksplaceholder.toggleShareLinksand inline-rendering code are removed;copyLink(and its toast) are kept.crates/hero_whiteboard_ui/templates/web/home.html.Notes
renameBoard,deleteBoard); pipe it through to the new share opener too so it can appear in the modal header.boardIdin a small in-page object so re-opening the modal for the same board doesn't re-issueshare.list/share.createcalls (parity with the currentdata-loadedshort-circuit).share.listfirst and only fall back toshare.createfor the missing role(s) -- preserve the existing behavior so we don't create duplicate shares on every click.Implementation Spec for Issue #82
Objective
Replace the inline share-links panel that expands inside each board card with a centered, themed modal that lists the View / Edit links with explicit Copy buttons and a single Close button — matching the rest of the home page's modal patterns.
Requirements
Share "<name>").copyLink(url)helper so the brief green toast confirmation is preserved.var(--wb-error)) inside the modal — noalert, modal stays open.var(--wb-...)CSS variables.board-card-linksplaceholder.toggleShareLinksfunction and the inline-render code are removed;copyLink(and its toast) stay.boardId -> { viewUrl, editUrl }cache avoids re-issuingshare.list/share.createcalls when the same board's modal is opened more than once (parity with the currentdata-loadedshort-circuit).crates/hero_whiteboard_ui/templates/web/home.html.Files to Modify
crates/hero_whiteboard_ui/templates/web/home.html— add the modal markup, replacetoggleShareLinkswith anopenShareModal(boardId, name)flow, drop the inlineboard-card-linksplaceholder, change the share button'sonclick, and extend the Escape keydown handler.No server / SDK / openrpc / DB changes — same
share.list/share.createRPCs are used.Implementation Plan
Step 1: Add the share modal markup, replace toggleShareLinks, drop the inline panel, and extend the keydown handler
Files:
crates/hero_whiteboard_ui/templates/web/home.htmlModal markup. In the
{% block content %}section (next to the existing modals), add:The body is populated dynamically by
openShareModal— initially shows a Loading placeholder, then either the two View/Edit rows or the inline error.Module-scope cache. Add near the top of the script block alongside
renamingBoardId/deletingBoardId:Replace the inline placeholder. Remove the
<div class="board-card-links" id="links-...">line from the per-cardcard.innerHTMLtemplate (currently around line 263). It's no longer needed.Change the share button's onclick (currently
toggleShareLinks(...)around line 267) to:Pass the board name through
escapeAttrso it survives the inline-string dance, the same way the rename and delete buttons do.Replace
toggleShareLinkswith the modal flow (delete lines ~487-543 and add):Extend the keydown handler. Add an Escape branch for the share modal alongside the others:
Keep
copyLinkunchanged.Dependencies: none.
Acceptance Criteria
Share "<name>").window.alert); the modal stays open.var(--wb-...)(looks correct in dark + light mode).share.list/share.create(cache hit).board-card-linksplaceholder.toggleShareLinksand its inline-rendering code are removed;copyLink(and its toast) stay.crates/hero_whiteboard_ui/templates/web/home.html.Notes
Number); the cache lives for the page lifetime, so a hard refresh re-fetches as before.escapeAttr(already defined in the same script) when interpolating the URL and board name into HTML strings to avoid quote/special-character issues in the inlineonclickandvalueattributes.Test Results
cargo test --workspace --lib: 4 lib targets, 0 tests / 0 passed / 0 failed each.cargo clippy --workspace -- -D warnings: clean.cargo check --workspace: clean (Askama compiled the template).Template-only change. Manual verification recommended:
Share "<name>").share.list/share.createRPC).Implementation Summary
Changes
crates/hero_whiteboard_ui/templates/web/home.html(+68 / -41)share-board-modalblock in the content section, styled like the rest of the page's modals (480px-wide centered card onvar(--wb-surface),padding:24px, inline error region, single Close button at bottom right).var shareUrlsCache = {};so re-opening a board's share modal doesn't re-issueshare.list/share.createcalls.<div class="board-card-links" id="links-...">placeholder from the card template — share UI is no longer inline.onclickto callopenShareModal(boardId, name); passes the board name throughescapeAttrso the modal can showShare "<name>"in the header.toggleShareLinkswithopenShareModal(boardId, name)andcloseShareModal(). The new function:Share "<board name>".share.list, fills any missing role withshare.create, caches the resulting URLs, and renders.alert).<input>+ aCopybutton that calls the existingcopyLink(url)helper (preserves the brief green toast).copyLinkand its toast are unchanged.Verification
cargo test --workspace --lib: passes (4 lib targets, 0 tests).cargo clippy --workspace -- -D warnings: clean.cargo check --workspace: clean.Notes / caveats
share.listandshare.createRPCs are used.