From e3e495000f26db0dfc41594d829440c5272e1aa6 Mon Sep 17 00:00:00 2001 From: Gabriel Viganotti Date: Thu, 28 Nov 2024 22:31:35 -0300 Subject: [PATCH] feat: split settings panel content into tabs --- src/settings.rs | 349 +++++++++++++++++++++++++-------------------- style/tailwind.css | 10 +- 2 files changed, 207 insertions(+), 152 deletions(-) diff --git a/src/settings.rs b/src/settings.rs index 50aa9c1..fa0e671 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -16,6 +16,7 @@ pub fn SettingsView(settings_panel: RwSignal) -> impl IntoView { move || settings_panel.get() == true, |_| async move { get_settings().await.unwrap_or_default() }, ); + let active_tab = create_rw_signal(0); view! {
) -> impl IntoView { >
-
+

Settings

@@ -46,8 +47,43 @@ pub fn SettingsView(settings_panel: RwSignal) -> impl IntoView {
+ +
- +
@@ -59,6 +95,7 @@ pub fn SettingsView(settings_panel: RwSignal) -> impl IntoView { pub fn SettingsForm( current_values: Resource, settings_panel: RwSignal, + active_tab: RwSignal, ) -> impl IntoView { let auto_upgrade = create_rw_signal(false); let auto_upgrade_delay = create_rw_signal(Ok(0)); @@ -85,163 +122,173 @@ pub fn SettingsForm( view! { "Loading..."

}> -
-
- + +
+ + +
+ + + + + ().map_err(|err| err.to_string()).map(|_| v) } + /> + ().map_err(|err| err.to_string()).map(|_| v) } - id="auto_upgrade" - type="checkbox" - on:change=move |ev| { auto_upgrade.set(event_target_checked(&ev)) } - class="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600" /> - -
- - - - - ().map_err(|err| err.to_string()).map(|_| v) } - /> - ().map_err(|err| err.to_string()).map(|_| v) } - /> + + -
- +
+
+ + +
+ ().map_err(|err| err.to_string()).map(|_| v) } + /> + - -
- ().map_err(|err| err.to_string()).map(|_| v) } - /> - - - + } + class="text-white bg-gray-800 hover:bg-gray-900 focus:outline-none focus:ring-4 focus:ring-gray-300 font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 dark:bg-gray-800 dark:hover:bg-gray-700 dark:focus:ring-gray-700 dark:border-gray-700" + > + Save + -
} } diff --git a/style/tailwind.css b/style/tailwind.css index 8a904d1..08a3ecb 100644 --- a/style/tailwind.css +++ b/style/tailwind.css @@ -16,4 +16,12 @@ .node-info-item { @apply text-blue-700 dark:text-blue-400 -} \ No newline at end of file +} + +.settings-tab { + @apply inline-block p-4 border-b-2 border-transparent rounded-t-lg hover:text-gray-600 hover:border-gray-300 dark:hover:text-gray-300 +} + +.settings-active-tab { + @apply inline-block p-4 text-blue-600 border-b-2 border-blue-600 rounded-t-lg active dark:text-blue-500 dark:border-blue-500 +}