gitoria

layouts

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit0bbfc5530bbfc553main-menu: format Style with nested rules and bare mediamre0bbfc553/components/showcase/files-upload-pick.hl

2.5 KB

  1. // components/showcase/files-upload-pick.hl — `/components/files-upload-pick`: the upload component in PICK mode (components ticket #18):
  2. // dropped, chosen, pasted (Ctrl+V) or photographed files are only collected, as thumbnails and rows; ✕ takes one away. It is ONE box: the
  3. // text field, the files right under it, and the footer: the small "Choose files" button at the left, Send at the right end. THE PAGE OWNS THE
  4. // LIST: it binds `files = attached`, hears every change through `onChange`, and at Send shows the message and empties the list. The
  5. // showcase sends nothing anywhere (the files stay in the browser). One FilesUpload per page, so this is a page of its own.
  6. parent '../main.hl'
  7. import SiteHeader from '../site-header.hl'
  8. import SiteSidebar from '../site-sidebar.hl'
  9. import ContentFirst from '../../theme/shell/content-first.hl'
  10. import TheFilesUpload from '../files-upload/files-upload.hl'
  11. import { namesOf } from '../../lib/pick.hl'
  12. __title = 'File upload, pick first · WorldAPI layouts'
  13. Hybrid attached = []
  14. Hybrid sent = []
  15. String state = ''
  16. picked = (list) => { attached = list }
  17. View {
  18. showFilesUploadPick {
  19. SiteHeader { current = "/components/files-upload-pick" }
  20. ContentFirst {
  21. SiteSidebar { current = "/components/files-upload-pick" }
  22. main {
  23. h1 { "File upload, pick first" }
  24. p { class = "muted" "A chat input in one box: type, and drop, paste (Ctrl+V), choose or photograph files — they wait under the text as thumbnails and rows, ✕ takes one away. Nothing is sent until Send (and here nothing leaves the browser). Up to 2 MB per file." }
  25. ol { id = "sent" for (m of sent) { li { p { class = "sent-text" m.text } p { class = "sent-files" m.files } } } }
  26. TheFilesUpload { mode = "pick" files = attached onChange = picked maxSize = 2097152
  27. form { id = "chat-form" on submit(e) { emit chatSend(e) }
  28. textarea { id = "chat-text" name = "text" rows = "2" placeholder = "Write a message…" 'aria-label' = "Message" }
  29. button { type = "submit" id = "chat-send" "Send" }
  30. }
  31. }
  32. p { class = "muted" output { id = "chat-state" state } }
  33. p { class = "readme links" a { href = "/read/readme-files-upload" "README of the component (how an app uses it)" } }
  34. }
  35. }
  36. }
  37. }
  38. on chatSend(e) {
  39. e.preventDefault()
  40. form = e.target
  41. text = form.querySelector('textarea').value
  42. if (text.trim() == '' && attached.length == 0) { return null }
  43. sent.push({ text = text files = attached.length + ' files: ' + namesOf(attached) })
  44. attached = []
  45. form.reset()
  46. state = 'Sent'
  47. }

Branches

Latest commits

  • 0bbfc553main-menu: format Style with nested rules and bare mediamre
  • 7755199dlist-first: format Style with nested rules and bare mediamre
  • 35199303content-first: format Style with nested rules and bare mediamre
  • 00f6e698app-sidebar: format Style with nested rules and bare mediamre
  • bb2f29c9app-header: format Style with nested rules and bare mediamre
  • 3aca2d7fSync components from 8176eb1 with reviewed nested stylesmre
  • 87e4003dRe-vendor layouts to Hybriel set day35mre
  • d8628cfflayouts: a startup error prints its message before exit 1 (hybriel#247)mre
  • 180fd76elayouts: MdEditor from components 59704ce (text on the clipboard always pastes, a file manager copy still attaches; pipe rows; empty Table-button table; tickets#49, notes#5)mre
  • a3eda8afRe-vendor Hybriel master 7a684920 (binary 74ab3715): plugins whole, startup fault exits 1; files-upload gate 340/0mre
  • 025d5880WIP re-vendor Hybriel set-day27b (a9712e61, master f5ff97bf): plugins whole, startup fault exits 1; NOT deployable: files-upload emit refused (see .scratch/rv27-upload)mre
  • 42183a71Merge sb3-standby: layouts deploys through its standbymre
  • 408de1f2layouts: no jobs switch needed in the standbymre
  • 0b85f57elayouts: a standby container (port 45019, profile standby); deploy hands over through standby-swap.sh without a gapmre
  • 31e40b8bMerge dm3-media: range handling in the layouts media routemre
  • 856dcacbLayouts media route: read suffix ranges and ignore range lists and garbage, like the components route (the layouts copy still answered 416 for the last bytes)mre
  • ad5056eaMerge dm3-sync: components re-sync to c2834ddmre
  • 740e2abeRe-sync the components copy to c2834dd: media player fixes (state after a queue pick, cover-less audio, accessibility labels)mre
  • 7fe103bbMerge mp-player: the media player showcase pagemre
  • 7db43c4eMedia route: serve the showcase's media from committed files (storage/ is not in git)mre