From 3b9ff3b6a8afc3c3848ec76bb9ff7310ed3aa04f Mon Sep 17 00:00:00 2001 From: StarFleetCPTN Date: Sat, 8 Mar 2025 23:03:41 -0800 Subject: [PATCH] chore: Refine config form and UI components - Add x-init hook to set default form values in config form - Adjust scrollbar hover color in layout - Create marker files for providers, source, and destination packages - Remove unnecessary error styling in local source form --- components/config_form.templ | 8 +++++++- components/layout.templ | 2 +- components/providers/destination/destination.go | 3 +++ components/providers/providers.go | 3 +++ components/providers/source/local.templ | 1 - components/providers/source/source.go | 3 +++ 6 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 components/providers/destination/destination.go create mode 100644 components/providers/providers.go create mode 100644 components/providers/source/source.go diff --git a/components/config_form.templ b/components/config_form.templ index 4eb9632..72b90a3 100644 --- a/components/config_form.templ +++ b/components/config_form.templ @@ -223,7 +223,13 @@ templ ConfigForm(ctx context.Context, data ConfigFormData) { hx-redirect="/configs" hx-boost="true" x-data={ getInitialData(data.Config) } - @submit.prevent="if (validateForm()) { loading = true; $el.submit(); } else { loading = false; }" + x-init="$nextTick(() => { + // Ensure initial form state displays correctly on load + sourceType = sourceType || 'local'; + destinationType = destinationType || 'local'; + sourcePort = sourcePort || 22; + destPort = destPort || 22; + })" > diff --git a/components/layout.templ b/components/layout.templ index 6ad74bb..395a3f1 100644 --- a/components/layout.templ +++ b/components/layout.templ @@ -269,7 +269,7 @@ templ LayoutWithContext(title string, ctx context.Context) { background: theme('colors.secondary.600'); } ::-webkit-scrollbar-thumb:hover { - background: theme('colors.secondary.400'); + background: theme('colors.secondary.500'); } .dark ::-webkit-scrollbar-thumb:hover { background: theme('colors.secondary.500'); diff --git a/components/providers/destination/destination.go b/components/providers/destination/destination.go new file mode 100644 index 0000000..e84df9b --- /dev/null +++ b/components/providers/destination/destination.go @@ -0,0 +1,3 @@ +// Package destination contains the UI destination forms for the GoMFT application. +// This file serves as a marker for the destination package to ensure it's properly recognized by Go. +package destination diff --git a/components/providers/providers.go b/components/providers/providers.go new file mode 100644 index 0000000..bb77876 --- /dev/null +++ b/components/providers/providers.go @@ -0,0 +1,3 @@ +// Package providers contains the UI providers for the GoMFT application. +// This file serves as a marker for the providers package to ensure it's properly recognized by Go. +package providers diff --git a/components/providers/source/local.templ b/components/providers/source/local.templ index 0dcffc5..f61fc73 100644 --- a/components/providers/source/local.templ +++ b/components/providers/source/local.templ @@ -14,7 +14,6 @@ templ LocalSourceForm() { id="source_path" x-model="sourcePath" required - x-bind:class="{'border-red-500 focus:border-red-500 focus:ring-red-500': errors.sourcePath}" class="form-input pl-10 w-full rounded-lg border-secondary-300 dark:border-secondary-700 dark:bg-secondary-800 dark:text-secondary-100 focus:ring-primary-500 focus:border-primary-500" placeholder="/path/to/source"/> diff --git a/components/providers/source/source.go b/components/providers/source/source.go new file mode 100644 index 0000000..5d10428 --- /dev/null +++ b/components/providers/source/source.go @@ -0,0 +1,3 @@ +// Package source contains the UI source forms for the GoMFT application. +// This file serves as a marker for the source package to ensure it's properly recognized by Go. +package source