layouts
All repositories: gitoria
2.7 KB
// lib/comments.hl — THE COMMENTS SHOWCASE'S MOCK DATA (the showcase's, not the component's): a short thread with an edited// comment and likes, and what the page does when the block tells it something — a new list each time (the block shows the// list it is given). The page keeps the list in itself: every visitor plays with an own copy, nothing is stored.static NL = ""static mockThread = [{ id = 'c1' author = 'alice' when = 'Oct 17, 09:12' text = 'The block takes **Markdown**: *emphasis*, `code`, links like [the README](/read/readme-comments) and lists:' + NL + NL + '- one' + NL + '- two' likes = 2 liked = false history = [] }{ id = 'c2' author = 'bob' when = 'Oct 17, 10:40' text = 'Edited twice — the earlier versions fold out under **edited**.' likes = 1 liked = true history = [ { when = 'Oct 17, 10:31' text = 'First try.' } { when = 'Oct 17, 10:35' text = 'First try, fixed.' } ] }{ id = 'c3' author = 'alice' when = 'Oct 18, 14:05' text = 'A long word wraps on a phone: Donaudampfschifffahrtsgesellschaftskapitänswitwenrentenversicherung.' likes = 0 liked = false history = [] files = [ { name = 'notes-from-the-meeting.pdf' url = '' image = false size = 1536000 } ] }]// the files of a new comment as the block shows them: names and sizes, no address (the showcase keeps nothing: a row, no link)static shownFiles = (Hybrid files) => {out = []for (f of files) { out.push({ name = f.name url = '' image = false size = f.size }) }return out}// a new comment by `who` at the endstatic withNew = (Hybrid list, String who, String text, Number seq, Hybrid files) => {out = []for (c of list) { out.push(c) }out.push({ id = 'n' + seq author = who when = 'just now' text = text likes = 0 liked = false history = [] files = files })return out}// the comment `id` with a new text; its old text goes to the end of its historystatic withEdit = (Hybrid list, String id, String text) => {out = []for (c of list) {if (c.id == id) {past = []for (h of c.history) { past.push(h) }past.push({ when = c.when text = c.text })out.push({ id = c.id author = c.author when = 'just now' text = text likes = c.likes liked = c.liked history = past files = c.files })} else { out.push(c) }}return out}static without = (Hybrid list, String id) => {out = []for (c of list) { if (c.id != id) { out.push(c) } }return out}// the user's like on `id` switched: on adds one, off takes one awaystatic withLike = (Hybrid list, String id) => {out = []for (c of list) {if (c.id == id) { out.push({ id = c.id author = c.author when = c.when text = c.text likes = c.liked ? c.likes - 1 : c.likes + 1 liked = !c.liked history = c.history files = c.files }) }else { out.push(c) }}return out}
Branches
Latest commits
- 4099e64aMerge branch 'font-segoe-ui' into mainAtlas
- e14fb795|||PR Theme font: Segoe UI first (his choice 2026-11-19)Atlas
- 44071d2cMerge branch 'hl-standard-5' into mainAtlas
- 5ea64202|||PR Gate: count the new-tab check's console errors tooAtlas
- 2752ceddMerge branch 'hl-standard-4' into mainAtlas
- ac552b81|||PR Gate: keyboard (Tab/Enter/Space) and Back/Forward/reload/new-tab checks (HL-STANDARD F5, F21)Atlas
- 8cddcaa9Merge branch 'hl-standard-2' into mainAtlas
- 2b480a64|||PR Type the route parameter of main-menu build (HL-STANDARD L10)Atlas
- ab54a39dMerge branch 'hl-standard' into mainAtlas
- 04d36fcf|||PR Type function parameters and drop unneeded let (HL-STANDARD L2, L10)Atlas
- 220c8fa4Merge branch 'readme-audit' into mainAtlas
- b78fb85a|||PR README matches the codemre
- 9f351699Preserve comments and nest supported selectors without changing rendered outputmre
- 97110ad9WIP: nest accepted layout selectors; stopped at startup parse failuremre
- ce4a0baeKeep caller slot styles whole so minimal shell apps startmre
- 12cd3992Re-vendor complete Hybriel plugins and runtime to day44mre
- b05c20feBackup tar: --hard-dereference, so mpackdb sidecars are never stored as hard links (Tracker's finding)mre
- 8d9ed0b8Re-vendor complete Hybriel plugins and runtime to day39mre
- ebd00b6cNest caller slot styles in three-panemre
- 009991efNest caller slot styles in list-firstmre