Update package.json scripts, enhance layout with new components, and improve API error handling
Some checks failed
Deploy / deploy (push) Failing after 1h28m6s

- Added new scripts for database operations and temporary production in package.json.
- Integrated KaydetBannerLazy component into the layout for improved user notifications.
- Enhanced API error handling in the soru route to mark credit exhaustion.
- Updated the IletisimPage for better button styling and user experience.
- Refactored ListemPage to streamline user flow and improve session handling.
- Removed unused ListePaneli component to clean up the codebase.
This commit is contained in:
bilalgursen
2026-08-06 02:27:42 +03:00
parent 488845ae1f
commit e62c6f07df
77 changed files with 4132 additions and 1659 deletions

36
src/lib/eposta-gonder.ts Normal file
View File

@@ -0,0 +1,36 @@
import type { EpostaIcerik } from "./eposta";
/**
* Ortak e-posta göndericisi (Resend). Şablonlar eposta.ts'te, gönderim
* burada — magic link (auth.ts) ve kredi hatırlatması aynı yoldan çıkar.
* RESEND_API_KEY yoksa dev fallback: içerik terminale yazılır.
*/
export async function epostaGonder(
to: string,
icerik: EpostaIcerik,
): Promise<void> {
if (!process.env.RESEND_API_KEY) {
console.log(
`\n[eposta] (dev) ${to} adresine gönderilecekti — ${icerik.subject}\n${icerik.text}\n`,
);
return;
}
const { Resend } = await import("resend");
const resend = new Resend(process.env.RESEND_API_KEY);
const { error } = await resend.emails.send({
from: process.env.EMAIL_FROM ?? "KolayTercih <onboarding@resend.dev>",
to,
subject: icerik.subject,
html: icerik.html,
// Düz metin alternatifi spam puanını düşürür ve HTML'i engelleyen
// istemcilerde içeriğin okunabilir kalmasını sağlar.
text: icerik.text,
});
// Resend SDK hata fırlatmaz, { data, error } döndürür. Kontrol etmezsek
// doğrulanmamış domain/kota hatası sessizce yutulur — fırlatarak çağıran
// tarafın (better-auth, hatırlatma taraması) haberdar olmasını sağlıyoruz.
if (error) {
console.error(`[eposta] Gönderilemedi (${to}):`, error);
throw new Error(`Resend: ${error.name} — ${error.message}`);
}
}