All checks were successful
Deploy / deploy (push) Successful in 2m38s
- Updated the `page.tsx` component to enhance user experience with new UI elements and improved layout. - Modified the `funnel-banner.tsx` to include dynamic text and improved styling for better engagement. - Adjusted the `liste-paneli.tsx` to provide clearer information on user credits and package details. - Enhanced the `rapor-listesi.tsx` to display additional data points for better insights. - Updated the database schema in `app.db` to reflect recent changes in the application logic. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
62 lines
2.1 KiB
TypeScript
62 lines
2.1 KiB
TypeScript
// turkey-map-react SVG uzayı (viewBox 0 0 1050 585) ile coğrafi koordinatlar
|
||
// arasındaki dönüşüm ve üniversite konum çözümü.
|
||
//
|
||
// Afin katsayılar, 81 il path'inin bbox merkezleri ile il merkezlerinin
|
||
// (lat, lng) değerleri arasında en küçük kareler uyumuyla hesaplanıp
|
||
// sabitlendi; ölçek doğrulaması: ~0.6 px/km her iki eksende de tutarlı.
|
||
|
||
import { UNI_KOORDINAT, IL_MERKEZ, type LatLng } from "./uni-koordinatlar";
|
||
|
||
export const HARITA_GENISLIK = 1050;
|
||
export const HARITA_YUKSEKLIK = 585;
|
||
/** Ülke çizimi y≈144'te başlıyor; üstteki ölü bant her haritada kırpılır. */
|
||
export const HARITA_UST_KIRPMA = 138;
|
||
|
||
export function latLngToXy([lat, lng]: LatLng): { x: number; y: number } {
|
||
return {
|
||
x: 52.5215 * lng - 1332.1743,
|
||
y: -65.4185 * lat + 2917.4061,
|
||
};
|
||
}
|
||
|
||
/** Harita il adını DB formatına çevirir: "Hakkâri" → "HAKKARİ". */
|
||
export function normalizeIlAdi(name: string): string {
|
||
return name
|
||
.toLocaleUpperCase("tr-TR")
|
||
.replace(/Â/g, "A")
|
||
.replace(/Î/g, "İ")
|
||
.replace(/Û/g, "U");
|
||
}
|
||
|
||
/** DB'deki üniversite adının "(İL)" ekini ayıklar. */
|
||
export function uniAdiNormalize(ad: string): string {
|
||
return ad.replace(/\s*\([^)]*\)\s*$/, "").trim();
|
||
}
|
||
|
||
export type UniKonum = {
|
||
x: number;
|
||
y: number;
|
||
/** true: kampüs koordinatı; false: il merkezine düşen yaklaşık konum */
|
||
kesin: boolean;
|
||
};
|
||
|
||
/**
|
||
* Üniversitenin harita üzerindeki konumu. Sıra: "AD|İL" → "AD" → il merkezi.
|
||
* KKTC ve yurtdışı kampüsler için null (harita dışı).
|
||
*/
|
||
export function uniKonum(universite: string, il: string | null): UniKonum | null {
|
||
const ad = uniAdiNormalize(universite);
|
||
const koord =
|
||
(il ? UNI_KOORDINAT[`${ad}|${il}`] : undefined) ?? UNI_KOORDINAT[ad];
|
||
if (koord) return { ...latLngToXy(koord), kesin: true };
|
||
const merkez = il ? IL_MERKEZ[il] : undefined;
|
||
if (merkez) return { ...latLngToXy(merkez), kesin: false };
|
||
return null;
|
||
}
|
||
|
||
/** İl merkezinin harita konumu (kilitli/adsız pinler için). */
|
||
export function ilKonum(il: string | null): { x: number; y: number } | null {
|
||
const merkez = il ? IL_MERKEZ[il] : undefined;
|
||
return merkez ? latLngToXy(merkez) : null;
|
||
}
|