mirror of
https://github.com/Myxelium/Bridge-Multi.git
synced 2026-07-07 18:45:09 +00:00
Improved downloads modal CSS
This commit is contained in:
@@ -1,27 +1,30 @@
|
|||||||
<div class="ui cards">
|
<div *ngIf="downloads.length > 0" class="ui segments">
|
||||||
<div *ngFor="let download of downloads; trackBy:trackByVersionID" class="card" [style.background-color]="getBackgroundColor(download)">
|
<div *ngFor="let download of downloads; trackBy:trackByVersionID" class="ui segment" [style.background-color]="getBackgroundColor(download)">
|
||||||
<div class="content">
|
|
||||||
<i class="inside right floated close icon" (click)="cancelDownload(download.versionID)"></i>
|
<h3 id="downloadTitle">
|
||||||
<div class="header">{{download.title}}</div>
|
<span style="flex-grow: 1;">{{download.title}}</span>
|
||||||
</div>
|
<i class="inside right close icon" (click)="cancelDownload(download.versionID)"></i>
|
||||||
<div class="content">
|
</h3>
|
||||||
<button
|
|
||||||
*ngIf="download.type == 'error'"
|
<div id="downloadText">
|
||||||
class="ui right floated labeled icon button"
|
<span style="flex-grow: 1;">{{download.header}}</span>
|
||||||
(click)="retryDownload(download.versionID)">
|
<span *ngIf="!download.isLink" class="description">{{download.description}}</span>
|
||||||
<i class="redo icon"></i>
|
<span *ngIf="download.isLink" class="description">
|
||||||
Retry
|
|
||||||
</button>
|
|
||||||
<div class="header">{{download.header}}</div>
|
|
||||||
<div *ngIf="download.type != 'done'" class="description">{{download.description}}</div>
|
|
||||||
<div *ngIf="download.type == 'done'" class="description">
|
|
||||||
<a (click)="openFolder(download.description)">{{download.description}}</a>
|
<a (click)="openFolder(download.description)">{{download.description}}</a>
|
||||||
</div>
|
</span>
|
||||||
<div appProgressBar [percent]="download.percent" class="ui progress">
|
</div>
|
||||||
|
|
||||||
|
<div id="downloadProgressDiv">
|
||||||
|
<div id="downloadProgressBar" appProgressBar [percent]="download.percent" class="ui small progress">
|
||||||
<div class="bar">
|
<div class="bar">
|
||||||
<div class="progress"></div>
|
<div class="progress"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<button *ngIf="download.type == 'error'" class="ui right attached labeled compact icon button"
|
||||||
|
(click)="retryDownload(download.versionID)">
|
||||||
|
<i class="redo icon"></i>
|
||||||
|
Retry
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,11 +1,26 @@
|
|||||||
.card {
|
#downloadTitle,
|
||||||
|
#downloadText {
|
||||||
|
display: flex;
|
||||||
|
margin-bottom: 0.3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
#downloadText {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
#downloadProgressDiv {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
#downloadProgressBar {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
}
|
|
||||||
|
|
||||||
.ui.progress {
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
.bar {
|
||||||
|
transform: translateY(-50%);
|
||||||
|
top: 50%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i.close.icon {
|
i.close.icon, a {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
@@ -44,8 +44,8 @@ export class DownloadsModalComponent {
|
|||||||
|
|
||||||
getBackgroundColor(download: DownloadProgress) {
|
getBackgroundColor(download: DownloadProgress) {
|
||||||
switch (download.type) {
|
switch (download.type) {
|
||||||
case 'error': return 'indianred'
|
case 'error': return '#a63a3a'
|
||||||
default: return 'unset'
|
default: return undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ input[type=number]::-webkit-inner-spin-button {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.ui.segments:not(.horizontal)>.segment {
|
.ui.segments:not(.horizontal)>.segment {
|
||||||
background-color: var(--dk-04dp) !important;
|
background-color: var(--dk-04dp); /* not important; the code changes this color */
|
||||||
border-top: 1px solid var(--dk-12dp) !important;
|
border-top: 1px solid var(--dk-12dp) !important;
|
||||||
}
|
}
|
||||||
.ui.segments:not(.horizontal)>.segment:first-child {
|
.ui.segments:not(.horizontal)>.segment:first-child {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ type EventCallback = {
|
|||||||
}
|
}
|
||||||
type Callbacks = { [E in keyof EventCallback]: EventCallback[E] }
|
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 {
|
export class ChartDownload {
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ export class ChartDownload {
|
|||||||
/**
|
/**
|
||||||
* Updates the GUI with new information about this chart download.
|
* 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 (this.wasCanceled) { return }
|
||||||
if (type == 'fastUpdate') {
|
if (type == 'fastUpdate') {
|
||||||
if (this.dropFastUpdate) {
|
if (this.dropFastUpdate) {
|
||||||
@@ -115,7 +115,8 @@ export class ChartDownload {
|
|||||||
header: header,
|
header: header,
|
||||||
description: description,
|
description: description,
|
||||||
percent: this.percent,
|
percent: this.percent,
|
||||||
type: type
|
type: type,
|
||||||
|
isLink
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,7 +126,7 @@ export class ChartDownload {
|
|||||||
private handleError(err: DownloadError, retry: () => void) {
|
private handleError(err: DownloadError, retry: () => void) {
|
||||||
this._hasFailed = true
|
this._hasFailed = true
|
||||||
this.retryFn = retry
|
this.retryFn = retry
|
||||||
this.updateGUI(err.header, err.body, 'error')
|
this.updateGUI(err.header, err.body, 'error', err.isLink == true)
|
||||||
this.callbacks.error()
|
this.callbacks.error()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,7 +271,7 @@ export class ChartDownload {
|
|||||||
|
|
||||||
transfer.on('start', (_destinationFolder) => {
|
transfer.on('start', (_destinationFolder) => {
|
||||||
destinationFolder = _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))
|
transfer.on('error', this.handleError.bind(this))
|
||||||
@@ -278,7 +279,7 @@ export class ChartDownload {
|
|||||||
return new Promise<void>(resolve => {
|
return new Promise<void>(resolve => {
|
||||||
transfer.on('complete', () => {
|
transfer.on('complete', () => {
|
||||||
this.percent = 100
|
this.percent = 100
|
||||||
this.updateGUI('Download complete.', destinationFolder, 'done')
|
this.updateGUI('Download complete.', destinationFolder, 'done', true)
|
||||||
resolve()
|
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.' } },
|
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.'),
|
libraryAccess: (err: NodeJS.ErrnoException) => fsError(err, 'Failed to access library folder.'),
|
||||||
destinationFolderExists: (destinationPath: string) => {
|
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.')
|
mkdirError: (err: NodeJS.ErrnoException) => fsError(err, 'Failed to create temporary folder.')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ export interface DownloadProgress {
|
|||||||
description: string
|
description: string
|
||||||
percent: number
|
percent: number
|
||||||
type: ProgressType
|
type: ProgressType
|
||||||
|
isLink: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ProgressType = 'good' | 'error' | 'cancel' | 'done' | 'fastUpdate'
|
export type ProgressType = 'good' | 'error' | 'cancel' | 'done' | 'fastUpdate'
|
||||||
Reference in New Issue
Block a user