House media player, working viewer Download, Everyone panel redesign
Browse files at this commite11412502c817c43e060de080983cfc79f34b5c1Parent: 0d80173- feat
- house media player, working viewer Download, Everyone panel redesign
6 changed files +226 -66
- crates/in-web/src/dropdown.rs +5 -6
- crates/in-web/src/files.rs +99 -9
- crates/in-web/src/i18n.rs +9 -4
- crates/in-web/src/layout.rs +2 -2
- crates/in-web/src/settings.rs +18 -11
- style/main.scss +93 -34
crates/in-web/src/dropdown.rsmodified+5 -6
| @@ -187,16 +187,15 @@ pub async fn dropdown_script(cx: &Cx) -> Result { | |||
| 187 | window.__inAdded(trigger);\ | 187 | window.__inAdded(trigger);\ |
| 188 | select.parentNode.insertBefore(trigger, select);\ | 188 | select.parentNode.insertBefore(trigger, select);\ |
| 189 | window.__inOwn(select, ['dd-native'], []);\ | 189 | window.__inOwn(select, ['dd-native'], []);\ |
| 190 | - /* The form's own submit only serves the no-script path; once \ | 190 | + /* The form's own submit only serves the no-script path of an \ |
| 191 | - the select is enhanced it duplicates the autosubmit, so it \ | 191 | + autosubmit select; once that select is enhanced it bows out. \ |
| 192 | - bows out — directly, not via a stylesheet the skin or a \ | 192 | + A select without autosubmit still needs its button — hiding \ |
| 193 | - morph might out-race. */ \ | 193 | + it then strands the form with no way to post at all. */ \ |
| 194 | - var go = null; \ | ||
| 195 | var sibs = select.parentNode.children; \ | 194 | var sibs = select.parentNode.children; \ |
| 196 | for (var si = 0; si < sibs.length; si++) { \ | 195 | for (var si = 0; si < sibs.length; si++) { \ |
| 197 | if (sibs[si].tagName === 'BUTTON' && sibs[si].type === 'submit' && !sibs[si].classList.contains('dd-trigger')) { go = sibs[si]; break; } \ | 196 | if (sibs[si].tagName === 'BUTTON' && sibs[si].type === 'submit' && !sibs[si].classList.contains('dd-trigger')) { go = sibs[si]; break; } \ |
| 198 | } \ | 197 | } \ |
| 199 | - if (go) { window.__inOwn(go, [], ['style']); go.style.display = 'none'; } \ | 198 | + if (go && select.hasAttribute('data-autosubmit')) { window.__inOwn(go, [], ['style']); go.style.display = 'none'; } \ |
| 200 | var panel = document.createElement('div');\ | 199 | var panel = document.createElement('div');\ |
| 201 | panel.className = 'dd-panel';\ | 200 | panel.className = 'dd-panel';\ |
| 202 | panel.setAttribute('role', 'listbox');\ | 201 | panel.setAttribute('role', 'listbox');\ |
crates/in-web/src/files.rsmodified+99 -9
| @@ -484,7 +484,7 @@ async fn view_file(cx: &Cx) -> Result { | |||
| 484 | <a class="quiet" href="/drive">(t(language, Key::BackToDrive))</a> | 484 | <a class="quiet" href="/drive">(t(language, Key::BackToDrive))</a> |
| 485 | <div class="spacer"></div> | 485 | <div class="spacer"></div> |
| 486 | if may_download { | 486 | if may_download { |
| 487 | - <a class="primary" href=(download_href)>(t(language, Key::Download))</a> | 487 | + <a class="primary" href=(download_href) download="">(t(language, Key::Download))</a> |
| 488 | } | 488 | } |
| 489 | </div> | 489 | </div> |
| 490 | <h1 class="settings-title viewer-title">(entry_chip(cx, &file).await?) (file.name.clone())</h1> | 490 | <h1 class="settings-title viewer-title">(entry_chip(cx, &file).await?) (file.name.clone())</h1> |
| @@ -495,8 +495,33 @@ async fn view_file(cx: &Cx) -> Result { | |||
| 495 | if matches!(viewer_kind(&file.mime), Some(ViewerKind::Image | ViewerKind::Video | ViewerKind::Audio)) || may_download { | 495 | if matches!(viewer_kind(&file.mime), Some(ViewerKind::Image | ViewerKind::Video | ViewerKind::Audio)) || may_download { |
| 496 | match viewer_kind(&file.mime) { | 496 | match viewer_kind(&file.mime) { |
| 497 | Some(ViewerKind::Image) => <img class="viewer-media" src=(src.clone()) alt=(file.name.clone()) draggable="false">, | 497 | Some(ViewerKind::Image) => <img class="viewer-media" src=(src.clone()) alt=(file.name.clone()) draggable="false">, |
| 498 | - Some(ViewerKind::Video) => <video class="viewer-media" src=(src.clone()) controls="" controlslist="nodownload" preload="metadata"></video>, | 498 | + Some(ViewerKind::Video) => <div class="media-player media-player-video"> |
| 499 | - Some(ViewerKind::Audio) => <div class="viewer-audio-wrap"><audio class="viewer-audio" src=(src.clone()) controls="" controlslist="nodownload" preload="metadata"></audio></div>, | 499 | + <video class="media-el viewer-video" src=(src.clone()) preload="metadata"></video> |
| 500 | + <div class="media-controls"> | ||
| 501 | + <button type="button" class="media-play" aria-label=(t(language, Key::Play)) | ||
| 502 | + data-play=(t(language, Key::Play)) data-pause=(t(language, Key::Pause))> | ||
| 503 | + <svg class="glyph glyph-play" width="14" height="14" viewBox="0 0 16 16" fill="currentColor" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round" aria-hidden="true"><path d="M5.5 3.5v9l7.5-4.5z"></path></svg> | ||
| 504 | + <svg class="glyph glyph-pause" width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M5.5 3.5v9M10.5 3.5v9"></path></svg> | ||
| 505 | + </button> | ||
| 506 | + <span class="media-time media-now">"0:00"</span> | ||
| 507 | + <input class="media-seek" type="range" min="0" max="1000" value="0" aria-label=(file.name.clone())> | ||
| 508 | + <span class="media-time media-dur">"0:00"</span> | ||
| 509 | + <button type="button" class="media-full" aria-label=(t(language, Key::Fullscreen))> | ||
| 510 | + <svg class="glyph" width="13" height="13" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true"><path d="M6 2H2v4M10 2h4v4M14 10v4h-4M2 10v4h4"></path></svg> | ||
| 511 | + </button> | ||
| 512 | + </div> | ||
| 513 | + </div>, | ||
| 514 | + Some(ViewerKind::Audio) => <div class="media-player"> | ||
| 515 | + <button type="button" class="media-play" aria-label=(t(language, Key::Play)) | ||
| 516 | + data-play=(t(language, Key::Play)) data-pause=(t(language, Key::Pause))> | ||
| 517 | + <svg class="glyph glyph-play" width="14" height="14" viewBox="0 0 16 16" fill="currentColor" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round" aria-hidden="true"><path d="M5.5 3.5v9l7.5-4.5z"></path></svg> | ||
| 518 | + <svg class="glyph glyph-pause" width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M5.5 3.5v9M10.5 3.5v9"></path></svg> | ||
| 519 | + </button> | ||
| 520 | + <span class="media-time media-now">"0:00"</span> | ||
| 521 | + <input class="media-seek" type="range" min="0" max="1000" value="0" aria-label=(file.name.clone())> | ||
| 522 | + <span class="media-time media-dur">"0:00"</span> | ||
| 523 | + <audio class="media-el" src=(src.clone()) preload="metadata"></audio> | ||
| 524 | + </div>, | ||
| 500 | Some(ViewerKind::Pdf) => <object class="viewer-media viewer-pdf" data=(src.clone()) type="application/pdf"> | 525 | Some(ViewerKind::Pdf) => <object class="viewer-media viewer-pdf" data=(src.clone()) type="application/pdf"> |
| 501 | <p class="field-note">(t(language, Key::PreviewUnavailable))</p> | 526 | <p class="field-note">(t(language, Key::PreviewUnavailable))</p> |
| 502 | </object>, | 527 | </object>, |
| @@ -531,16 +556,81 @@ async fn view_file(cx: &Cx) -> Result { | |||
| 531 | </div> | 556 | </div> |
| 532 | </section> | 557 | </section> |
| 533 | </main> | 558 | </main> |
| 559 | + (media_player_script(cx).await?) | ||
| 534 | (viewer_guard_script(cx).await?) | 560 | (viewer_guard_script(cx).await?) |
| 535 | } | 561 | } |
| 536 | } | 562 | } |
| 537 | 563 | ||
| 538 | -/// The preview's save-path cleanup: the media elements already carry no | 564 | +/// The house media player: play toggle, clock, seek bar — and a fullscreen |
| 539 | -/// download affordance (`controlslist="nodownload"`, `draggable="false"`), | 565 | +/// button on video — over a controls-less `<audio>`/`<video>`. Native |
| 540 | -/// and this drops the context menu over the stage, so "save as" never | 566 | +/// controls are the browser's own chrome: they ignore the theme's shape |
| 541 | -/// opens on a preview. A page's bytes on the wire can always be captured — | 567 | +/// language and swallow `Escape` while focused, so the viewer draws its own |
| 542 | -/// this keeps the surface from offering it, which is what a view-only | 568 | +/// (ported from iz's audio player, one player for both media kinds). Wiring |
| 543 | -/// grant promises. | 569 | +/// is per-player and idempotent (`data-wired`), re-run on `in:wire` so a |
| 570 | +/// player arriving in a soft page swap still gets its controls. | ||
| 571 | +async fn media_player_script(cx: &Cx) -> Result { | ||
| 572 | + use topcoat::view::Unescaped; | ||
| 573 | + const JS: &str = "\ | ||
| 574 | + (function () { \ | ||
| 575 | + if (window.__inMediaWired) { return; } \ | ||
| 576 | + window.__inMediaWired = true; \ | ||
| 577 | + function wireAll() { document.querySelectorAll('.media-player').forEach(wirePlayer); } \ | ||
| 578 | + function wirePlayer(player) { \ | ||
| 579 | + if (player.dataset.wired) { return; } \ | ||
| 580 | + window.__inOwn(player, [], ['data-wired']); \ | ||
| 581 | + player.dataset.wired = '1'; \ | ||
| 582 | + var media = player.querySelector('.media-el'); \ | ||
| 583 | + var play = player.querySelector('.media-play'); \ | ||
| 584 | + var seek = player.querySelector('.media-seek'); \ | ||
| 585 | + var now = player.querySelector('.media-now'); \ | ||
| 586 | + var dur = player.querySelector('.media-dur'); \ | ||
| 587 | + var full = player.querySelector('.media-full'); \ | ||
| 588 | + function clock(s) { \ | ||
| 589 | + if (!isFinite(s)) { return '0:00'; } \ | ||
| 590 | + var m = Math.floor(s / 60); \ | ||
| 591 | + var r = Math.floor(s % 60); \ | ||
| 592 | + return m + ':' + (r < 10 ? '0' : '') + r; \ | ||
| 593 | + } \ | ||
| 594 | + function toggle() { if (media.paused) { media.play(); } else { media.pause(); } } \ | ||
| 595 | + play.addEventListener('click', toggle); \ | ||
| 596 | + /* The video surface itself toggles too — the house bar is the \ | ||
| 597 | + only chrome, so the picture keeps the habit. */ \ | ||
| 598 | + if (media.tagName === 'VIDEO') { media.addEventListener('click', toggle); } \ | ||
| 599 | + media.addEventListener('play', function () { \ | ||
| 600 | + window.__inOwn(player, ['media-playing'], []); \ | ||
| 601 | + player.classList.add('media-playing'); \ | ||
| 602 | + play.setAttribute('aria-label', play.getAttribute('data-pause')); \ | ||
| 603 | + }); \ | ||
| 604 | + media.addEventListener('pause', function () { \ | ||
| 605 | + player.classList.remove('media-playing'); \ | ||
| 606 | + play.setAttribute('aria-label', play.getAttribute('data-play')); \ | ||
| 607 | + }); \ | ||
| 608 | + media.addEventListener('loadedmetadata', function () { dur.textContent = clock(media.duration); }); \ | ||
| 609 | + media.addEventListener('timeupdate', function () { \ | ||
| 610 | + now.textContent = clock(media.currentTime); \ | ||
| 611 | + if (media.duration) { seek.value = media.currentTime / media.duration * 1000; } \ | ||
| 612 | + }); \ | ||
| 613 | + seek.addEventListener('input', function () { \ | ||
| 614 | + if (media.duration) { media.currentTime = seek.value / 1000 * media.duration; } \ | ||
| 615 | + }); \ | ||
| 616 | + if (full) { \ | ||
| 617 | + full.addEventListener('click', function () { \ | ||
| 618 | + if (document.fullscreenElement) { document.exitFullscreen(); } \ | ||
| 619 | + else if (player.requestFullscreen) { player.requestFullscreen(); } \ | ||
| 620 | + }); \ | ||
| 621 | + } \ | ||
| 622 | + } \ | ||
| 623 | + wireAll(); \ | ||
| 624 | + document.addEventListener('in:wire', wireAll); \ | ||
| 625 | + })();"; | ||
| 626 | + view! { cx => <script>(Unescaped::new_unchecked(JS))</script> } | ||
| 627 | +} | ||
| 628 | + | ||
| 629 | +/// The preview's save-path cleanup: the house media player carries no | ||
| 630 | +/// download affordance, images are not draggable, and this drops the | ||
| 631 | +/// context menu over the stage, so "save as" never opens on a preview. | ||
| 632 | +/// A page's bytes on the wire can always be captured — this keeps the | ||
| 633 | +/// surface from offering it, which is what a view-only grant promises. | ||
| 544 | async fn viewer_guard_script(cx: &Cx) -> Result { | 634 | async fn viewer_guard_script(cx: &Cx) -> Result { |
| 545 | use topcoat::view::Unescaped; | 635 | use topcoat::view::Unescaped; |
| 546 | const JS: &str = "\ | 636 | const JS: &str = "\ |
crates/in-web/src/i18n.rsmodified+9 -4
| @@ -124,6 +124,9 @@ pub enum Key { | |||
| 124 | // File view. | 124 | // File view. |
| 125 | FileDetails, | 125 | FileDetails, |
| 126 | PreviewUnavailable, | 126 | PreviewUnavailable, |
| 127 | + Play, | ||
| 128 | + Pause, | ||
| 129 | + Fullscreen, | ||
| 127 | RenameFile, | 130 | RenameFile, |
| 128 | DeleteFile, | 131 | DeleteFile, |
| 129 | // Share. | 132 | // Share. |
| @@ -204,8 +207,6 @@ pub enum Key { | |||
| 204 | KindFolders, | 207 | KindFolders, |
| 205 | KindFiles, | 208 | KindFiles, |
| 206 | DeletedLabel, | 209 | DeletedLabel, |
| 207 | - // Settings limits redesign (SettingsBuild owns this block). | ||
| 208 | - UploadLimitSection, | ||
| 209 | // Per-entry share page (ShareBuild owns this block). | 210 | // Per-entry share page (ShareBuild owns this block). |
| 210 | CreateLink, | 211 | CreateLink, |
| 211 | ExpiresInDays, | 212 | ExpiresInDays, |
| @@ -275,6 +276,9 @@ pub fn t(lang: Lang, key: Key) -> &'static str { | |||
| 275 | RetryUpload => "Try again", | 276 | RetryUpload => "Try again", |
| 276 | FileDetails => "File", | 277 | FileDetails => "File", |
| 277 | PreviewUnavailable => "No preview for this kind of file.", | 278 | PreviewUnavailable => "No preview for this kind of file.", |
| 279 | + Play => "Play", | ||
| 280 | + Pause => "Pause", | ||
| 281 | + Fullscreen => "Fullscreen", | ||
| 278 | RenameFile => "Rename file", | 282 | RenameFile => "Rename file", |
| 279 | DeleteFile => "Delete file", | 283 | DeleteFile => "Delete file", |
| 280 | Share => "Share", | 284 | Share => "Share", |
| @@ -354,7 +358,6 @@ pub fn t(lang: Lang, key: Key) -> &'static str { | |||
| 354 | KindFolders => "Folders", | 358 | KindFolders => "Folders", |
| 355 | DeletedLabel => "Deleted", | 359 | DeletedLabel => "Deleted", |
| 356 | KindFiles => "Files", | 360 | KindFiles => "Files", |
| 357 | - UploadLimitSection => "Upload limit — applies to everyone.", | ||
| 358 | CreateLink => "Create link", | 361 | CreateLink => "Create link", |
| 359 | ExpiresInDays => "Expires in days", | 362 | ExpiresInDays => "Expires in days", |
| 360 | NoShares => "Not shared with anyone yet.", | 363 | NoShares => "Not shared with anyone yet.", |
| @@ -415,6 +418,9 @@ pub fn t(lang: Lang, key: Key) -> &'static str { | |||
| 415 | RenameFile => "Dosyayı yeniden adlandır", | 418 | RenameFile => "Dosyayı yeniden adlandır", |
| 416 | DeleteFile => "Dosyayı sil", | 419 | DeleteFile => "Dosyayı sil", |
| 417 | Share => "Paylaş", | 420 | Share => "Paylaş", |
| 421 | + Play => "Oynat", | ||
| 422 | + Pause => "Duraklat", | ||
| 423 | + Fullscreen => "Tam ekran", | ||
| 418 | ShareLink => "Paylaşım bağlantısı", | 424 | ShareLink => "Paylaşım bağlantısı", |
| 419 | CopyLink => "Bağlantıyı kopyala", | 425 | CopyLink => "Bağlantıyı kopyala", |
| 420 | RevokeLink => "Bağlantıyı iptal et", | 426 | RevokeLink => "Bağlantıyı iptal et", |
| @@ -484,7 +490,6 @@ pub fn t(lang: Lang, key: Key) -> &'static str { | |||
| 484 | KindFolders => "Klasörler", | 490 | KindFolders => "Klasörler", |
| 485 | KindFiles => "Dosyalar", | 491 | KindFiles => "Dosyalar", |
| 486 | DeletedLabel => "Silindi", | 492 | DeletedLabel => "Silindi", |
| 487 | - UploadLimitSection => "Yükleme sınırı — herkes için geçerlidir.", | ||
| 488 | CreateLink => "Bağlantı oluştur", | 493 | CreateLink => "Bağlantı oluştur", |
| 489 | Copied => "Kopyalandı", | 494 | Copied => "Kopyalandı", |
| 490 | WhoHasAccess => "Erişimi olanlar", | 495 | WhoHasAccess => "Erişimi olanlar", |
crates/in-web/src/layout.rsmodified+2 -2
| @@ -294,7 +294,7 @@ pub async fn topbar(cx: &Cx, active: NavPage, user: &User, lang: Lang) -> Result | |||
| 294 | /// click listener — registered after the close/scrim one, and skipped when | 294 | /// click listener — registered after the close/scrim one, and skipped when |
| 295 | /// that one already `preventDefault`ed — fetches the href and swaps it in | 295 | /// that one already `preventDefault`ed — fetches the href and swaps it in |
| 296 | /// under a `history.pushState`, so folder rows and file chips no longer | 296 | /// under a `history.pushState`, so folder rows and file chips no longer |
| 297 | -/// reload the page. Raw `/files/` byte routes, `download`/`target`/ | 297 | +/// reload the page. Raw byte routes (`/file/<id>`, `/files`), `download`/ |
| 298 | /// `data-hard` links and modified clicks (ctrl/meta/shift/alt, non-left | 298 | /// `data-hard` links and modified clicks (ctrl/meta/shift/alt, non-left |
| 299 | /// button) stay browser-native. `popstate` replays the same fetch without | 299 | /// button) stay browser-native. `popstate` replays the same fetch without |
| 300 | /// pushing. Fresh-URL navigations pass `swap`'s third argument to scroll | 300 | /// pushing. Fresh-URL navigations pass `swap`'s third argument to scroll |
| @@ -651,7 +651,7 @@ pub async fn soft_nav_script(cx: &Cx) -> Result { | |||
| 651 | var link = e.target.closest ? e.target.closest('a') : null; \ | 651 | var link = e.target.closest ? e.target.closest('a') : null; \ |
| 652 | if (!link || link.hasAttribute('download') || link.hasAttribute('target') || link.hasAttribute('data-hard')) { return; } \ | 652 | if (!link || link.hasAttribute('download') || link.hasAttribute('target') || link.hasAttribute('data-hard')) { return; } \ |
| 653 | var href = link.getAttribute('href'); \ | 653 | var href = link.getAttribute('href'); \ |
| 654 | - if (!href || href.charAt(0) !== '/' || href.indexOf('/files/') === 0) { return; } \ | 654 | + if (!href || href.charAt(0) !== '/' || href.indexOf('/files/') === 0 || href.indexOf('/file/') === 0) { return; } \ |
| 655 | e.preventDefault(); \ | 655 | e.preventDefault(); \ |
| 656 | var n = navStep(); \ | 656 | var n = navStep(); \ |
| 657 | fetch(href).then( \ | 657 | fetch(href).then( \ |
crates/in-web/src/settings.rsmodified+18 -11
| @@ -416,7 +416,7 @@ async fn settings(cx: &Cx) -> Result { | |||
| 416 | <th class="member-col-name" scope="col">(t(language, Key::NameColumn))</th> | 416 | <th class="member-col-name" scope="col">(t(language, Key::NameColumn))</th> |
| 417 | <th class="member-col-address" scope="col">(t(language, Key::EmailAddress))</th> | 417 | <th class="member-col-address" scope="col">(t(language, Key::EmailAddress))</th> |
| 418 | <th class="member-col-account" scope="col">(t(language, Key::QuotaUsage))</th> | 418 | <th class="member-col-account" scope="col">(t(language, Key::QuotaUsage))</th> |
| 419 | - <th class="member-col-role" scope="col"></th> | 419 | + <th class="member-col-quota" scope="col">(t(language, Key::QuotaBytes))</th> |
| 420 | </tr> | 420 | </tr> |
| 421 | </thead> | 421 | </thead> |
| 422 | <tbody> | 422 | <tbody> |
| @@ -435,7 +435,7 @@ async fn settings(cx: &Cx) -> Result { | |||
| 435 | </td> | 435 | </td> |
| 436 | <td class="member-col-address member-address">(listed.email.clone())</td> | 436 | <td class="member-col-address member-address">(listed.email.clone())</td> |
| 437 | <td class="member-col-account member-account">(format!("{} {} {}", human_bytes(listed.used_bytes), t(language, Key::QuotaOf), human_bytes(listed.quota_bytes)))</td> | 437 | <td class="member-col-account member-account">(format!("{} {} {}", human_bytes(listed.used_bytes), t(language, Key::QuotaOf), human_bytes(listed.quota_bytes)))</td> |
| 438 | - <td class="member-col-role"> | 438 | + <td class="member-col-quota"> |
| 439 | <form class="pop-row-form member-quota" method="post" action="/api/settings/quota"> | 439 | <form class="pop-row-form member-quota" method="post" action="/api/settings/quota"> |
| 440 | <input type="hidden" name="user_id" value=(listed.id.clone())> | 440 | <input type="hidden" name="user_id" value=(listed.id.clone())> |
| 441 | <input class="field-input" type="number" name="quota" min="0" step="any" value=(bytes_as_unit(listed.quota_bytes).0) aria-label=(t(language, Key::QuotaBytes))> | 441 | <input class="field-input" type="number" name="quota" min="0" step="any" value=(bytes_as_unit(listed.quota_bytes).0) aria-label=(t(language, Key::QuotaBytes))> |
| @@ -445,6 +445,8 @@ async fn settings(cx: &Cx) -> Result { | |||
| 445 | </select> | 445 | </select> |
| 446 | <button class="quiet" type="submit">(t(language, Key::SetQuota))</button> | 446 | <button class="quiet" type="submit">(t(language, Key::SetQuota))</button> |
| 447 | </form> | 447 | </form> |
| 448 | + </td> | ||
| 449 | + <td class="member-col-role"> | ||
| 448 | if listed.id != fresh.id { | 450 | if listed.id != fresh.id { |
| 449 | <form class="pop-row-form" method="post" action="/api/settings/disable"> | 451 | <form class="pop-row-form" method="post" action="/api/settings/disable"> |
| 450 | <input type="hidden" name="user_id" value=(listed.id.clone())> | 452 | <input type="hidden" name="user_id" value=(listed.id.clone())> |
| @@ -464,16 +466,21 @@ async fn settings(cx: &Cx) -> Result { | |||
| 464 | </table> | 466 | </table> |
| 465 | </div> | 467 | </div> |
| 466 | if let Some(limit) = upload_limit { | 468 | if let Some(limit) = upload_limit { |
| 467 | - <form class="pop-row-form member-quota" method="post" action="/api/settings/upload-limit"> | 469 | + // The instance-wide limit, one labeled row under the member table — |
| 468 | - <span class="field-note">(t(language, Key::UploadLimitSection))</span> | 470 | + // same compact amount+unit form the per-user quota cells use. |
| 471 | + <div class="upload-limit"> | ||
| 472 | + <span class="field-label">(t(language, Key::MaxUploadBytes))</span> | ||
| 469 | <span class="field-note">(format!("{}: {}", t(language, Key::CurrentUploadLimit), human_bytes(limit)))</span> | 473 | <span class="field-note">(format!("{}: {}", t(language, Key::CurrentUploadLimit), human_bytes(limit)))</span> |
| 470 | - <input class="field-input" type="number" name="max_upload" min="0" step="any" value=(bytes_as_unit(limit).0) aria-label=(t(language, Key::MaxUploadBytes))> | 474 | + <div class="spacer"></div> |
| 471 | - <select class="field-input" name="max_upload_unit" aria-label=(t(language, Key::MaxUploadBytes))> | 475 | + <form class="pop-row-form member-quota" method="post" action="/api/settings/upload-limit"> |
| 472 | - <option value="MiB" selected=(bytes_as_unit(limit).1 == "MiB")>"MiB"</option> | 476 | + <input class="field-input" type="number" name="max_upload" min="0" step="any" value=(bytes_as_unit(limit).0) aria-label=(t(language, Key::MaxUploadBytes))> |
| 473 | - <option value="GiB" selected=(bytes_as_unit(limit).1 == "GiB")>"GiB"</option> | 477 | + <select class="field-input" name="max_upload_unit" aria-label=(t(language, Key::MaxUploadBytes))> |
| 474 | - </select> | 478 | + <option value="MiB" selected=(bytes_as_unit(limit).1 == "MiB")>"MiB"</option> |
| 475 | - <button class="quiet" type="submit">(t(language, Key::Save))</button> | 479 | + <option value="GiB" selected=(bytes_as_unit(limit).1 == "GiB")>"GiB"</option> |
| 476 | - </form> | 480 | + </select> |
| 481 | + <button class="quiet" type="submit">(t(language, Key::Save))</button> | ||
| 482 | + </form> | ||
| 483 | + </div> | ||
| 477 | } | 484 | } |
| 478 | </div> | 485 | </div> |
| 479 | </section> | 486 | </section> |
style/main.scssmodified+93 -34
| @@ -1295,10 +1295,11 @@ img.avatar { | |||
| 1295 | 1295 | ||
| 1296 | .viewer-media { max-width: 100%; max-height: 78vh; border-radius: var(--radius-md); } | 1296 | .viewer-media { max-width: 100%; max-height: 78vh; border-radius: var(--radius-md); } |
| 1297 | 1297 | ||
| 1298 | -// The house audio player: the native pill is browser chrome — it ignores the | 1298 | +// The house media player: the native controls are browser chrome — they |
| 1299 | -// theme's shape language and swallows Escape while focused, so the viewer | 1299 | +// ignore the theme's shape language and swallow Escape while focused, so the |
| 1300 | -// draws its own controls over a hidden `<audio>`. | 1300 | +// viewer draws its own over a controls-less element. One player serves both |
| 1301 | -.audio-player { | 1301 | +// kinds: audio is the bar alone, video stacks the bar under the picture. |
| 1302 | +.media-player { | ||
| 1302 | display: flex; | 1303 | display: flex; |
| 1303 | align-items: center; | 1304 | align-items: center; |
| 1304 | gap: 12px; | 1305 | gap: 12px; |
| @@ -1308,10 +1309,42 @@ img.avatar { | |||
| 1308 | border: 1px solid var(--border); | 1309 | border: 1px solid var(--border); |
| 1309 | border-radius: var(--radius-md); | 1310 | border-radius: var(--radius-md); |
| 1310 | 1311 | ||
| 1311 | - .audio-el { display: none; } | 1312 | + .media-el { display: none; } |
| 1312 | } | 1313 | } |
| 1313 | 1314 | ||
| 1314 | -.audio-play { | 1315 | +.media-player-video { |
| 1316 | + flex-direction: column; | ||
| 1317 | + align-items: stretch; | ||
| 1318 | + gap: 0; | ||
| 1319 | + width: 100%; | ||
| 1320 | + // No card of its own: the viewer stage already frames it. | ||
| 1321 | + padding: 0; | ||
| 1322 | + border: none; | ||
| 1323 | + background: none; | ||
| 1324 | + | ||
| 1325 | + // The controls bar lives under the picture, and the page chrome (topbar, | ||
| 1326 | + // head, title, meta, stage padding) takes ~330px above it: the picture's | ||
| 1327 | + // cap pays for both, so player and bar land on screen together. | ||
| 1328 | + .media-el { | ||
| 1329 | + display: block; | ||
| 1330 | + width: 100%; | ||
| 1331 | + height: auto; | ||
| 1332 | + max-height: calc(100vh - 380px); | ||
| 1333 | + border-radius: var(--radius-md); | ||
| 1334 | + background: #000; | ||
| 1335 | + cursor: pointer; | ||
| 1336 | + } | ||
| 1337 | +} | ||
| 1338 | + | ||
| 1339 | +.media-controls { | ||
| 1340 | + display: flex; | ||
| 1341 | + align-items: center; | ||
| 1342 | + gap: 12px; | ||
| 1343 | + padding: 10px 16px; | ||
| 1344 | + border-top: 1px solid var(--border); | ||
| 1345 | +} | ||
| 1346 | + | ||
| 1347 | +.media-play { | ||
| 1315 | display: grid; | 1348 | display: grid; |
| 1316 | place-items: center; | 1349 | place-items: center; |
| 1317 | width: 32px; | 1350 | width: 32px; |
| @@ -1328,12 +1361,12 @@ img.avatar { | |||
| 1328 | &:hover { border-color: var(--accent-strong); } | 1361 | &:hover { border-color: var(--accent-strong); } |
| 1329 | } | 1362 | } |
| 1330 | 1363 | ||
| 1331 | -.audio-playing .audio-play { | 1364 | +.media-playing .media-play { |
| 1332 | .glyph-play { display: none; } | 1365 | .glyph-play { display: none; } |
| 1333 | .glyph-pause { display: block; } | 1366 | .glyph-pause { display: block; } |
| 1334 | } | 1367 | } |
| 1335 | 1368 | ||
| 1336 | -.audio-time { | 1369 | +.media-time { |
| 1337 | font-family: var(--font-mono); | 1370 | font-family: var(--font-mono); |
| 1338 | font-size: 12px; | 1371 | font-size: 12px; |
| 1339 | color: var(--muted); | 1372 | color: var(--muted); |
| @@ -1341,7 +1374,7 @@ img.avatar { | |||
| 1341 | text-align: center; | 1374 | text-align: center; |
| 1342 | } | 1375 | } |
| 1343 | 1376 | ||
| 1344 | -.audio-seek { | 1377 | +.media-seek { |
| 1345 | flex: 1; | 1378 | flex: 1; |
| 1346 | appearance: none; | 1379 | appearance: none; |
| 1347 | height: 4px; | 1380 | height: 4px; |
| @@ -1380,6 +1413,32 @@ img.avatar { | |||
| 1380 | } | 1413 | } |
| 1381 | } | 1414 | } |
| 1382 | 1415 | ||
| 1416 | +.media-full { | ||
| 1417 | + display: grid; | ||
| 1418 | + place-items: center; | ||
| 1419 | + width: 28px; | ||
| 1420 | + height: 28px; | ||
| 1421 | + flex: none; | ||
| 1422 | + padding: 0; | ||
| 1423 | + border: none; | ||
| 1424 | + border-radius: var(--radius); | ||
| 1425 | + background: none; | ||
| 1426 | + color: var(--muted); | ||
| 1427 | + cursor: pointer; | ||
| 1428 | + | ||
| 1429 | + &:hover { background: var(--row-hover); color: var(--ink); } | ||
| 1430 | +} | ||
| 1431 | + | ||
| 1432 | +// Fullscreen re-frames the same player: the picture takes the screen and the | ||
| 1433 | +// bar settles at its bottom. | ||
| 1434 | +.media-player-video:fullscreen { | ||
| 1435 | + width: 100%; | ||
| 1436 | + max-width: none; | ||
| 1437 | + background: #000; | ||
| 1438 | + | ||
| 1439 | + .media-el { height: calc(100% - 48px); max-height: none; object-fit: contain; border-radius: 0; } | ||
| 1440 | +} | ||
| 1441 | + | ||
| 1383 | .viewer-pdf { width: 100%; height: 78vh; border: 1px solid var(--border); border-radius: var(--radius-md); } | 1442 | .viewer-pdf { width: 100%; height: 78vh; border: 1px solid var(--border); border-radius: var(--radius-md); } |
| 1384 | 1443 | ||
| 1385 | // A workbook has no element of its own, so the viewer draws it: a tab strip | 1444 | // A workbook has no element of its own, so the viewer draws it: a tab strip |
| @@ -3429,6 +3488,7 @@ input[type="radio"] { | |||
| 3429 | // `width: 1%` is how a table cell asks for its intrinsic width. | 3488 | // `width: 1%` is how a table cell asks for its intrinsic width. |
| 3430 | .member-col-name, | 3489 | .member-col-name, |
| 3431 | .member-col-role, | 3490 | .member-col-role, |
| 3491 | + .member-col-quota, | ||
| 3432 | .member-col-account { | 3492 | .member-col-account { |
| 3433 | width: 1%; | 3493 | width: 1%; |
| 3434 | white-space: nowrap; | 3494 | white-space: nowrap; |
| @@ -4357,17 +4417,9 @@ input[type="radio"] { | |||
| 4357 | 4417 | ||
| 4358 | // -- file viewer page ------------------------------------------------------------ | 4418 | // -- file viewer page ------------------------------------------------------------ |
| 4359 | // GET /view/{id}: the preview on its own page. The media elements reuse the | 4419 | // GET /view/{id}: the preview on its own page. The media elements reuse the |
| 4360 | -// in-app viewer classes (.viewer-media, .viewer-pdf); the stage centers | 4420 | +// in-app viewer classes (.viewer-media, .viewer-pdf); the text frame wears |
| 4361 | -// them, the audio element takes a readable width, and the text frame wears | 4421 | +// the pdf box's shape. The stage card itself is defined with viewer-details |
| 4362 | -// the pdf box's shape. | 4422 | +// below — one rule, not two that must agree. |
| 4363 | -.viewer-stage { | ||
| 4364 | - display: flex; | ||
| 4365 | - justify-content: center; | ||
| 4366 | - margin: 16px 0; | ||
| 4367 | -} | ||
| 4368 | - | ||
| 4369 | -.viewer-audio { width: min(480px, 100%); } | ||
| 4370 | - | ||
| 4371 | .viewer-text { | 4423 | .viewer-text { |
| 4372 | width: 100%; | 4424 | width: 100%; |
| 4373 | height: 70vh; | 4425 | height: 70vh; |
| @@ -4587,8 +4639,8 @@ input[type="radio"] { | |||
| 4587 | // capped at the modal viewer's width so media never sprawls into a full-width | 4639 | // capped at the modal viewer's width so media never sprawls into a full-width |
| 4588 | // slab at desktop sizes. Video/images shrink to fit the viewport (70vh, the | 4640 | // slab at desktop sizes. Video/images shrink to fit the viewport (70vh, the |
| 4589 | // same proportion as the modal's 78vh minus the page chrome); text and pdf | 4641 | // same proportion as the modal's 78vh minus the page chrome); text and pdf |
| 4590 | -// fill the card in the same chrome. The native audio pill ignores the theme's | 4642 | +// fill the card in the same chrome. Media plays through the house |
| 4591 | -// shape language, so it sits in a sunken wrap at a readable width instead. | 4643 | +// `.media-player` — the native pill is gone from the page entirely. |
| 4592 | .viewer-head { | 4644 | .viewer-head { |
| 4593 | display: flex; | 4645 | display: flex; |
| 4594 | align-items: center; | 4646 | align-items: center; |
| @@ -4599,6 +4651,9 @@ input[type="radio"] { | |||
| 4599 | .viewer-title { overflow-wrap: anywhere; } | 4651 | .viewer-title { overflow-wrap: anywhere; } |
| 4600 | 4652 | ||
| 4601 | .viewer-stage { | 4653 | .viewer-stage { |
| 4654 | + display: flex; | ||
| 4655 | + flex-direction: column; | ||
| 4656 | + justify-content: center; | ||
| 4602 | width: 100%; | 4657 | width: 100%; |
| 4603 | max-width: min(100%, 960px); | 4658 | max-width: min(100%, 960px); |
| 4604 | margin: 16px auto; | 4659 | margin: 16px auto; |
| @@ -4630,18 +4685,6 @@ input[type="radio"] { | |||
| 4630 | max-height: 70vh; | 4685 | max-height: 70vh; |
| 4631 | } | 4686 | } |
| 4632 | 4687 | ||
| 4633 | -.viewer-audio-wrap { | ||
| 4634 | - width: min(560px, 100%); | ||
| 4635 | - display: flex; | ||
| 4636 | - justify-content: center; | ||
| 4637 | - padding: 12px 16px; | ||
| 4638 | - background: var(--surface-sunken); | ||
| 4639 | - border: 1px solid var(--border); | ||
| 4640 | - border-radius: var(--radius-md); | ||
| 4641 | -} | ||
| 4642 | - | ||
| 4643 | -.viewer-audio-wrap .viewer-audio { width: 100%; } | ||
| 4644 | - | ||
| 4645 | // -- row polish (RowBuild) ------------------------------------------------------------ | 4688 | // -- row polish (RowBuild) ------------------------------------------------------------ |
| 4646 | // Single-line discipline for the drive/trash/shared rows, the anchored options | 4689 | // Single-line discipline for the drive/trash/shared rows, the anchored options |
| 4647 | // menu, and progress rows inside the corner stack. One contiguous section; | 4690 | // menu, and progress rows inside the corner stack. One contiguous section; |
| @@ -4729,6 +4772,22 @@ input[type="radio"] { | |||
| 4729 | width: auto; | 4772 | width: auto; |
| 4730 | flex: none; | 4773 | flex: none; |
| 4731 | } | 4774 | } |
| 4775 | +.member-quota button.field-input { | ||
| 4776 | + width: auto; | ||
| 4777 | + flex: none; | ||
| 4778 | +} | ||
| 4779 | + | ||
| 4780 | +// The instance-wide upload limit: one labeled row under the register, the | ||
| 4781 | +// same compact amount+unit form the quota cells use. | ||
| 4782 | +.upload-limit { | ||
| 4783 | + display: flex; | ||
| 4784 | + align-items: center; | ||
| 4785 | + gap: 10px; | ||
| 4786 | + flex-wrap: wrap; | ||
| 4787 | + margin-top: 14px; | ||
| 4788 | + padding-top: 14px; | ||
| 4789 | + border-top: 1px solid var(--border); | ||
| 4790 | +} | ||
| 4732 | .member-table .member-col-address { | 4791 | .member-table .member-col-address { |
| 4733 | min-width: 26ch; | 4792 | min-width: 26ch; |
| 4734 | } | 4793 | } |