diff --git a/app/components/Feedback.vue b/app/components/Feedback.vue index 422d6ce90..7a4dcb7ad 100644 --- a/app/components/Feedback.vue +++ b/app/components/Feedback.vue @@ -1,5 +1,6 @@ @@ -53,35 +39,26 @@ const state = computed(() => props.open ? 'close' : 'normal') stroke-linecap="round" stroke-linejoin="round" > - - - diff --git a/app/components/module/ModuleItem.vue b/app/components/module/ModuleItem.vue index cbcbd09c5..3d9dabde0 100644 --- a/app/components/module/ModuleItem.vue +++ b/app/components/module/ModuleItem.vue @@ -156,7 +156,7 @@ const items = computed(() => [ [ /> -import * as v from 'valibot' -import type { FormSubmitEvent } from '#ui/types' +import type { FormError, FormSubmitEvent } from '#ui/types' const { label = 'Subscribe to our newsletter', @@ -17,17 +16,16 @@ const { track } = useAnalytics() const loading = ref(false) -const schema = v.object({ - email: v.pipe(v.string(), v.email('Please enter a valid email')) -}) - -type Schema = v.InferOutput - const state = reactive({ email: '' }) -async function onSubmit(event: FormSubmitEvent) { +// The server validates the address too; this only catches typos before the request. +function validate(data: Partial): FormError[] { + return /^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/.test(data.email ?? '') ? [] : [{ name: 'email', message: 'Please enter a valid email' }] +} + +async function onSubmit(event: FormSubmitEvent) { loading.value = true await $fetch('/api/newsletter/subscribe', { @@ -49,7 +47,7 @@ async function onSubmit(event: FormSubmitEvent) { - + diff --git a/layers/nuxi/app/components/agent/AgentChatButton.vue b/layers/nuxi/app/components/agent/AgentChatButton.vue index 74fad1ff0..f912a2dd2 100644 --- a/layers/nuxi/app/components/agent/AgentChatButton.vue +++ b/layers/nuxi/app/components/agent/AgentChatButton.vue @@ -1,6 +1,4 @@ - - + - - + + diff --git a/layers/nuxi/app/components/agent/AgentChatSwitcher.vue b/layers/nuxi/app/components/agent/AgentChatSwitcher.vue index 5f605b590..d1abc8fca 100644 --- a/layers/nuxi/app/components/agent/AgentChatSwitcher.vue +++ b/layers/nuxi/app/components/agent/AgentChatSwitcher.vue @@ -1,6 +1,4 @@ - - + @@ -99,6 +98,6 @@ function onEscape() { - - + + diff --git a/layers/nuxi/app/components/agent/AgentPanel.vue b/layers/nuxi/app/components/agent/AgentPanel.vue index 04719c4b3..da6e5ac62 100644 --- a/layers/nuxi/app/components/agent/AgentPanel.vue +++ b/layers/nuxi/app/components/agent/AgentPanel.vue @@ -1,6 +1,5 @@