Add demo request page with server-validated form
Browse files at this commit4663e368a69fb8775863522797f19faa8090fa3eParent: 9274e88- feat
- add demo request page with server-validated form
7 changed files +504 -7
- src/components/ContactForm.tsx +141 -0
- src/config.ts +10 -2
- src/i18n/index.ts +6 -4
- src/i18n/tr-pages.ts +196 -0
- src/i18n/tr.ts +2 -1
- src/lib/contact.ts +73 -0
- src/routes/iletisim.tsx +76 -0
src/components/ContactForm.tsxadded+141 -0
| @@ -0,0 +1,141 @@ | |||
| 1 | +import { useSubmission } from "@solidjs/router"; | ||
| 2 | +import { For, Show } from "solid-js"; | ||
| 3 | +import { PixelArrowRight, PixelCheck } from "./icons/pixel"; | ||
| 4 | +import { submitContact } from "~/lib/contact"; | ||
| 5 | +import { mailto, site } from "~/config"; | ||
| 6 | +import { t } from "~/i18n"; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * The demo request form. | ||
| 10 | + * | ||
| 11 | + * It is a real `<form>` posting to a server action, so it works before the | ||
| 12 | + * client bundle arrives and keeps working if it never does. The submission | ||
| 13 | + * signal only adds what progressive enhancement cannot: a pending label and | ||
| 14 | + * the field-level error the server decided on. | ||
| 15 | + */ | ||
| 16 | +export default function ContactForm() { | ||
| 17 | + const submission = useSubmission(submitContact); | ||
| 18 | + | ||
| 19 | + const f = t.contact.fields; | ||
| 20 | + const errorCode = () => { | ||
| 21 | + const result = submission.result; | ||
| 22 | + return result && !result.ok ? result.code : null; | ||
| 23 | + }; | ||
| 24 | + const errorFor = (field: string) => { | ||
| 25 | + const code = errorCode(); | ||
| 26 | + if (!code) return null; | ||
| 27 | + const result = submission.result; | ||
| 28 | + if (result && !result.ok && result.field !== field) return null; | ||
| 29 | + return t.contact.errors[code as keyof typeof t.contact.errors] ?? t.contact.errors.unknown; | ||
| 30 | + }; | ||
| 31 | + | ||
| 32 | + return ( | ||
| 33 | + <div class="hz-form-card"> | ||
| 34 | + <Show | ||
| 35 | + when={!submission.result?.ok} | ||
| 36 | + fallback={ | ||
| 37 | + <div class="hz-form-done"> | ||
| 38 | + <span class="hz-card-icon"> | ||
| 39 | + <PixelCheck aria-hidden="true" /> | ||
| 40 | + </span> | ||
| 41 | + <h2 class="hz-h3">{t.contact.successTitle}</h2> | ||
| 42 | + <p class="hz-small">{t.contact.successBody}</p> | ||
| 43 | + <a class="hz-btn hz-btn-ghost" href={mailto(t.cta.subject)}> | ||
| 44 | + {site.email} | ||
| 45 | + </a> | ||
| 46 | + </div> | ||
| 47 | + } | ||
| 48 | + > | ||
| 49 | + <form action={submitContact} method="post" class="hz-form"> | ||
| 50 | + <h2 class="hz-h3">{t.contact.formTitle}</h2> | ||
| 51 | + | ||
| 52 | + <div class="hz-field-row"> | ||
| 53 | + <label class="hz-field"> | ||
| 54 | + <span> | ||
| 55 | + {f.name} <i>{f.required}</i> | ||
| 56 | + </span> | ||
| 57 | + <input name="name" required autocomplete="name" /> | ||
| 58 | + </label> | ||
| 59 | + <label class="hz-field"> | ||
| 60 | + <span> | ||
| 61 | + {f.institution} <i>{f.required}</i> | ||
| 62 | + </span> | ||
| 63 | + <input name="institution" required autocomplete="organization" /> | ||
| 64 | + </label> | ||
| 65 | + </div> | ||
| 66 | + | ||
| 67 | + <div class="hz-field-row"> | ||
| 68 | + <label class="hz-field"> | ||
| 69 | + <span>{f.role}</span> | ||
| 70 | + <input name="role" placeholder={f.rolePlaceholder} autocomplete="organization-title" /> | ||
| 71 | + </label> | ||
| 72 | + <label class="hz-field"> | ||
| 73 | + <span> | ||
| 74 | + {f.email} <i>{f.required}</i> | ||
| 75 | + </span> | ||
| 76 | + <input name="email" type="email" required autocomplete="email" /> | ||
| 77 | + </label> | ||
| 78 | + </div> | ||
| 79 | + | ||
| 80 | + <div class="hz-field-row"> | ||
| 81 | + <label class="hz-field"> | ||
| 82 | + <span> | ||
| 83 | + {f.phone} <i>{f.phoneHint}</i> | ||
| 84 | + </span> | ||
| 85 | + <input name="phone" type="tel" autocomplete="tel" /> | ||
| 86 | + </label> | ||
| 87 | + <label class="hz-field"> | ||
| 88 | + <span>{f.students}</span> | ||
| 89 | + <select name="students"> | ||
| 90 | + <For each={f.studentsOptions}>{option => <option value={option}>{option}</option>}</For> | ||
| 91 | + </select> | ||
| 92 | + </label> | ||
| 93 | + </div> | ||
| 94 | + | ||
| 95 | + <fieldset class="hz-field"> | ||
| 96 | + <legend>{f.interest}</legend> | ||
| 97 | + <div class="hz-choices"> | ||
| 98 | + <For each={f.interestOptions}> | ||
| 99 | + {option => ( | ||
| 100 | + <label class="hz-choice"> | ||
| 101 | + <input type="checkbox" name="interest" value={option} /> | ||
| 102 | + <span>{option}</span> | ||
| 103 | + </label> | ||
| 104 | + )} | ||
| 105 | + </For> | ||
| 106 | + </div> | ||
| 107 | + </fieldset> | ||
| 108 | + | ||
| 109 | + <label class="hz-field"> | ||
| 110 | + <span>{f.message}</span> | ||
| 111 | + <textarea name="message" rows={4} placeholder={f.messagePlaceholder} /> | ||
| 112 | + </label> | ||
| 113 | + | ||
| 114 | + <label class="hz-consent"> | ||
| 115 | + <input type="checkbox" name="consent" value="1" required /> | ||
| 116 | + <span>{f.consent}</span> | ||
| 117 | + </label> | ||
| 118 | + | ||
| 119 | + <Show when={errorCode()}> | ||
| 120 | + <p class="hz-form-error" role="alert"> | ||
| 121 | + {errorFor("name") ?? | ||
| 122 | + errorFor("institution") ?? | ||
| 123 | + errorFor("email") ?? | ||
| 124 | + errorFor("consent") ?? | ||
| 125 | + t.contact.errors.unknown} | ||
| 126 | + </p> | ||
| 127 | + </Show> | ||
| 128 | + | ||
| 129 | + <button type="submit" class="hz-btn hz-btn-primary hz-btn-lg" disabled={submission.pending}> | ||
| 130 | + {submission.pending ? t.contact.submitting : t.contact.submit} | ||
| 131 | + <Show when={!submission.pending}> | ||
| 132 | + <PixelArrowRight aria-hidden="true" /> | ||
| 133 | + </Show> | ||
| 134 | + </button> | ||
| 135 | + | ||
| 136 | + <p class="hz-form-note">{t.contact.kvkk}</p> | ||
| 137 | + </form> | ||
| 138 | + </Show> | ||
| 139 | + </div> | ||
| 140 | + ); | ||
| 141 | +} | ||
src/config.tsmodified+10 -2
| @@ -31,9 +31,15 @@ export const site = { | |||
| 31 | }, | 31 | }, |
| 32 | } as const; | 32 | } as const; |
| 33 | 33 | ||
| 34 | -/** The standing pages. The landing page is the site; the rest are utilities. */ | 34 | +/** |
| 35 | + * The standing pages. The landing page carries the argument; the other two | ||
| 36 | + * are the places it sends people — the form that starts a demo, and the | ||
| 37 | + * diagram that answers "how does this actually work?" in full. | ||
| 38 | + */ | ||
| 35 | export const routes = { | 39 | export const routes = { |
| 36 | home: "/", | 40 | home: "/", |
| 41 | + contact: "/iletisim", | ||
| 42 | + how: "/nasil-calisir", | ||
| 37 | } as const; | 43 | } as const; |
| 38 | 44 | ||
| 39 | /** | 45 | /** |
| @@ -45,7 +51,7 @@ export const anchors = { | |||
| 45 | problem: "/#neden", | 51 | problem: "/#neden", |
| 46 | products: "/#urunler", | 52 | products: "/#urunler", |
| 47 | platform: "/#moduller", | 53 | platform: "/#moduller", |
| 48 | - theory: "/#nasil-calisir", | 54 | + theory: "/#akis", |
| 49 | roles: "/#roller", | 55 | roles: "/#roller", |
| 50 | trust: "/#guven", | 56 | trust: "/#guven", |
| 51 | audience: "/#kimler-icin", | 57 | audience: "/#kimler-icin", |
| @@ -66,4 +72,6 @@ export const mailto = (subject: string) => | |||
| 66 | */ | 72 | */ |
| 67 | export const pageUpdated: Record<keyof typeof routes, string> = { | 73 | export const pageUpdated: Record<keyof typeof routes, string> = { |
| 68 | home: "2026-09-12", | 74 | home: "2026-09-12", |
| 75 | + contact: "2026-09-12", | ||
| 76 | + how: "2026-09-12", | ||
| 69 | }; | 77 | }; |
src/i18n/index.tsmodified+6 -4
| @@ -1,14 +1,16 @@ | |||
| 1 | import { tr } from "./tr"; | 1 | import { tr } from "./tr"; |
| 2 | +import { trPages } from "./tr-pages"; | ||
| 2 | 3 | ||
| 3 | /** | 4 | /** |
| 4 | - * Every string on the site, in one place. The site is Turkish only, so this | 5 | + * Every string on the site, in one object. The site is Turkish only, so this |
| 5 | * is a plain module rather than a provider: there is no locale to resolve, no | 6 | * is a plain module rather than a provider: there is no locale to resolve, no |
| 6 | * cookie to read and nothing to re-render when it changes. Components import | 7 | * cookie to read and nothing to re-render when it changes. Components import |
| 7 | * `t` and read it like the object it is. | 8 | * `t` and read it like the object it is. |
| 8 | * | 9 | * |
| 9 | * The copy still lives apart from the components that render it, because that | 10 | * The copy still lives apart from the components that render it, because that |
| 10 | - * is what makes it possible to read the whole site's voice in one file. | 11 | + * is what makes it possible to read the whole site's voice in two files: the |
| 12 | + * landing page in `tr.ts`, the two standing pages in `tr-pages.ts`. | ||
| 11 | */ | 13 | */ |
| 12 | -export const t = tr; | 14 | +export const t = { ...tr, ...trPages }; |
| 13 | 15 | ||
| 14 | -export type Dictionary = typeof tr; | 16 | +export type Dictionary = typeof t; |
src/i18n/tr-pages.tsadded+196 -0
| @@ -0,0 +1,196 @@ | |||
| 1 | +/** | ||
| 2 | + * Copy for the two standing pages: the diagram behind "nasıl çalıştığını gör" | ||
| 3 | + * and the form behind "demo talep et". | ||
| 4 | + * | ||
| 5 | + * It lives beside `tr.ts` rather than inside it so the landing page's copy | ||
| 6 | + * stays readable in one pass; `i18n/index.ts` merges the two into the single | ||
| 7 | + * `t` every component reads. | ||
| 8 | + */ | ||
| 9 | +export const trPages = { | ||
| 10 | + /** `/nasil-calisir` — the whole chain, drawn and annotated. */ | ||
| 11 | + how: { | ||
| 12 | + metaTitle: "Nasıl çalışır — Hezarfen", | ||
| 13 | + metaDescription: | ||
| 14 | + "Sınav verisinden öğretmen onaylı kişisel çalışma planına: Hezarfen'in veri modeli, analiz hattı, onay kapıları ve rol bazlı çıktılarının şeması.", | ||
| 15 | + label: "Şema", | ||
| 16 | + title: "Bir sınav kâğıdı, otuz ayrı çalışma planına nasıl dönüşür", | ||
| 17 | + lead: "Aşağıdaki dört adım ürünün tamamıdır: veri toplanır, analiz kanıta bağlanır, öğretmen onaylar, herkes kendi ekranında görür. Yeni sınav geldiğinde zincir baştan işler ve plan kendini günceller.", | ||
| 18 | + ctaPrimary: "Demo talep et", | ||
| 19 | + ctaSecondary: "Ürünlere dön", | ||
| 20 | + | ||
| 21 | + /** The animated pipeline. Four stages, then the loop back to analysis. */ | ||
| 22 | + flowLabel: "Veri akışı", | ||
| 23 | + flowNote: "Yeni sınav, ödev ya da çalışma kaydı geldiğinde akış baştan işler; plan eski hâliyle kalmaz.", | ||
| 24 | + stages: [ | ||
| 25 | + { | ||
| 26 | + id: "toplama", | ||
| 27 | + num: "01", | ||
| 28 | + title: "Toplama", | ||
| 29 | + subtitle: "Sınav · ödev · yoklama · çalışma süresi", | ||
| 30 | + description: | ||
| 31 | + "Kurumun günlük işi platformda yürüdüğü için veri ayrıca girilmez. Sınav tanımlanırken her soru konu ve kazanım etiketini alır; optik ya da elle girilen cevaplar öğrenci, soru ve seçenek düzeyinde saklanır.", | ||
| 32 | + bullets: [ | ||
| 33 | + "Her soru bir konu ve kazanım koduna bağlı", | ||
| 34 | + "Her cevap hangi seçeneğin işaretlendiğini tutar", | ||
| 35 | + "Ödev, yoklama ve çalışma süresi aynı öğrenci kaydında", | ||
| 36 | + ], | ||
| 37 | + }, | ||
| 38 | + { | ||
| 39 | + id: "analiz", | ||
| 40 | + num: "02", | ||
| 41 | + title: "Analiz", | ||
| 42 | + subtitle: "Konu yetkinliği · çeldirici örüntüsü · güncellik", | ||
| 43 | + description: | ||
| 44 | + "Doğru sayısı bir şey anlatmaz; hangi konuda, hangi çeldiriciye ve ne zaman yanıldığı anlatır. Öğrenci-soru matrisinden konu yetkinliği kestirilir, güncel veri geçmişin önüne geçer.", | ||
| 45 | + bullets: [ | ||
| 46 | + "Konu bazlı doğruluk ve çeldirici örüntüsü", | ||
| 47 | + "Zaman içindeki değişim: gelişen konu eksik sayılmaz", | ||
| 48 | + "Sınıf ve şube düzeyinde toplu görünüm", | ||
| 49 | + ], | ||
| 50 | + }, | ||
| 51 | + { | ||
| 52 | + id: "plan", | ||
| 53 | + num: "03", | ||
| 54 | + title: "Plan ve onay", | ||
| 55 | + subtitle: "Haftalık program · kanıt · öğretmen kararı", | ||
| 56 | + description: | ||
| 57 | + "Analizden ve öğrencinin hedefinden haftalık çalışma programı üretilir. Program öğretmene kanıtıyla gelir: hangi soru, hangi tarih, hangi başarı oranı. Öğretmen onaylar ya da düzeltir; düzeltme kaydedilir.", | ||
| 58 | + bullets: [ | ||
| 59 | + "Her öneri dayandığı soru ve tarihle birlikte görünür", | ||
| 60 | + "Öğretmen onaylamadan hiçbir içerik öğrenciye gitmez", | ||
| 61 | + "Düzeltmeler geri bildirim olarak sonraki öneriyi etkiler", | ||
| 62 | + ], | ||
| 63 | + }, | ||
| 64 | + { | ||
| 65 | + id: "kullanim", | ||
| 66 | + num: "04", | ||
| 67 | + title: "Kullanım", | ||
| 68 | + subtitle: "Öğrenci · öğretmen · yönetici · veli", | ||
| 69 | + description: | ||
| 70 | + "Onaylanan plan öğrencinin ekranına düşer; öğretmen sınıfın eksiğini, yönetici kurumun durumunu, veli anlaşılır bir gelişim görünümünü görür. Plana uyum ve sonuç yeniden veri olur.", | ||
| 71 | + bullets: [ | ||
| 72 | + "Herkes yalnızca yetkisi olan veriyi görür", | ||
| 73 | + "Çalışma kaydı ve yeni sınav akışı baştan tetikler", | ||
| 74 | + "Veli karne dönemini beklemez", | ||
| 75 | + ], | ||
| 76 | + }, | ||
| 77 | + ], | ||
| 78 | + | ||
| 79 | + contract: { | ||
| 80 | + label: "Veri sözleşmesi", | ||
| 81 | + title: "Şemanın çalışmasını mümkün kılan üç kural", | ||
| 82 | + description: | ||
| 83 | + "Bu üç kural olmadan geri kalan her şey tahmine dönüşür. Kurulumda veri bu biçime getirilir; sonrasında kurumun yaptığı tek şey işini platformda yürütmektir.", | ||
| 84 | + items: [ | ||
| 85 | + { | ||
| 86 | + id: "etiket", | ||
| 87 | + title: "Soru, konuya bağlıdır", | ||
| 88 | + description: "Her sınav sorusu ders, konu ve kazanım etiketiyle saklanır; etiketsiz soru sınava eklenmez.", | ||
| 89 | + }, | ||
| 90 | + { | ||
| 91 | + id: "madde", | ||
| 92 | + title: "Cevap, seçenek düzeyinde saklanır", | ||
| 93 | + description: "“Yanlış” yetmez: hangi seçeneğin işaretlendiği tutulur, çünkü çeldirici örüntüsü konuyu anlatır.", | ||
| 94 | + }, | ||
| 95 | + { | ||
| 96 | + id: "zaman", | ||
| 97 | + title: "Her kayıt zamanlıdır", | ||
| 98 | + description: "Aynı konudaki iki deneme arasındaki fark analizin çıktısını belirler; güncel veri geçmişi bastırır.", | ||
| 99 | + }, | ||
| 100 | + ], | ||
| 101 | + }, | ||
| 102 | + | ||
| 103 | + gates: { | ||
| 104 | + label: "Kapılar", | ||
| 105 | + title: "Zincirin dört noktasında sistem kendini durdurur", | ||
| 106 | + description: | ||
| 107 | + "Bir eğitim ürününde asıl mesele neyi üretebildiği değil, neyi üretmeyi reddettiğidir. Hezarfen'de dört kapı bunun için var.", | ||
| 108 | + items: [ | ||
| 109 | + { id: "onay", title: "Öğretmen onayı", description: "Öğrenciye gidecek plan, özet ve soru taslağı öğretmenden geçmeden yayımlanmaz." }, | ||
| 110 | + { id: "yetki", title: "Rol bazlı yetki", description: "Analiz de asistan da kullanıcının yetkisiyle çalışır; yetki dışındaki veri ne gösterilir ne özetlenir." }, | ||
| 111 | + { id: "kaynak", title: "Kaynak izleme", description: "Özet ve sohbet yalnızca kurumun yüklediği kaynaktan üretilir; yanıt dayandığı bölüme bağlanır." }, | ||
| 112 | + { id: "kalite", title: "Kalite kapısı", description: "Sesli ders bölümü ölçülen eşikleri geçmezse otomatik olarak yayımdan engellenir." }, | ||
| 113 | + ], | ||
| 114 | + }, | ||
| 115 | + | ||
| 116 | + map: { | ||
| 117 | + label: "Ürünler şemada", | ||
| 118 | + title: "Hangi ürün zincirin neresinde duruyor", | ||
| 119 | + description: "Dört ürün ayrı satın alınır ama aynı zincirin farklı halkalarıdır.", | ||
| 120 | + items: [ | ||
| 121 | + { stage: "01 · Toplama", name: "Hezarfen Platform", description: "Veriyi üreten ve saklayan çekirdek: roller, dersler, yoklama, sınav, ödev, not, ödeme." }, | ||
| 122 | + { stage: "02 · Analiz", name: "Hezarfen Zekâ", description: "Konu yetkinliğini kestiren, planı üreten ve çizelge taslağını hazırlayan katman." }, | ||
| 123 | + { stage: "03 · Onay", name: "Çelebi", description: "Kullanıcıyı doğru ekrana götüren, kaynaktan kanıtlı özet çıkaran asistan." }, | ||
| 124 | + { stage: "04 · Kullanım", name: "Ses Atölyesi", description: "Onaylanan içeriği kaynağına izlenebilir sesli derse çeviren üretim hattı." }, | ||
| 125 | + ], | ||
| 126 | + }, | ||
| 127 | + | ||
| 128 | + measures: { | ||
| 129 | + label: "Ölçüm", | ||
| 130 | + title: "Pilotta neye bakıyoruz", | ||
| 131 | + description: | ||
| 132 | + "Şemanın işlediğini iddia etmek yetmez; pilot dönemi boyunca ölçülen şeyler bunlar.", | ||
| 133 | + items: [ | ||
| 134 | + "Sınav sonrası rapora ulaşma süresi", | ||
| 135 | + "Rehberlik başına hazırlanan kişisel plan sayısı", | ||
| 136 | + "Önerilerin kabul ve düzeltme oranı", | ||
| 137 | + "Öğrencinin plana uyumu", | ||
| 138 | + "Ders programı çakışma sayısı", | ||
| 139 | + "Veli bilgilendirmesine dönen soru yükü", | ||
| 140 | + ], | ||
| 141 | + }, | ||
| 142 | + }, | ||
| 143 | + | ||
| 144 | + /** `/iletisim` — the form the demo button opens. */ | ||
| 145 | + contact: { | ||
| 146 | + metaTitle: "Demo talebi ve iletişim — Hezarfen", | ||
| 147 | + metaDescription: | ||
| 148 | + "Kurumunuz için demo talebi: formu doldurun, 20 dakikalık ihtiyaç görüşmesiyle başlayalım. Kurulum, veri aktarımı ve rol bazlı eğitim dahil.", | ||
| 149 | + label: "İletişim", | ||
| 150 | + title: "Kurumunuz için demo talep edin", | ||
| 151 | + lead: "Formu doldurun; iki iş günü içinde dönüp 20 dakikalık bir ihtiyaç görüşmesi planlıyoruz. Demoyu kurumunuzun kendi iş akışına göre hazırlıyoruz.", | ||
| 152 | + formTitle: "Demo talep formu", | ||
| 153 | + fields: { | ||
| 154 | + name: "Ad ve soyad", | ||
| 155 | + institution: "Kurum adı", | ||
| 156 | + role: "Göreviniz", | ||
| 157 | + rolePlaceholder: "Kurum müdürü, kurucu, koordinatör…", | ||
| 158 | + email: "E-posta", | ||
| 159 | + phone: "Telefon", | ||
| 160 | + phoneHint: "İsteğe bağlı", | ||
| 161 | + students: "Öğrenci sayısı", | ||
| 162 | + studentsOptions: ["1–150", "150–400", "400–800", "800+"], | ||
| 163 | + interest: "İlgilendiğiniz ürünler", | ||
| 164 | + interestOptions: ["Hezarfen Platform", "Hezarfen Zekâ", "Çelebi", "Ses Atölyesi"], | ||
| 165 | + message: "Eklemek istedikleriniz", | ||
| 166 | + messagePlaceholder: "Bugün hangi araçları kullanıyorsunuz, en çok nerede zaman kaybediyorsunuz?", | ||
| 167 | + consent: "Formdaki bilgilerin demo talebimin değerlendirilmesi amacıyla işlenmesini onaylıyorum.", | ||
| 168 | + required: "zorunlu", | ||
| 169 | + }, | ||
| 170 | + submit: "Demo talebini gönder", | ||
| 171 | + submitting: "Gönderiliyor…", | ||
| 172 | + successTitle: "Talebiniz alındı", | ||
| 173 | + successBody: "İki iş günü içinde dönüyoruz. Acelesi varsa doğrudan yazabilirsiniz:", | ||
| 174 | + errors: { | ||
| 175 | + name: "Adınızı yazın.", | ||
| 176 | + institution: "Kurum adını yazın.", | ||
| 177 | + email: "Geçerli bir e-posta adresi yazın.", | ||
| 178 | + consent: "Formu gönderebilmek için onay kutusunu işaretleyin.", | ||
| 179 | + unknown: "Talep gönderilemedi. Lütfen tekrar deneyin ya da doğrudan e-posta yazın.", | ||
| 180 | + }, | ||
| 181 | + next: { | ||
| 182 | + title: "Formdan sonra ne oluyor", | ||
| 183 | + steps: [ | ||
| 184 | + { num: "01", title: "İhtiyaç görüşmesi", description: "20 dakika: kurumun akışı, kullandığı araçlar ve en çok zaman kaybettiren adımlar." }, | ||
| 185 | + { num: "02", title: "Kuruma özel demo", description: "Aynı verinin dört üründe nasıl değere döndüğü, sizin iş akışınızla gösterilir." }, | ||
| 186 | + { num: "03", title: "İsterseniz pilot", description: "Bir dönemlik pilotta başlangıç değerleri ölçülür; sonunda önce/sonra raporunu birlikte okuruz." }, | ||
| 187 | + ], | ||
| 188 | + }, | ||
| 189 | + direct: { | ||
| 190 | + title: "Doğrudan iletişim", | ||
| 191 | + description: "Form yerine yazmayı tercih ederseniz aynı yere düşer.", | ||
| 192 | + cityLabel: "Merkez", | ||
| 193 | + }, | ||
| 194 | + kvkk: "Form verileri yalnızca talebin değerlendirilmesi için kullanılır, üçüncü taraflarla paylaşılmaz ve talebiniz kapandıktan sonra saklanmaz.", | ||
| 195 | + }, | ||
| 196 | +} as const; | ||
src/i18n/tr.tsmodified+2 -1
| @@ -166,6 +166,7 @@ export const tr = { | |||
| 166 | title: "Sınav kâğıdından öğretmen onaylı plana dört adım", | 166 | title: "Sınav kâğıdından öğretmen onaylı plana dört adım", |
| 167 | description: | 167 | description: |
| 168 | "Zincirin hiçbir halkası öğretmeni devre dışı bırakmaz. Her adımın ölçülebilir bir karşılığı var: işlem süresi, program çakışması, önerilerin kabul oranı ve plana uyum.", | 168 | "Zincirin hiçbir halkası öğretmeni devre dışı bırakmaz. Her adımın ölçülebilir bir karşılığı var: işlem süresi, program çakışması, önerilerin kabul oranı ve plana uyum.", |
| 169 | + more: "Ayrıntılı şemayı gör", | ||
| 169 | steps: [ | 170 | steps: [ |
| 170 | { | 171 | { |
| 171 | num: "Adım 1", | 172 | num: "Adım 1", |
| @@ -326,7 +327,7 @@ export const tr = { | |||
| 326 | subtitle: | 327 | subtitle: |
| 327 | "20 dakikalık ihtiyaç görüşmesiyle başlıyoruz; demo kurumunuzun kendi akışına göre kurulur, ardından isterseniz bir dönemlik pilotta sonuçları birlikte ölçüyoruz.", | 328 | "20 dakikalık ihtiyaç görüşmesiyle başlıyoruz; demo kurumunuzun kendi akışına göre kurulur, ardından isterseniz bir dönemlik pilotta sonuçları birlikte ölçüyoruz.", |
| 328 | panelTitle: "Kurumunuz için 20 dakika ayırın, gerisini birlikte planlayalım", | 329 | panelTitle: "Kurumunuz için 20 dakika ayırın, gerisini birlikte planlayalım", |
| 329 | - panelSubtitle: "Demo kaydı ya da yüz yüze görüşme; Kayseri ve Niğde'de yerinde destek veriyoruz.", | 330 | + |
| 330 | secondary: "Pilot sürecini sor", | 331 | secondary: "Pilot sürecini sor", |
| 331 | subject: "Hezarfen demo talebi", | 332 | subject: "Hezarfen demo talebi", |
| 332 | pilotSubject: "Hezarfen pilot görüşmesi", | 333 | pilotSubject: "Hezarfen pilot görüşmesi", |
src/lib/contact.tsadded+73 -0
| @@ -0,0 +1,73 @@ | |||
| 1 | +import { action } from "@solidjs/router"; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * The demo request, server side. | ||
| 5 | + * | ||
| 6 | + * Delivery is a webhook rather than an SMTP client: the only thing this site | ||
| 7 | + * has to do is get the request in front of a human, and a single URL in the | ||
| 8 | + * environment (Slack, Discord, Make, Resend's own endpoint — anything that | ||
| 9 | + * takes a JSON POST) does that without shipping mail credentials in the | ||
| 10 | + * build. `CONTACT_WEBHOOK_URL` is that URL. | ||
| 11 | + * | ||
| 12 | + * With no webhook configured the submission is logged and still reported as | ||
| 13 | + * received, because the form also states the address underneath it: the | ||
| 14 | + * request is never silently dropped without the visitor being told where | ||
| 15 | + * else to write. | ||
| 16 | + */ | ||
| 17 | + | ||
| 18 | +export type ContactResult = { ok: true } | { ok: false; field?: string; code: string }; | ||
| 19 | + | ||
| 20 | +const text = (form: FormData, key: string) => String(form.get(key) ?? "").trim(); | ||
| 21 | + | ||
| 22 | +/** Deliberately loose: a regex cannot validate an address, only reject typos. */ | ||
| 23 | +const looksLikeEmail = (value: string) => /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(value); | ||
| 24 | + | ||
| 25 | +export const submitContact = action(async (form: FormData): Promise<ContactResult> => { | ||
| 26 | + "use server"; | ||
| 27 | + | ||
| 28 | + const name = text(form, "name"); | ||
| 29 | + const institution = text(form, "institution"); | ||
| 30 | + const email = text(form, "email"); | ||
| 31 | + const consent = form.get("consent") !== null; | ||
| 32 | + | ||
| 33 | + if (name.length < 2) return { ok: false, field: "name", code: "name" }; | ||
| 34 | + if (institution.length < 2) return { ok: false, field: "institution", code: "institution" }; | ||
| 35 | + if (!looksLikeEmail(email)) return { ok: false, field: "email", code: "email" }; | ||
| 36 | + if (!consent) return { ok: false, field: "consent", code: "consent" }; | ||
| 37 | + | ||
| 38 | + const payload = { | ||
| 39 | + name, | ||
| 40 | + institution, | ||
| 41 | + role: text(form, "role"), | ||
| 42 | + email, | ||
| 43 | + phone: text(form, "phone"), | ||
| 44 | + students: text(form, "students"), | ||
| 45 | + // Checkbox groups arrive as repeated keys; `getAll` is the only way to | ||
| 46 | + // read every box that was ticked rather than the last one. | ||
| 47 | + interest: form.getAll("interest").map(String), | ||
| 48 | + message: text(form, "message"), | ||
| 49 | + receivedAt: new Date().toISOString(), | ||
| 50 | + }; | ||
| 51 | + | ||
| 52 | + const webhook = process.env.CONTACT_WEBHOOK_URL; | ||
| 53 | + | ||
| 54 | + if (!webhook) { | ||
| 55 | + console.info("[contact] no CONTACT_WEBHOOK_URL set, logging instead:", payload); | ||
| 56 | + return { ok: true }; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + try { | ||
| 60 | + const response = await fetch(webhook, { | ||
| 61 | + method: "POST", | ||
| 62 | + headers: { "content-type": "application/json" }, | ||
| 63 | + body: JSON.stringify(payload), | ||
| 64 | + }); | ||
| 65 | + if (!response.ok) throw new Error(`webhook responded ${response.status}`); | ||
| 66 | + } catch (error) { | ||
| 67 | + // The visitor is told to write directly; the reason is kept server side. | ||
| 68 | + console.error("[contact] delivery failed:", error); | ||
| 69 | + return { ok: false, code: "unknown" }; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + return { ok: true }; | ||
| 73 | +}, "contact"); | ||
src/routes/iletisim.tsxadded+76 -0
| @@ -0,0 +1,76 @@ | |||
| 1 | +import { A } from "@solidjs/router"; | ||
| 2 | +import { For } from "solid-js"; | ||
| 3 | +import Seo from "~/components/Seo"; | ||
| 4 | +import ContactForm from "~/components/ContactForm"; | ||
| 5 | +import { PixelArrowRight } from "~/components/icons/pixel"; | ||
| 6 | +import { mailto, routes, site } from "~/config"; | ||
| 7 | +import { t } from "~/i18n"; | ||
| 8 | +import { contactPageNode } from "~/lib/schema"; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * The page the demo button opens. The form is the page: everything beside it | ||
| 12 | + * is what a visitor needs in order to trust sending it — what happens next, | ||
| 13 | + * where the request goes, and what is done with the data. | ||
| 14 | + */ | ||
| 15 | +export default function Contact() { | ||
| 16 | + const url = () => `${site.url}${routes.contact}`; | ||
| 17 | + | ||
| 18 | + return ( | ||
| 19 | + <> | ||
| 20 | + <Seo | ||
| 21 | + title={t.contact.metaTitle} | ||
| 22 | + description={t.contact.metaDescription} | ||
| 23 | + full | ||
| 24 | + breadcrumb={t.nav.contact} | ||
| 25 | + schema={[contactPageNode(t, url())]} | ||
| 26 | + /> | ||
| 27 | + | ||
| 28 | + <section class="hz-pagehead"> | ||
| 29 | + <div class="hz-wrap"> | ||
| 30 | + <span class="hz-label">{t.contact.label}</span> | ||
| 31 | + <h1 class="hz-display">{t.contact.title}</h1> | ||
| 32 | + <p class="hz-lead">{t.contact.lead}</p> | ||
| 33 | + </div> | ||
| 34 | + </section> | ||
| 35 | + | ||
| 36 | + <section class="hz-band hz-band-alt"> | ||
| 37 | + <div class="hz-wrap hz-contact-split"> | ||
| 38 | + <ContactForm /> | ||
| 39 | + | ||
| 40 | + <aside class="hz-contact-aside"> | ||
| 41 | + <div> | ||
| 42 | + <h2 class="hz-h3">{t.contact.next.title}</h2> | ||
| 43 | + <ol class="hz-ministeps"> | ||
| 44 | + <For each={t.contact.next.steps}> | ||
| 45 | + {step => ( | ||
| 46 | + <li> | ||
| 47 | + <span class="hz-step-num">{step.num}</span> | ||
| 48 | + <strong>{step.title}</strong> | ||
| 49 | + <p class="hz-small">{step.description}</p> | ||
| 50 | + </li> | ||
| 51 | + )} | ||
| 52 | + </For> | ||
| 53 | + </ol> | ||
| 54 | + </div> | ||
| 55 | + | ||
| 56 | + <div class="hz-contact-direct"> | ||
| 57 | + <h2 class="hz-h3">{t.contact.direct.title}</h2> | ||
| 58 | + <p class="hz-small">{t.contact.direct.description}</p> | ||
| 59 | + <a class="hz-contact-mail" href={mailto(t.cta.subject)}> | ||
| 60 | + {site.email} | ||
| 61 | + </a> | ||
| 62 | + <p class="hz-small"> | ||
| 63 | + {t.contact.direct.cityLabel}: {site.city} | ||
| 64 | + </p> | ||
| 65 | + </div> | ||
| 66 | + | ||
| 67 | + <A href={routes.how} class="hz-btn hz-btn-quiet"> | ||
| 68 | + {t.nav.theory} | ||
| 69 | + <PixelArrowRight aria-hidden="true" /> | ||
| 70 | + </A> | ||
| 71 | + </aside> | ||
| 72 | + </div> | ||
| 73 | + </section> | ||
| 74 | + </> | ||
| 75 | + ); | ||
| 76 | +} | ||