gitoria

layouts

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit0573eed30573eed3usage: notes + tickets on MdEditor (md-editor.js retired), gitoria on theme dbe3de7, tracker theme oldermre0573eed3/lib/comments.hl

2.6 KB

  1. // lib/comments.hl — THE COMMENTS SHOWCASE'S MOCK DATA (the showcase's, not the component's): a short thread with an edited
  2. // comment and likes, and what the page does when the block tells it something — a new list each time (the block shows the
  3. // list it is given). The page keeps the list in itself: every visitor plays with an own copy, nothing is stored.
  4. static NL = "
  5. "
  6. static mockThread = [
  7. { 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 = [] }
  8. { 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.' } ] }
  9. { 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 } ] }
  10. ]
  11. // the files of a new comment as the block shows them: names and sizes, no address (the showcase keeps nothing: a row, no link)
  12. static shownFiles = (files) => {
  13. out = []
  14. for (f of files) { out.push({ name = f.name url = '' image = false size = f.size }) }
  15. return out
  16. }
  17. // a new comment by `who` at the end
  18. static withNew = (list, who, text, seq, files) => {
  19. out = []
  20. for (c of list) { out.push(c) }
  21. out.push({ id = 'n' + seq author = who when = 'just now' text = text likes = 0 liked = false history = [] files = files })
  22. return out
  23. }
  24. // the comment `id` with a new text; its old text goes to the end of its history
  25. static withEdit = (list, id, text) => {
  26. out = []
  27. for (c of list) {
  28. if (c.id == id) {
  29. let past = []
  30. for (h of c.history) { past.push(h) }
  31. past.push({ when = c.when text = c.text })
  32. out.push({ id = c.id author = c.author when = 'just now' text = text likes = c.likes liked = c.liked history = past files = c.files })
  33. } else { out.push(c) }
  34. }
  35. return out
  36. }
  37. static without = (list, id) => {
  38. out = []
  39. for (c of list) { if (c.id != id) { out.push(c) } }
  40. return out
  41. }
  42. // the user's like on `id` switched: on adds one, off takes one away
  43. static withLike = (list, id) => {
  44. out = []
  45. for (c of list) {
  46. 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 }) }
  47. else { out.push(c) }
  48. }
  49. return out
  50. }

Branches

Latest commits

  • 0573eed3usage: notes + tickets on MdEditor (md-editor.js retired), gitoria on theme dbe3de7, tracker theme oldermre
  • 78478f6eSync showcase to components.hybriel 1442e58: pick-mode page, comments attach, md-editor rows/files off; gates 285/0mre
  • dbe3de79Display bugs from a real Chrome walk (mission 007): Settings page and in-shell doc reader instead of raw .md links, closed phone search hidden whatever a page says, /elements form rules scoped, three-pane danger contrast; display audit gate (132 -> 244 checks), walk + Settings e2e toolsmre
  • 1875a051Theme: 44 px tap targets mobile first (layoutTap), 16 px fields, desktop denser only in @media 60rem; 390 px tap audit + gate checks (mission 006)mre
  • 3d4f8e19Sync showcase to components.hybriel 9db927d: comments and files-upload pages, pagination onPage, md-editor readonly, gate 99 checksmre
  • 64d635acmission brief 005mre
  • 0d0fef25paths: projects moved into /media/STORAGE/projects/WorldAPI/mre
  • 2dbe0df5Re-vendor Hybriel to the shared static build 0f396652 (plugins; bin/ is git-ignored), compose cache volume + tmpfs /tmp, gate wait 120 s, report 004mre
  • 0adc551emission brief 004mre
  • 1376e905deploy.sh: wait up to DEPLOY_URL_WAIT (120 s) for 200 after the restart, as the other apps (cold compile, hybriel#148)mre
  • c0fdbf6cdocker-compose: init: true (hybriel#156, PID 1 ignored SIGTERM, every restart waited 10 s)mre
  • ecf70665usage: layouts on components a567b57mre
  • 315731efcomponents re-synced to components.hybriel a567b57 (md-editor tables)mre
  • b59e2ee9docs/usage.md + tools/usage.sh: which app carries which component/theme/tokens copy, and whether it matches the sourcemre
  • 0222f67ctheme: two corner radii only (radiusSmall 5px, radiusLarge 10px); check-theme flags any other radius; gate 76/0mre
  • 877b63acdesign rules: two radii only (5px small, 10px large)mre
  • 635234dfcomponents re-synced to components.hybriel 5a98d77 (#15 black/white base look); gate 73/0, check-theme 0, screenshots unchangedmre
  • 876b2064docs: workaround note for hybriel#130 (slot marker mid-line)mre
  • 85b56541layouts mission 002 3/3: same-output tests, letcount, shots ports, docs, reportmre
  • 0f325d3blayouts mission 002 2/3: code rules — styles.hl -> components/styles.hl, the one never-reassigned let dropped; gate 73/0, same outputmre