Cancel, Retry, and Warning download UI

This commit is contained in:
Geomitron
2020-02-11 20:50:51 -05:00
parent a98b03dcd4
commit db083d573a
13 changed files with 291 additions and 179 deletions

View File

@@ -37,6 +37,7 @@ export default class Database {
}
})
// TODO: make this error message more user-friendly (retry option?)
return new Promise<void>((resolve, reject) => {
this.conn.connect(err => {
if (err) {

View File

@@ -3,8 +3,8 @@ import { VersionResult, AlbumArtResult } from './interfaces/songDetails.interfac
import SearchHandler from '../ipc/SearchHandler.ipc'
import SongDetailsHandler from '../ipc/SongDetailsHandler.ipc'
import AlbumArtHandler from '../ipc/AlbumArtHandler.ipc'
import { Download, NewDownload } from './interfaces/download.interface'
import { AddDownloadHandler } from '../ipc/download/AddDownloadHandler'
import { Download, NewDownload, DownloadProgress } from './interfaces/download.interface'
import { DownloadHandler } from '../ipc/download/DownloadHandler'
import { Settings } from './Settings'
import InitSettingsHandler from '../ipc/InitSettingsHandler.ipc'
@@ -51,13 +51,13 @@ export interface IPCInvokeHandler<E extends keyof IPCInvokeEvents> {
export function getIPCEmitHandlers(): IPCEmitHandler<keyof IPCEmitEvents>[]{
return [
new AddDownloadHandler()
new DownloadHandler()
]
}
export type IPCEmitEvents = {
'add-download': NewDownload
'download-updated': Download
'download': Download
'download-updated': DownloadProgress
}
export interface IPCEmitHandler<E extends keyof IPCEmitEvents> {

View File

@@ -1,8 +1,13 @@
export interface Download {
action: 'add' | 'retry' | 'continue' | 'cancel'
versionID: number
data ?: NewDownload
}
/**
* Contains the data required to start downloading a single chart
*/
export interface NewDownload {
versionID: number
avTagName: string
artist: string
charter: string
@@ -12,10 +17,11 @@ export interface NewDownload {
/**
* Represents the download progress of a single chart
*/
export interface Download {
export interface DownloadProgress {
versionID: number
title: string
header: string
description: string
percent: number
type: 'good' | 'warning' | 'error' | 'cancel'
}