Update Next.js configuration and package dependencies
All checks were successful
Deploy / deploy (push) Successful in 9m29s
All checks were successful
Deploy / deploy (push) Successful in 9m29s
- Modified redirects in next.config.ts to change the destination for "/sohbet" to "/listem". - Added new dependencies in package.json: marked, motion, react-markdown, remark-breaks, remark-gfm, shiki, and use-stick-to-bottom. - Updated pnpm-lock.yaml to reflect the new package versions and dependencies. - Removed obsolete stack files for Flutter, Nuxt, Nuxt.js, React Native, and Svelte from the UI/UX Pro Max skill data. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
59
src/lib/harita.ts
Normal file
59
src/lib/harita.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
// 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;
|
||||
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user