BlueGit

ict rusty-teams

feat(receipts): show nothing until a receipt is known, fade a live read

- drop Receipt::Pending and the pulsing receipt slot
- one-shot fade only for a sent -> read change after the chat's receipts settled

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

metis Daniel Däschle · pushed by metis

Authored 2026-10-17 · 6 weeks ago

Hash
07228d2094fbc4bec0158b2ee1ffc29165d8a775
Parent
01283219
4 files changed +152 −30
crates/app-state/src/rows.rs +1 −1
@@ -89,9 +89,9 @@ pub fn bubble_corners(own: bool, series: Series) -> Corners {
89 89 pub enum Receipt {
90 90 #[default]
91 91 Hidden,
92 Pending,
93 92 Sent,
94 93 Read,
94 ReadLive,
95 95 }
96 96
97 97 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -89,9 +89,9 @@ pub fn bubble_corners(own: bool, series: Series) -> Corners {
89pub enum Receipt {
89pub enum Receipt {
90 #[default]
90 #[default]
91 Hidden,
91 Hidden,
92 Pending,
93 Sent,
92 Sent,
94 Read,
93 Read,
94 ReadLive,
95}
95}
96
96
97#[derive(Debug, Clone, Copy, PartialEq, Eq)]
97#[derive(Debug, Clone, Copy, PartialEq, Eq)]
crates/app/src/views/conversation.rs +29 −14
@@ -26,6 +26,7 @@ mod feed;
26 26 mod pins;
27 27 mod proposal;
28 28 mod recap;
29 mod receipt_fade;
29 30 mod render_env;
30 31 mod scheduled;
31 32 mod shared;
@@ -217,6 +218,7 @@ pub struct ConversationView {
217 218 agent_layouts: HashMap<String, (usize, bool)>,
218 219 agent_runs: Rc<RefCell<HashMap<String, AgentRun>>>,
219 220 reaction_proposals: Rc<RefCell<HashMap<String, ReactionProposal>>>,
221 receipt_fade: receipt_fade::ReceiptFade,
220 222 _subscriptions: Vec<Subscription>,
221 223 }
222 224
@@ -544,6 +546,7 @@ impl ConversationView {
544 546 agent_layouts: HashMap::new(),
545 547 agent_runs: Rc::new(RefCell::new(HashMap::new())),
546 548 reaction_proposals: Rc::new(RefCell::new(HashMap::new())),
549 receipt_fade: receipt_fade::ReceiptFade::default(),
547 550 _subscriptions: subscriptions,
548 551 };
549 552 if let Some(selection) = pinned.or_else(|| view.app.read(cx).selection.clone()) {
@@ -1536,7 +1539,10 @@ impl ConversationView {
1536 1539 } else {
1537 1540 rows.extend(local.into_iter().map(|row| Row::Message(Box::new(row))));
1538 1541 }
1539 let receipts = self.receipts(&records, cx);
1542 let mut receipts = self.receipts(&records, cx);
1543 if self.track_receipt_fades(&mut receipts) {
1544 self.schedule_fade_end(cx);
1545 }
1540 1546 for row in rows.iter_mut() {
1541 1547 if let Row::Message(message) = row
1542 1548 && message.own
@@ -1828,18 +1834,12 @@ impl ConversationView {
1828 1834
1829 1835 fn receipts(&self, records: &[MessageRecord], cx: &App) -> HashMap<String, Receipt> {
1830 1836 let state = self.app.read(cx);
1831 let receipts_syncing = self
1832 .current
1833 .as_ref()
1834 .is_some_and(|current| current.sync.receipts);
1835 1837 if state.mode.demo {
1836 1838 let read_ids = crate::demo::read_message_ids(records);
1837 1839 return records
1838 1840 .iter()
1839 1841 .map(|record| {
1840 let receipt = if receipts_syncing {
1841 Receipt::Pending
1842 } else if read_ids.contains(&record.message_id) {
1842 let receipt = if read_ids.contains(&record.message_id) {
1843 1843 Receipt::Read
1844 1844 } else {
1845 1845 Receipt::Sent
@@ -1851,24 +1851,39 @@ impl ConversationView {
1851 1851 let Some(engine) = state.engine.as_ref() else {
1852 1852 return HashMap::new();
1853 1853 };
1854 let unknown = if receipts_syncing {
1855 Receipt::Pending
1856 } else {
1857 Receipt::Hidden
1858 };
1859 1854 records
1860 1855 .iter()
1861 1856 .map(|record| {
1862 1857 let receipt = match engine.receipt_state_for(record) {
1863 1858 teams_core::ReceiptState::Read { .. } => Receipt::Read,
1864 1859 teams_core::ReceiptState::Sent => Receipt::Sent,
1865 teams_core::ReceiptState::Unknown => unknown,
1860 teams_core::ReceiptState::Unknown => Receipt::Hidden,
1866 1861 };
1867 1862 (record.message_id.clone(), receipt)
1868 1863 })
1869 1864 .collect()
1870 1865 }
1871 1866
1867 fn track_receipt_fades(&mut self, receipts: &mut HashMap<String, Receipt>) -> bool {
1868 let Some(current) = self.current.as_ref() else {
1869 return false;
1870 };
1871 let settled = !current.sync.receipts;
1872 let conversation_id = current.selection.conversation_id().to_owned();
1873 self.receipt_fade
1874 .apply(&conversation_id, settled, receipts, Instant::now())
1875 }
1876
1877 fn schedule_fade_end(&mut self, cx: &mut Context<Self>) {
1878 cx.spawn(async move |this, cx| {
1879 cx.background_executor()
1880 .timer(receipt_fade::RECEIPT_FADE)
1881 .await;
1882 this.update(cx, |this, cx| this.rebuild(false, cx)).ok();
1883 })
1884 .detach();
1885 }
1886
1872 1887 fn refresh_receipts(&mut self, generation: u64, cx: &mut Context<Self>) {
1873 1888 let state = self.app.read(cx);
1874 1889 let (Some(engine), Some(Selection::Chat(chat_id))) = (
@@ -26,6 +26,7 @@ mod feed;
26mod pins;
26mod pins;
27mod proposal;
27mod proposal;
28mod recap;
28mod recap;
29mod receipt_fade;
29mod render_env;
30mod render_env;
30mod scheduled;
31mod scheduled;
31mod shared;
32mod shared;
@@ -217,6 +218,7 @@ pub struct ConversationView {
217 agent_layouts: HashMap<String, (usize, bool)>,
218 agent_layouts: HashMap<String, (usize, bool)>,
218 agent_runs: Rc<RefCell<HashMap<String, AgentRun>>>,
219 agent_runs: Rc<RefCell<HashMap<String, AgentRun>>>,
219 reaction_proposals: Rc<RefCell<HashMap<String, ReactionProposal>>>,
220 reaction_proposals: Rc<RefCell<HashMap<String, ReactionProposal>>>,
221 receipt_fade: receipt_fade::ReceiptFade,
220 _subscriptions: Vec<Subscription>,
222 _subscriptions: Vec<Subscription>,
221}
223}
222
224
@@ -544,6 +546,7 @@ impl ConversationView {
544 agent_layouts: HashMap::new(),
546 agent_layouts: HashMap::new(),
545 agent_runs: Rc::new(RefCell::new(HashMap::new())),
547 agent_runs: Rc::new(RefCell::new(HashMap::new())),
546 reaction_proposals: Rc::new(RefCell::new(HashMap::new())),
548 reaction_proposals: Rc::new(RefCell::new(HashMap::new())),
549 receipt_fade: receipt_fade::ReceiptFade::default(),
547 _subscriptions: subscriptions,
550 _subscriptions: subscriptions,
548 };
551 };
549 if let Some(selection) = pinned.or_else(|| view.app.read(cx).selection.clone()) {
552 if let Some(selection) = pinned.or_else(|| view.app.read(cx).selection.clone()) {
@@ -1536,7 +1539,10 @@ impl ConversationView {
1536 } else {
1539 } else {
1537 rows.extend(local.into_iter().map(|row| Row::Message(Box::new(row))));
1540 rows.extend(local.into_iter().map(|row| Row::Message(Box::new(row))));
1538 }
1541 }
1539 let receipts = self.receipts(&records, cx);
1542 let mut receipts = self.receipts(&records, cx);
1543 if self.track_receipt_fades(&mut receipts) {
1544 self.schedule_fade_end(cx);
1545 }
1540 for row in rows.iter_mut() {
1546 for row in rows.iter_mut() {
1541 if let Row::Message(message) = row
1547 if let Row::Message(message) = row
1542 && message.own
1548 && message.own
@@ -1828,18 +1834,12 @@ impl ConversationView {
1828
1834
1829 fn receipts(&self, records: &[MessageRecord], cx: &App) -> HashMap<String, Receipt> {
1835 fn receipts(&self, records: &[MessageRecord], cx: &App) -> HashMap<String, Receipt> {
1830 let state = self.app.read(cx);
1836 let state = self.app.read(cx);
1831 let receipts_syncing = self
1832 .current
1833 .as_ref()
1834 .is_some_and(|current| current.sync.receipts);
1835 if state.mode.demo {
1837 if state.mode.demo {
1836 let read_ids = crate::demo::read_message_ids(records);
1838 let read_ids = crate::demo::read_message_ids(records);
1837 return records
1839 return records
1838 .iter()
1840 .iter()
1839 .map(|record| {
1841 .map(|record| {
1840 let receipt = if receipts_syncing {
1842 let receipt = if read_ids.contains(&record.message_id) {
1841 Receipt::Pending
1842 } else if read_ids.contains(&record.message_id) {
1843 Receipt::Read
1843 Receipt::Read
1844 } else {
1844 } else {
1845 Receipt::Sent
1845 Receipt::Sent
@@ -1851,24 +1851,39 @@ impl ConversationView {
1851 let Some(engine) = state.engine.as_ref() else {
1851 let Some(engine) = state.engine.as_ref() else {
1852 return HashMap::new();
1852 return HashMap::new();
1853 };
1853 };
1854 let unknown = if receipts_syncing {
1855 Receipt::Pending
1856 } else {
1857 Receipt::Hidden
1858 };
1859 records
1854 records
1860 .iter()
1855 .iter()
1861 .map(|record| {
1856 .map(|record| {
1862 let receipt = match engine.receipt_state_for(record) {
1857 let receipt = match engine.receipt_state_for(record) {
1863 teams_core::ReceiptState::Read { .. } => Receipt::Read,
1858 teams_core::ReceiptState::Read { .. } => Receipt::Read,
1864 teams_core::ReceiptState::Sent => Receipt::Sent,
1859 teams_core::ReceiptState::Sent => Receipt::Sent,
1865 teams_core::ReceiptState::Unknown => unknown,
1860 teams_core::ReceiptState::Unknown => Receipt::Hidden,
1866 };
1861 };
1867 (record.message_id.clone(), receipt)
1862 (record.message_id.clone(), receipt)
1868 })
1863 })
1869 .collect()
1864 .collect()
1870 }
1865 }
1871
1866
1867 fn track_receipt_fades(&mut self, receipts: &mut HashMap<String, Receipt>) -> bool {
1868 let Some(current) = self.current.as_ref() else {
1869 return false;
1870 };
1871 let settled = !current.sync.receipts;
1872 let conversation_id = current.selection.conversation_id().to_owned();
1873 self.receipt_fade
1874 .apply(&conversation_id, settled, receipts, Instant::now())
1875 }
1876
1877 fn schedule_fade_end(&mut self, cx: &mut Context<Self>) {
1878 cx.spawn(async move |this, cx| {
1879 cx.background_executor()
1880 .timer(receipt_fade::RECEIPT_FADE)
1881 .await;
1882 this.update(cx, |this, cx| this.rebuild(false, cx)).ok();
1883 })
1884 .detach();
1885 }
1886
1872 fn refresh_receipts(&mut self, generation: u64, cx: &mut Context<Self>) {
1887 fn refresh_receipts(&mut self, generation: u64, cx: &mut Context<Self>) {
1873 let state = self.app.read(cx);
1888 let state = self.app.read(cx);
1874 let (Some(engine), Some(Selection::Chat(chat_id))) = (
1889 let (Some(engine), Some(Selection::Chat(chat_id))) = (
crates/app/src/views/conversation/receipt_fade.rs added +111 −0
@@ -0,0 +1,111 @@
1 use std::collections::HashMap;
2 use std::time::{Duration, Instant};
3
4 use crate::rows::Receipt;
5
6 pub(super) const RECEIPT_FADE: Duration = Duration::from_millis(600);
7
8 /// Marks a receipt that turned from sent to read while the chat was open, never one seen on first paint.
9 #[derive(Default)]
10 pub(super) struct ReceiptFade {
11 conversation_id: String,
12 previous: HashMap<String, Receipt>,
13 fading: HashMap<String, Instant>,
14 }
15
16 impl ReceiptFade {
17 /// Returns true when a new fade started, so the caller can rebuild once it is over.
18 pub(super) fn apply(
19 &mut self,
20 conversation_id: &str,
21 settled: bool,
22 receipts: &mut HashMap<String, Receipt>,
23 now: Instant,
24 ) -> bool {
25 if self.conversation_id != conversation_id || !settled {
26 self.conversation_id = conversation_id.to_owned();
27 self.previous.clear();
28 self.fading.clear();
29 if !settled {
30 return false;
31 }
32 }
33 let mut started = false;
34 let baseline_known = !self.previous.is_empty();
35 for (message_id, receipt) in receipts.iter() {
36 if baseline_known
37 && *receipt == Receipt::Read
38 && self.previous.get(message_id) == Some(&Receipt::Sent)
39 {
40 self.fading.insert(message_id.clone(), now);
41 started = true;
42 }
43 }
44 self.fading
45 .retain(|_, since| now.duration_since(*since) < RECEIPT_FADE);
46 self.previous.clone_from(receipts);
47 for (message_id, receipt) in receipts.iter_mut() {
48 if *receipt == Receipt::Read && self.fading.contains_key(message_id) {
49 *receipt = Receipt::ReadLive;
50 }
51 }
52 started
53 }
54 }
55
56 #[cfg(test)]
57 mod tests {
58 use super::*;
59
60 fn receipts(entries: &[(&str, Receipt)]) -> HashMap<String, Receipt> {
61 entries
62 .iter()
63 .map(|(id, receipt)| ((*id).to_owned(), *receipt))
64 .collect()
65 }
66
67 #[test]
68 fn the_first_paint_never_fades() {
69 let mut fade = ReceiptFade::default();
70 let now = Instant::now();
71 let mut first = receipts(&[("a", Receipt::Read)]);
72 assert!(!fade.apply("chat", true, &mut first, now));
73 assert_eq!(first["a"], Receipt::Read);
74 }
75
76 #[test]
77 fn a_change_while_receipts_load_does_not_fade() {
78 let mut fade = ReceiptFade::default();
79 let now = Instant::now();
80 let mut cached = receipts(&[("a", Receipt::Sent)]);
81 fade.apply("chat", false, &mut cached, now);
82 let mut fetched = receipts(&[("a", Receipt::Read)]);
83 assert!(!fade.apply("chat", true, &mut fetched, now));
84 assert_eq!(fetched["a"], Receipt::Read);
85 }
86
87 #[test]
88 fn a_live_sent_to_read_change_fades_once() {
89 let mut fade = ReceiptFade::default();
90 let now = Instant::now();
91 let mut baseline = receipts(&[("a", Receipt::Sent), ("b", Receipt::Sent)]);
92 fade.apply("chat", true, &mut baseline, now);
93 let mut live = receipts(&[("a", Receipt::Read), ("b", Receipt::Sent)]);
94 assert!(fade.apply("chat", true, &mut live, now));
95 assert_eq!(live["a"], Receipt::ReadLive);
96 assert_eq!(live["b"], Receipt::Sent);
97 let mut later = receipts(&[("a", Receipt::Read), ("b", Receipt::Sent)]);
98 assert!(!fade.apply("chat", true, &mut later, now + RECEIPT_FADE));
99 assert_eq!(later["a"], Receipt::Read);
100 }
101
102 #[test]
103 fn switching_chats_drops_the_baseline() {
104 let mut fade = ReceiptFade::default();
105 let now = Instant::now();
106 let mut first_chat = receipts(&[("a", Receipt::Sent)]);
107 fade.apply("one", true, &mut first_chat, now);
108 let mut other_chat = receipts(&[("a", Receipt::Read)]);
109 assert!(!fade.apply("two", true, &mut other_chat, now));
110 }
111 }
@@ -0,0 +1,111 @@
1use std::collections::HashMap;
2use std::time::{Duration, Instant};
3
4use crate::rows::Receipt;
5
6pub(super) const RECEIPT_FADE: Duration = Duration::from_millis(600);
7
8/// Marks a receipt that turned from sent to read while the chat was open, never one seen on first paint.
9#[derive(Default)]
10pub(super) struct ReceiptFade {
11 conversation_id: String,
12 previous: HashMap<String, Receipt>,
13 fading: HashMap<String, Instant>,
14}
15
16impl ReceiptFade {
17 /// Returns true when a new fade started, so the caller can rebuild once it is over.
18 pub(super) fn apply(
19 &mut self,
20 conversation_id: &str,
21 settled: bool,
22 receipts: &mut HashMap<String, Receipt>,
23 now: Instant,
24 ) -> bool {
25 if self.conversation_id != conversation_id || !settled {
26 self.conversation_id = conversation_id.to_owned();
27 self.previous.clear();
28 self.fading.clear();
29 if !settled {
30 return false;
31 }
32 }
33 let mut started = false;
34 let baseline_known = !self.previous.is_empty();
35 for (message_id, receipt) in receipts.iter() {
36 if baseline_known
37 && *receipt == Receipt::Read
38 && self.previous.get(message_id) == Some(&Receipt::Sent)
39 {
40 self.fading.insert(message_id.clone(), now);
41 started = true;
42 }
43 }
44 self.fading
45 .retain(|_, since| now.duration_since(*since) < RECEIPT_FADE);
46 self.previous.clone_from(receipts);
47 for (message_id, receipt) in receipts.iter_mut() {
48 if *receipt == Receipt::Read && self.fading.contains_key(message_id) {
49 *receipt = Receipt::ReadLive;
50 }
51 }
52 started
53 }
54}
55
56#[cfg(test)]
57mod tests {
58 use super::*;
59
60 fn receipts(entries: &[(&str, Receipt)]) -> HashMap<String, Receipt> {
61 entries
62 .iter()
63 .map(|(id, receipt)| ((*id).to_owned(), *receipt))
64 .collect()
65 }
66
67 #[test]
68 fn the_first_paint_never_fades() {
69 let mut fade = ReceiptFade::default();
70 let now = Instant::now();
71 let mut first = receipts(&[("a", Receipt::Read)]);
72 assert!(!fade.apply("chat", true, &mut first, now));
73 assert_eq!(first["a"], Receipt::Read);
74 }
75
76 #[test]
77 fn a_change_while_receipts_load_does_not_fade() {
78 let mut fade = ReceiptFade::default();
79 let now = Instant::now();
80 let mut cached = receipts(&[("a", Receipt::Sent)]);
81 fade.apply("chat", false, &mut cached, now);
82 let mut fetched = receipts(&[("a", Receipt::Read)]);
83 assert!(!fade.apply("chat", true, &mut fetched, now));
84 assert_eq!(fetched["a"], Receipt::Read);
85 }
86
87 #[test]
88 fn a_live_sent_to_read_change_fades_once() {
89 let mut fade = ReceiptFade::default();
90 let now = Instant::now();
91 let mut baseline = receipts(&[("a", Receipt::Sent), ("b", Receipt::Sent)]);
92 fade.apply("chat", true, &mut baseline, now);
93 let mut live = receipts(&[("a", Receipt::Read), ("b", Receipt::Sent)]);
94 assert!(fade.apply("chat", true, &mut live, now));
95 assert_eq!(live["a"], Receipt::ReadLive);
96 assert_eq!(live["b"], Receipt::Sent);
97 let mut later = receipts(&[("a", Receipt::Read), ("b", Receipt::Sent)]);
98 assert!(!fade.apply("chat", true, &mut later, now + RECEIPT_FADE));
99 assert_eq!(later["a"], Receipt::Read);
100 }
101
102 #[test]
103 fn switching_chats_drops_the_baseline() {
104 let mut fade = ReceiptFade::default();
105 let now = Instant::now();
106 let mut first_chat = receipts(&[("a", Receipt::Sent)]);
107 fade.apply("one", true, &mut first_chat, now);
108 let mut other_chat = receipts(&[("a", Receipt::Read)]);
109 assert!(!fade.apply("two", true, &mut other_chat, now));
110 }
111}
crates/app/src/views/message_row.rs +11 −15
@@ -57,6 +57,7 @@ const SAVED_MARK_SIZE: f32 = 12.;
57 57 const FORWARDED_SIZE: f32 = 11.;
58 58 const FIGURE_SPACE_WIDTH: f32 = 7.4;
59 59 const PULSE_PERIOD: Duration = Duration::from_millis(1600);
60 const RECEIPT_FADE_PERIOD: Duration = Duration::from_millis(600);
60 61 const SKELETON_LINE_HEIGHT: f32 = 20.;
61 62
62 63 pub struct DeliveryActions {
@@ -365,13 +366,16 @@ fn bubble_meta(row: &MessageRow, own: bool, saved: bool) -> Div {
365 366 own && row.delivery == Delivery::Delivered,
366 367 |meta| match row.receipt {
367 368 Receipt::Hidden => meta,
368 Receipt::Pending => meta.child(receipt_slot(tint).relative().top(px(1.))),
369 369 Receipt::Sent => meta.child(on_baseline(symbol("done", META_CHECK_SIZE, tint))),
370 370 Receipt::Read => meta.child(on_baseline(symbol(
371 371 "done_all",
372 372 META_CHECK_SIZE,
373 373 theme::own_read(),
374 374 ))),
375 Receipt::ReadLive => meta.child(receipt_fade_in(
376 &row.key,
377 on_baseline(symbol("done_all", META_CHECK_SIZE, theme::own_read())),
378 )),
375 379 },
376 380 )
377 381 }
@@ -390,20 +394,12 @@ fn pulse<E: IntoElement + Styled + 'static>(id: &'static str, element: E) -> Ani
390 394 )
391 395 }
392 396
393 fn receipt_slot(tint: Hsla) -> Div {
394 h_flex()
395 .size(px(META_CHECK_SIZE))
396 .flex_none()
397 .items_center()
398 .justify_center()
399 .child(pulse(
400 "receipt-slot",
401 div()
402 .w(px(13.))
403 .h(px(4.))
404 .rounded(px(2.))
405 .bg(tint.opacity(0.5)),
406 ))
397 fn receipt_fade_in(message_key: &str, check: Div) -> AnimationElement<Div> {
398 check.with_animation(
399 SharedString::from(format!("receipt-fade/{message_key}")),
400 Animation::new(RECEIPT_FADE_PERIOD).with_easing(ease_in_out),
401 |check, delta| check.opacity(0.25 + 0.75 * delta),
402 )
407 403 }
408 404
409 405 pub fn render_skeleton_row(skeleton: &Skeleton, index: usize) -> AnyElement {
@@ -57,6 +57,7 @@ const SAVED_MARK_SIZE: f32 = 12.;
57const FORWARDED_SIZE: f32 = 11.;
57const FORWARDED_SIZE: f32 = 11.;
58const FIGURE_SPACE_WIDTH: f32 = 7.4;
58const FIGURE_SPACE_WIDTH: f32 = 7.4;
59const PULSE_PERIOD: Duration = Duration::from_millis(1600);
59const PULSE_PERIOD: Duration = Duration::from_millis(1600);
60const RECEIPT_FADE_PERIOD: Duration = Duration::from_millis(600);
60const SKELETON_LINE_HEIGHT: f32 = 20.;
61const SKELETON_LINE_HEIGHT: f32 = 20.;
61
62
62pub struct DeliveryActions {
63pub struct DeliveryActions {
@@ -365,13 +366,16 @@ fn bubble_meta(row: &MessageRow, own: bool, saved: bool) -> Div {
365 own && row.delivery == Delivery::Delivered,
366 own && row.delivery == Delivery::Delivered,
366 |meta| match row.receipt {
367 |meta| match row.receipt {
367 Receipt::Hidden => meta,
368 Receipt::Hidden => meta,
368 Receipt::Pending => meta.child(receipt_slot(tint).relative().top(px(1.))),
369 Receipt::Sent => meta.child(on_baseline(symbol("done", META_CHECK_SIZE, tint))),
369 Receipt::Sent => meta.child(on_baseline(symbol("done", META_CHECK_SIZE, tint))),
370 Receipt::Read => meta.child(on_baseline(symbol(
370 Receipt::Read => meta.child(on_baseline(symbol(
371 "done_all",
371 "done_all",
372 META_CHECK_SIZE,
372 META_CHECK_SIZE,
373 theme::own_read(),
373 theme::own_read(),
374 ))),
374 ))),
375 Receipt::ReadLive => meta.child(receipt_fade_in(
376 &row.key,
377 on_baseline(symbol("done_all", META_CHECK_SIZE, theme::own_read())),
378 )),
375 },
379 },
376 )
380 )
377}
381}
@@ -390,20 +394,12 @@ fn pulse<E: IntoElement + Styled + 'static>(id: &'static str, element: E) -> Ani
390 )
394 )
391}
395}
392
396
393fn receipt_slot(tint: Hsla) -> Div {
397fn receipt_fade_in(message_key: &str, check: Div) -> AnimationElement<Div> {
394 h_flex()
398 check.with_animation(
395 .size(px(META_CHECK_SIZE))
399 SharedString::from(format!("receipt-fade/{message_key}")),
396 .flex_none()
400 Animation::new(RECEIPT_FADE_PERIOD).with_easing(ease_in_out),
397 .items_center()
401 |check, delta| check.opacity(0.25 + 0.75 * delta),
398 .justify_center()
402 )
399 .child(pulse(
400 "receipt-slot",
401 div()
402 .w(px(13.))
403 .h(px(4.))
404 .rounded(px(2.))
405 .bg(tint.opacity(0.5)),
406 ))
407}
403}
408
404
409pub fn render_skeleton_row(skeleton: &Skeleton, index: usize) -> AnyElement {
405pub fn render_skeleton_row(skeleton: &Skeleton, index: usize) -> AnyElement {