gitoria

ident

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Branchf7-hookseee0b513|||PR ident#34 part: test-hook classes replaced by name/element/attribute selectors (tests adjusted), the shared lead/message/notice looks are statics in styles.hlmref7-hooks/components/identity.hl

3.4 KB

  1. // components/identity.hl — `/identity/<id>`: ONE IDENTITY'S PAGE (ident#26), reached from "Used in" on the identities list.
  2. // Name, short id and "Used in": one row per app the identity is connected to — app name, "since <day> · last use <ago>" and
  3. // a "Notif." chip to the per-app page (`/inbox/<connection id>`, components/appsettings.hl). No identity edit here
  4. // (that stays on `/`). Layout after the ident#27 proposal 027-06 (the identity page); nothing of #27 is built.
  5. //
  6. // Faces: none — the page is read only.
  7. parent './main.hl'
  8. import { accountOfSession } from '../lib/accounts.hl'
  9. import { usedIn } from '../lib/usedin.hl'
  10. import { siteName } from '../project.hl'
  11. import { leadLook, messageLook } from './styles.hl'
  12. session = null
  13. iid = null
  14. me = accountOfSession(&session)
  15. signedIn = me != null
  16. signedOut = me == null
  17. page = me != null && iid != null ? usedIn(me.id, iid) : null
  18. found = page != null
  19. notFound = me != null && page == null
  20. meEmail = me != null ? me.email : ''
  21. who = page != null ? page.identity : null
  22. rows = page != null ? page.rows : []
  23. hasRows = rows.length > 0
  24. noRows = rows.length == 0
  25. __title = siteName + (page != null ? ' | ' + page.identity.label : ' | identity')
  26. Style {
  27. pLead = leadLook
  28. pMessage = messageLook
  29. identityHead {
  30. display = 'flex'
  31. alignItems = 'center'
  32. gap = '.8rem'
  33. 'img.avatar' {
  34. flex = '0 0 auto'
  35. width = '48px'
  36. height = '48px'
  37. objectFit = 'cover'
  38. borderRadius = '50%'
  39. background = 'var(--color-background-sunken)'
  40. }
  41. }
  42. '#backtoids' {
  43. display = 'inline-flex'
  44. alignItems = 'center'
  45. minHeight = 'var(--layout-tap)'
  46. justifySelf = 'start'
  47. fontSize = '.875rem'
  48. }
  49. usedMain {
  50. flex = '1 1 10rem'
  51. display = 'grid'
  52. gap = '.15rem'
  53. minWidth = '0'
  54. }
  55. usedApp {
  56. fontWeight = '700'
  57. color = 'var(--color-text-strong)'
  58. overflowWrap = 'anywhere'
  59. }
  60. usedLine {
  61. color = 'var(--color-text-muted)'
  62. fontSize = '.875rem'
  63. overflowWrap = 'anywhere'
  64. }
  65. // the "Notif." chip, and the identities list's "Used in…" link (identitylist.hl) that looks the same
  66. 'a.chip, identity-actions a.used' {
  67. display = 'inline-flex'
  68. alignItems = 'center'
  69. justifyContent = 'center'
  70. minHeight = 'var(--layout-tap)'
  71. minWidth = 'var(--layout-tap)'
  72. padding = '0 .8rem'
  73. fontSize = '.875rem'
  74. background = 'var(--color-background-sunken)'
  75. borderRadius = 'var(--radius-small)'
  76. }
  77. '#usedinsection' {
  78. marginTop = '.6rem'
  79. }
  80. }
  81. View {
  82. identCard { class = "wide"
  83. if (signedOut) {
  84. h1 { "Identity" }
  85. p { id = "signinfirst" Style.pLead "Sign in to ident first: " a { href = "/" "sign in" } "." }
  86. }
  87. if (notFound) {
  88. h1 { "Identity" }
  89. p { id = "notfound" Style.pMessage "This identity does not exist or is not yours." }
  90. p { class = "links" a { href = "/" "Back to your identities" } }
  91. }
  92. if (found) {
  93. a { id = "backtoids" href = "/" "‹ Identities" }
  94. identityHead {
  95. if (who.hasAvatar) { img { class = "avatar" src = who.avatar alt = "" width = "48" height = "48" } }
  96. identityMain {
  97. h1 { id = "idlabel" who.label }
  98. identityShortId { id = "idshort" who.shortId }
  99. }
  100. }
  101. section { id = "usedinsection"
  102. h2 { "Used in" }
  103. if (noRows) { p { id = "usedinnone" Style.pLead "Not used in any app yet. When this identity signs in to an app, the app shows up here." } }
  104. ul { id = "usedin"
  105. for (u of rows) {
  106. li {
  107. usedMain {
  108. usedApp { u.app }
  109. usedLine { u.line }
  110. }
  111. a { class = "chip notif" href = u.href "Notif." }
  112. }
  113. }
  114. }
  115. }
  116. }
  117. }
  118. }

Branches

Latest commits

  • eee0b513|||PR ident#34 part: test-hook classes replaced by name/element/attribute selectors (tests adjusted), the shared lead/message/notice looks are statics in styles.hlmre
  • ccd6d0c4ident#34: browser gate: rowButton finds the row's button by namemre
  • 24dd414eident#34: the shared lead, message and notice looks are statics in components/styles.hl, imported by the components (lib/looks.hl gone)mre
  • 03ed26c7ident#34: access.hl: the remaining lead classes droppedmre
  • 1d066c42ident#34: access.hl drops its unstyled lead class (the shared lead rule would otherwise mute it)mre
  • 1e1dd7b4ident#34: the access page keeps its lead class string (the page has no ident-card, so its lead line was never muted; a shared rule would change the look)mre
  • 89ac6553ident#34: the lead, message and notice lines are named with Style.pLead / pMessage / pNotice (shared bodies in lib/looks.hl) instead of class stringsmre
  • e84be3deident#34: browser gate lists the Edit/Delete buttons by namemre
  • fb7111faident#34: access page: unstyled test-hook classes (idrow, never, who, whoname, appname, neverrevoke) dropped; the tests use element/name selectorsmre
  • 9f2ad803ident#34: notification switches: push/email by name=..., locked by aria-disabled, the switch look is the role=switch button (no switch/push/email/locked classes)mre
  • e0f0ddaaident#34: inbox: the Mark read/unread button is styled as the button of its note-foot, the icon is found as the row's img (no toggle/icon classes)mre
  • 16b49756ident#34: unused row classes (choice, usedrow, kind, shortid) droppedmre
  • f9d6fb38ident#34: apps and identity rows: the Edit/New secret/Delete buttons carry name=..., the API key is found by its element; unused row classes (app, identity, shortid) droppedmre
  • b323265aMerge branch 'f5-styles' into mainIdent
  • 9ced53c3|||PR ident#33 ident#35 every component's styles live in its own Style block; styles.hl keeps the page-wide rest; the account bar is phone first (min-width: 60rem block); the avatar preview is hidden with the hidden attribute (ident#34 in part)mre
  • f28333e4ident#33 ident#35: styles.hl keeps only the accent, the page column and the shared patterns; the account bar is written phone first (base rule + one min-width: 60rem block) instead of a max-width overridemre
  • 5b4541fcident#33: the selector sign-in frame's rules move into embed.hl's Stylemre
  • 00235f21ident#33: the per-app notification switches move into appsettings.hl's Stylemre
  • 2249945cident#33: the inbox and connection list rules move into inbox.hl's Stylemre
  • f2d9f79fident#33: the apps list and the secret box move into apps.hl's Stylemre