diff --git a/frontend/scss/app/components/_icon_button.scss b/frontend/scss/app/components/_icon_button.scss index 295afea60..7e1de3f33 100644 --- a/frontend/scss/app/components/_icon_button.scss +++ b/frontend/scss/app/components/_icon_button.scss @@ -17,4 +17,8 @@ fill: var(--icon-button-hover-color); outline: none; } + + .svg-icon { + pointer-events: none; + } } \ No newline at end of file diff --git a/frontend/src/app/components/api_user/api_user_view.rs b/frontend/src/app/components/api_user/api_user_view.rs index 0d76a9866..6b32000fd 100644 --- a/frontend/src/app/components/api_user/api_user_view.rs +++ b/frontend/src/app/components/api_user/api_user_view.rs @@ -1,6 +1,6 @@ use yew::{function_component, html, Callback, Html}; use crate::app::components::loading_indicator::BusyIndicator; -use crate::app::components::{IconButton, ToastrView}; +use crate::app::components::{AppIcon, IconButton, ToastrView}; use crate::hooks::use_service_context; use crate::provider::DialogProvider; @@ -24,9 +24,9 @@ pub fn ApiUserView() -> Html {
{ if let Some(ref title) = services.config.ui_config.app_title { - html! { title.as_str() } + html! { { title } } } else { - html! { /* */ } + html! { } } }
diff --git a/frontend/src/app/components/home.rs b/frontend/src/app/components/home.rs index 632e23200..d262824fd 100644 --- a/frontend/src/app/components/home.rs +++ b/frontend/src/app/components/home.rs @@ -1,4 +1,4 @@ -use crate::app::components::{DashboardView, IconButton, InputRow, Panel, PlaylistEditorView, PlaylistExplorerView, PlaylistUpdateView, Sidebar, StatsView, ToastrView, UserlistView}; +use crate::app::components::{AppIcon, DashboardView, IconButton, InputRow, Panel, PlaylistEditorView, PlaylistExplorerView, PlaylistUpdateView, Sidebar, StatsView, ToastrView, UserlistView}; use crate::app::context::{ConfigContext, PlaylistContext, StatusContext}; use crate::hooks::{use_server_status, use_service_context}; use crate::model::{EventMessage, ViewType}; @@ -141,9 +141,9 @@ pub fn Home() -> Html {
{ if let Some(ref title) = services.config.ui_config.app_title { - html! { title.as_str() } + html! { { title } } } else { - html! { /* */ } + html! { } } }
diff --git a/frontend/src/app/components/input.rs b/frontend/src/app/components/input.rs index 558ba56dc..f86ca0513 100644 --- a/frontend/src/app/components/input.rs +++ b/frontend/src/app/components/input.rs @@ -1,5 +1,5 @@ use web_sys::{HtmlInputElement, InputEvent, KeyboardEvent, MouseEvent}; -use yew::{function_component, html, use_effect_with, use_node_ref, use_state, Callback, Html, NodeRef, Properties, TargetCast}; +use yew::{function_component, html, use_effect_with, use_state, Callback, Html, NodeRef, Properties, TargetCast}; use crate::app::components::IconButton; use crate::html_if; @@ -25,7 +25,6 @@ pub struct InputProps { #[function_component] pub fn Input(props: &InputProps) -> Html { - let icon_btn_ref = use_node_ref(); let hide_content = use_state(|| props.hidden); let local_ref = props.input_ref.clone().unwrap_or_default(); @@ -41,14 +40,9 @@ pub fn Input(props: &InputProps) -> Html { let handle_hide_content = { let hide_content = hide_content.clone(); - let button_ref = icon_btn_ref.clone(); - Callback::from(move |(_, event): (String, MouseEvent)| { - if let Some(target) = event.target_dyn_into::() { - if let Some(button) = button_ref.cast::() { - if button == target { - hide_content.set(!*hide_content); - } - } + Callback::from(move |(name, event): (String, MouseEvent)| { + if name == "hide" { + hide_content.set(!*hide_content); } }) }; @@ -83,7 +77,7 @@ pub fn Input(props: &InputProps) -> Html { oninput={handle_oninput} /> { html_if!(props.hidden, { - + })} diff --git a/frontend/src/app/components/role_based_content.rs b/frontend/src/app/components/role_based_content.rs index 2a3d85d08..31f1598fc 100644 --- a/frontend/src/app/components/role_based_content.rs +++ b/frontend/src/app/components/role_based_content.rs @@ -8,6 +8,10 @@ use crate::hooks::use_service_context; pub fn RoleBasedContent() -> Html { let services = use_service_context(); + if !services.auth.is_authenticated() { + return html! { "Not authorized" }; + } + if services.auth.is_admin() { html! { render={switch} /> } } else if services.auth.is_user() { diff --git a/shared/src/utils/string_utils.rs b/shared/src/utils/string_utils.rs index 0ab84be5d..80e9e5d91 100644 --- a/shared/src/utils/string_utils.rs +++ b/shared/src/utils/string_utils.rs @@ -30,7 +30,7 @@ pub fn get_trimmed_string(value: &Option) -> Option { } pub fn generate_random_string(length: usize) -> String { - let mut rng = fastrand::Rng::with_seed(Utc::now().timestamp() as u64); + let mut rng = fastrand::Rng::new(); let random_string: String = (0..length).map(|_| rng.alphanumeric()).collect(); random_string }