@@ -9,13 +9,16 @@ import { roundFractionForProgressBar } from '../util/numbers';
99import { ProgressCircle } from './ProgressCircle' ;
1010import { ContextMenu } from './ContextMenu' ;
1111import { BackupMediaDownloadCancelConfirmationDialog } from './BackupMediaDownloadCancelConfirmationDialog' ;
12+ import { LeftPaneDialog } from './LeftPaneDialog' ;
13+ import { WidthBreakpoint } from './_util' ;
1214
1315export type PropsType = Readonly < {
1416 i18n : LocalizerType ;
1517 downloadedBytes : number ;
1618 totalBytes : number ;
1719 isIdle : boolean ;
1820 isPaused : boolean ;
21+ widthBreakpoint : WidthBreakpoint ;
1922 handleCancel : VoidFunction ;
2023 handleClose : VoidFunction ;
2124 handleResume : VoidFunction ;
@@ -32,6 +35,7 @@ export function BackupMediaDownloadProgress({
3235 handleClose,
3336 handleResume,
3437 handlePause,
38+ widthBreakpoint,
3539} : PropsType ) : JSX . Element | null {
3640 const [ isShowingCancelConfirmation , setIsShowingCancelConfirmation ] =
3741 useState ( false ) ;
@@ -62,7 +66,10 @@ export function BackupMediaDownloadProgress({
6266 let actionButton : JSX . Element | undefined ;
6367 if ( fractionComplete === 1 ) {
6468 icon = (
65- < div className = "BackupMediaDownloadProgress__icon BackupMediaDownloadProgress__icon--complete" />
69+ < div
70+ className = "BackupMediaDownloadProgress__icon BackupMediaDownloadProgress__icon--complete"
71+ aria-label = { i18n ( 'icu:BackupMediaDownloadProgress__title-complete' ) }
72+ />
6673 ) ;
6774 content = (
6875 < >
@@ -77,7 +84,10 @@ export function BackupMediaDownloadProgress({
7784 actionButton = closeButton ;
7885 } else if ( isIdle && ! isPaused ) {
7986 icon = (
80- < div className = "BackupMediaDownloadProgress__icon BackupMediaDownloadProgress__icon--idle" />
87+ < div
88+ className = "BackupMediaDownloadProgress__icon BackupMediaDownloadProgress__icon--idle"
89+ aria-label = { i18n ( 'icu:BackupMediaDownloadProgress__description-idle' ) }
90+ />
8191 ) ;
8292 content = (
8393 < >
@@ -94,28 +104,34 @@ export function BackupMediaDownloadProgress({
94104 ) ;
95105 actionButton = closeButton ;
96106 } else {
97- icon = (
98- < div className = "BackupMediaDownloadProgress__icon" >
99- < ProgressCircle fractionComplete = { fractionComplete } />
100- </ div >
101- ) ;
102-
103107 if ( isPaused ) {
104108 content = (
105109 < >
106110 < div className = "BackupMediaDownloadProgress__title" >
107111 { i18n ( 'icu:BackupMediaDownloadProgress__title-paused' ) }
108112 </ div >
109- < button
110- type = "button"
111- onClick = { handleResume }
112- className = "BackupMediaDownloadProgress__button"
113- aria-label = { i18n ( 'icu:BackupMediaDownloadProgress__button-resume' ) }
114- >
115- { i18n ( 'icu:BackupMediaDownloadProgress__button-resume' ) }
116- </ button >
113+ { widthBreakpoint !== WidthBreakpoint . Narrow ? (
114+ < button
115+ type = "button"
116+ onClick = { handleResume }
117+ className = "BackupMediaDownloadProgress__button"
118+ aria-label = { i18n (
119+ 'icu:BackupMediaDownloadProgress__button-resume'
120+ ) }
121+ >
122+ { i18n ( 'icu:BackupMediaDownloadProgress__button-resume' ) }
123+ </ button >
124+ ) : null }
117125 </ >
118126 ) ;
127+ icon = (
128+ < div className = "BackupMediaDownloadProgress__icon" >
129+ < ProgressCircle
130+ fractionComplete = { fractionComplete }
131+ ariaLabel = { i18n ( 'icu:BackupMediaDownloadProgress__title-paused' ) }
132+ />
133+ </ div >
134+ ) ;
119135 } else {
120136 content = (
121137 < >
@@ -131,6 +147,16 @@ export function BackupMediaDownloadProgress({
131147 </ div >
132148 </ >
133149 ) ;
150+ icon = (
151+ < div className = "BackupMediaDownloadProgress__icon" >
152+ < ProgressCircle
153+ fractionComplete = { fractionComplete }
154+ ariaLabel = { i18n (
155+ 'icu:BackupMediaDownloadProgress__title-in-progress'
156+ ) }
157+ />
158+ </ div >
159+ ) ;
134160 }
135161
136162 actionButton = (
@@ -173,17 +199,20 @@ export function BackupMediaDownloadProgress({
173199 }
174200
175201 return (
176- < div className = "BackupMediaDownloadProgress" >
177- { icon }
202+ < LeftPaneDialog
203+ type = "info"
204+ containerWidthBreakpoint = { widthBreakpoint }
205+ icon = { icon }
206+ >
178207 < div className = "BackupMediaDownloadProgress__content" > { content } </ div >
179- { actionButton }
208+ { widthBreakpoint !== WidthBreakpoint . Narrow ? actionButton : null }
180209 { isShowingCancelConfirmation ? (
181210 < BackupMediaDownloadCancelConfirmationDialog
182211 i18n = { i18n }
183212 handleDialogClose = { ( ) => setIsShowingCancelConfirmation ( false ) }
184213 handleConfirmCancel = { handleConfirmedCancel }
185214 />
186215 ) : null }
187- </ div >
216+ </ LeftPaneDialog >
188217 ) ;
189218}
0 commit comments