| 1 | package docs |
| 2 | |
| 3 | // The phone document screen (design/phone-web, approved by Paul |
| 4 | // 2026-11-28; slice P1). Below 704px estilo's bar is compact |
| 5 | // (chrome.Bar.Compact): Back, the undo/redo pair, Aa and ••• (menu.go's |
| 6 | // newMoreView). The page carries a large title with the save state as |
| 7 | // its subtitle, which the bar takes over as an inline title once the |
| 8 | // large title has scrolled away (brand/phone.js sets estilo-bar-folded). |
| 9 | // From 704px none of it is drawn and the screen is the desktop editor. |
| 10 | |
| 11 | import ( |
| 12 | "net/http" |
| 13 | |
| 14 | "amadan.net/oficina/estilo.git/savestatus" |
| 15 | "amadan.net/rastrillo/rastrillo" |
| 16 | ) |
| 17 | |
| 18 | // largeTitleView is the large title's copy: the rename form's for a |
| 19 | // writer, "View only" for a reader, and the subtitle's sharing note |
| 20 | // (handlers.go's sharedNote: empty on the person's own document). |
| 21 | type largeTitleView struct { |
| 22 | Shared string |
| 23 | TitleLabel string |
| 24 | TitleHint string |
| 25 | Rename string |
| 26 | Cancel string |
| 27 | // RenameFailed is said in the hint's place when a rename could not be |
| 28 | // saved (brand/phone.js). |
| 29 | RenameFailed string |
| 30 | ViewOnly string |
| 31 | // Status is the save state under the title: estilo's savestatus in |
| 32 | // its "subtitle" placement, saying the quiet states too. The page |
| 33 | // opens saved, since it was just read from the server; brand/phone.js |
| 34 | // mirrors the editor's state into it from the corner toast's. |
| 35 | Status savestatus.Data |
| 36 | } |
| 37 | |
| 38 | func newLargeTitleView(r *http.Request, shared string) largeTitleView { |
| 39 | return largeTitleView{ |
| 40 | Shared: shared, |
| 41 | TitleLabel: rastrillo.T(r, "docs.chrome.title.label"), |
| 42 | TitleHint: rastrillo.T(r, "docs.chrome.title.hint"), |
| 43 | Rename: rastrillo.T(r, "docs.chrome.title.rename"), |
| 44 | Cancel: rastrillo.T(r, "docs.chrome.title.cancel"), |
| 45 | RenameFailed: rastrillo.T(r, "docs.chrome.title.failed"), |
| 46 | ViewOnly: rastrillo.T(r, "docs.show.viewonly"), |
| 47 | Status: savestatus.Data{ |
| 48 | State: "saved", |
| 49 | Placement: "subtitle", |
| 50 | Saved: rastrillo.T(r, "docs.editor.status.saved"), |
| 51 | Saving: rastrillo.T(r, "docs.editor.status.saving"), |
| 52 | Retrying: rastrillo.T(r, "docs.editor.status.retrying"), |
| 53 | Failed: rastrillo.T(r, "docs.editor.status.failed"), |
| 54 | }, |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | // inlineTitleView is the bar's inline title (chrome.Compact.Title): the |
| 59 | // title over the subtitle, hidden from assistive technology because the |
| 60 | // large title is the page's heading and the subtitle's state is said by |
| 61 | // its own live region. |
| 62 | type inlineTitleView struct { |
| 63 | Title, Shared, State string |
| 64 | // Tone is the state's data-state: "saved" for a writer, "viewonly" |
| 65 | // for a reader. |
| 66 | Tone string |
| 67 | } |
| 68 | |