1- import { FC , useState } from "react" ;
2- import { useEffect } from 'react' ;
3- import { Alert , Button , Grid , Link , TextField } from "@mui/material" ;
1+ import { FC , useState , useEffect } from "react" ;
2+ import {
3+ Alert ,
4+ Button ,
5+ DialogActions ,
6+ DialogContent ,
7+ DialogContentText ,
8+ Grid ,
9+ Link ,
10+ TextField ,
11+ } from "@mui/material" ;
412import apiSingleton from "../../api/ApiSingleton" ;
513import { green , red } from "@material-ui/core/colors" ;
614import { LoadingButton } from "@mui/lab" ;
@@ -129,43 +137,47 @@ const ExportToYandex: FC<ExportToYandexProps> = (props: ExportToYandexProps) =>
129137 } ;
130138
131139 return userToken === null ? (
132- < Grid container direction = "column" spacing = { 1 } width = "100%" >
133- < Grid item xs = { 12 } >
134- { ! isAuthorizationError &&
135- < Alert severity = "info" variant = "standard" >
136- Для загрузки таблицы необходимо пройти{ " " }
137- < Link href = { yacRequestLink } >
138- авторизацию
139- </ Link >
140- </ Alert >
141- }
142- { isAuthorizationError &&
143- < Alert severity = "error" variant = "standard" >
144- Авторизация не пройдена. Попробуйте{ " " }
145- < Link href = { yacRequestLink } >
146- еще раз
147- </ Link >
148- </ Alert >
149- }
150- </ Grid >
151- < Grid item marginLeft = "auto" >
152- < Button variant = "text" color = "inherit" type = "button"
153- onClick = { props . onCancellation } >
154- Отмена
155- </ Button >
156- </ Grid >
157- </ Grid >
140+ < DialogContent >
141+ < DialogContentText >
142+ < Grid item >
143+ { isAuthorizationError ? (
144+ < Alert severity = "error" variant = "standard" >
145+ Авторизация не пройдена. Попробуйте{ " " }
146+ < Link href = { yacRequestLink } >
147+ еще раз
148+ </ Link >
149+ </ Alert >
150+ ) : (
151+ < Alert severity = "info" variant = "standard" >
152+ Для загрузки таблицы необходимо пройти{ " " }
153+ < Link href = { yacRequestLink } >
154+ авторизацию
155+ </ Link >
156+ </ Alert >
157+ ) }
158+ </ Grid >
159+ </ DialogContentText >
160+ < DialogActions >
161+ < Grid item >
162+ < Button variant = "text" color = "inherit" type = "button"
163+ onClick = { props . onCancellation } >
164+ Отмена
165+ </ Button >
166+ </ Grid >
167+ </ DialogActions >
168+ </ DialogContent >
158169 ) : (
159- < Grid container direction = "column" spacing = { 1 } width = "100%" >
160- < Grid item xs = { 12 } >
161- < Alert severity = "success" variant = "standard" >
162- Авторизация успешно пройдена. Файл будет загружен на диск по адресу
163- "Приложения/{ import . meta. env . VITE_YANDEX_APPLICATION_NAME } /{ fileName } .xlsx"
164- </ Alert >
165- </ Grid >
166- < Grid container item direction = "row" spacing = { 1 } width = "100%"
167- justifyContent = "space-between" alignItems = "center" >
168- < Grid item xs = { 6 } >
170+ < DialogContent >
171+ < DialogContentText >
172+ < Grid item >
173+ < Alert severity = "success" variant = "standard" >
174+ Авторизация успешно пройдена. Файл будет загружен на диск по адресу
175+ "Приложения/{ import . meta. env . VITE_YANDEX_APPLICATION_NAME } /{ fileName } .xlsx"
176+ </ Alert >
177+ </ Grid >
178+ </ DialogContentText >
179+ < DialogActions >
180+ < Grid item style = { { marginRight : "auto" } } >
169181 < TextField
170182 fullWidth
171183 size = "small"
@@ -184,8 +196,7 @@ const ExportToYandex: FC<ExportToYandexProps> = (props: ExportToYandexProps) =>
184196 variant = "text"
185197 color = "primary"
186198 type = "button"
187- sx = { buttonSx }
188- style = { { marginRight : 8 } }
199+ sx = { buttonSx }
189200 loading = { loadingStatus === LoadingStatus . Loading }
190201 onClick = { ( ) => {
191202 setState ( ( prevState ) => ( { ...prevState , loadingStatus : LoadingStatus . Loading } ) )
@@ -194,13 +205,15 @@ const ExportToYandex: FC<ExportToYandexProps> = (props: ExportToYandexProps) =>
194205 >
195206 Сохранить
196207 </ LoadingButton >
208+ </ Grid >
209+ < Grid item >
197210 < Button variant = "text" color = "inherit" type = "button"
198211 onClick = { props . onCancellation } >
199212 Отмена
200213 </ Button >
201214 </ Grid >
202- </ Grid >
203- </ Grid >
215+ </ DialogActions >
216+ </ DialogContent >
204217 )
205218}
206219
0 commit comments