turash/bugulma/frontend/contexts/MapProvider.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

56 lines
1.9 KiB
TypeScript

/**
* Unified Map Provider
* Combines all map-related contexts for easy consumption
* Provides a single import for map functionality
*/
import { ReactNode } from 'react';
import type { BackendOrganization } from '@/schemas/backend/organization';
import { MapActionsProvider } from '@/contexts/MapActionsContext.tsx';
import { MapFilterProvider } from '@/contexts/MapFilterContext.tsx';
import { MapInteractionProvider } from '@/contexts/MapInteractionContext.tsx';
import { MapUIProvider } from '@/contexts/MapUIContext.tsx';
import { MapViewportProvider } from '@/contexts/MapViewportContext.tsx';
interface MapProviderProps {
children: ReactNode;
organizations: BackendOrganization[];
initialCenter?: [number, number];
initialZoom?: number;
defaultViewMode?: 'organizations' | 'historical';
}
/**
* Unified Map Provider that combines all map contexts
* Use this instead of the monolithic MapContexts
*/
export const MapProvider = ({
children,
organizations,
initialCenter,
initialZoom,
defaultViewMode = 'organizations',
}: MapProviderProps) => {
return (
<MapViewportProvider initialCenter={initialCenter} initialZoom={initialZoom}>
<MapInteractionProvider>
<MapFilterProvider organizations={organizations}>
<MapUIProvider defaultViewMode={defaultViewMode}>
<MapActionsProvider>{children}</MapActionsProvider>
</MapUIProvider>
</MapFilterProvider>
</MapInteractionProvider>
</MapViewportProvider>
);
};
// Re-export all hooks and contexts for convenience
export * from '@/contexts/MapActionsContext.tsx';
export * from '@/contexts/MapFilterContext.tsx';
export * from '@/contexts/MapInteractionContext.tsx';
export * from '@/contexts/MapUIContext.tsx';
export * from '@/contexts/MapViewportContext.tsx';
// Legacy export for backward compatibility
export { MapProvider as MapViewProvider };