Projekt

Obecné

Profil

« Předchozí | Další » 

Revize a7ae217f

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

import export part 1

re #9741

Zobrazit rozdíly:

frontend/src/features/TrackingTool/TrackingTool.tsx
5 5
    Grid,
6 6
    Stack,
7 7
    Typography,
8
} from "@mui/material"
9
import { Fragment, useEffect, useRef, useState } from "react"
10
import { MapContainer, TileLayer, useMap } from "react-leaflet"
11
import mapConfig from "../../config/mapConfig"
12
import TextPath from "react-leaflet-textpath"
13
import PlaintextUpload from "./PlaintextUpload"
14
import FileUpload from "./FileUpload"
15
import L, { Map } from "leaflet"
16
import DeleteIcon from "@mui/icons-material/Delete"
17
import { PathDto } from "../../swagger/data-contracts"
18
import { formatHtmlStringToReactDom } from "../../utils/formatting/HtmlUtils"
19
import MapPath from "./MapPath"
20
import EditIcon from "@mui/icons-material/Edit"
21
import { useDispatch, useSelector } from "react-redux"
22
import { RootState } from "../redux/store"
23
import { clear, consumeErr as consumeError } from "./trackingToolSlice"
24
import { showNotification } from "../Notification/notificationSlice"
25
import ClearIcon from "@mui/icons-material/Clear"
8
} from '@mui/material'
9
import { Fragment, useEffect, useRef } from 'react'
10
import { MapContainer, TileLayer } from 'react-leaflet'
11
import mapConfig from '../../config/mapConfig'
12
import PlaintextUpload from './Upload/PlaintextUpload'
13
import FileUpload from './Upload/FileUpload'
14
import { Map } from 'leaflet'
15
import { formatHtmlStringToReactDom } from '../../utils/formatting/HtmlUtils'
16
import MapPath from './MapPath'
17
import { useDispatch, useSelector } from 'react-redux'
18
import { RootState } from '../redux/store'
19
import { clear, consumeErr as consumeError } from './trackingToolSlice'
20
import { showNotification } from '../Notification/notificationSlice'
21
import ClearIcon from '@mui/icons-material/Clear'
22
import GeoJsonExportButton from './Upload/GeoJsonExportButton'
23
import GeoJsonImportDialog from './Upload/GeoJsonImportDialog'
26 24

  
27 25
// Page with tracking tool
28 26
const TrackingTool = () => {
......
50 48
        dispatch(
51 49
            showNotification({
52 50
                message: error,
53
                severity: "error",
51
                severity: 'error',
54 52
            })
55 53
        )
56 54
    }, [err, dispatch])
......
58 56
    const mapRef = useRef<Map | undefined>(undefined)
59 57
    useEffect(() => {
60 58
        if (!mapRef || !mapRef.current) {
61
            console.log("No map ref")
59
            console.log('No map ref')
62 60
            return
63 61
        }
64 62

  
......
87 85
                            Looks like no path / catalog items match this query.
88 86
                        </Typography>
89 87
                    )}
90
                    {!pathDto && (
91
                        <Stack
92
                            direction="row"
93
                            alignItems="flex-start"
94
                            spacing={2}
95
                            sx={{ mt: 1 }}
96
                        >
97
                            <Typography
98
                                variant="h5"
99
                                sx={{ mb: 2 }}
100
                                fontWeight="500"
101
                            >
102
                                Upload:
103
                            </Typography>
104
                            <PlaintextUpload />
105
                            <FileUpload />
106
                        </Stack>
107
                    )}
88
                    <Stack
89
                        direction="row"
90
                        alignItems="flex-start"
91
                        spacing={2}
92
                        sx={{ mt: 1 }}
93
                    >
94
                        {!pathDto && (
95
                            <Fragment>
96
                                <Typography
97
                                    variant="h5"
98
                                    sx={{ mb: 2 }}
99
                                    fontWeight="500"
100
                                >
101
                                    Upload:
102
                                </Typography>
103
                                <PlaintextUpload />
104
                                <FileUpload />
105
                            </Fragment>
106
                        )}
107
                        <GeoJsonImportDialog />
108
                        {pathVariants && pathVariants.length > 0 && (
109
                            <GeoJsonExportButton />
110
                        )}
111
                    </Stack>
108 112

  
109 113
                    {pathDto && (
110 114
                        <Stack alignItems="flex-end">
......
125 129
                    xs={12}
126 130
                    md={12}
127 131
                    style={{
128
                        minHeight: "60vh",
129
                        maxHeight: "100vh",
130
                        width: "100%",
132
                        minHeight: '60vh',
133
                        maxHeight: '100vh',
134
                        width: '100%',
131 135
                    }}
132 136
                >
133 137
                    <MapContainer
134 138
                        center={[mapCenter[0], mapCenter[1]]}
135 139
                        zoom={mapConfig.defaultZoom}
136
                        style={{ height: "100%", minHeight: "100%" }}
137
                        whenCreated={(map) => { mapRef.current = map }}
140
                        style={{ height: '100%', minHeight: '100%' }}
141
                        whenCreated={(map) => {
142
                            mapRef.current = map
143
                        }}
138 144
                    >
139 145
                        <TileLayer
140 146
                            attribution={mapConfig.attribution}
......
158 164
                                        </Typography>
159 165
                                        <Typography variant="body2">
160 166
                                            {formatHtmlStringToReactDom(
161
                                                pathDto.text ?? ""
167
                                                pathDto.text ?? ''
162 168
                                            )}
163 169
                                        </Typography>
164 170
                                    </Stack>

Také k dispozici: Unified diff