csi_webclient/ui/
stream.rs1use crate::state::AppState;
2
3pub fn render(ui: &mut egui::Ui, state: &mut AppState) {
5 ui.heading("Stream");
6 ui.separator();
7
8 ui.horizontal(|ui| {
9 ui.checkbox(&mut state.transient.auto_scroll_stream, "Auto-scroll");
10 ui.label(format!("Frames: {}", state.runtime.frames_received));
11 ui.label(format!("Bytes: {}", state.runtime.bytes_received));
12 });
13
14 ui.separator();
15
16 egui::ScrollArea::vertical()
17 .stick_to_bottom(state.transient.auto_scroll_stream)
18 .show(ui, |ui| {
19 egui::Grid::new("stream_frames_grid")
20 .num_columns(3)
21 .striped(true)
22 .show(ui, |ui| {
23 ui.strong("Time");
24 ui.strong("Length");
25 ui.strong("Preview (hex)");
26 ui.end_row();
27
28 for frame in state.runtime.recent_frames.iter().rev().take(250) {
29 ui.label(&frame.timestamp);
30 ui.label(frame.length.to_string());
31 ui.monospace(&frame.preview_hex);
32 ui.end_row();
33 }
34 });
35 });
36}