repl: Design tweaks (#14988)

- Add spinner to "Executing..."
- Update Queued label to match others.

Release Notes:

- N/A
This commit is contained in:
Nate Butler 2024-07-22 19:05:36 -04:00 committed by GitHub
parent fe1f55cbfd
commit 4ba430b16c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,8 +1,12 @@
use std::sync::Arc; use std::sync::Arc;
use std::time::Duration;
use crate::stdio::TerminalOutput; use crate::stdio::TerminalOutput;
use anyhow::Result; use anyhow::Result;
use gpui::{img, AnyElement, FontWeight, ImageData, Render, TextRun, View}; use gpui::{
img, percentage, Animation, AnimationExt, AnyElement, FontWeight, ImageData, Render, TextRun,
Transformation, View,
};
use runtimelib::datatable::TableSchema; use runtimelib::datatable::TableSchema;
use runtimelib::media::datatable::TabularDataResource; use runtimelib::media::datatable::TabularDataResource;
use runtimelib::{ExecutionState, JupyterMessageContent, MimeBundle, MimeType}; use runtimelib::{ExecutionState, JupyterMessageContent, MimeBundle, MimeType};
@ -510,8 +514,21 @@ impl Render for ExecutionView {
ExecutionStatus::ConnectingToKernel => Label::new("Connecting to kernel...") ExecutionStatus::ConnectingToKernel => Label::new("Connecting to kernel...")
.color(Color::Muted) .color(Color::Muted)
.into_any_element(), .into_any_element(),
ExecutionStatus::Executing => Label::new("Executing...") ExecutionStatus::Executing => h_flex()
.color(Color::Muted) .gap_2()
.child(
Icon::new(IconName::ArrowCircle)
.size(IconSize::Small)
.color(Color::Muted)
.with_animation(
"arrow-circle",
Animation::new(Duration::from_secs(3)).repeat(),
|icon, delta| {
icon.transform(Transformation::rotate(percentage(delta)))
},
),
)
.child(Label::new("Executing...").color(Color::Muted))
.into_any_element(), .into_any_element(),
ExecutionStatus::Finished => Icon::new(IconName::Check) ExecutionStatus::Finished => Icon::new(IconName::Check)
.size(IconSize::Small) .size(IconSize::Small)
@ -525,9 +542,9 @@ impl Render for ExecutionView {
ExecutionStatus::Shutdown => Label::new("Kernel shutdown") ExecutionStatus::Shutdown => Label::new("Kernel shutdown")
.color(Color::Muted) .color(Color::Muted)
.into_any_element(), .into_any_element(),
ExecutionStatus::Queued => { ExecutionStatus::Queued => Label::new("Queued...")
Label::new("Queued").color(Color::Muted).into_any_element() .color(Color::Muted)
} .into_any_element(),
ExecutionStatus::KernelErrored(error) => { ExecutionStatus::KernelErrored(error) => {
Label::new(format!("Kernel error: {}", error)) Label::new(format!("Kernel error: {}", error))
.color(Color::Error) .color(Color::Error)