Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
22 lines
660 B
TypeScript
22 lines
660 B
TypeScript
/** Env + coords only — no mapbox import for lighter non-map pages */
|
|
|
|
export function getPublicMapApiKey(): string {
|
|
return (process.env.NEXT_PUBLIC_MAP_API_KEY || '').trim()
|
|
}
|
|
|
|
/** Mapbox / Map.ir: [lng, lat]; form uses { lat, lng } */
|
|
|
|
export function toMapirLngLat(lat: number, lng: number): [number, number] {
|
|
return [lng, lat]
|
|
}
|
|
|
|
/** Backend geo fields: max 6 decimal places */
|
|
export const GEO_COORDINATE_DECIMALS = 6
|
|
|
|
export function roundGeoCoordinate(value: number, decimals: number = GEO_COORDINATE_DECIMALS): number {
|
|
if (!Number.isFinite(value)) return value
|
|
const factor = 10 ** decimals
|
|
|
|
return Math.round(value * factor) / factor
|
|
}
|