diff --git a/crates/iz-web/src/avatar.rs b/crates/iz-web/src/avatar.rs index 88983d4..3a99b72 100644 --- a/crates/iz-web/src/avatar.rs +++ b/crates/iz-web/src/avatar.rs @@ -68,7 +68,12 @@ async fn avatar(cx: &Cx) -> topcoat::Result<(StatusCode, HeaderMap, Vec)> { // means a stale row, never a lie about freshness. let etag = format!("\"p{}\"", row.photo_version); let mut headers = HeaderMap::new(); - headers.insert(header::ETAG, HeaderValue::from_str(&etag).unwrap()); + // A u64 version formats to ASCII, so the fallback never fires; an + // unreadable etag means revalidation, never a wrong face. + headers.insert( + header::ETAG, + HeaderValue::from_str(&etag).unwrap_or(HeaderValue::from_static("\"p0\"")), + ); // A `?v` that agrees with the row means this exact face is pinned to a // URL that changes the day the face does, so the browser may keep it // for a year. Every other spelling — including no stamp at all — diff --git a/crates/iz-web/src/detail.rs b/crates/iz-web/src/detail.rs index 0c55973..7a7b1ef 100644 --- a/crates/iz-web/src/detail.rs +++ b/crates/iz-web/src/detail.rs @@ -367,9 +367,20 @@ async fn load_snapshot( let sends = store.sends_for_task(&detail.id, 50).await?; let mut columns_cache: std::collections::HashMap> = std::collections::HashMap::new(); + let mut rules_cache: std::collections::HashMap> = + std::collections::HashMap::new(); let mut notifications = Vec::with_capacity(decisions.len()); for decision in decisions { - let rule = store.mail_rule(&decision.rule_id).await?; + // One read per rule, not per decision: a rule that decided ten + // mails is ten decisions naming the same sentence. + let rule = match rules_cache.get(decision.rule_id.as_str()) { + Some(rule) => rule, + None => { + let rule = store.mail_rule(&decision.rule_id).await?; + rules_cache.insert(decision.rule_id.clone(), rule); + rules_cache.get(decision.rule_id.as_str()).expect("just inserted") + } + }; let rule_name = may_administer.then(|| { rule.as_ref() .map(|rule| rule.subject.clone()) diff --git a/crates/iz-web/src/files.rs b/crates/iz-web/src/files.rs index 88382ea..6f817b5 100644 --- a/crates/iz-web/src/files.rs +++ b/crates/iz-web/src/files.rs @@ -590,14 +590,16 @@ async fn download(cx: &Cx) -> topcoat::Result<(StatusCode, HeaderMap, Vec)> let slice = bytes[start as usize..=end as usize].to_vec(); headers.insert( header::CONTENT_RANGE, - HeaderValue::from_str(&format!("bytes {start}-{end}/{total}")).unwrap(), + HeaderValue::from_str(&format!("bytes {start}-{end}/{total}")) + .unwrap_or(HeaderValue::from_static("bytes */0")), ); Ok((StatusCode::PARTIAL_CONTENT, headers, slice)) } Some(Err(())) => { headers.insert( header::CONTENT_RANGE, - HeaderValue::from_str(&format!("bytes */{total}")).unwrap(), + HeaderValue::from_str(&format!("bytes */{total}")) + .unwrap_or(HeaderValue::from_static("bytes */0")), ); Ok((StatusCode::RANGE_NOT_SATISFIABLE, headers, Vec::new())) } diff --git a/crates/iz-web/src/health.rs b/crates/iz-web/src/health.rs index 709c5ce..a97d401 100644 --- a/crates/iz-web/src/health.rs +++ b/crates/iz-web/src/health.rs @@ -1,15 +1,18 @@ //! The one family-health probe, ported from im's `health.rs`: a sibling is //! asked `GET {url}/healthz` where it stands — no credentials, two seconds -//! to answer — and the callers fan the probes out concurrently, so a family -//! member that is down costs its two seconds, not two seconds each. iz has -//! no admin health table: the wordmark's flyout is the only reader, so the -//! probe's body and latency ride the enum ([`Probe::Up`]) but only the -//! on/off dot ever renders. +//! to answer — and [`probe_family`] fans the probes out concurrently, so a +//! family member that is down costs its two seconds, not two seconds each. +//! The readings are cached for [`PROBE_TTL`], so a page render inside the +//! window reuses the last round instead of stalling on every sibling +//! again. iz has no admin health table: the wordmark's flyout is the only +//! reader, so the probe's body and latency ride the enum ([`Probe::Up`]) +//! but only the on/off dot ever renders. /// One `/healthz` reading. `Up` carries the body — the deploy contract's /// `ok ` — and the answer's latency; everything else, refused /// or wrong status or a body that does not begin ok or the two-second /// ceiling, is `Down`. +#[derive(Clone)] pub enum Probe { Up { body: String, ms: u128 }, Down, @@ -40,6 +43,52 @@ pub async fn probe_healthz(http: &reqwest::Client, url: &str) -> Probe { } } +/// One shared client for the app's lifetime: a fresh pool per render would +/// tear down and re-handshake every socket it touched. +static PROBE_HTTP: std::sync::LazyLock = + std::sync::LazyLock::new(reqwest::Client::new); + +/// The last family-wide round of readings and when it landed, keyed by the +/// probed urls: a family that changed shape misses the cache and probes +/// fresh instead of wearing a stranger's dot. +static PROBES: parking_lot::Mutex)>> = + parking_lot::Mutex::new(None); + +/// How long one round of readings stands in for the live siblings. +const PROBE_TTL: std::time::Duration = std::time::Duration::from_secs(30); + +/// Every url probed at once — a family member that is down costs its two +/// seconds, not two seconds each — but at most one round per [`PROBE_TTL`]: +/// a render inside the window reuses the last reading instead of stalling +/// on every sibling again. +pub(crate) async fn probe_family(urls: Vec) -> Vec { + { + let cache = PROBES.lock(); + if let Some((at, readings)) = cache.as_ref() { + let same = readings + .iter() + .map(|(url, _)| url.as_str()) + .eq(urls.iter().map(String::as_str)); + if at.elapsed() < PROBE_TTL && same { + return readings.iter().map(|(_, probe)| probe.clone()).collect(); + } + } + } + let mut probes = Vec::new(); + for url in &urls { + let http = PROBE_HTTP.clone(); + let url = url.clone(); + probes.push(tokio::spawn(async move { probe_healthz(&http, &url).await })); + } + let mut readings: Vec<(String, Probe)> = Vec::with_capacity(urls.len()); + for (url, probe) in urls.into_iter().zip(probes) { + let probe = probe.await.unwrap_or(Probe::Down); + readings.push((url, probe)); + } + *PROBES.lock() = Some((std::time::Instant::now(), readings.clone())); + readings.into_iter().map(|(_, probe)| probe).collect() +} + /// The flyout's marks as final HTML, pure over resolved probes: this app's /// own row filtered out, every sibling a plain link carrying its probe's /// dot — `health-on` while it answers `ok`, `health-off` while it does not @@ -77,4 +126,56 @@ fn escape(raw: &str) -> String { .replace('<', "<") .replace('>', ">") .replace('"', """) + .replace('\'', "'") +} + +#[cfg(test)] +mod tests { + use super::*; + + /// The cache is the point of [`probe_family`]: the same family probed + /// twice inside the window dials the sibling once, and a family that + /// changed shape misses the cache and dials the newcomer fresh. + #[tokio::test] + async fn a_render_inside_the_window_reuses_the_last_round() { + use std::sync::Arc; + use std::sync::atomic::{AtomicUsize, Ordering}; + use tokio::io::AsyncWriteExt as _; + + async fn stand_in() -> (std::net::SocketAddr, Arc) { + let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap(); + let addr = listener.local_addr().unwrap(); + let hits = Arc::new(AtomicUsize::new(0)); + let counted = hits.clone(); + tokio::spawn(async move { + loop { + let Ok((mut socket, _)) = listener.accept().await else { + break; + }; + counted.fetch_add(1, Ordering::SeqCst); + let _ = socket + .write_all(b"HTTP/1.1 200 OK\r\ncontent-length: 2\r\n\r\nok") + .await; + } + }); + (addr, hits) + } + + let (a, a_hits) = stand_in().await; + let (b, b_hits) = stand_in().await; + let urls = |addr: std::net::SocketAddr| vec![format!("http://{addr}/healthz")]; + probe_family(urls(a)).await; + probe_family(urls(a)).await; + assert_eq!( + a_hits.load(Ordering::SeqCst), + 1, + "the second render inside the window dialled the sibling again" + ); + probe_family(urls(b)).await; + assert_eq!( + b_hits.load(Ordering::SeqCst), + 1, + "a changed family did not probe the newcomer fresh" + ); + } } diff --git a/crates/iz-web/src/i18n.rs b/crates/iz-web/src/i18n.rs index 7497d7c..6faab75 100644 --- a/crates/iz-web/src/i18n.rs +++ b/crates/iz-web/src/i18n.rs @@ -221,6 +221,7 @@ pub enum Key { SendLabel, ToLabel, BodyLabel, + SubjectPlaceholder, TaskDetails, AddRule, SaveRule, @@ -389,8 +390,8 @@ pub fn t(lang: Lang, key: Key) -> &'static str { match (key, lang) { (NewTask, En) => "New task", (NewTask, Tr) => "Yeni görev", - (Title, En) => "TITLE", - (Title, Tr) => "BAŞLIK", + (Title, En) => "Title", + (Title, Tr) => "Başlık", (Cancel, En) => "Cancel", (Cancel, Tr) => "Vazgeç", (SomethingWentWrong, En) => "Something went wrong.", @@ -433,8 +434,8 @@ pub fn t(lang: Lang, key: Key) -> &'static str { (LinkAnotherTask, Tr) => "Başka bir görevi bağla", (LinkATask, En) => "Link a task", (LinkATask, Tr) => "Görev bağla", - (Direction, En) => "DIRECTION", - (Direction, Tr) => "YÖN", + (Direction, En) => "Direction", + (Direction, Tr) => "Yön", (BlocksThisTask, En) => "blocks this task", (BlocksThisTask, Tr) => "bu görevi engelliyor", (WaitsOnThisTask, En) => "waits on this task", @@ -467,36 +468,36 @@ pub fn t(lang: Lang, key: Key) -> &'static str { (Esc, Tr) => "esc", (CloseThisTask, En) => "Close this task", (CloseThisTask, Tr) => "Bu görevi kapat", - (Status, En) => "STATUS", - (Status, Tr) => "DURUM", - (Assignees, En) => "ASSIGNEES", - (Assignees, Tr) => "ATANANLAR", - (Deadline, En) => "DEADLINE", - (Deadline, Tr) => "SON TARİH", - (Description, En) => "DESCRIPTION", - (Description, Tr) => "AÇIKLAMA", - (Dependencies, En) => "DEPENDENCIES", - (Dependencies, Tr) => "BAĞIMLILIKLAR", + (Status, En) => "Status", + (Status, Tr) => "Durum", + (Assignees, En) => "Assignees", + (Assignees, Tr) => "Atananlar", + (Deadline, En) => "Deadline", + (Deadline, Tr) => "Son tarih", + (Description, En) => "Description", + (Description, Tr) => "Açıklama", + (Dependencies, En) => "Dependencies", + (Dependencies, Tr) => "Bağımlılıklar", (TabTask, En) => "Task", (TabTask, Tr) => "Görev", - (Files, En) => "FILES", - (Files, Tr) => "DOSYALAR", + (Files, En) => "Files", + (Files, Tr) => "Dosyalar", (File, En) => "File", (File, Tr) => "Dosya", - (Comments, En) => "COMMENTS", - (Comments, Tr) => "YORUMLAR", + (Comments, En) => "Comments", + (Comments, Tr) => "Yorumlar", (TabMail, En) => "Mail", (TabMail, Tr) => "Posta", (WriteAComment, En) => "Write a comment…", (WriteAComment, Tr) => "Bir yorum yaz…", (Comment, En) => "Comment", (Comment, Tr) => "Yorum yap", - (Notifications, En) => "NOTIFICATIONS", - (Notifications, Tr) => "BİLDİRİMLER", + (Notifications, En) => "Notifications", + (Notifications, Tr) => "Bildirimler", (Retry, En) => "Retry", (Retry, Tr) => "Yeniden dene", - (Activity, En) => "ACTIVITY", - (Activity, Tr) => "ETKİNLİK", + (Activity, En) => "Activity", + (Activity, Tr) => "Etkinlik", (DeleteTask, En) => "Delete task", (DeleteTask, Tr) => "Görevi sil", (CommentGoesWithIt, En) => "1 comment goes with it", @@ -537,8 +538,8 @@ pub fn t(lang: Lang, key: Key) -> &'static str { (NavTags, Tr) => "Etiketler", (NewTag, En) => "New tag", (NewTag, Tr) => "Yeni etiket", - (NameLabel, En) => "NAME", - (NameLabel, Tr) => "İSİM", + (NameLabel, En) => "Name", + (NameLabel, Tr) => "İsim", (AddTag, En) => "Add tag", (AddTag, Tr) => "Etiket ekle", (SaveTag, En) => "Save tag", @@ -598,18 +599,18 @@ pub fn t(lang: Lang, key: Key) -> &'static str { (StorageLastProblem, Tr) => "Son sorun", (StorageAbsent, En) => "Not in the family", (StorageAbsent, Tr) => "Ailede değil", - (EmailLabel, En) => "EMAIL", - (EmailLabel, Tr) => "E-POSTA", - (ThemeLabel, En) => "THEME", - (ThemeLabel, Tr) => "TEMA", - (UiLabel, En) => "INTERFACE", - (UiLabel, Tr) => "ARAYÜZ", + (EmailLabel, En) => "Email", + (EmailLabel, Tr) => "E-posta", + (ThemeLabel, En) => "Theme", + (ThemeLabel, Tr) => "Tema", + (UiLabel, En) => "Interface", + (UiLabel, Tr) => "Arayüz", (LightOption, En) => "Light", (LightOption, Tr) => "Açık", (DarkOption, En) => "Dark", (DarkOption, Tr) => "Koyu", - (LanguageLabel, En) => "LANGUAGE", - (LanguageLabel, Tr) => "DİL", + (LanguageLabel, En) => "Language", + (LanguageLabel, Tr) => "Dil", (Saved, En) => "Saved.", (Saved, Tr) => "Kaydedildi.", (SignOut, En) => "Sign out", @@ -644,52 +645,52 @@ pub fn t(lang: Lang, key: Key) -> &'static str { (CheckConnection, Tr) => "Bağlantıyı dene", (NotConnectedNote, En) => "Not connected.", (NotConnectedNote, Tr) => "Bağlı değil.", - (SmtpHostLabel, En) => "SMTP HOST", - (SmtpHostLabel, Tr) => "SMTP SUNUCUSU", - (PortLabel, En) => "PORT", - (PortLabel, Tr) => "PORT", - (UsernameLabel, En) => "USERNAME", - (UsernameLabel, Tr) => "KULLANICI ADI", - (PasswordLabel, En) => "PASSWORD", - (PasswordLabel, Tr) => "PAROLA", + (SmtpHostLabel, En) => "SMTP host", + (SmtpHostLabel, Tr) => "SMTP sunucusu", + (PortLabel, En) => "Port", + (PortLabel, Tr) => "Port", + (UsernameLabel, En) => "Username", + (UsernameLabel, Tr) => "Kullanıcı adı", + (PasswordLabel, En) => "Password", + (PasswordLabel, Tr) => "Parola", (PasswordSetPlaceholder, En) => "Unchanged", (PasswordSetPlaceholder, Tr) => "Değişmedi", (PasswordNeededPlaceholder, En) => "Required", (PasswordNeededPlaceholder, Tr) => "Gerekli", - (FromNameLabel, En) => "FROM NAME", - (FromNameLabel, Tr) => "GÖNDEREN ADI", - (FromAddressLabel, En) => "FROM ADDRESS", - (FromAddressLabel, Tr) => "GÖNDEREN ADRESİ", + (FromNameLabel, En) => "From name", + (FromNameLabel, Tr) => "Gönderen adı", + (FromAddressLabel, En) => "From address", + (FromAddressLabel, Tr) => "Gönderen adresi", (SendTestMail, En) => "Send test mail to myself", (SendTestMail, Tr) => "Kendime test postası gönder", (WorkspaceLimits, En) => "Workspace limits", (WorkspaceLimits, Tr) => "Çalışma alanı limitleri", - (AttachmentLimitLabel, En) => "ATTACHMENT LIMIT (MB)", - (AttachmentLimitLabel, Tr) => "EK LİMİTİ (MB)", - (AllowedFileTypesLabel, En) => "ALLOWED FILE TYPES", - (AllowedFileTypesLabel, Tr) => "İZİN VERİLEN DOSYA TÜRLERİ", + (AttachmentLimitLabel, En) => "Attachment limit (MB)", + (AttachmentLimitLabel, Tr) => "Ek limiti (MB)", + (AllowedFileTypesLabel, En) => "Allowed file types", + (AllowedFileTypesLabel, Tr) => "İzin verilen dosya türleri", (Members, En) => "Members", (Members, Tr) => "Üyeler", (Message, En) => "Message", (Message, Tr) => "Mesaj", (Everyone, En) => "Everyone", (Everyone, Tr) => "Herkes", - (Recipient, En) => "RECIPIENT", - (Recipient, Tr) => "ALICI", - (Subject, En) => "SUBJECT", - (Subject, Tr) => "KONU", - (Body, En) => "BODY", - (Body, Tr) => "İÇERİK", + (Recipient, En) => "Recipient", + (Recipient, Tr) => "Alıcı", + (Subject, En) => "Subject", + (Subject, Tr) => "Konu", + (Body, En) => "Body", + (Body, Tr) => "İçerik", (Send, En) => "Send", (Send, Tr) => "Gönder", - (NameCol, En) => "NAME", - (NameCol, Tr) => "AD", - (AddressCol, En) => "ADDRESS", - (AddressCol, Tr) => "ADRES", - (RoleCol, En) => "ROLE", - (RoleCol, Tr) => "ROL", - (AccountCol, En) => "ACCOUNT", - (AccountCol, Tr) => "HESAP", + (NameCol, En) => "Name", + (NameCol, Tr) => "Ad", + (AddressCol, En) => "Address", + (AddressCol, Tr) => "Adres", + (RoleCol, En) => "Role", + (RoleCol, Tr) => "Rol", + (AccountCol, En) => "Account", + (AccountCol, Tr) => "Hesap", (OwnerStatus, En) => "owner", (OwnerStatus, Tr) => "kurucu", (InvitedStatus, En) => "invited", @@ -746,16 +747,18 @@ pub fn t(lang: Lang, key: Key) -> &'static str { (NoSenderConnectedPrefix, Tr) => "Bağlı gönderen yok.", (NewRule, En) => "New rule", (NewRule, Tr) => "Yeni kural", - (WhenLabel, En) => "WHEN", - (WhenLabel, Tr) => "NE ZAMAN", - (ColumnLabel, En) => "COLUMN", - (ColumnLabel, Tr) => "SÜTUN", - (SendLabel, En) => "SEND", - (SendLabel, Tr) => "GÖNDER", - (ToLabel, En) => "TO", - (ToLabel, Tr) => "KİME", - (BodyLabel, En) => "BODY", - (BodyLabel, Tr) => "İÇERİK", + (WhenLabel, En) => "When", + (WhenLabel, Tr) => "Ne zaman", + (ColumnLabel, En) => "Column", + (ColumnLabel, Tr) => "Sütun", + (SendLabel, En) => "Send", + (SendLabel, Tr) => "Gönder", + (ToLabel, En) => "To", + (ToLabel, Tr) => "Kime", + (BodyLabel, En) => "Body", + (BodyLabel, Tr) => "İçerik", + (SubjectPlaceholder, En) => "Task completed", + (SubjectPlaceholder, Tr) => "Görev tamamlandı", (TaskDetails, En) => "Task details", (TaskDetails, Tr) => "Görev ayrıntıları", (AddRule, En) => "Add rule", @@ -953,8 +956,8 @@ pub fn t(lang: Lang, key: Key) -> &'static str { (SubtaskGoesWithIt, Tr) => "alt görevi de silinir", (SubtasksGoWithIt, En) => "subtasks go with it", (SubtasksGoWithIt, Tr) => "alt görevi de silinir", - (Subtasks, En) => "SUBTASKS", - (Subtasks, Tr) => "ALT GÖREVLER", + (Subtasks, En) => "Subtasks", + (Subtasks, Tr) => "Alt görevler", (NoSubtasks, En) => "no subtasks", (NoSubtasks, Tr) => "alt görev yok", (NewSubtask, En) => "Subtask", @@ -1025,10 +1028,10 @@ pub fn t(lang: Lang, key: Key) -> &'static str { (CommentsLabel, Tr) => "Yorumlar", (RecentActivity, En) => "Recent activity", (RecentActivity, Tr) => "Son etkinlik", - (JoinedLabel, En) => "JOINED", - (JoinedLabel, Tr) => "KATILDI", - (LastSeenLabel, En) => "LAST SEEN", - (LastSeenLabel, Tr) => "SON GÖRÜLME", + (JoinedLabel, En) => "Joined", + (JoinedLabel, Tr) => "Katıldı", + (LastSeenLabel, En) => "Last seen", + (LastSeenLabel, Tr) => "Son görülme", (MailBatchLabel, En) => "Mail delay (minutes)", (MailBatchLabel, Tr) => "Posta gecikmesi (dakika)", (ReminderMinutesLabel, En) => "Reminder (minutes)", diff --git a/crates/iz-web/src/layout.rs b/crates/iz-web/src/layout.rs index 2203b99..baca822 100644 --- a/crates/iz-web/src/layout.rs +++ b/crates/iz-web/src/layout.rs @@ -13,7 +13,7 @@ use topcoat::{ view::{BoxView, Unescaped, View, ViewExt, error_boundary, view}, }; -use crate::health::{Probe, probe_healthz, switcher_marks}; +use crate::health::{probe_family, switcher_marks}; use crate::i18n::{Key, Lang, t}; use crate::server::{FAMILY_KEY, current_user, store}; @@ -284,25 +284,26 @@ pub(crate) async fn family_mark<'a>(cx: &'a Cx) -> Result { if siblings.is_empty() { return mark(cx).await.map(|v| v.boxed()); } - // Every probe at once: a family member that is down costs its two - // seconds, not two seconds each. - let http = reqwest::Client::new(); - let mut probes = Vec::new(); - for service in &siblings { - let http = http.clone(); - let url = format!("{}/healthz", service.url.trim_end_matches('/')); - probes.push(tokio::spawn(async move { probe_healthz(&http, &url).await })); - } - let mut rows = Vec::new(); - for (service, probe) in siblings.iter().zip(probes) { - let probe = probe.await.unwrap_or(Probe::Down); - rows.push(( - service.key.as_str(), - service.name.as_str(), - service.url.as_str(), - probe, - )); - } + // Every probe at once, at most one family-wide round per TTL + // ([`crate::health::probe_family`]): a sibling that is down costs its + // two seconds once, not once per page render. + let urls: Vec = siblings + .iter() + .map(|service| format!("{}/healthz", service.url.trim_end_matches('/'))) + .collect(); + let probes = probe_family(urls).await; + let rows: Vec<_> = siblings + .iter() + .zip(probes) + .map(|(service, probe)| { + ( + service.key.as_str(), + service.name.as_str(), + service.url.as_str(), + probe, + ) + }) + .collect(); let marks = switcher_marks(rows); Ok(view! { cx => @@ -543,6 +544,8 @@ pub async fn soft_nav_script<'a>(cx: &'a Cx) -> Result { else { document.documentElement.removeAttribute('data-theme'); } \ if (root.hasAttribute('data-ui')) { document.documentElement.setAttribute('data-ui', root.getAttribute('data-ui')); } \ else { document.documentElement.removeAttribute('data-ui'); } \ + var freshTitle = doc.querySelector('title'); \ + if (freshTitle && freshTitle.textContent) { document.title = freshTitle.textContent; } \ if (url) { history[push ? 'pushState' : 'replaceState'](null, '', url); } \ if (morphing) { \ morph(document.body, doc.body); \ @@ -1018,6 +1021,22 @@ async fn root_layout(cx: &Cx, slot: topcoat::view::Child<'_>) -> Result t(lang, Key::SignIn).to_string(), + "/" => t(lang, Key::NavBoard).to_string(), + p if p.starts_with("/rules") => t(lang, Key::NavMailRules).to_string(), + p if p.starts_with("/logs") => t(lang, Key::NavLogs).to_string(), + p if p.starts_with("/tags") => t(lang, Key::NavTags).to_string(), + p if p.starts_with("/settings") => t(lang, Key::NavSettings).to_string(), + p if p.starts_with("/people") => t(lang, Key::Members).to_string(), + _ => "iz".to_string(), + }; Ok(view! { cx => @@ -1031,7 +1050,7 @@ async fn root_layout(cx: &Cx, slot: topcoat::view::Child<'_>) -> Result - "iz" + (title) topcoat::runtime::script() diff --git a/crates/iz-web/src/logs.rs b/crates/iz-web/src/logs.rs index 0066144..e4182dc 100644 --- a/crates/iz-web/src/logs.rs +++ b/crates/iz-web/src/logs.rs @@ -1031,7 +1031,7 @@ async fn logs_screen<'a>( (t(lang, Key::MailDecisions)) (t(lang, Key::WorkspaceActivity)) -
+

(t(lang, Key::Logs))

(t(lang, Key::AdminOnly)) diff --git a/crates/iz-web/src/rules.rs b/crates/iz-web/src/rules.rs index 95d2787..2116e70 100644 --- a/crates/iz-web/src/rules.rs +++ b/crates/iz-web/src/rules.rs @@ -710,7 +710,7 @@ async fn rule_form<'a>( class="field-input" type="text" name="subject" - placeholder="Task completed" + placeholder=(t(lang, Key::SubjectPlaceholder)) maxlength="120" required="" value=(subject) diff --git a/crates/iz-web/src/server.rs b/crates/iz-web/src/server.rs index 8456f63..48ab422 100644 --- a/crates/iz-web/src/server.rs +++ b/crates/iz-web/src/server.rs @@ -482,10 +482,11 @@ impl Refusal { } } - /// `message()`, in a user's language, for the handful of refusals - /// `board.rs`/`detail.rs` render — those two pages' only refusal variants. - /// Everything else falls back to the English `message()`: the rest of the - /// app's pages have not been translated yet. + /// `message()`, in a user's language. English is the canonical + /// sentence; the Turkish match arms every variant — the compiler holds + /// it exhaustive, so a refusal cannot land untranslated — and + /// `BadSender` falls back to English because its sentence is built + /// where the complaint is decided, already in the caller's language. pub fn message_in(&self, lang: crate::i18n::Lang) -> String { use crate::i18n::Lang::Tr; if lang != Tr { diff --git a/crates/iz-web/tests/http.rs b/crates/iz-web/tests/http.rs index a54b1b0..44817f7 100644 --- a/crates/iz-web/tests/http.rs +++ b/crates/iz-web/tests/http.rs @@ -6501,7 +6501,7 @@ async fn a_task_with_no_mail_shows_the_quiet_notifications_line() { .get(&format!("/?task={task}&tab=mail"), Some(&admin_cookie)) .await; let html = String::from_utf8_lossy(&page.bytes); - assert!(html.contains("NOTIFICATIONS"), "{html}"); + assert!(html.contains("Notifications"), "{html}"); assert!(html.contains("Nothing yet."), "{html}"); } @@ -6941,7 +6941,7 @@ async fn each_tab_renders_only_its_own_region() { .await; let mail_html = String::from_utf8_lossy(&mail.bytes); assert!( - mail_html.contains("NOTIFICATIONS"), + mail_html.contains("Notifications"), "no notifications heading: {mail_html}" ); } @@ -8188,7 +8188,7 @@ async fn a_profile_names_its_fields() { .await; assert_eq!(page.status.as_u16(), 200); let html = String::from_utf8(page.bytes).unwrap(); - for label in ["EMAIL", "JOINED", "LAST SEEN"] { + for label in ["Email", "Joined", "Last seen"] { assert!( html.contains(label), "the {label} field is not on the page: {html}" @@ -9795,9 +9795,9 @@ async fn a_sign_out_hands_the_browser_to_the_providers_logout_pointed_home() { #[tokio::test] async fn the_topbar_shows_the_family_switcher_and_marks_this_app_only_when_configured() { let family = "\ - [{\"key\":\"in\",\"name\":\"Files\",\"url\":\"http://127.0.0.1:7655\"},\ - {\"key\":\"iz\",\"name\":\"Board\",\"url\":\"http://127.0.0.1:7654\"},\ - {\"key\":\"im\",\"name\":\"Account\",\"url\":\"http://127.0.0.1:7650\"}]" + [{\"key\":\"in\",\"name\":\"Files\",\"url\":\"http://127.0.0.1:9655\"},\ + {\"key\":\"iz\",\"name\":\"Board\",\"url\":\"http://127.0.0.1:9654\"},\ + {\"key\":\"im\",\"name\":\"Account\",\"url\":\"http://127.0.0.1:9650\"}]" .to_string(); let app = App::build_with(Mail::silent(), Some(family), "", None).await; let board_admin = admin(&app).await; @@ -9806,9 +9806,9 @@ async fn the_topbar_shows_the_family_switcher_and_marks_this_app_only_when_confi assert!(html.contains("service-switcher"), "{html}"); // This app has no door back into itself: only the siblings hang there, // in the order im served them. - assert!(!html.contains("href=\"http://127.0.0.1:7654\""), "{html}"); - let in_at = html.find("href=\"http://127.0.0.1:7655\"").unwrap(); - let im_at = html.find("href=\"http://127.0.0.1:7650\"").unwrap(); + assert!(!html.contains("href=\"http://127.0.0.1:9654\""), "{html}"); + let in_at = html.find("href=\"http://127.0.0.1:9655\"").unwrap(); + let im_at = html.find("href=\"http://127.0.0.1:9650\"").unwrap(); assert!(in_at < im_at, "marks out of order: {html}"); // The dots ride along: the fixture's ports answer nobody, so the diff --git a/style/main.scss b/style/main.scss index 6d1adb3..23a9022 100644 --- a/style/main.scss +++ b/style/main.scss @@ -2064,6 +2064,7 @@ img.avatar { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; + text-transform: uppercase; color: var(--muted-soft); } @@ -3028,8 +3029,6 @@ img.avatar { scrollbar-width: none; &::-webkit-scrollbar { display: none; } - &.stage-wide { max-width: 1200px; } - // A panel's own `overflow: hidden` (the corner clip) zeroes its flex // min-height, so the column would compress it to the viewport and clip the // rows invisibly. Panels keep natural height; the stage is what pans. @@ -3157,6 +3156,7 @@ img.avatar { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; + text-transform: uppercase; color: var(--muted-soft); } @@ -3412,6 +3412,7 @@ input[type="radio"] { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; + text-transform: uppercase; font-weight: 400; color: var(--muted-soft); border-bottom: 1px solid var(--border); @@ -4046,6 +4047,7 @@ input[type="radio"] { dt { font-size: 10px; letter-spacing: 0.09em; + text-transform: uppercase; color: var(--muted); }