Skip to content

Commit

Permalink
Add "Indexing..." text on main view while load bar for currently runn…
Browse files Browse the repository at this point in the history
…ing command generators is shown
  • Loading branch information
Exidex committed Nov 14, 2024
1 parent ca609d5 commit 8dae5cb
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
9 changes: 9 additions & 0 deletions rust/client/src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1623,12 +1623,19 @@ impl Application for AppModel {
}
};

let toast_text = if !self.loading_bar_state.is_empty() {
Some("Indexing...")
} else {
None
};

let root = match sub_state {
MainViewState::None => {
render_root(
false,
input,
separator,
toast_text,
content,
primary_action,
action_panel,
Expand All @@ -1645,6 +1652,7 @@ impl Application for AppModel {
true,
input,
separator,
toast_text,
content,
primary_action,
action_panel,
Expand All @@ -1661,6 +1669,7 @@ impl Application for AppModel {
true,
input,
separator,
toast_text,
content,
primary_action,
action_panel,
Expand Down
23 changes: 22 additions & 1 deletion rust/client/src/ui/widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2030,6 +2030,7 @@ impl<'b> ComponentWidgets<'b> {
show_action_panel,
top_panel,
top_separator,
None,
content,
primary_action,
action_panel,
Expand All @@ -2046,6 +2047,7 @@ impl<'b> ComponentWidgets<'b> {
show_action_panel,
top_panel,
top_separator,
None,
content,
primary_action,
action_panel,
Expand Down Expand Up @@ -2409,6 +2411,7 @@ pub fn render_root<'a, T: 'a + Clone, ACTION>(
show_action_panel: bool,
top_panel: Element<'a, T>,
top_separator: Element<'a, T>,
toast_text: Option<&str>,
content: Element<'a, T>,
primary_action: Option<(String, UiWidgetId, PhysicalShortcut)>,
action_panel: Option<ActionPanel>,
Expand Down Expand Up @@ -2469,6 +2472,13 @@ pub fn render_root<'a, T: 'a + Clone, ACTION>(

let mut bottom_panel_content = vec![entrypoint_name];

if let Some(toast_text) = toast_text {
let toast_text = text(toast_text)
.into();

bottom_panel_content.push(toast_text);
}

let space = horizontal_space()
.into();

Expand Down Expand Up @@ -2509,7 +2519,18 @@ pub fn render_root<'a, T: 'a + Clone, ACTION>(
let space: Element<_> = Space::new(Length::Fill, panel_height)
.into();

let mut bottom_panel_content = vec![entrypoint_name, space];
let mut bottom_panel_content = vec![];

if let Some(toast_text) = toast_text {
let toast_text = text(toast_text)
.into();

bottom_panel_content.push(toast_text);
} else {
bottom_panel_content.push(entrypoint_name);
}

bottom_panel_content.push(space);

if let Some(primary_action) = primary_action {
bottom_panel_content.push(primary_action);
Expand Down

0 comments on commit 8dae5cb

Please sign in to comment.