web: make random emoji selection more deterministic

This commit is contained in:
Bill Thiede 2025-04-21 10:12:12 -07:00
parent c1496bf87b
commit 38e75ec251

View File

@ -341,9 +341,10 @@ fn search_results(
let caught_up = query.contains("is:unread");
let read_emoji = ["👻", "👽", "👾", "🤖", "💀"];
let no_results_emoji = ["🙈", "👀", "🤦", "🤷", "🙅", "🛟", "🍩", "🌑", "💿", "🔍"];
// Randomly choose emoji based on what 10-second window we're currently in
let now = seed::window()
.performance()
.map(|p| p.now() as usize)
.map(|p| p.now() as usize / 10_000)
.unwrap_or(0);
let (emoji, text) = if caught_up {
let idx = now % read_emoji.len();