mirror of
https://github.com/Myxelium/Bridge-Multi.git
synced 2026-07-09 03:25:09 +00:00
Improved downloads modal CSS
This commit is contained in:
@@ -19,7 +19,7 @@ type EventCallback = {
|
||||
}
|
||||
type Callbacks = { [E in keyof EventCallback]: EventCallback[E] }
|
||||
|
||||
export type DownloadError = { header: string; body: string }
|
||||
export type DownloadError = { header: string; body: string; isLink?: boolean }
|
||||
|
||||
export class ChartDownload {
|
||||
|
||||
@@ -98,7 +98,7 @@ export class ChartDownload {
|
||||
/**
|
||||
* Updates the GUI with new information about this chart download.
|
||||
*/
|
||||
private updateGUI(header: string, description: string, type: ProgressType) {
|
||||
private updateGUI(header: string, description: string, type: ProgressType, isLink = false) {
|
||||
if (this.wasCanceled) { return }
|
||||
if (type == 'fastUpdate') {
|
||||
if (this.dropFastUpdate) {
|
||||
@@ -115,7 +115,8 @@ export class ChartDownload {
|
||||
header: header,
|
||||
description: description,
|
||||
percent: this.percent,
|
||||
type: type
|
||||
type: type,
|
||||
isLink
|
||||
})
|
||||
}
|
||||
|
||||
@@ -125,7 +126,7 @@ export class ChartDownload {
|
||||
private handleError(err: DownloadError, retry: () => void) {
|
||||
this._hasFailed = true
|
||||
this.retryFn = retry
|
||||
this.updateGUI(err.header, err.body, 'error')
|
||||
this.updateGUI(err.header, err.body, 'error', err.isLink == true)
|
||||
this.callbacks.error()
|
||||
}
|
||||
|
||||
@@ -270,7 +271,7 @@ export class ChartDownload {
|
||||
|
||||
transfer.on('start', (_destinationFolder) => {
|
||||
destinationFolder = _destinationFolder
|
||||
this.updateGUI('Moving files to library folder...', destinationFolder, 'good')
|
||||
this.updateGUI('Moving files to library folder...', destinationFolder, 'good', true)
|
||||
})
|
||||
|
||||
transfer.on('error', this.handleError.bind(this))
|
||||
@@ -278,7 +279,7 @@ export class ChartDownload {
|
||||
return new Promise<void>(resolve => {
|
||||
transfer.on('complete', () => {
|
||||
this.percent = 100
|
||||
this.updateGUI('Download complete.', destinationFolder, 'done')
|
||||
this.updateGUI('Download complete.', destinationFolder, 'done', true)
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -21,7 +21,7 @@ const filesystemErrors = {
|
||||
libraryFolder: () => { return { header: 'Library folder not specified', body: 'Please go to the settings to set your library folder.' } },
|
||||
libraryAccess: (err: NodeJS.ErrnoException) => fsError(err, 'Failed to access library folder.'),
|
||||
destinationFolderExists: (destinationPath: string) => {
|
||||
return { header: 'This chart already exists in your library folder.', body: destinationPath }
|
||||
return { header: 'This chart already exists in your library folder.', body: destinationPath, isLink: true }
|
||||
},
|
||||
mkdirError: (err: NodeJS.ErrnoException) => fsError(err, 'Failed to create temporary folder.')
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ export interface DownloadProgress {
|
||||
description: string
|
||||
percent: number
|
||||
type: ProgressType
|
||||
isLink: boolean
|
||||
}
|
||||
|
||||
export type ProgressType = 'good' | 'error' | 'cancel' | 'done' | 'fastUpdate'
|
||||
Reference in New Issue
Block a user