-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bf66aab
commit cc0b6fb
Showing
11 changed files
with
226 additions
and
71 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
napoli-pain/src/components/order_details/live_streaming_indicator.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#[derive(PartialEq, Clone)] | ||
pub enum LiveStreamingStatus { | ||
Error(String), | ||
Connecting, | ||
Connected, | ||
} | ||
|
||
#[derive(yew::Properties, PartialEq, Clone)] | ||
pub struct StreamingIndicatorProps { | ||
pub status: LiveStreamingStatus, | ||
} | ||
|
||
#[yew::function_component(StreamingIndicator)] | ||
pub fn streaming_indicator(props: &StreamingIndicatorProps) -> yew::Html { | ||
let (status_symbol, status_message, hover_text) = match &props.status { | ||
LiveStreamingStatus::Error(msg) => { | ||
("🔴", "Live updates inactive", format!("Error: {}", msg)) | ||
} | ||
LiveStreamingStatus::Connecting => ("🟡", "Live updates connecting", String::new()), | ||
LiveStreamingStatus::Connected => ("🟢", "Live updates active", String::new()), | ||
}; | ||
|
||
yew::html!( | ||
<div class="fixed top-4 right-4" title={hover_text}> | ||
{status_message}{" "}{status_symbol} | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
mod add_order_entry_form; | ||
mod live_streaming_indicator; | ||
pub mod order_details; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.