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

View File

@@ -0,0 +1,54 @@
"use client";
import { useEffect, useRef, type RefObject } from "react";
import { olay, type OlayAdi, type Ozellikler } from "@/lib/analitik";
/**
* Bir elemanın viewport'a ilk girişinde analitik olayı atan ref hook'u.
* Gösterim olayları (hazir_panel_goruntulendi, kilit_goruntulendi vb.)
* oturum başına en fazla 1 kez sayılmalı; tekilleştirme sessionStorage
* anahtarıyla yapılır. IntersectionObserver yoksa olay hiç atılmaz —
* "görüntülendi" ölçümünde görünürlüğü doğrulayamadığımız cihazı saymak
* veriyi şişirir.
*/
export function useGorunumOlayi<T extends HTMLElement = HTMLElement>(
ad: OlayAdi,
ozellikler?: Ozellikler,
/** Aynı olayın farklı yüzeyleri için tekilleştirme eki ("satir", "kart"). */
anahtarEki?: string,
): RefObject<T | null> {
const ref = useRef<T>(null);
// Özellikler her render sonrası tazelenir; observer effect'i yalnızca
// ad/anahtar değişiminde kurulur (deps'e obje koymamak için ref).
const ozelliklerRef = useRef(ozellikler);
useEffect(() => {
ozelliklerRef.current = ozellikler;
});
useEffect(() => {
const el = ref.current;
if (!el || typeof IntersectionObserver === "undefined") return;
const anahtar = `kolaytercih.olay.${ad}${anahtarEki ? `.${anahtarEki}` : ""}`;
try {
if (window.sessionStorage.getItem(anahtar)) return;
} catch {
// Storage engelliyse tekilleştirmeden vazgeç, olay yine atılabilir
}
const io = new IntersectionObserver((entries) => {
if (!entries.some((e) => e.isIntersecting)) return;
io.disconnect();
try {
window.sessionStorage.setItem(anahtar, "1");
} catch {
// yut
}
olay(ad, ozelliklerRef.current);
});
io.observe(el);
return () => io.disconnect();
}, [ad, anahtarEki]);
return ref;
}