Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 7aa6893d

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

button openable dialog now closes correctly

re #9741

Zobrazit rozdíly:

frontend/src/features/Reusables/ButtonOpenableDialog.tsx
10 10
    buttonVariant: 'text' | 'outlined' | 'contained' // the variant of the button that opens the dialog
11 11
    children: ReactNode // the content of the dialog
12 12
    maxWidth?: 'xs' | 'sm' | 'md' | 'lg' // the max width of the dialog
13
    open: boolean,
14
    setOpen: (open: boolean) => void
13 15
}
14 16

  
15 17

  
......
22 24
    buttonVariant,
23 25
    children,
24 26
    maxWidth,
27
    open,
28
    setOpen
25 29
}) => {
26
    const [open, setOpen] = useState(false)
27 30

  
28 31
    // Change maxWidth to large if its undefined
29 32
    maxWidth = maxWidth ?? 'lg'
frontend/src/features/TrackingTool/Upload/FileUpload.tsx
26 26

  
27 27
    const [filename, setFilename] = useState<string | undefined>(undefined)
28 28
    const [fileProcessing, setFileProcessing] = useState(false)
29
    const [open, setOpen] = useState(false)
29 30

  
30 31
    const validationSchema = yup.object().shape({
31 32
        file: yup.mixed().required('File is required'),
......
74 75
            buttonVariant="contained"
75 76
            onCloseCallback={onClose}
76 77
            maxWidth="xs"
78
            open={open}
79
            setOpen={setOpen}
77 80
        >
78 81
            <DialogTitle>Upload New File</DialogTitle>
79 82
            <DialogContent>
frontend/src/features/TrackingTool/Upload/GeoJsonImportDialog.tsx
16 16

  
17 17
    const [filename, setFilename] = useState<string | undefined>(undefined)
18 18
    const [fileProcessing, setFileProcessing] = useState(false)
19
    const [open, setOpen] = useState(false)
19 20

  
20 21
    const validationSchema = yup.object().shape({
21 22
        file: yup.mixed().required('File is required'),
......
40 41
        }
41 42
        setFilename(undefined)
42 43
        formik.resetForm()
44
        setOpen(false)
43 45
    }
44 46

  
45 47
    const onClearSelectedFile = () => {
......
60 62
                    console.log(pathVariant)
61 63
                    // Merge current path variant with the new one
62 64
                    dispatch(mergeWithCurrentPath(pathVariant))
65
                    onClose()
63 66
                } catch (e: any) {
64 67
                    dispatch(
65 68
                        showNotification({
......
80 83
            buttonText="Import"
81 84
            buttonColor="primary"
82 85
            buttonVariant="contained"
83
            onCloseCallback={() => {}}
86
            onCloseCallback={onClose}
84 87
            maxWidth="xs"
88
            open={open}
89
            setOpen={setOpen}
85 90
        >
86 91
            <DialogTitle>Import Path</DialogTitle>
87 92
            <DialogContent>

Také k dispozici: Unified diff