From a90d9565d11682a1f8e3759fc753c7abaecf1e6b Mon Sep 17 00:00:00 2001 From: patrick Date: Wed, 25 Mar 2026 19:16:56 -0400 Subject: [PATCH] move turnstile sitekey import to main page from component --- src/components/svelte/ContactForm.svelte | 8 +++++++- src/pages/index.astro | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/svelte/ContactForm.svelte b/src/components/svelte/ContactForm.svelte index 0c0f2e8..ead2224 100644 --- a/src/components/svelte/ContactForm.svelte +++ b/src/components/svelte/ContactForm.svelte @@ -5,12 +5,18 @@ import IconCheck from '~icons/lucide/check-circle' import IconAlertCircle from '~icons/lucide/alert-circle' + interface Props { + sitekey: string + } + + let { sitekey }: Props = $props() + let formState = $state<'idle' | 'submitting' | 'success' | 'error'>('idle') let errorMessage = $state('') let turnstileWidgetId: string | null = $state(null) let turnstileContainer: HTMLElement - const TURNSTILE_SITEKEY = import.meta.env.PUBLIC_TURNSTILE_SITEKEY + const TURNSTILE_SITEKEY = sitekey onMount(() => { // Wait for Turnstile script to load diff --git a/src/pages/index.astro b/src/pages/index.astro index d52444e..6d88ded 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -52,6 +52,7 @@ const education: TimelineEntry[] = [ ] const featuredProjects = await getFeaturedProjects() const currentUrl = Astro.url; +const turnstileSitekey = import.meta.env.PUBLIC_TURNSTILE_SITEKEY --- @@ -216,7 +217,7 @@ const currentUrl = Astro.url;
- +