use gpui_kit::component::{h_flex, v_flex}; use gpui_kit::prelude::FluentBuilder as _; use gpui_kit::*; use super::avatar::person_avatar; use super::message_row::{AVATAR_GAP, AVATAR_SIZE, RowAction, day_separator, new_marker}; use super::profile_card::opens_profile; use super::widgets::symbol; use crate::data::Directory; use crate::rows::{CallCard, CallIcon, CallParticipant, MessageRow, RecordingCard}; use crate::theme; const SERIES_START_GAP: f32 = 8.; const CARD_RADIUS: f32 = 12.; const CARD_MIN_WIDTH: f32 = 200.; const ICON_CIRCLE: f32 = 30.; const ICON_SIZE: f32 = 18.; const TITLE_SIZE: f32 = 13.; const DETAIL_SIZE: f32 = 11.; const JOIN_HEIGHT: f32 = 24.; const PARTICIPANT_AVATAR: f32 = 20.; const PARTICIPANT_GAP: f32 = 2.; const TILE_WIDTH: f32 = 288.; const TILE_HEIGHT: f32 = 162.; const TILE_RADIUS: f32 = 8.; const PLAY_CIRCLE: f32 = 40.; const PLAY_GLYPH: f32 = 24.; const DURATION_INSET: f32 = 6.; const CHIP_HEIGHT: f32 = 26.; pub struct CallActions { pub call_back: RowAction, pub join: RowAction, pub open_recording: RowAction, pub open_transcript: RowAction, } impl CallActions { pub fn none() -> Self { CallActions { call_back: None, join: None, open_recording: None, open_transcript: None, } } } fn icon_circle(call: &CallCard, own: bool) -> Div { let (fill, glyph, tint) = match call.icon { CallIcon::Missed => (theme::red().opacity(0.2), "call_missed", theme::red_soft()), CallIcon::Call => (circle_fill(own), "call", theme::text()), CallIcon::Video => (circle_fill(own), "videocam", theme::text()), CallIcon::Record => ( circle_fill(own), "radio_button_checked", theme::accent_text(), ), CallIcon::RecordStop => (circle_fill(own), "stop_circle", theme::text()), }; h_flex() .size(px(ICON_CIRCLE)) .flex_none() .items_center() .justify_center() .rounded_full() .bg(fill) .child(symbol(glyph, ICON_SIZE, tint)) } fn circle_fill(own: bool) -> Hsla { if own { theme::reaction_on_own() } else { theme::popup() } } fn detail_line(call: &CallCard, index: usize, own: bool, call_back: RowAction) -> Div { let tint = if own { theme::own_meta() } else { theme::text_muted() }; h_flex() .gap(px(4.)) .items_center() .text_size(px(DETAIL_SIZE)) .text_color(tint) .child(call.detail.clone()) .when(call.missed, |line| { line.child("\u{b7}").child( div() .id(ElementId::Name(format!("call-back-{index}").into())) .cursor_pointer() .text_color(theme::accent_text()) .child("Call back") .when_some(call_back, |link, call_back| { link.on_click(move |_, _, cx| call_back(cx)) }), ) }) } fn join_button(index: usize, join: RowAction) -> Stateful