turash/bugulma/frontend/components/map/MapControls.tsx
Damir Mukimov 6347f42e20
Consolidate repositories: Remove nested frontend .git and merge into main repository
- 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.
2025-11-25 06:02:57 +01:00

62 lines
1.6 KiB
TypeScript

import React from 'react';
import { useMap } from 'react-leaflet';
import { useMapActions } from '@/contexts/MapContexts.tsx';
import { RotateCw, ZoomIn, ZoomOut } from 'lucide-react';
import Button from '@/components/ui/Button.tsx';
// Bugulma center coordinates [lat, lng] for Leaflet
const BUGULMA_CENTER: [number, number] = [54.5384152, 52.7955953];
const DEFAULT_ZOOM = 12;
const MapControls: React.FC = () => {
const map = useMap();
const { resetView } = useMapActions();
const handleZoomIn = () => {
map.zoomIn();
};
const handleZoomOut = () => {
map.zoomOut();
};
const handleReset = () => {
map.setView(BUGULMA_CENTER, DEFAULT_ZOOM, { animate: true });
resetView();
};
return (
<div className="absolute bottom-4 right-4 flex flex-col gap-2 z-50">
<Button
variant="outline"
size="sm"
onClick={handleZoomIn}
className="h-10 w-10 p-0 shadow-md"
aria-label="Zoom in"
>
<ZoomIn className="h-4 h-5 text-current w-4 w-5" />
</Button>
<Button
variant="outline"
size="sm"
onClick={handleZoomOut}
className="h-10 w-10 p-0 shadow-md"
aria-label="Zoom out"
>
<ZoomOut className="h-4 h-5 text-current w-4 w-5" />
</Button>
<Button
variant="outline"
size="sm"
onClick={handleReset}
className="h-10 w-10 p-0 shadow-md"
aria-label="Reset view"
>
<RotateCw className="h-4 h-5 text-current w-4 w-5" />
</Button>
</div>
);
};
export default React.memo(MapControls);