From 4663e368a69fb8775863522797f19faa8090fa3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Boduro=C4=9Flu?= <80620802+burakboduroglu@users.noreply.github.com> Date: Sat, 12 Sep 2026 02:08:52 +0300 Subject: [PATCH] feat(contact): add demo request page with server-validated form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Demo düğmesi artık mailto yerine /iletisim sayfasını açıyor. Form gerçek bir
: SolidStart sunucu eylemine POST eder, istemci paketi gelmeden çalışır ve doğrulamayı sunucu yapar; alan bazlı hata forma döner. Teslim tek bir ortam değişkeniyle: CONTACT_WEBHOOK_URL. Değişken yoksa talep sunucu günlüğüne yazılır ve kullanıcıya başarı bildirilir — form altında doğrudan e-posta adresi de durduğu için talep sessizce kaybolmaz. --- src/components/ContactForm.tsx | 141 ++++++++++++++++++++++++ src/config.ts | 12 +- src/i18n/index.ts | 10 +- src/i18n/tr-pages.ts | 196 +++++++++++++++++++++++++++++++++ src/i18n/tr.ts | 3 +- src/lib/contact.ts | 73 ++++++++++++ src/routes/iletisim.tsx | 76 +++++++++++++ 7 files changed, 504 insertions(+), 7 deletions(-) create mode 100644 src/components/ContactForm.tsx create mode 100644 src/i18n/tr-pages.ts create mode 100644 src/lib/contact.ts create mode 100644 src/routes/iletisim.tsx diff --git a/src/components/ContactForm.tsx b/src/components/ContactForm.tsx new file mode 100644 index 0000000..e7f9ca5 --- /dev/null +++ b/src/components/ContactForm.tsx @@ -0,0 +1,141 @@ +import { useSubmission } from "@solidjs/router"; +import { For, Show } from "solid-js"; +import { PixelArrowRight, PixelCheck } from "./icons/pixel"; +import { submitContact } from "~/lib/contact"; +import { mailto, site } from "~/config"; +import { t } from "~/i18n"; + +/** + * The demo request form. + * + * It is a real `` posting to a server action, so it works before the + * client bundle arrives and keeps working if it never does. The submission + * signal only adds what progressive enhancement cannot: a pending label and + * the field-level error the server decided on. + */ +export default function ContactForm() { + const submission = useSubmission(submitContact); + + const f = t.contact.fields; + const errorCode = () => { + const result = submission.result; + return result && !result.ok ? result.code : null; + }; + const errorFor = (field: string) => { + const code = errorCode(); + if (!code) return null; + const result = submission.result; + if (result && !result.ok && result.field !== field) return null; + return t.contact.errors[code as keyof typeof t.contact.errors] ?? t.contact.errors.unknown; + }; + + return ( +
+ + + +

{t.contact.successTitle}

+

{t.contact.successBody}

+ + {site.email} + +
+ } + > + +

{t.contact.formTitle}

+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ {f.interest} +
+ + {option => ( + + )} + +
+
+ +