Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 48690561

Přidáno uživatelem Václav Honzík před asi 2 roky(ů)

smol refactor

re #9741

Zobrazit rozdíly:

frontend/src/features/TrackingTool/Import/ImportContextMenu.tsx
2 2
import { Fragment, useCallback, useState } from 'react'
3 3
import { Popup, useMapEvents } from 'react-leaflet'
4 4
import Typography from '@mui/material/Typography'
5
import {  Stack } from '@mui/material'
5
import { Stack } from '@mui/material'
6 6
import AddFromCoordinatesDialog from './AddFromCoordinatesDialog'
7 7
import { useSelector } from 'react-redux'
8 8
import { RootState } from '../../redux/store'
9 9
import ImportLocationDialog from './ImportLocationDialog'
10
import { PathDto } from '../../../swagger/data-contracts'
11 10

  
12 11
const RightClickPopupMenu = () => {
13 12
    const [open, setOpen] = useState(false)
14 13
    const [latLng, setLatLng] = useState<[number, number]>([0, 0])
15
    const pathDto = useSelector((state: RootState) => state.trackingTool.pathDto)
14
    const path = useSelector(
15
        (state: RootState) => state.trackingTool.displayedPath
16
    )
16 17

  
17 18
    useMapEvents({
18 19
        contextmenu: (e: LeafletMouseEvent) => {
19
            if (!pathDto) {
20
            if (!path) {
20 21
                return
21 22
            }
22 23
            setLatLng([e.latlng.lat, e.latlng.lng])
......
38 39
                        justifyItems="center"
39 40
                        justifyContent="center"
40 41
                    >
41
                        <Typography style={{margin: 0}} sx={{ mb: 0.5 }} align="center">
42
                        <Typography
43
                            style={{ margin: 0 }}
44
                            sx={{ mb: 0.5 }}
45
                            align="center"
46
                        >
42 47
                            {latLng[0].toFixed(5)}°{latLng[1].toFixed(5)}°
43 48
                        </Typography>
44 49
                        <AddFromCoordinatesDialog

Také k dispozici: Unified diff