refactor(sezon): tercih takvimi tek kaynakta (lib/sezon.ts)
Üst banttaki elle gömülü 2026 başlangıç/bitiş damgaları `src/lib/sezon.ts` içindeki `SEZON_TAKVIMI`ye taşındı. Aşama hesabı (`sezonAsamasi`) ve geri sayım hedefi (`sezonHedefi`) artık oradan geliyor; `devam-ediyor` dalının davranışı birebir aynı. 2027 takvimi ÖSYM tarafından açıklanmadığı için `null` bırakıldı — tarih uydurulmadı. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,12 +3,10 @@
|
||||
import { startTransition, useEffect, useState } from "react";
|
||||
import NumberFlow, { NumberFlowGroup } from "@number-flow/react";
|
||||
import { CalendarDays, Clock3 } from "lucide-react";
|
||||
|
||||
const TERCIH_BASLANGICI = new Date("2026-07-29T00:00:00+03:00").getTime();
|
||||
const TERCIH_BITISI = new Date("2026-08-10T23:59:59+03:00").getTime();
|
||||
import { sezonAsamasi, sezonHedefi, type SezonAsamasi } from "@/lib/sezon";
|
||||
|
||||
type GeriSayim = {
|
||||
asama: "baslamadi" | "devam-ediyor" | "sona-erdi";
|
||||
asama: SezonAsamasi;
|
||||
gun: number;
|
||||
saat: number;
|
||||
dakika: number;
|
||||
@@ -16,16 +14,9 @@ type GeriSayim = {
|
||||
};
|
||||
|
||||
function geriSayimiHesapla(simdi: number): GeriSayim {
|
||||
const asama =
|
||||
simdi < TERCIH_BASLANGICI
|
||||
? "baslamadi"
|
||||
: simdi <= TERCIH_BITISI
|
||||
? "devam-ediyor"
|
||||
: "sona-erdi";
|
||||
|
||||
const hedef =
|
||||
asama === "baslamadi" ? TERCIH_BASLANGICI : TERCIH_BITISI;
|
||||
const kalan = Math.max(0, hedef - simdi);
|
||||
const asama = sezonAsamasi(simdi);
|
||||
const hedef = sezonHedefi(asama);
|
||||
const kalan = hedef === null ? 0 : Math.max(0, hedef - simdi);
|
||||
|
||||
return {
|
||||
asama,
|
||||
|
||||
Reference in New Issue
Block a user