Pending invites in People with Invalidate
Browse files at this commit5e196bf49ca3250617005b84ffcc6d25d3cf8ee5Parent: f464e35- feat
- pending invites in People with Invalidate
- account deletion
- colored mail chip
4 changed files +330 -17
- crates/im-core/src/accounts.rs +146 -0
- crates/im-web/assets/main.css +42 -0
- crates/im-web/src/admin.rs +96 -17
- style/main.scss +46 -0
crates/im-core/src/accounts.rsmodified+146 -0
| @@ -18,6 +18,7 @@ use rand::Rng; | |||
| 18 | use serde::{Deserialize, Serialize}; | 18 | use serde::{Deserialize, Serialize}; |
| 19 | use sha2::{Digest, Sha256}; | 19 | use sha2::{Digest, Sha256}; |
| 20 | use subtle::ConstantTimeEq; | 20 | use subtle::ConstantTimeEq; |
| 21 | +use time::OffsetDateTime; | ||
| 21 | 22 | ||
| 22 | use crate::model::{Invite, User, UserId}; | 23 | use crate::model::{Invite, User, UserId}; |
| 23 | use crate::store::{self, Result, Store, StoreError, backend}; | 24 | use crate::store::{self, Result, Store, StoreError, backend}; |
| @@ -287,6 +288,69 @@ pub async fn invite_by_token(store: &Store, token: &str) -> Result<Option<Invite | |||
| 287 | })) | 288 | })) |
| 288 | } | 289 | } |
| 289 | 290 | ||
| 291 | +/// An invite still waiting on its person, as the People section lists it. | ||
| 292 | +/// `token_hash` is the row's identity — the digest, never the raw token, so | ||
| 293 | +/// the panel can carry it in a form without a live invite leaking into HTML | ||
| 294 | +/// anyone can view-source. | ||
| 295 | +#[derive(Debug, Clone)] | ||
| 296 | +pub struct PendingInvite { | ||
| 297 | + pub token_hash: String, | ||
| 298 | + pub email: String, | ||
| 299 | + pub admin: bool, | ||
| 300 | + pub created_at: OffsetDateTime, | ||
| 301 | + pub expires_at: OffsetDateTime, | ||
| 302 | +} | ||
| 303 | + | ||
| 304 | +/// Invites not yet accepted and not yet expired, oldest first. | ||
| 305 | +pub async fn list_pending_invites(store: &Store) -> Result<Vec<PendingInvite>> { | ||
| 306 | + let mut rows = store | ||
| 307 | + .conn | ||
| 308 | + .query( | ||
| 309 | + "SELECT token, email, admin, created_at, expires_at FROM invites \ | ||
| 310 | + WHERE accepted_at IS NULL AND expires_at > ?1 ORDER BY created_at", | ||
| 311 | + turso::params![store::stamp(store::now())?], | ||
| 312 | + ) | ||
| 313 | + .await | ||
| 314 | + .map_err(backend)?; | ||
| 315 | + let mut pending = Vec::new(); | ||
| 316 | + while let Some(row) = rows.next().await.map_err(backend)? { | ||
| 317 | + pending.push(PendingInvite { | ||
| 318 | + token_hash: store::text(&row, 0)?, | ||
| 319 | + email: store::text(&row, 1)?, | ||
| 320 | + admin: store::int(&row, 2)? != 0, | ||
| 321 | + created_at: store::parse_stamp(&store::text(&row, 3)?)?, | ||
| 322 | + expires_at: store::parse_stamp(&store::text(&row, 4)?)?, | ||
| 323 | + }); | ||
| 324 | + } | ||
| 325 | + Ok(pending) | ||
| 326 | +} | ||
| 327 | + | ||
| 328 | +/// Invalidates an invite: the row is gone, the link reads "not valid" from | ||
| 329 | +/// that moment on. Returns the address it was made out to, for the log line. | ||
| 330 | +pub async fn revoke_invite(store: &Store, token_hash: &str) -> Result<Option<String>> { | ||
| 331 | + let mut rows = store | ||
| 332 | + .conn | ||
| 333 | + .query( | ||
| 334 | + "SELECT email FROM invites WHERE token = ?1", | ||
| 335 | + turso::params![token_hash], | ||
| 336 | + ) | ||
| 337 | + .await | ||
| 338 | + .map_err(backend)?; | ||
| 339 | + let Some(row) = rows.next().await.map_err(backend)? else { | ||
| 340 | + return Ok(None); | ||
| 341 | + }; | ||
| 342 | + let email = store::text(&row, 0)?; | ||
| 343 | + store | ||
| 344 | + .conn | ||
| 345 | + .execute( | ||
| 346 | + "DELETE FROM invites WHERE token = ?1", | ||
| 347 | + turso::params![token_hash], | ||
| 348 | + ) | ||
| 349 | + .await | ||
| 350 | + .map_err(backend)?; | ||
| 351 | + Ok(Some(email)) | ||
| 352 | +} | ||
| 353 | + | ||
| 290 | /// Turns a valid invite into a user. The invite is marked accepted in the | 354 | /// Turns a valid invite into a user. The invite is marked accepted in the |
| 291 | /// same transaction as the user insert, so a token can never mint two | 355 | /// same transaction as the user insert, so a token can never mint two |
| 292 | /// accounts. | 356 | /// accounts. |
| @@ -488,6 +552,28 @@ pub async fn user_by_id(store: &Store, id: &UserId) -> Result<Option<User>> { | |||
| 488 | })) | 552 | })) |
| 489 | } | 553 | } |
| 490 | 554 | ||
| 555 | +/// Deletes an account outright: the user row, its sessions, and every app | ||
| 556 | +/// token born of them. Disable is the reversible door; this is for "this | ||
| 557 | +/// account should not exist" — the OIDC subject dies with it, and if the | ||
| 558 | +/// person returns they get a fresh one. | ||
| 559 | +pub async fn delete_user(store: &Store, user: &UserId) -> Result<()> { | ||
| 560 | + let id = user.to_string(); | ||
| 561 | + for sql in [ | ||
| 562 | + "DELETE FROM app_sessions WHERE user_id = ?1", | ||
| 563 | + "DELETE FROM refresh_tokens WHERE user_id = ?1", | ||
| 564 | + "DELETE FROM sessions WHERE user_id = ?1", | ||
| 565 | + "UPDATE invites SET invited_by = NULL WHERE invited_by = ?1", | ||
| 566 | + "DELETE FROM users WHERE id = ?1", | ||
| 567 | + ] { | ||
| 568 | + store | ||
| 569 | + .conn | ||
| 570 | + .execute(sql, turso::params![id.clone()]) | ||
| 571 | + .await | ||
| 572 | + .map_err(backend)?; | ||
| 573 | + } | ||
| 574 | + Ok(()) | ||
| 575 | +} | ||
| 576 | + | ||
| 491 | /// Every user, oldest first — the admin panel's roster. | 577 | /// Every user, oldest first — the admin panel's roster. |
| 492 | pub async fn list_users(store: &Store) -> Result<Vec<User>> { | 578 | pub async fn list_users(store: &Store) -> Result<Vec<User>> { |
| 493 | let mut rows = store | 579 | let mut rows = store |
| @@ -699,4 +785,64 @@ mod tests { | |||
| 699 | Err(AccountError::EmailTaken) | 785 | Err(AccountError::EmailTaken) |
| 700 | )); | 786 | )); |
| 701 | } | 787 | } |
| 788 | + | ||
| 789 | + #[tokio::test] | ||
| 790 | + async fn pending_invites_list_and_revoke() { | ||
| 791 | + let store = fixture().await; | ||
| 792 | + let token = create_invite(&store, "bob@example.com", None, true) | ||
| 793 | + .await | ||
| 794 | + .unwrap(); | ||
| 795 | + | ||
| 796 | + let pending = list_pending_invites(&store).await.unwrap(); | ||
| 797 | + assert_eq!(pending.len(), 1); | ||
| 798 | + assert_eq!(pending[0].email, "bob@example.com"); | ||
| 799 | + assert!(pending[0].admin); | ||
| 800 | + | ||
| 801 | + let email = revoke_invite(&store, &pending[0].token_hash).await.unwrap(); | ||
| 802 | + assert_eq!(email.as_deref(), Some("bob@example.com")); | ||
| 803 | + assert!(list_pending_invites(&store).await.unwrap().is_empty()); | ||
| 804 | + // The link is dead: the token resolves to nothing. | ||
| 805 | + assert!( | ||
| 806 | + invite_by_token(&store, token.expose()) | ||
| 807 | + .await | ||
| 808 | + .unwrap() | ||
| 809 | + .is_none() | ||
| 810 | + ); | ||
| 811 | + // Revoking the same invite twice is a quiet no-op. | ||
| 812 | + assert!( | ||
| 813 | + revoke_invite(&store, &pending[0].token_hash) | ||
| 814 | + .await | ||
| 815 | + .unwrap() | ||
| 816 | + .is_none() | ||
| 817 | + ); | ||
| 818 | + } | ||
| 819 | + | ||
| 820 | + #[tokio::test] | ||
| 821 | + async fn delete_user_takes_sessions_with_it() { | ||
| 822 | + let store = fixture().await; | ||
| 823 | + let invite = create_invite(&store, "ann@example.com", None, false) | ||
| 824 | + .await | ||
| 825 | + .unwrap(); | ||
| 826 | + let user = create_user_from_invite(&store, invite.expose(), "Ann", "tDLr9!mZQ2xv") | ||
| 827 | + .await | ||
| 828 | + .unwrap(); | ||
| 829 | + let session = crate::sessions::create_session(&store, &user.id) | ||
| 830 | + .await | ||
| 831 | + .unwrap(); | ||
| 832 | + | ||
| 833 | + delete_user(&store, &user.id).await.unwrap(); | ||
| 834 | + assert!(user_by_id(&store, &user.id).await.unwrap().is_none()); | ||
| 835 | + assert!( | ||
| 836 | + crate::sessions::resolve_session(&store, session.expose()) | ||
| 837 | + .await | ||
| 838 | + .unwrap() | ||
| 839 | + .is_none() | ||
| 840 | + ); | ||
| 841 | + // The address is free again: a fresh invite can be made for it. | ||
| 842 | + assert!( | ||
| 843 | + create_invite(&store, "ann@example.com", None, false) | ||
| 844 | + .await | ||
| 845 | + .is_ok() | ||
| 846 | + ); | ||
| 847 | + } | ||
| 702 | } | 848 | } |
crates/im-web/assets/main.cssmodified+42 -0
| @@ -504,6 +504,48 @@ body:has(.admin-shell) { | |||
| 504 | gap: 8px; | 504 | gap: 8px; |
| 505 | } | 505 | } |
| 506 | 506 | ||
| 507 | +.chip { | ||
| 508 | + display: inline-flex; | ||
| 509 | + align-items: center; | ||
| 510 | + height: 24px; | ||
| 511 | + padding: 0 10px; | ||
| 512 | + border-radius: var(--radius); | ||
| 513 | + font-size: 11px; | ||
| 514 | + font-weight: 600; | ||
| 515 | +} | ||
| 516 | + | ||
| 517 | +.chip-muted { | ||
| 518 | + background: var(--panel-sunken); | ||
| 519 | + border: 1px solid var(--border-strong); | ||
| 520 | + color: var(--muted); | ||
| 521 | +} | ||
| 522 | + | ||
| 523 | +.chip-connected { | ||
| 524 | + background: var(--positive-tint); | ||
| 525 | + border: 1px solid var(--positive-border); | ||
| 526 | + color: var(--positive); | ||
| 527 | +} | ||
| 528 | + | ||
| 529 | +.chip-refused { | ||
| 530 | + background: var(--danger-tint-alt); | ||
| 531 | + border: 1px solid var(--danger-border-soft); | ||
| 532 | + color: var(--danger); | ||
| 533 | +} | ||
| 534 | + | ||
| 535 | +.admin-card-head { | ||
| 536 | + display: flex; | ||
| 537 | + align-items: center; | ||
| 538 | + justify-content: space-between; | ||
| 539 | + gap: 10px; | ||
| 540 | +} | ||
| 541 | + | ||
| 542 | +.admin-danger { | ||
| 543 | + color: var(--danger); | ||
| 544 | +} | ||
| 545 | +.admin-danger:hover { | ||
| 546 | + background: var(--danger-tint-alt); | ||
| 547 | +} | ||
| 548 | + | ||
| 507 | input[type=checkbox] { | 549 | input[type=checkbox] { |
| 508 | accent-color: var(--accent); | 550 | accent-color: var(--accent); |
| 509 | } | 551 | } |
crates/im-web/src/admin.rsmodified+96 -17
| @@ -108,6 +108,8 @@ async fn admin_page(cx: &Cx) -> Result<Response> { | |||
| 108 | "smtp" => "Mail settings saved.", | 108 | "smtp" => "Mail settings saved.", |
| 109 | "smtp_test" => "Test mail sent.", | 109 | "smtp_test" => "Test mail sent.", |
| 110 | "password" => "Password changed — every other device is signed out.", | 110 | "password" => "Password changed — every other device is signed out.", |
| 111 | + "uninvited" => "Invite invalidated — the link is dead.", | ||
| 112 | + "deleted" => "Account deleted.", | ||
| 111 | _ => "Done.", | 113 | _ => "Done.", |
| 112 | } | 114 | } |
| 113 | )), | 115 | )), |
| @@ -172,6 +174,7 @@ async fn users_section( | |||
| 172 | invited: Option<&str>, | 174 | invited: Option<&str>, |
| 173 | ) -> Result<String, topcoat::Error> { | 175 | ) -> Result<String, topcoat::Error> { |
| 174 | let users = accounts::list_users(&app(cx).store).await?; | 176 | let users = accounts::list_users(&app(cx).store).await?; |
| 177 | + let pending = accounts::list_pending_invites(&app(cx).store).await?; | ||
| 175 | let mut rows = String::new(); | 178 | let mut rows = String::new(); |
| 176 | for user in &users { | 179 | for user in &users { |
| 177 | let flags = [ | 180 | let flags = [ |
| @@ -198,7 +201,7 @@ async fn users_section( | |||
| 198 | ) | 201 | ) |
| 199 | }; | 202 | }; |
| 200 | format!( | 203 | format!( |
| 201 | - r#"{toggle}<form method="post" action="/admin/revoke"><input type="hidden" name="user" value="{id}"><button class="admin-action" type="submit">Sign out everywhere</button></form>"# | 204 | + r#"{toggle}<form method="post" action="/admin/revoke"><input type="hidden" name="user" value="{id}"><button class="admin-action" type="submit">Sign out everywhere</button></form><form method="post" action="/admin/delete"><input type="hidden" name="user" value="{id}"><button class="admin-action admin-danger" type="submit">Delete</button></form>"# |
| 202 | ) | 205 | ) |
| 203 | }; | 206 | }; |
| 204 | rows.push_str(&format!( | 207 | rows.push_str(&format!( |
| @@ -209,6 +212,26 @@ async fn users_section( | |||
| 209 | actions | 212 | actions |
| 210 | )); | 213 | )); |
| 211 | } | 214 | } |
| 215 | + // Invites still waiting on their person sit in the same table — "waiting" | ||
| 216 | + // instead of a name, and the one action an outstanding link understands: | ||
| 217 | + for row in &pending { | ||
| 218 | + let flags = [Some("invited"), row.admin.then_some("admin")] | ||
| 219 | + .into_iter() | ||
| 220 | + .flatten() | ||
| 221 | + .collect::<Vec<_>>() | ||
| 222 | + .join(" · "); | ||
| 223 | + let expires = row | ||
| 224 | + .expires_at | ||
| 225 | + .format(&time::macros::format_description!("[year]-[month]-[day]")) | ||
| 226 | + .unwrap_or_default(); | ||
| 227 | + rows.push_str(&format!( | ||
| 228 | + r#"<tr><td class="mono">{}</td><td class="muted">waiting · until {}</td><td class="muted">{}</td><td class="actions"><form method="post" action="/admin/uninvite"><input type="hidden" name="invite" value="{}"><button class="admin-action" type="submit">Invalidate</button></form></td></tr>"#, | ||
| 229 | + escape(&row.email), | ||
| 230 | + expires, | ||
| 231 | + flags, | ||
| 232 | + escape(&row.token_hash), | ||
| 233 | + )); | ||
| 234 | + } | ||
| 212 | let invited_html = invited | 235 | let invited_html = invited |
| 213 | .map(|link| { | 236 | .map(|link| { |
| 214 | format!( | 237 | format!( |
| @@ -245,31 +268,50 @@ async fn mail_section(cx: &Cx) -> Result<String, topcoat::Error> { | |||
| 245 | } else { | 268 | } else { |
| 246 | "no password set" | 269 | "no password set" |
| 247 | }; | 270 | }; |
| 248 | - // The standing line, izlek's chip as a sentence: what the last probe | 271 | + // The standing chip, izlek's idiom: one colored chip that says what the |
| 249 | - // proved, and when. Saving settings wipes the record, so this can never | 272 | + // last probe proved, with the server's own words under it on a refusal. |
| 250 | - // claim "connected" for settings that changed since. | 273 | + // Saving settings wipes the record, so the chip can never claim |
| 274 | + // "connected" for settings that changed since. | ||
| 251 | let stamp = |at: time::OffsetDateTime| { | 275 | let stamp = |at: time::OffsetDateTime| { |
| 252 | at.format(&time::macros::format_description!( | 276 | at.format(&time::macros::format_description!( |
| 253 | "[year]-[month]-[day] [hour]:[minute] UTC" | 277 | "[year]-[month]-[day] [hour]:[minute] UTC" |
| 254 | )) | 278 | )) |
| 255 | .unwrap_or_default() | 279 | .unwrap_or_default() |
| 256 | }; | 280 | }; |
| 257 | - let standing = match settings::standing(store).await? { | 281 | + let (chip_class, chip_text, lede) = match settings::standing(store).await? { |
| 258 | - settings::Standing::NotConfigured => "No sender configured.".to_string(), | 282 | + settings::Standing::NotConfigured => ( |
| 259 | - settings::Standing::Unchecked => { | 283 | + "chip chip-muted", |
| 284 | + "not configured".to_string(), | ||
| 285 | + String::new(), | ||
| 286 | + ), | ||
| 287 | + settings::Standing::Unchecked => ( | ||
| 288 | + "chip chip-muted", | ||
| 289 | + "unchecked".to_string(), | ||
| 260 | "Saved, but never checked — the check dials the server and stops before sending." | 290 | "Saved, but never checked — the check dials the server and stops before sending." |
| 261 | - .to_string() | 291 | + .to_string(), |
| 262 | - } | 292 | + ), |
| 263 | - settings::Standing::Connected { at, took_ms } => { | 293 | + settings::Standing::Connected { at, took_ms } => ( |
| 264 | - format!("Connected · {took_ms} ms · {}", stamp(at)) | 294 | + "chip chip-connected", |
| 265 | - } | 295 | + format!("connected · {took_ms} ms"), |
| 266 | - settings::Standing::Refused { at, said } => { | 296 | + format!( |
| 267 | - format!("Refused · {} — {}", stamp(at), escape(&said)) | 297 | + "Checked {} — TLS, hello, password: all accepted.", |
| 268 | - } | 298 | + stamp(at) |
| 299 | + ), | ||
| 300 | + ), | ||
| 301 | + settings::Standing::Refused { at, said } => ( | ||
| 302 | + "chip chip-refused", | ||
| 303 | + "refused".to_string(), | ||
| 304 | + format!("{} — {}", stamp(at), escape(&said)), | ||
| 305 | + ), | ||
| 306 | + }; | ||
| 307 | + let lede_html = if lede.is_empty() { | ||
| 308 | + String::new() | ||
| 309 | + } else { | ||
| 310 | + format!(r#"<div class="admin-standing">{lede}</div>"#) | ||
| 269 | }; | 311 | }; |
| 270 | Ok(format!( | 312 | Ok(format!( |
| 271 | r#"<div class="admin-card"> | 313 | r#"<div class="admin-card"> |
| 272 | - <div class="auth-title">Mail</div> | 314 | + <div class="admin-card-head"><div class="auth-title">Mail</div><span class="{chip_class}">{chip_text}</span></div> |
| 273 | <div class="auth-sub">Invites go out through this sender. The password is sealed under <span class="mono">im.key</span>; without a sender, invite links are shown here instead of mailed.</div> | 315 | <div class="auth-sub">Invites go out through this sender. The password is sealed under <span class="mono">im.key</span>; without a sender, invite links are shown here instead of mailed.</div> |
| 274 | <form method="post" action="/admin/smtp" class="admin-form"> | 316 | <form method="post" action="/admin/smtp" class="admin-form"> |
| 275 | <label class="auth-field"><span class="auth-label">Host</span> | 317 | <label class="auth-field"><span class="auth-label">Host</span> |
| @@ -284,7 +326,7 @@ async fn mail_section(cx: &Cx) -> Result<String, topcoat::Error> { | |||
| 284 | <input class="auth-input auth-input-mono" type="text" name="from" value="{}" placeholder="im <auth@example.com>"></label> | 326 | <input class="auth-input auth-input-mono" type="text" name="from" value="{}" placeholder="im <auth@example.com>"></label> |
| 285 | <button class="auth-submit admin-action-wide" type="submit"><span class="auth-submit-text">Save</span></button> | 327 | <button class="auth-submit admin-action-wide" type="submit"><span class="auth-submit-text">Save</span></button> |
| 286 | </form> | 328 | </form> |
| 287 | - <div class="admin-standing">{standing}</div> | 329 | + {lede_html} |
| 288 | <div class="admin-pair"> | 330 | <div class="admin-pair"> |
| 289 | <form method="post" action="/admin/smtp_check"><button class="admin-action" type="submit">Check connection</button></form> | 331 | <form method="post" action="/admin/smtp_check"><button class="admin-action" type="submit">Check connection</button></form> |
| 290 | <form method="post" action="/admin/smtp_test"><button class="admin-action" type="submit">Send a test mail to myself</button></form> | 332 | <form method="post" action="/admin/smtp_test"><button class="admin-action" type="submit">Send a test mail to myself</button></form> |
| @@ -373,6 +415,43 @@ async fn invite(cx: &Cx, Form(input): Form<InviteForm>) -> Result<Response> { | |||
| 373 | } | 415 | } |
| 374 | } | 416 | } |
| 375 | 417 | ||
| 418 | +#[derive(Deserialize)] | ||
| 419 | +struct InviteAction { | ||
| 420 | + invite: String, | ||
| 421 | +} | ||
| 422 | + | ||
| 423 | +/// Invalidates an outstanding invite: the link dies now, not at expiry. | ||
| 424 | +#[route(POST "/admin/uninvite")] | ||
| 425 | +async fn uninvite(cx: &Cx, Form(input): Form<InviteAction>) -> Result<Response> { | ||
| 426 | + let me = match require_admin(cx).await { | ||
| 427 | + Ok(me) => me, | ||
| 428 | + Err(redirect) => return Ok(redirect), | ||
| 429 | + }; | ||
| 430 | + let store = &app(cx).store; | ||
| 431 | + let email = accounts::revoke_invite(store, &input.invite).await?; | ||
| 432 | + events::log(store, "invite_revoked", Some(&me.email), email.as_deref()).await; | ||
| 433 | + back(cx, "users", "&ok=uninvited") | ||
| 434 | +} | ||
| 435 | + | ||
| 436 | +/// Deletes the account outright — user, sessions, app tokens. Disable is | ||
| 437 | +/// the reversible door; this one is for "should not exist". The admin's own | ||
| 438 | +/// row never carries the button, so there is no self-delete to guard here. | ||
| 439 | +#[route(POST "/admin/delete")] | ||
| 440 | +async fn delete(cx: &Cx, Form(input): Form<UserAction>) -> Result<Response> { | ||
| 441 | + let me = match require_admin(cx).await { | ||
| 442 | + Ok(me) => me, | ||
| 443 | + Err(redirect) => return Ok(redirect), | ||
| 444 | + }; | ||
| 445 | + let store = &app(cx).store; | ||
| 446 | + let user_id = UserId::from(input.user); | ||
| 447 | + let email = accounts::user_by_id(store, &user_id) | ||
| 448 | + .await? | ||
| 449 | + .map(|u| u.email); | ||
| 450 | + accounts::delete_user(store, &user_id).await?; | ||
| 451 | + events::log(store, "user_deleted", Some(&me.email), email.as_deref()).await; | ||
| 452 | + back(cx, "users", "&ok=deleted") | ||
| 453 | +} | ||
| 454 | + | ||
| 376 | #[derive(Deserialize)] | 455 | #[derive(Deserialize)] |
| 377 | struct PasswordForm { | 456 | struct PasswordForm { |
| 378 | current: String, | 457 | current: String, |
style/main.scssmodified+46 -0
| @@ -540,6 +540,52 @@ body:has(.admin-shell) { | |||
| 540 | gap: 8px; | 540 | gap: 8px; |
| 541 | } | 541 | } |
| 542 | 542 | ||
| 543 | +// The standing chip, iz's idiom: one colored pill that says what the last | ||
| 544 | +// probe proved — positive green on a pass, the danger tint on a refusal, | ||
| 545 | +// quiet gray until there is anything to say. | ||
| 546 | +.chip { | ||
| 547 | + display: inline-flex; | ||
| 548 | + align-items: center; | ||
| 549 | + height: 24px; | ||
| 550 | + padding: 0 10px; | ||
| 551 | + border-radius: var(--radius); | ||
| 552 | + font-size: 11px; | ||
| 553 | + font-weight: 600; | ||
| 554 | +} | ||
| 555 | + | ||
| 556 | +.chip-muted { | ||
| 557 | + background: var(--panel-sunken); | ||
| 558 | + border: 1px solid var(--border-strong); | ||
| 559 | + color: var(--muted); | ||
| 560 | +} | ||
| 561 | + | ||
| 562 | +.chip-connected { | ||
| 563 | + background: var(--positive-tint); | ||
| 564 | + border: 1px solid var(--positive-border); | ||
| 565 | + color: var(--positive); | ||
| 566 | +} | ||
| 567 | + | ||
| 568 | +.chip-refused { | ||
| 569 | + background: var(--danger-tint-alt); | ||
| 570 | + border: 1px solid var(--danger-border-soft); | ||
| 571 | + color: var(--danger); | ||
| 572 | +} | ||
| 573 | + | ||
| 574 | +.admin-card-head { | ||
| 575 | + display: flex; | ||
| 576 | + align-items: center; | ||
| 577 | + justify-content: space-between; | ||
| 578 | + gap: 10px; | ||
| 579 | +} | ||
| 580 | + | ||
| 581 | +// Delete is the one destructive row action; it wears the danger ink so it | ||
| 582 | +// never reads as another quiet button. | ||
| 583 | +.admin-danger { | ||
| 584 | + color: var(--danger); | ||
| 585 | + | ||
| 586 | + &:hover { background: var(--danger-tint-alt); } | ||
| 587 | +} | ||
| 588 | + | ||
| 543 | input[type="checkbox"] { accent-color: var(--accent); } | 589 | input[type="checkbox"] { accent-color: var(--accent); } |
| 544 | 590 | ||
| 545 | @media (max-width: 720px) { | 591 | @media (max-width: 720px) { |