mirror of
https://github.com/SamyRai/turash.git
synced 2025-12-26 23:01:33 +00:00
- Remove nested git repository from bugulma/frontend/.git - Add all frontend files to main repository tracking - Convert from separate frontend/backend repos to unified monorepo - Preserve all frontend code and development history as tracked files - Eliminate nested repository complexity for simpler development workflow This creates a proper monorepo structure with frontend and backend coexisting in the same repository for easier development and deployment.
45 lines
1.5 KiB
TypeScript
45 lines
1.5 KiB
TypeScript
import { useState, useCallback } from 'react';
|
|
import { Organization, HistoricalLandmark } from '@/types';
|
|
|
|
export const useMapInteraction = (
|
|
setMapCenter: (coords: [number, number]) => void,
|
|
setZoom: (zoom: number) => void
|
|
) => {
|
|
const [selectedOrg, setSelectedOrg] = useState<Organization | null>(null);
|
|
const [hoveredOrgId, setHoveredOrgId] = useState<string | null>(null);
|
|
const [selectedLandmark, setSelectedLandmark] = useState<HistoricalLandmark | null>(null);
|
|
const [hoveredLandmarkId, setHoveredLandmarkId] = useState<string | null>(null);
|
|
|
|
const handleSelectOrg = useCallback((org: Organization | null) => {
|
|
setSelectedOrg(org);
|
|
setSelectedLandmark(null);
|
|
// Note: Location will be set via site coordinates in the map component
|
|
// We'll need to fetch the site for the org to get coordinates
|
|
// For now, just select the org - the map will handle centering
|
|
}, []);
|
|
|
|
const handleSelectLandmark = useCallback(
|
|
(landmark: HistoricalLandmark | null) => {
|
|
setSelectedLandmark(landmark);
|
|
setSelectedOrg(null);
|
|
if (landmark && landmark.location) {
|
|
// Leaflet uses [lat, lng] format
|
|
setMapCenter([landmark.location.lat, landmark.location.lng]);
|
|
setZoom(14);
|
|
}
|
|
},
|
|
[setMapCenter, setZoom]
|
|
);
|
|
|
|
return {
|
|
selectedOrg,
|
|
hoveredOrgId,
|
|
selectedLandmark,
|
|
hoveredLandmarkId,
|
|
handleSelectOrg,
|
|
setHoveredOrgId,
|
|
handleSelectLandmark,
|
|
setHoveredLandmarkId,
|
|
};
|
|
};
|