Projekt

Obecné

Profil

« Předchozí | Další » 

Revize c0b66eaf

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

map icon colors start

re #9741

Zobrazit rozdíly:

frontend/src/features/TrackingTool/Import/AddFromCoordinatesDialog.tsx
14 14
import * as yup from 'yup'
15 15
import { useDispatch } from 'react-redux'
16 16
import { mergeWithCurrentPath } from '../trackingToolSlice'
17
import { MapPointType, PathVariant } from '../Map/pathUtils'
17
import { MapPointType, PathVariant } from '../trackingToolUtils'
18 18
import generateUuid from '../../../utils/id/uuidGenerator'
19 19
import { useFormik } from 'formik'
20 20
import ContextMenuDialogProps from './contextMenuDialogProps'
......
46 46
            name: yup.string().required('Name is required'),
47 47
        }),
48 48
        onSubmit: (values: AddCatalogItemFromCoords) => {
49
            dispatch(
50
                mergeWithCurrentPath([
51
                    {
52
                        id: generateUuid(),
53
                        idx: -1,
54
                        addToPath: false,
55
                        type: MapPointType.FromCoordinates,
56
                        catalogItem: {
57
                            name: values.name,
58
                            latitude: values.latitude,
59
                            longitude: values.longitude,
60
                        },
61
                    },
62
                ] as PathVariant)
63
            )
49
            const item = {
50
                id: generateUuid(),
51
                idx: -1,
52
                addToPath: false,
53
                type: MapPointType.FromCoordinates,
54
                catalogItem: {
55
                    name: values.name,
56
                    latitude: values.latitude,
57
                    longitude: values.longitude,
58
                },
59
            }
60
            console.log(`Creating item: ${JSON.stringify(item)}`)
61
            dispatch(mergeWithCurrentPath([item] as PathVariant))
62
            onClose()
64 63
        },
65 64
    })
66 65

  
......
133 132
                                    md={3}
134 133
                                    justifyContent="flex-end"
135 134
                                >
136
                                    <Button variant="contained" type="submit" color="primary">
135
                                    <Button
136
                                        variant="contained"
137
                                        type="submit"
138
                                        color="primary"
139
                                    >
137 140
                                        Import
138 141
                                    </Button>
139 142
                                </Grid>

Také k dispozici: Unified diff