Landing decluttered: photo actions move into the viewer; sessions read as devices, details a click behind the header
Browse files at this commitbacd628dbd28615e9539bf98355000571cad070eParent: 5182e935 changed files +257 -112
- crates/im-web/assets/main.css +59 -24
- crates/im-web/src/admin.rs +5 -2
- crates/im-web/src/layout.rs +29 -5
- crates/im-web/src/pages.rs +97 -53
- style/main.scss +67 -28
crates/im-web/assets/main.cssmodified+59 -24
| @@ -399,13 +399,13 @@ body:has(.auth-stage) > .auth-stage::-webkit-scrollbar { | |||
| 399 | font-size: 13px; | 399 | font-size: 13px; |
| 400 | } | 400 | } |
| 401 | 401 | ||
| 402 | -.profile-actions { | 402 | +.viewer-actions { |
| 403 | display: flex; | 403 | display: flex; |
| 404 | - flex-wrap: wrap; | 404 | + justify-content: center; |
| 405 | gap: 8px; | 405 | gap: 8px; |
| 406 | - align-items: center; | 406 | + margin-top: 12px; |
| 407 | } | 407 | } |
| 408 | -.profile-actions label.admin-action { | 408 | +.viewer-actions label.admin-action { |
| 409 | display: inline-flex; | 409 | display: inline-flex; |
| 410 | align-items: center; | 410 | align-items: center; |
| 411 | box-sizing: border-box; | 411 | box-sizing: border-box; |
| @@ -469,6 +469,9 @@ body:has(.auth-stage) > .auth-stage::-webkit-scrollbar { | |||
| 469 | .viewer { | 469 | .viewer { |
| 470 | outline: none; | 470 | outline: none; |
| 471 | cursor: default; | 471 | cursor: default; |
| 472 | + display: flex; | ||
| 473 | + flex-direction: column; | ||
| 474 | + align-items: center; | ||
| 472 | } | 475 | } |
| 473 | 476 | ||
| 474 | .viewer-media { | 477 | .viewer-media { |
| @@ -528,45 +531,77 @@ body:has(.auth-stage) > .auth-stage::-webkit-scrollbar { | |||
| 528 | flex-direction: column; | 531 | flex-direction: column; |
| 529 | } | 532 | } |
| 530 | 533 | ||
| 531 | -.session-row { | 534 | +.session-item { |
| 532 | - display: flex; | ||
| 533 | - gap: 12px; | ||
| 534 | - align-items: flex-start; | ||
| 535 | - padding: 12px 0; | ||
| 536 | border-top: 1px solid var(--border-soft); | 535 | border-top: 1px solid var(--border-soft); |
| 537 | } | 536 | } |
| 538 | -.session-row:first-child { | 537 | +.session-item:first-child { |
| 539 | border-top: 0; | 538 | border-top: 0; |
| 540 | - padding-top: 0; | ||
| 541 | -} | ||
| 542 | -.session-row:last-child { | ||
| 543 | - padding-bottom: 0; | ||
| 544 | -} | ||
| 545 | -.session-row form { | ||
| 546 | - flex: none; | ||
| 547 | } | 539 | } |
| 548 | 540 | ||
| 549 | -.session-main { | 541 | +.session-head { |
| 550 | - flex: 1; | ||
| 551 | display: flex; | 542 | display: flex; |
| 552 | - flex-direction: column; | 543 | + gap: 12px; |
| 553 | - gap: 2px; | 544 | + align-items: baseline; |
| 554 | - min-width: 0; | 545 | + padding: 12px 0; |
| 546 | + cursor: pointer; | ||
| 547 | + list-style: none; | ||
| 548 | +} | ||
| 549 | +.session-head::-webkit-details-marker { | ||
| 550 | + display: none; | ||
| 555 | } | 551 | } |
| 556 | 552 | ||
| 557 | .session-device { | 553 | .session-device { |
| 558 | font-size: 13px; | 554 | font-size: 13px; |
| 559 | - overflow-wrap: anywhere; | 555 | + color: var(--ink); |
| 560 | } | 556 | } |
| 561 | .session-device .chip { | 557 | .session-device .chip { |
| 562 | margin-left: 8px; | 558 | margin-left: 8px; |
| 563 | } | 559 | } |
| 564 | 560 | ||
| 565 | -.session-meta { | 561 | +.session-ip { |
| 562 | + margin-left: auto; | ||
| 566 | font-size: 12px; | 563 | font-size: 12px; |
| 567 | color: var(--muted); | 564 | color: var(--muted); |
| 568 | } | 565 | } |
| 569 | 566 | ||
| 567 | +.session-item[open] .session-head { | ||
| 568 | + position: relative; | ||
| 569 | + z-index: 121; | ||
| 570 | +} | ||
| 571 | +.session-item[open] .session-head::after { | ||
| 572 | + content: ""; | ||
| 573 | + position: fixed; | ||
| 574 | + inset: 0; | ||
| 575 | + z-index: -1; | ||
| 576 | + background: rgba(0, 0, 0, 0.65); | ||
| 577 | +} | ||
| 578 | + | ||
| 579 | +.session-detail { | ||
| 580 | + position: fixed; | ||
| 581 | + top: 50%; | ||
| 582 | + left: 50%; | ||
| 583 | + transform: translate(-50%, -50%); | ||
| 584 | + z-index: 122; | ||
| 585 | + width: min(90vw, 420px); | ||
| 586 | + max-height: 85vh; | ||
| 587 | + overflow: auto; | ||
| 588 | + background: var(--surface); | ||
| 589 | + border: 1px solid var(--border); | ||
| 590 | + border-radius: var(--radius-lg); | ||
| 591 | + padding: 20px; | ||
| 592 | +} | ||
| 593 | +.session-detail .profile-fields { | ||
| 594 | + margin: 0; | ||
| 595 | +} | ||
| 596 | +.session-detail form { | ||
| 597 | + margin-top: 12px; | ||
| 598 | + text-align: right; | ||
| 599 | +} | ||
| 600 | + | ||
| 601 | +.session-agent { | ||
| 602 | + overflow-wrap: anywhere; | ||
| 603 | +} | ||
| 604 | + | ||
| 570 | @media (max-width: 720px) { | 605 | @media (max-width: 720px) { |
| 571 | .auth-stage { | 606 | .auth-stage { |
| 572 | padding: 0 16px 24px; | 607 | padding: 0 16px 24px; |
crates/im-web/src/admin.rsmodified+5 -2
| @@ -248,7 +248,7 @@ fn sessions_row(user: &User, sessions: &[im_core::sessions::SessionInfo]) -> Str | |||
| 248 | .unwrap_or_else(|_| seen_at.date().to_string()); | 248 | .unwrap_or_else(|_| seen_at.date().to_string()); |
| 249 | rows.push_str(&format!( | 249 | rows.push_str(&format!( |
| 250 | concat!( | 250 | concat!( |
| 251 | - r#"<tr><td>{}</td>"#, | 251 | + r#"<tr><td title="{}">{}</td>"#, |
| 252 | r#"<td class="mono">{}</td>"#, | 252 | r#"<td class="mono">{}</td>"#, |
| 253 | r#"<td class="muted">{}</td>"#, | 253 | r#"<td class="muted">{}</td>"#, |
| 254 | r#"<td class="muted">{}</td>"#, | 254 | r#"<td class="muted">{}</td>"#, |
| @@ -259,12 +259,15 @@ fn sessions_row(user: &User, sessions: &[im_core::sessions::SessionInfo]) -> Str | |||
| 259 | r#"<button class="admin-action" type="submit">Revoke</button>"#, | 259 | r#"<button class="admin-action" type="submit">Revoke</button>"#, |
| 260 | r#"</form></td></tr>"# | 260 | r#"</form></td></tr>"# |
| 261 | ), | 261 | ), |
| 262 | + // The cell reads as a device; the raw agent rides the title | ||
| 263 | + // for the admin who needs the whole string. | ||
| 262 | session | 264 | session |
| 263 | .agent | 265 | .agent |
| 264 | .as_deref() | 266 | .as_deref() |
| 265 | .filter(|agent| !agent.is_empty()) | 267 | .filter(|agent| !agent.is_empty()) |
| 266 | .map(escape) | 268 | .map(escape) |
| 267 | - .unwrap_or_else(|| "Unknown device".to_string()), | 269 | + .unwrap_or_default(), |
| 270 | + escape(&crate::pages::device_label(session.agent.as_deref())), | ||
| 268 | session | 271 | session |
| 269 | .ip | 272 | .ip |
| 270 | .as_deref() | 273 | .as_deref() |
crates/im-web/src/layout.rsmodified+29 -5
| @@ -53,11 +53,13 @@ pub async fn avatar(cx: &Cx, user: &im_core::model::User) -> Result { | |||
| 53 | /// overlay and the picker's autosubmit. A click on a photo `.avatar-view` | 53 | /// overlay and the picker's autosubmit. A click on a photo `.avatar-view` |
| 54 | /// opens a `.viewer-scrim` around the same `/photo/{id}?v=` URL the avatar | 54 | /// opens a `.viewer-scrim` around the same `/photo/{id}?v=` URL the avatar |
| 55 | /// reads — the overlay has no server state behind it, so it is client-built | 55 | /// reads — the overlay has no server state behind it, so it is client-built |
| 56 | -/// and client-closed (scrim click or Escape). A `data-autosubmit` input | 56 | +/// and client-closed (scrim click or Escape). A face marked `data-own` gets |
| 57 | -/// posts its form on change: choosing a file IS the upload, no Save button. | 57 | +/// the photo's Change/Remove inside the viewer, so the page itself carries |
| 58 | -/// Both are delegated document listeners, so the hard-post re-render never | 58 | +/// no buttons for a picture. A `data-autosubmit` input posts its form on |
| 59 | -/// needs rewiring. Emitted by the landing and the person page — every | 59 | +/// change: choosing a file IS the upload, no Save button. Both are delegated |
| 60 | -/// surface that draws a clickable face. | 60 | +/// document listeners, so the hard-post re-render never needs rewiring. |
| 61 | +/// Emitted by the landing and the person page — every surface that draws a | ||
| 62 | +/// clickable face. | ||
| 61 | pub async fn avatar_script(cx: &Cx) -> Result { | 63 | pub async fn avatar_script(cx: &Cx) -> Result { |
| 62 | use topcoat::view::Unescaped; | 64 | use topcoat::view::Unescaped; |
| 63 | const JS: &str = "\ | 65 | const JS: &str = "\ |
| @@ -79,6 +81,22 @@ pub async fn avatar_script(cx: &Cx) -> Result { | |||
| 79 | box.className = 'viewer'; \ | 81 | box.className = 'viewer'; \ |
| 80 | box.tabIndex = -1; \ | 82 | box.tabIndex = -1; \ |
| 81 | box.appendChild(media); \ | 83 | box.appendChild(media); \ |
| 84 | + if (view.hasAttribute('data-own')) { \ | ||
| 85 | + var actions = document.createElement('div'); \ | ||
| 86 | + actions.className = 'viewer-actions'; \ | ||
| 87 | + var change = document.createElement('label'); \ | ||
| 88 | + change.className = 'admin-action'; \ | ||
| 89 | + change.setAttribute('for', 'profile-photo-input'); \ | ||
| 90 | + change.textContent = 'Change'; \ | ||
| 91 | + var remove = document.createElement('button'); \ | ||
| 92 | + remove.type = 'submit'; \ | ||
| 93 | + remove.className = 'admin-action admin-danger'; \ | ||
| 94 | + remove.setAttribute('form', 'profile-photo-remove'); \ | ||
| 95 | + remove.textContent = 'Remove'; \ | ||
| 96 | + actions.appendChild(change); \ | ||
| 97 | + actions.appendChild(remove); \ | ||
| 98 | + box.appendChild(actions); \ | ||
| 99 | + } \ | ||
| 82 | scrim.appendChild(box); \ | 100 | scrim.appendChild(box); \ |
| 83 | document.body.appendChild(scrim); \ | 101 | document.body.appendChild(scrim); \ |
| 84 | box.focus(); \ | 102 | box.focus(); \ |
| @@ -92,6 +110,8 @@ pub async fn avatar_script(cx: &Cx) -> Result { | |||
| 92 | if (e.key !== 'Escape') { return; } \ | 110 | if (e.key !== 'Escape') { return; } \ |
| 93 | var scrim = document.querySelector('.viewer-scrim'); \ | 111 | var scrim = document.querySelector('.viewer-scrim'); \ |
| 94 | if (scrim) { scrim.remove(); } \ | 112 | if (scrim) { scrim.remove(); } \ |
| 113 | + var openSession = document.querySelector('.session-item[open]'); \ | ||
| 114 | + if (openSession) { openSession.removeAttribute('open'); } \ | ||
| 95 | }); \ | 115 | }); \ |
| 96 | document.addEventListener('change', function (e) { \ | 116 | document.addEventListener('change', function (e) { \ |
| 97 | var input = e.target.closest ? e.target.closest('[data-autosubmit]') : null; \ | 117 | var input = e.target.closest ? e.target.closest('[data-autosubmit]') : null; \ |
| @@ -104,6 +124,10 @@ pub async fn avatar_script(cx: &Cx) -> Result { | |||
| 104 | var data = new FormData(form); \ | 124 | var data = new FormData(form); \ |
| 105 | form.__imUploading = true; \ | 125 | form.__imUploading = true; \ |
| 106 | input.disabled = true; \ | 126 | input.disabled = true; \ |
| 127 | + /* The picker may have fired from the viewer's Change — the \ | ||
| 128 | + overlay steps aside so the progress row is the thing seen. */ \ | ||
| 129 | + var openScrim = document.querySelector('.viewer-scrim'); \ | ||
| 130 | + if (openScrim) { openScrim.remove(); } \ | ||
| 107 | var row = document.createElement('div'); \ | 131 | var row = document.createElement('div'); \ |
| 108 | row.className = 'profile-upload-row'; \ | 132 | row.className = 'profile-upload-row'; \ |
| 109 | var bar = document.createElement('div'); \ | 133 | var bar = document.createElement('div'); \ |
crates/im-web/src/pages.rsmodified+97 -53
| @@ -422,17 +422,43 @@ fn escape(raw: &str) -> String { | |||
| 422 | .replace('"', """) | 422 | .replace('"', """) |
| 423 | } | 423 | } |
| 424 | 424 | ||
| 425 | -/// The device line of a session row: the agent shortened to fit the row, or | 425 | +/// What the agent string means to a person — "Chrome on Linux", not the raw |
| 426 | -/// the honest fallback when the session predates agent capture. | 426 | +/// header. The full string stays one click away in the session's detail. |
| 427 | -fn device_name(agent: Option<&str>) -> String { | 427 | +/// Substring matching in precedence order (Edge before Chrome before Safari: |
| 428 | - const MAX: usize = 80; | 428 | +/// each carries the later one's token too); shared with the admin panel. |
| 429 | - match agent { | 429 | +pub(crate) fn device_label(agent: Option<&str>) -> String { |
| 430 | - None | Some("") => "Unknown device".to_string(), | 430 | + let Some(agent) = agent.filter(|agent| !agent.is_empty()) else { |
| 431 | - Some(agent) if agent.chars().count() > MAX => { | 431 | + return "Unknown device".to_string(); |
| 432 | - format!("{}…", agent.chars().take(MAX).collect::<String>()) | 432 | + }; |
| 433 | - } | 433 | + let browser = if agent.contains("Edg/") { |
| 434 | - Some(agent) => agent.to_string(), | 434 | + "Edge" |
| 435 | - } | 435 | + } else if agent.contains("Firefox/") { |
| 436 | + "Firefox" | ||
| 437 | + } else if agent.contains("Chrome/") { | ||
| 438 | + "Chrome" | ||
| 439 | + } else if agent.contains("Safari/") { | ||
| 440 | + "Safari" | ||
| 441 | + } else { | ||
| 442 | + "Browser" | ||
| 443 | + }; | ||
| 444 | + let system = if agent.contains("iPhone") { | ||
| 445 | + "iPhone" | ||
| 446 | + } else if agent.contains("iPad") { | ||
| 447 | + "iPad" | ||
| 448 | + } else if agent.contains("Android") { | ||
| 449 | + "Android" | ||
| 450 | + } else if agent.contains("Windows") { | ||
| 451 | + "Windows" | ||
| 452 | + } else if agent.contains("Mac OS X") { | ||
| 453 | + "macOS" | ||
| 454 | + } else if agent.contains("CrOS") { | ||
| 455 | + "ChromeOS" | ||
| 456 | + } else if agent.contains("Linux") { | ||
| 457 | + "Linux" | ||
| 458 | + } else { | ||
| 459 | + return browser.to_string(); | ||
| 460 | + }; | ||
| 461 | + format!("{browser} on {system}") | ||
| 436 | } | 462 | } |
| 437 | 463 | ||
| 438 | /// `2026-09-04 10:22`: the last-seen stamp. An unrenderable stamp falls back | 464 | /// `2026-09-04 10:22`: the last-seen stamp. An unrenderable stamp falls back |
| @@ -444,9 +470,13 @@ fn stamp_min(when: time::OffsetDateTime) -> String { | |||
| 444 | .unwrap_or_else(|_| when.date().to_string()) | 470 | .unwrap_or_else(|_| when.date().to_string()) |
| 445 | } | 471 | } |
| 446 | 472 | ||
| 447 | -/// The sessions card's rows: device, address, stamps, and the per-session | 473 | +/// The sessions card: one header row per live session — what a person |
| 448 | -/// revoke. The current row wears the chip and its button reads as the way | 474 | +/// recognizes (device, address, the current one chipped) — with everything |
| 449 | -/// out of this browser; every other button names what it does instead. | 475 | +/// else a click behind it. The item is a `<details>`, so the open state and |
| 476 | +/// its modal styling (style/main.scss) work with no script at all; the full | ||
| 477 | +/// agent string, the stamps and the revoke live in the detail. The current | ||
| 478 | +/// session's button reads as the way out of this browser; every other names | ||
| 479 | +/// what it does. | ||
| 450 | fn sessions_html(sessions: &[im_core::sessions::SessionInfo], current: Option<&str>) -> String { | 480 | fn sessions_html(sessions: &[im_core::sessions::SessionInfo], current: Option<&str>) -> String { |
| 451 | let mut rows = String::new(); | 481 | let mut rows = String::new(); |
| 452 | for session in sessions { | 482 | for session in sessions { |
| @@ -457,26 +487,47 @@ fn sessions_html(sessions: &[im_core::sessions::SessionInfo], current: Option<&s | |||
| 457 | } else { | 487 | } else { |
| 458 | "" | 488 | "" |
| 459 | }; | 489 | }; |
| 490 | + let ip = session | ||
| 491 | + .ip | ||
| 492 | + .as_deref() | ||
| 493 | + .map(escape) | ||
| 494 | + .unwrap_or_else(|| "—".to_string()); | ||
| 460 | rows.push_str(&format!( | 495 | rows.push_str(&format!( |
| 461 | concat!( | 496 | concat!( |
| 462 | - r#"<div class="session-row"><div class="session-main">"#, | 497 | + r#"<details class="session-item"><summary class="session-head">"#, |
| 463 | - r#"<div class="session-device">{}{}</div>"#, | 498 | + r#"<span class="session-device">{}{}</span>"#, |
| 464 | - r#"<div class="session-meta mono">{}</div>"#, | 499 | + r#"<span class="session-ip mono">{}</span>"#, |
| 465 | - r#"<div class="session-meta">Signed in {} · Last seen {}</div>"#, | 500 | + r#"</summary><div class="session-detail">"#, |
| 466 | - r#"</div>"#, | 501 | + r#"<dl class="profile-fields">"#, |
| 502 | + r#"<div class="profile-field"><dt class="auth-label">Device</dt>"#, | ||
| 503 | + r#"<dd class="profile-value session-agent">{}</dd></div>"#, | ||
| 504 | + r#"<div class="profile-field"><dt class="auth-label">Address</dt>"#, | ||
| 505 | + r#"<dd class="profile-value mono">{}</dd></div>"#, | ||
| 506 | + r#"<div class="profile-field"><dt class="auth-label">Signed in</dt>"#, | ||
| 507 | + r#"<dd class="profile-value">{}</dd></div>"#, | ||
| 508 | + r#"<div class="profile-field"><dt class="auth-label">Last seen</dt>"#, | ||
| 509 | + r#"<dd class="profile-value">{}</dd></div>"#, | ||
| 510 | + r#"<div class="profile-field"><dt class="auth-label">Expires</dt>"#, | ||
| 511 | + r#"<dd class="profile-value">{}</dd></div>"#, | ||
| 512 | + r#"</dl>"#, | ||
| 467 | r#"<form method="post" action="/sessions/revoke">"#, | 513 | r#"<form method="post" action="/sessions/revoke">"#, |
| 468 | r#"<input type="hidden" name="session" value="{}">"#, | 514 | r#"<input type="hidden" name="session" value="{}">"#, |
| 469 | - r#"<button class="admin-action" type="submit">{}</button></form></div>"# | 515 | + r#"<button class="admin-action" type="submit">{}</button></form>"#, |
| 516 | + r#"</div></details>"# | ||
| 470 | ), | 517 | ), |
| 471 | - escape(&device_name(session.agent.as_deref())), | 518 | + escape(&device_label(session.agent.as_deref())), |
| 472 | chip, | 519 | chip, |
| 520 | + ip, | ||
| 473 | session | 521 | session |
| 474 | - .ip | 522 | + .agent |
| 475 | .as_deref() | 523 | .as_deref() |
| 524 | + .filter(|agent| !agent.is_empty()) | ||
| 476 | .map(escape) | 525 | .map(escape) |
| 477 | - .unwrap_or_else(|| "—".to_string()), | 526 | + .unwrap_or_else(|| "Unknown device".to_string()), |
| 527 | + ip, | ||
| 478 | session.created_at.date(), | 528 | session.created_at.date(), |
| 479 | stamp_min(seen), | 529 | stamp_min(seen), |
| 530 | + session.expires_at.date(), | ||
| 480 | escape(&session.token_hash), | 531 | escape(&session.token_hash), |
| 481 | if mine { "Sign out" } else { "Revoke" }, | 532 | if mine { "Sign out" } else { "Revoke" }, |
| 482 | )); | 533 | )); |
| @@ -496,8 +547,7 @@ async fn signed_in(cx: &Cx, user: &im_core::model::User) -> Result { | |||
| 496 | let stats = im_core::stats::profile_stats(&server::app(cx).store, &user.id).await?; | 547 | let stats = im_core::stats::profile_stats(&server::app(cx).store, &user.id).await?; |
| 497 | let joined = user.created_at.date().to_string(); | 548 | let joined = user.created_at.date().to_string(); |
| 498 | let sessions = im_core::sessions::list_sessions(&server::app(cx).store, &user.id).await?; | 549 | let sessions = im_core::sessions::list_sessions(&server::app(cx).store, &user.id).await?; |
| 499 | - let current = | 550 | + let current = server::presented_session(cx).map(|token| im_core::accounts::hash_token(&token)); |
| 500 | - server::presented_session(cx).map(|token| im_core::accounts::hash_token(&token)); | ||
| 501 | let sessions_html = sessions_html(&sessions, current.as_deref()); | 551 | let sessions_html = sessions_html(&sessions, current.as_deref()); |
| 502 | let stage = view! { | 552 | let stage = view! { |
| 503 | cx => | 553 | cx => |
| @@ -507,11 +557,28 @@ async fn signed_in(cx: &Cx, user: &im_core::model::User) -> Result { | |||
| 507 | <div class="auth-card"> | 557 | <div class="auth-card"> |
| 508 | <div class="profile-head"> | 558 | <div class="profile-head"> |
| 509 | if user.has_photo { | 559 | if user.has_photo { |
| 510 | - // iz's identity row: with a photo, the face opens | 560 | + // The face is the whole control surface: it opens |
| 511 | - // the viewer; Change owns the picker. | 561 | + // the viewer, and the viewer carries Change/Remove |
| 512 | - <button class="avatar-view" type="button" aria-label="View photo"> | 562 | + // (avatar_script builds them for `data-own`). The |
| 563 | + // picker input hides here, unreached until the | ||
| 564 | + // viewer's Change label points at it by id. | ||
| 565 | + <button | ||
| 566 | + class="avatar-view" | ||
| 567 | + type="button" | ||
| 568 | + aria-label="View photo" | ||
| 569 | + data-own="" | ||
| 570 | + > | ||
| 513 | (avatar(cx, user).await?) | 571 | (avatar(cx, user).await?) |
| 514 | </button> | 572 | </button> |
| 573 | + <input | ||
| 574 | + id="profile-photo-input" | ||
| 575 | + class="profile-file-hidden" | ||
| 576 | + type="file" | ||
| 577 | + name="photo" | ||
| 578 | + accept="image/png,image/jpeg,image/gif,image/webp,image/avif" | ||
| 579 | + form="profile-photo-form" | ||
| 580 | + data-autosubmit="" | ||
| 581 | + > | ||
| 515 | } else { | 582 | } else { |
| 516 | // Without one, the face itself is the picker: the | 583 | // Without one, the face itself is the picker: the |
| 517 | // label wraps the hidden input, which autosubmits | 584 | // label wraps the hidden input, which autosubmits |
| @@ -540,28 +607,6 @@ async fn signed_in(cx: &Cx, user: &im_core::model::User) -> Result { | |||
| 540 | <span class="chip chip-accent">"Admin"</span> | 607 | <span class="chip chip-accent">"Admin"</span> |
| 541 | } | 608 | } |
| 542 | </div> | 609 | </div> |
| 543 | - if user.has_photo { | ||
| 544 | - <div class="profile-actions"> | ||
| 545 | - <label class="admin-action"> | ||
| 546 | - "Change" | ||
| 547 | - <input | ||
| 548 | - class="profile-file-hidden" | ||
| 549 | - type="file" | ||
| 550 | - name="photo" | ||
| 551 | - accept="image/png,image/jpeg,image/gif,image/webp,image/avif" | ||
| 552 | - form="profile-photo-form" | ||
| 553 | - data-autosubmit="" | ||
| 554 | - > | ||
| 555 | - </label> | ||
| 556 | - <button | ||
| 557 | - class="admin-action" | ||
| 558 | - type="submit" | ||
| 559 | - form="profile-photo-remove" | ||
| 560 | - > | ||
| 561 | - "Remove" | ||
| 562 | - </button> | ||
| 563 | - </div> | ||
| 564 | - } | ||
| 565 | </div> | 610 | </div> |
| 566 | </div> | 611 | </div> |
| 567 | if let Some(code) = ok { | 612 | if let Some(code) = ok { |
| @@ -582,9 +627,8 @@ async fn signed_in(cx: &Cx, user: &im_core::model::User) -> Result { | |||
| 582 | </dl> | 627 | </dl> |
| 583 | <a class="auth-alt" href=(format!("/people/{}", user.id))>"Public profile"</a> | 628 | <a class="auth-alt" href=(format!("/people/{}", user.id))>"Public profile"</a> |
| 584 | // Both forms carry no visible chrome of their own: the | 629 | // Both forms carry no visible chrome of their own: the |
| 585 | - // picker inputs live on the face and the Change action, | 630 | + // picker input hides beside the face, the remove button |
| 586 | - // the remove button in the actions row — all reaching | 631 | + // lives in the viewer — all reaching here by `form=`. |
| 587 | - // here by `form=`. | ||
| 588 | <form | 632 | <form |
| 589 | id="profile-photo-form" | 633 | id="profile-photo-form" |
| 590 | method="post" | 634 | method="post" |
style/main.scssmodified+67 -28
| @@ -441,13 +441,13 @@ body:has(.auth-stage) { | |||
| 441 | font-size: 13px; | 441 | font-size: 13px; |
| 442 | } | 442 | } |
| 443 | 443 | ||
| 444 | -// The Change/Remove actions ride the profile head, iz's identity-row idiom: | 444 | +// The photo's Change/Remove live inside the viewer (avatar_script builds |
| 445 | -// quiet row-buttons, the file input itself never seen. | 445 | +// them for a `data-own` face): a quiet row under the enlarged picture. |
| 446 | -.profile-actions { | 446 | +.viewer-actions { |
| 447 | display: flex; | 447 | display: flex; |
| 448 | - flex-wrap: wrap; | 448 | + justify-content: center; |
| 449 | gap: 8px; | 449 | gap: 8px; |
| 450 | - align-items: center; | 450 | + margin-top: 12px; |
| 451 | 451 | ||
| 452 | // A label wearing the quiet-button skin needs the flex centering a button | 452 | // A label wearing the quiet-button skin needs the flex centering a button |
| 453 | // gets for free. | 453 | // gets for free. |
| @@ -530,8 +530,10 @@ body:has(.auth-stage) { | |||
| 530 | .viewer { | 530 | .viewer { |
| 531 | outline: none; | 531 | outline: none; |
| 532 | cursor: default; | 532 | cursor: default; |
| 533 | + display: flex; | ||
| 534 | + flex-direction: column; | ||
| 535 | + align-items: center; | ||
| 533 | } | 536 | } |
| 534 | - | ||
| 535 | .viewer-media { | 537 | .viewer-media { |
| 536 | max-width: min(90vw, 960px); | 538 | max-width: min(90vw, 960px); |
| 537 | max-height: 85vh; | 539 | max-height: 85vh; |
| @@ -586,50 +588,87 @@ body:has(.auth-stage) { | |||
| 586 | letter-spacing: -0.01em; | 588 | letter-spacing: -0.01em; |
| 587 | } | 589 | } |
| 588 | 590 | ||
| 589 | -// The sessions list: one row per live device, in the profile-fields idiom — | 591 | +// The sessions list: one header row per live device — the name a person |
| 590 | -// a device line, a quiet meta line, the revoke riding the row's end. | 592 | +// recognizes, the address, the current one chipped. Everything else sits a |
| 593 | +// click behind the header: the item is a <details>, and the open detail | ||
| 594 | +// floats as a card over a dimmed ground. The backdrop is the summary's own | ||
| 595 | +// pseudo-element, so a click anywhere off the card toggles it shut — no | ||
| 596 | +// script at all (avatar_script adds Escape on top). | ||
| 591 | .session-list { | 597 | .session-list { |
| 592 | display: flex; | 598 | display: flex; |
| 593 | flex-direction: column; | 599 | flex-direction: column; |
| 594 | } | 600 | } |
| 595 | 601 | ||
| 596 | -.session-row { | 602 | +.session-item { |
| 597 | - display: flex; | ||
| 598 | - gap: 12px; | ||
| 599 | - align-items: flex-start; | ||
| 600 | - padding: 12px 0; | ||
| 601 | border-top: 1px solid var(--border-soft); | 603 | border-top: 1px solid var(--border-soft); |
| 602 | 604 | ||
| 603 | - &:first-child { | 605 | + &:first-child { border-top: 0; } |
| 604 | - border-top: 0; | ||
| 605 | - padding-top: 0; | ||
| 606 | - } | ||
| 607 | - | ||
| 608 | - &:last-child { padding-bottom: 0; } | ||
| 609 | - | ||
| 610 | - form { flex: none; } | ||
| 611 | } | 606 | } |
| 612 | 607 | ||
| 613 | -.session-main { | 608 | +.session-head { |
| 614 | - flex: 1; | ||
| 615 | display: flex; | 609 | display: flex; |
| 616 | - flex-direction: column; | 610 | + gap: 12px; |
| 617 | - gap: 2px; | 611 | + align-items: baseline; |
| 618 | - min-width: 0; | 612 | + padding: 12px 0; |
| 613 | + cursor: pointer; | ||
| 614 | + list-style: none; | ||
| 615 | + | ||
| 616 | + &::-webkit-details-marker { display: none; } | ||
| 619 | } | 617 | } |
| 620 | 618 | ||
| 621 | .session-device { | 619 | .session-device { |
| 622 | font-size: 13px; | 620 | font-size: 13px; |
| 623 | - overflow-wrap: anywhere; | 621 | + color: var(--ink); |
| 624 | 622 | ||
| 625 | .chip { margin-left: 8px; } | 623 | .chip { margin-left: 8px; } |
| 626 | } | 624 | } |
| 627 | 625 | ||
| 628 | -.session-meta { | 626 | +.session-ip { |
| 627 | + margin-left: auto; | ||
| 629 | font-size: 12px; | 628 | font-size: 12px; |
| 630 | color: var(--muted); | 629 | color: var(--muted); |
| 631 | } | 630 | } |
| 632 | 631 | ||
| 632 | +// An open item's header stays above the dim, reading as the card's title. | ||
| 633 | +.session-item[open] .session-head { | ||
| 634 | + position: relative; | ||
| 635 | + z-index: 121; | ||
| 636 | + | ||
| 637 | + &::after { | ||
| 638 | + content: ""; | ||
| 639 | + position: fixed; | ||
| 640 | + inset: 0; | ||
| 641 | + z-index: -1; | ||
| 642 | + background: rgb(0 0 0 / 0.65); | ||
| 643 | + } | ||
| 644 | +} | ||
| 645 | + | ||
| 646 | +.session-detail { | ||
| 647 | + position: fixed; | ||
| 648 | + top: 50%; | ||
| 649 | + left: 50%; | ||
| 650 | + transform: translate(-50%, -50%); | ||
| 651 | + z-index: 122; | ||
| 652 | + width: min(90vw, 420px); | ||
| 653 | + max-height: 85vh; | ||
| 654 | + overflow: auto; | ||
| 655 | + background: var(--surface); | ||
| 656 | + border: 1px solid var(--border); | ||
| 657 | + border-radius: var(--radius-lg); | ||
| 658 | + padding: 20px; | ||
| 659 | + | ||
| 660 | + .profile-fields { margin: 0; } | ||
| 661 | + | ||
| 662 | + form { | ||
| 663 | + margin-top: 12px; | ||
| 664 | + text-align: right; | ||
| 665 | + } | ||
| 666 | +} | ||
| 667 | + | ||
| 668 | +// The full agent string is detail content: whole, wrapped, never stretching | ||
| 669 | +// the card. | ||
| 670 | +.session-agent { overflow-wrap: anywhere; } | ||
| 671 | + | ||
| 633 | @media (max-width: 720px) { | 672 | @media (max-width: 720px) { |
| 634 | .auth-stage { padding: 0 16px 24px; } | 673 | .auth-stage { padding: 0 16px 24px; } |
| 635 | } | 674 | } |