refactor(app-show): refactor component (#961)

* refactor(app-show): refactor component

* chore: remove precommit hook for the time being

* chore: fix mutation by spreading

Co-authored-by: Drew Ansbacher <drew.ansbacher@spiredigital.com>
This commit is contained in:
Alex Inkin
2021-12-29 18:27:17 +03:00
committed by Aiden McClelland
parent dbc159c82e
commit 5e681aa3fb
42 changed files with 2446 additions and 784 deletions

View File

@@ -1,8 +1,13 @@
import { InstallProgress } from 'src/app/services/patch-db/data-model'
import { isEmptyObject } from './misc.util'
export function packageLoadingProgress (
export function packageLoadingProgress(
loadData: InstallProgress,
): ProgressData {
): ProgressData | null {
if (isEmptyObject(loadData)) {
return null
}
let {
downloaded,
validated,
@@ -28,11 +33,10 @@ export function packageLoadingProgress (
unpackWeight * unpacked,
)
const denominator = Math.floor(
size * (downloadWeight + validateWeight + unpackWeight),
)
const totalProgress = Math.floor(100 * numerator / denominator)
const totalProgress = Math.floor((100 * numerator) / denominator)
return {
totalProgress,