update ui
This commit is contained in:
@@ -10,6 +10,7 @@ log.workspace = true
|
||||
gpui.workspace = true
|
||||
gpui-kit = { workspace = true, features = ["speech"] }
|
||||
flume.workspace = true
|
||||
instant.workspace = true
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
common = { path = "../common" }
|
||||
|
||||
@@ -5,8 +5,35 @@ mod parakeet;
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
mod web;
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
use gpui::{
|
||||
Animation, AnimationExt as _, AnyElement, App, IntoElement as _, ParentElement as _,
|
||||
Styled as _, div,
|
||||
};
|
||||
use gpui_kit::component::ActiveTheme as _;
|
||||
use gpui_kit::component::speech::SpeechRecognizer;
|
||||
|
||||
/// A ticking `M:SS` counter for the dictation in progress.
|
||||
pub fn elapsed(started: instant::Instant, cx: &App) -> AnyElement {
|
||||
div()
|
||||
.text_xs()
|
||||
.text_color(cx.theme().muted_foreground)
|
||||
.with_animation(
|
||||
"dictation-elapsed",
|
||||
Animation::new(Duration::from_secs(1))
|
||||
.repeat()
|
||||
.with_max_fps(1.),
|
||||
move |counter, _| counter.child(format_elapsed(started)),
|
||||
)
|
||||
.into_any_element()
|
||||
}
|
||||
|
||||
fn format_elapsed(started: instant::Instant) -> String {
|
||||
let seconds = started.elapsed().as_secs();
|
||||
format!("{}:{:02}", seconds / 60, seconds % 60)
|
||||
}
|
||||
|
||||
/// The recognizer backing the composer's microphone button.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub fn recognizer() -> impl SpeechRecognizer {
|
||||
|
||||
Reference in New Issue
Block a user