Files
kolaytercih/src/features/sihirbaz/components/sira-gerekli.tsx
bilalgursen ad086c3eca feat(ux): anlamsal yapı ve metin — içeriğe geç linki, sıralama yok sayfası
- Site geneli "İçeriğe geç" linki (klavyede ilk durak, WCAG 2.4.1)
- Sıralama yok sayfası: "Geçerli bir sıralama gerekli" yerine "Önce
  sıralamanı gir" ve ne işe yaradığı; CTA ok sonda, 48 px
- Rapor satırı aç/kapa düğmesi açtığı bölgeye bağlandı (aria-controls)
- Liste hazırlanırken "sayfayı kapatma" uyarısı 12 px griden okunur
  boya; bekleme metinleri "…" ile; başlık iri
- /sonuc başlığında dengeli satır kırılımı (text-balance)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 01:31:20 +03:00

82 lines
3.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"use client";
// Profil çerezi yokken: localStorage'da kayıtlı profil varsa çereze taşıyıp
// sayfayı tazele (URL değişmez); yoksa kapıyı aç. Sıra bilgisi localStorage'daki
// TercihProfili ile tüm uygulamada ortak, sunucu tablosu çerezden okur.
import { useEffect } from "react";
import { useRouter } from "next/navigation";
import Link from "next/link";
import { ArrowLeft, ArrowRight } from "lucide-react";
import { Button } from "@/components/ui/button";
import { PagePixelDivider } from "@/components/pixel-decor";
import { profilCerezineYaz } from "@/features/sihirbaz/sihirbaz-profil";
import {
sonucaGitIste,
useProfilKapisi,
} from "@/features/liste/hooks/use-tercih-profili";
export function SiraGerekli() {
const router = useRouter();
const { profil, profilYuklendi } = useProfilKapisi();
// "Yönleniyor" durumu ayrı state gerektirmez: profil varken aşağıdaki koşul
// zaten bekleme ekranını gösteriyor. Çerezi olmayan eski kullanıcı (profil
// yalnızca localStorage'da) burada çereze taşınır; refresh sunucu tablosunu
// aynı URL'de yeni çerezle render eder.
useEffect(() => {
if (profilYuklendi && profil) {
profilCerezineYaz(profil);
router.refresh();
}
}, [profil, profilYuklendi, router]);
if (!profilYuklendi || profil) {
return (
<main className="mx-auto flex max-w-2xl flex-col items-center px-4 py-24 text-center">
<p role="status" className="text-base text-slate-500">
Sıralaman kontrol ediliyor…
</p>
</main>
);
}
return (
<main className="mx-auto flex max-w-2xl flex-col items-center px-4 py-24 text-center">
<h1 className="font-heading text-3xl font-bold text-balance text-slate-900 sm:text-4xl">
Önce sıralamanı gir
</h1>
<p className="mt-4 max-w-md text-base leading-relaxed text-slate-600 sm:text-lg">
YKS başarı sıralamanı girince hangi programların sana açık olduğunu
hemen görürsün. Bir kez girmen yeter; her sayfada kullanılır.
</p>
<PagePixelDivider seed={59} className="mx-auto mt-6" />
<div className="mt-6 flex flex-wrap items-center justify-center gap-3">
<Button
type="button"
onClick={() => {
const { href } = sonucaGitIste();
if (href) router.push(href);
}}
size="lg"
className="cursor-pointer bg-orange-500 text-white transition-[background-color,transform] duration-200 hover:bg-orange-600 active:scale-[0.97]"
>
Sıralamamı gir
<ArrowRight className="size-4" aria-hidden />
</Button>
<Button
asChild
size="lg"
variant="outline"
className="cursor-pointer px-6 transition-[background-color,border-color,color,transform] duration-150 hover:border-orange-500 hover:bg-orange-50/60 hover:text-orange-500 active:scale-[0.97]"
>
<Link href="/">
<ArrowLeft className="size-4" aria-hidden />
Ana sayfaya dön
</Link>
</Button>
</div>
</main>
);
}