fix typescrypt build shit
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { useState, FormEvent } from 'react';
|
||||
import { useState } from 'react';
|
||||
import type { FormEvent } from 'react';
|
||||
import { useNavigate, Link } from 'react-router-dom';
|
||||
import { useAuthStore } from '../../stores/authStore';
|
||||
import { useUIStore } from '../../stores/uiStore';
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useState, FormEvent } from 'react';
|
||||
import { useState } from 'react';
|
||||
import type { FormEvent } from 'react';
|
||||
import { useNavigate, Link } from 'react-router-dom';
|
||||
import { useAuthStore } from '../../stores/authStore';
|
||||
import { useUIStore } from '../../stores/uiStore';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ReactNode } from 'react';
|
||||
import type { ReactNode } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useAuthStore } from '../../stores/authStore';
|
||||
import { useUIStore } from '../../stores/uiStore';
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useMapEvents, Polyline, Marker } from 'react-leaflet';
|
||||
import L from 'leaflet';
|
||||
import { useDrawingStore } from '../../stores/drawingStore';
|
||||
import { useUIStore } from '../../stores/uiStore';
|
||||
import { mapItemService } from '../../services/mapItemService';
|
||||
@@ -12,7 +11,7 @@ interface DrawingHandlerProps {
|
||||
}
|
||||
|
||||
export function DrawingHandler({ mapId, onItemCreated }: DrawingHandlerProps) {
|
||||
const { activeTool, isDrawing, drawingPoints, setIsDrawing, addDrawingPoint, resetDrawing, setActiveTool } =
|
||||
const { activeTool, isDrawing, drawingPoints, setIsDrawing, addDrawingPoint, resetDrawing } =
|
||||
useDrawingStore();
|
||||
const { showToast } = useUIStore();
|
||||
const [cursorPosition, setCursorPosition] = useState<[number, number] | null>(null);
|
||||
@@ -307,11 +306,6 @@ export function DrawingHandler({ mapId, onItemCreated }: DrawingHandlerProps) {
|
||||
|
||||
const dashArray = isWirelessTool ? '10, 10' : undefined;
|
||||
|
||||
// Create preview line from last point to cursor
|
||||
const previewPositions = cursorPosition
|
||||
? [...drawingPoints, cursorPosition]
|
||||
: drawingPoints;
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* Main line connecting all points */}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { useState } from 'react';
|
||||
|
||||
interface LayerInfo {
|
||||
name: string;
|
||||
url: string;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
import { Polyline, Marker, Popup, Circle, Tooltip, useMapEvents } from 'react-leaflet';
|
||||
import { Polyline, Marker, Popup, Circle, useMapEvents } from 'react-leaflet';
|
||||
import L from 'leaflet';
|
||||
import { mapItemService } from '../../services/mapItemService';
|
||||
import { uploadService } from '../../services/uploadService';
|
||||
|
||||
@@ -37,7 +37,7 @@ export function MapView({ mapId, activeLayer, mapLayers, showShareDialog = false
|
||||
};
|
||||
|
||||
// WebSocket connection for real-time updates
|
||||
const { isConnected, permission } = useMapWebSocket({
|
||||
const { permission } = useMapWebSocket({
|
||||
mapId: mapId || '',
|
||||
onItemCreated: (item) => {
|
||||
console.log('Real-time item created:', item);
|
||||
|
||||
@@ -51,7 +51,7 @@ export function ShareDialog({ mapId, onClose }: ShareDialogProps) {
|
||||
setLoading(true);
|
||||
try {
|
||||
await mapShareService.shareWithUser(mapId, {
|
||||
user_identifier: newUserId.trim(),
|
||||
user_id: newUserId.trim(),
|
||||
permission: newUserPermission,
|
||||
});
|
||||
setNewUserId('');
|
||||
|
||||
@@ -3,7 +3,6 @@ import type { DrawingTool } from '../../types/mapItem';
|
||||
import { CABLE_COLORS, CABLE_LABELS } from '../../types/mapItem';
|
||||
|
||||
interface ToolbarProps {
|
||||
mapId: string;
|
||||
readOnly?: boolean;
|
||||
}
|
||||
|
||||
@@ -81,7 +80,7 @@ const INFO_TOOL: ToolButton = {
|
||||
description: 'Information Marker',
|
||||
};
|
||||
|
||||
export function Toolbar({ mapId, readOnly = false }: ToolbarProps) {
|
||||
export function Toolbar({ readOnly = false }: ToolbarProps) {
|
||||
const { activeTool, setActiveTool } = useDrawingStore();
|
||||
|
||||
const renderIcon = (tool: ToolButton, isDisabled: boolean) => {
|
||||
|
||||
@@ -26,7 +26,7 @@ export function useMapWebSocket({
|
||||
const [isConnected, setIsConnected] = useState(false);
|
||||
const [permission, setPermission] = useState<'read' | 'edit' | null>(null);
|
||||
const wsRef = useRef<WebSocket | null>(null);
|
||||
const reconnectTimeoutRef = useRef<NodeJS.Timeout | null>(null);
|
||||
const reconnectTimeoutRef = useRef<number | null>(null);
|
||||
const reconnectAttemptsRef = useRef(0);
|
||||
|
||||
// Use refs for callbacks to avoid reconnecting when they change
|
||||
|
||||
@@ -76,7 +76,7 @@ export function Dashboard() {
|
||||
{selectedMapId && (
|
||||
<>
|
||||
<div className="border-t border-gray-200 dark:border-gray-700">
|
||||
<Toolbar mapId={selectedMapId} />
|
||||
<Toolbar />
|
||||
</div>
|
||||
|
||||
{/* Map Style section */}
|
||||
@@ -84,7 +84,7 @@ export function Dashboard() {
|
||||
<h3 className="text-sm font-semibold text-gray-700 dark:text-gray-300 px-1 mb-2">Map Style</h3>
|
||||
<LayerSwitcher
|
||||
activeLayer={activeLayer}
|
||||
onLayerChange={setActiveLayer}
|
||||
onLayerChange={(layer) => setActiveLayer(layer as MapLayer)}
|
||||
layers={MAP_LAYERS}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useParams, useNavigate } from 'react-router-dom';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { MapContainer, TileLayer, useMap } from 'react-leaflet';
|
||||
import 'leaflet/dist/leaflet.css';
|
||||
import { LayerSwitcher } from '../components/map/LayerSwitcher';
|
||||
import { DrawingHandler } from '../components/map/DrawingHandler';
|
||||
import { MapItemsLayer } from '../components/map/MapItemsLayer';
|
||||
import { Toolbar } from '../components/map/Toolbar';
|
||||
import { MapView } from '../components/map/MapView';
|
||||
import { useMapWebSocket } from '../hooks/useMapWebSocket';
|
||||
import { apiClient } from '../services/api';
|
||||
import { useUIStore } from '../stores/uiStore';
|
||||
@@ -49,7 +48,6 @@ function MapController() {
|
||||
|
||||
export function SharedMap() {
|
||||
const { token } = useParams<{ token: string }>();
|
||||
const navigate = useNavigate();
|
||||
const { darkMode, toggleDarkMode } = useUIStore();
|
||||
const [activeLayer, setActiveLayer] = useState<MapLayer>('osm');
|
||||
const [refreshTrigger, setRefreshTrigger] = useState(0);
|
||||
@@ -201,7 +199,7 @@ export function SharedMap() {
|
||||
style={{ zIndex: 9999 }}
|
||||
>
|
||||
<div className="border-t border-gray-200 dark:border-gray-700">
|
||||
<Toolbar mapId={mapData.id} readOnly={isReadOnly} />
|
||||
<Toolbar readOnly={isReadOnly} />
|
||||
</div>
|
||||
|
||||
{/* Map Style section */}
|
||||
@@ -209,7 +207,7 @@ export function SharedMap() {
|
||||
<h3 className="text-sm font-semibold text-gray-700 dark:text-gray-300 px-1 mb-2">Map Style</h3>
|
||||
<LayerSwitcher
|
||||
activeLayer={activeLayer}
|
||||
onLayerChange={setActiveLayer}
|
||||
onLayerChange={(layer) => setActiveLayer(layer as MapLayer)}
|
||||
layers={MAP_LAYERS}
|
||||
/>
|
||||
</div>
|
||||
@@ -229,7 +227,7 @@ export function SharedMap() {
|
||||
url={MAP_LAYERS[activeLayer].url}
|
||||
attribution={MAP_LAYERS[activeLayer].attribution}
|
||||
maxZoom={MAP_LAYERS[activeLayer].maxZoom}
|
||||
maxNativeZoom={MAP_LAYERS[activeLayer].maxNativeZoom}
|
||||
maxNativeZoom={(MAP_LAYERS[activeLayer] as any).maxNativeZoom}
|
||||
/>
|
||||
|
||||
{/* Drawing handler for edit access */}
|
||||
|
||||
Reference in New Issue
Block a user