mirror of
https://github.com/Myxelium/Bridge-Multi.git
synced 2026-04-11 14:19:38 +00:00
ESM Conversion, fix downloads
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Component, Input } from '@angular/core'
|
||||
|
||||
import { capitalize } from 'lodash'
|
||||
import _ from 'lodash'
|
||||
import { Instrument } from 'scan-chart'
|
||||
import { ChartData } from 'src-shared/interfaces/search.interface'
|
||||
import { instrumentToDiff } from 'src-shared/UtilFunctions'
|
||||
@@ -27,7 +27,7 @@ export class ChartSidebarInstrumentComponent {
|
||||
.map(nc => nc.difficulty)
|
||||
|
||||
if (difficulties.length === 1) {
|
||||
return capitalize(difficulties[0])
|
||||
return _.capitalize(difficulties[0])
|
||||
}
|
||||
|
||||
let str = ''
|
||||
|
||||
@@ -2,7 +2,7 @@ import { HttpClient } from '@angular/common/http'
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'
|
||||
import { FormControl, NonNullableFormBuilder, Validators } from '@angular/forms'
|
||||
|
||||
import { sortBy } from 'lodash'
|
||||
import _ from 'lodash'
|
||||
import { environment } from 'src-angular/environments/environment'
|
||||
import { ChartData } from 'src-shared/interfaces/search.interface'
|
||||
import { driveLink } from 'src-shared/UtilFunctions'
|
||||
@@ -53,7 +53,7 @@ export class ChartSidebarMenutComponent implements OnInit {
|
||||
get reportExtraInfo() { return this.reportForm.get('reportExtraInfo')! }
|
||||
|
||||
get displayVersions() {
|
||||
return sortBy(this.chartVersions, v => v.modifiedTime).reverse()
|
||||
return _.sortBy(this.chartVersions, v => v.modifiedTime).reverse()
|
||||
}
|
||||
|
||||
getVersionBreadcrumbs(version: ChartData) {
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="join">
|
||||
<button class="btn rounded-md flex-1 join-item btn-primary" (click)="onDownloadClicked()">Download</button>
|
||||
<button class="btn rounded-md flex-1 join-item btn-primary capitalize" (click)="onDownloadClicked()">Download</button>
|
||||
<div
|
||||
#menu
|
||||
class="cursor-pointer bg-neutral rounded-md join-item dropdown dropdown-top dropdown-end p-1 flex items-center"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Component, ElementRef, HostBinding, OnInit, Renderer2, ViewChild } from '@angular/core'
|
||||
import { FormControl } from '@angular/forms'
|
||||
|
||||
import { capitalize, chain, compact, flatMap, intersection, round, sortBy } from 'lodash'
|
||||
import _ from 'lodash'
|
||||
import { ChartIssueType, Difficulty, FolderIssueType, Instrument, MetadataIssueType, NoteIssueType, TrackIssueType } from 'scan-chart'
|
||||
import { DownloadService } from 'src-angular/app/core/services/download.service'
|
||||
import { SearchService } from 'src-angular/app/core/services/search.service'
|
||||
@@ -68,7 +68,7 @@ export class ChartSidebarComponent implements OnInit {
|
||||
}
|
||||
|
||||
public get albumArtMd5() {
|
||||
return flatMap(this.charts ?? []).find(c => !!c.albumArtMd5)?.albumArtMd5 || null
|
||||
return _.flatMap(this.charts ?? []).find(c => !!c.albumArtMd5)?.albumArtMd5 || null
|
||||
}
|
||||
|
||||
public get hasIcons() { return !!this.searchService.availableIcons }
|
||||
@@ -90,7 +90,7 @@ export class ChartSidebarComponent implements OnInit {
|
||||
}
|
||||
|
||||
public get extraLengthSeconds() {
|
||||
return round((this.selectedChart!.notesData.length - this.selectedChart!.notesData.effectiveLength) / 1000, 1)
|
||||
return _.round((this.selectedChart!.notesData.length - this.selectedChart!.notesData.effectiveLength) / 1000, 1)
|
||||
}
|
||||
|
||||
public get hasIssues() {
|
||||
@@ -116,7 +116,7 @@ export class ChartSidebarComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
public get folderIssues() {
|
||||
return chain(this.selectedChart!.folderIssues)
|
||||
return _.chain(this.selectedChart!.folderIssues)
|
||||
.filter(i => !['albumArtSize', 'invalidIni', 'multipleVideo', 'badIniLine'].includes(i.folderIssue))
|
||||
.map(i => i.folderIssue)
|
||||
.uniq()
|
||||
@@ -157,16 +157,16 @@ export class ChartSidebarComponent implements OnInit {
|
||||
}
|
||||
|
||||
public get trackIssuesGroups() {
|
||||
return chain([
|
||||
return _.chain([
|
||||
...this.selectedChart!.notesData.trackIssues.map(i => ({ ...i, issues: i.trackIssues })),
|
||||
...this.selectedChart!.notesData.noteIssues.map(i => ({ ...i, issues: i.noteIssues.map(ni => ni.issueType) })),
|
||||
])
|
||||
.sortBy(g => instruments.indexOf(g.instrument), g => difficulties.indexOf(g.difficulty))
|
||||
.groupBy(g => `${capitalize(g.instrument)} - ${capitalize(g.difficulty)} Issues Found:`)
|
||||
.groupBy(g => `${_.capitalize(g.instrument)} - ${_.capitalize(g.difficulty)} Issues Found:`)
|
||||
.toPairs()
|
||||
.map(([groupName, group]) => ({
|
||||
groupName,
|
||||
issues: chain(group)
|
||||
issues: _.chain(group)
|
||||
.flatMap(g => g.issues)
|
||||
.filter(i => i !== 'babySustain' && i !== 'noNotesOnNonemptyTrack')
|
||||
.uniq()
|
||||
@@ -193,9 +193,9 @@ export class ChartSidebarComponent implements OnInit {
|
||||
|
||||
public get boolProperties(): ({ value: boolean; text: string })[] {
|
||||
const notesData = this.selectedChart!.notesData
|
||||
const showGuitarlikeProperties = intersection(this.instruments, this.guitarlikeInstruments).length > 0
|
||||
const showDrumlikeProperties = intersection(this.instruments, ['drums']).length > 0
|
||||
return compact([
|
||||
const showGuitarlikeProperties = _.intersection(this.instruments, this.guitarlikeInstruments).length > 0
|
||||
const showDrumlikeProperties = _.intersection(this.instruments, ['drums']).length > 0
|
||||
return _.compact([
|
||||
showGuitarlikeProperties ? { value: notesData.hasSoloSections, text: 'Solo Sections' } : null,
|
||||
{ value: notesData.hasLyrics, text: 'Lyrics' },
|
||||
showGuitarlikeProperties ? { value: notesData.hasForcedNotes, text: 'Forced Notes' } : null,
|
||||
@@ -211,10 +211,10 @@ export class ChartSidebarComponent implements OnInit {
|
||||
* Displays the information for the selected song.
|
||||
*/
|
||||
async onRowClicked(song: ChartData[]) {
|
||||
this.charts = chain(song)
|
||||
this.charts = _.chain(song)
|
||||
.groupBy(c => c.versionGroupId)
|
||||
.values()
|
||||
.map(versionGroup => sortBy(versionGroup, vg => vg.modifiedTime).reverse())
|
||||
.map(versionGroup => _.sortBy(versionGroup, vg => vg.modifiedTime).reverse())
|
||||
.value()
|
||||
if (this.selectedChart?.albumArtMd5 !== this.charts[0][0].albumArtMd5) {
|
||||
this.albumLoading = true
|
||||
@@ -238,7 +238,7 @@ export class ChartSidebarComponent implements OnInit {
|
||||
}
|
||||
public get instruments(): Instrument[] {
|
||||
if (!this.selectedChart) { return [] }
|
||||
return chain(this.selectedChart.notesData.noteCounts)
|
||||
return _.chain(this.selectedChart.notesData.noteCounts)
|
||||
.map(nc => nc.instrument)
|
||||
.uniq()
|
||||
.sortBy(i => instruments.indexOf(i))
|
||||
@@ -251,7 +251,7 @@ export class ChartSidebarComponent implements OnInit {
|
||||
}
|
||||
public get difficulties(): Difficulty[] {
|
||||
if (!this.selectedChart) { return [] }
|
||||
return chain(this.selectedChart.notesData.noteCounts)
|
||||
return _.chain(this.selectedChart.notesData.noteCounts)
|
||||
.filter(nc => nc.instrument === this.instrumentDropdown.value && nc.count > 0)
|
||||
.map(nc => nc.difficulty)
|
||||
.sortBy(d => difficulties.indexOf(d))
|
||||
@@ -262,7 +262,7 @@ export class ChartSidebarComponent implements OnInit {
|
||||
if (this.noteCount < 2) {
|
||||
return 0
|
||||
} else {
|
||||
return round(this.noteCount / (this.selectedChart!.notesData.effectiveLength / 1000), 1)
|
||||
return _.round(this.noteCount / (this.selectedChart!.notesData.effectiveLength / 1000), 1)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Component, ElementRef, EventEmitter, HostBinding, HostListener, OnInit, Output, QueryList, ViewChild, ViewChildren } from '@angular/core'
|
||||
import { Router } from '@angular/router'
|
||||
|
||||
import { sortBy } from 'lodash'
|
||||
import _ from 'lodash'
|
||||
import { SettingsService } from 'src-angular/app/core/services/settings.service'
|
||||
import { ChartData } from 'src-shared/interfaces/search.interface'
|
||||
|
||||
@@ -74,7 +74,7 @@ export class ResultTableComponent implements OnInit {
|
||||
private updateSort() {
|
||||
const col = this.sortColumn
|
||||
if (col !== null) {
|
||||
const groupedSongs = sortBy(this.searchService.groupedSongs, song => song[0][col]?.toLowerCase())
|
||||
const groupedSongs = _.sortBy(this.searchService.groupedSongs, song => song[0][col]?.toLowerCase())
|
||||
if (this.sortDirection === 'descending') { groupedSongs.reverse() }
|
||||
this.searchService.groupedSongs = groupedSongs
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component, ElementRef, ViewChild } from '@angular/core'
|
||||
|
||||
import { keys, pickBy } from 'lodash'
|
||||
import _ from 'lodash'
|
||||
|
||||
import { DownloadService } from '../../../core/services/download.service'
|
||||
import { SearchService } from '../../../core/services/search.service'
|
||||
@@ -27,7 +27,7 @@ export class StatusBarComponent {
|
||||
}
|
||||
|
||||
get selectedGroupIds() {
|
||||
return keys(pickBy(this.selectionService.selections)).map(k => Number(k))
|
||||
return _.keys(_.pickBy(this.selectionService.selections)).map(k => Number(k))
|
||||
}
|
||||
|
||||
async downloadSelected() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ChangeDetectorRef, Component, ElementRef, OnInit, ViewChild } from '@angular/core'
|
||||
import { FormControl } from '@angular/forms'
|
||||
|
||||
import { capitalize } from 'lodash'
|
||||
import _ from 'lodash'
|
||||
import { SettingsService } from 'src-angular/app/core/services/settings.service'
|
||||
import { themes } from 'src-shared/Settings'
|
||||
|
||||
@@ -91,7 +91,7 @@ export class SettingsComponent implements OnInit {
|
||||
}
|
||||
|
||||
capitalize(text: string) {
|
||||
return capitalize(text)
|
||||
return _.capitalize(text)
|
||||
}
|
||||
|
||||
downloadUpdate() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { EventEmitter, Injectable, NgZone } from '@angular/core'
|
||||
|
||||
import { assign } from 'lodash'
|
||||
import _ from 'lodash'
|
||||
import { ChartData } from 'src-shared/interfaces/search.interface'
|
||||
import { removeStyleTags } from 'src-shared/UtilFunctions'
|
||||
|
||||
@@ -22,7 +22,7 @@ export class DownloadService {
|
||||
} else if (downloadIndex === -1) {
|
||||
this.downloads.push(download)
|
||||
} else {
|
||||
assign(this.downloads[downloadIndex], download)
|
||||
_.assign(this.downloads[downloadIndex], download)
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import { HttpClient } from '@angular/common/http'
|
||||
import { EventEmitter, Injectable } from '@angular/core'
|
||||
import { FormControl } from '@angular/forms'
|
||||
|
||||
import { chain, xorBy } from 'lodash'
|
||||
import _ from 'lodash'
|
||||
import { catchError, mergeMap, tap, throwError, timer } from 'rxjs'
|
||||
import { Difficulty, Instrument } from 'scan-chart'
|
||||
import { environment } from 'src-angular/environments/environment'
|
||||
@@ -103,7 +103,7 @@ export class SearchService {
|
||||
if (!nextPage) {
|
||||
// Don't reload results if they are the same
|
||||
if (this.groupedSongs
|
||||
&& xorBy(this.songsResponse!.data, response.data, r => r.chartId).length === 0
|
||||
&& _.xorBy(this.songsResponse!.data, response.data, r => r.chartId).length === 0
|
||||
&& this.songsResponse!.found === response.found) {
|
||||
return
|
||||
} else {
|
||||
@@ -113,7 +113,7 @@ export class SearchService {
|
||||
this.songsResponse = response
|
||||
|
||||
this.groupedSongs.push(
|
||||
...chain(response.data)
|
||||
..._.chain(response.data)
|
||||
.groupBy(c => c.songId ?? -1 * c.chartId)
|
||||
.values()
|
||||
.value()
|
||||
@@ -148,7 +148,7 @@ export class SearchService {
|
||||
|
||||
// Don't reload results if they are the same
|
||||
if (this.groupedSongs
|
||||
&& xorBy(this.songsResponse!.data, response.data, r => r.chartId).length === 0
|
||||
&& _.xorBy(this.songsResponse!.data, response.data, r => r.chartId).length === 0
|
||||
&& this.songsResponse!.found === response.found) {
|
||||
return
|
||||
} else {
|
||||
@@ -158,7 +158,7 @@ export class SearchService {
|
||||
this.songsResponse = response
|
||||
|
||||
this.groupedSongs.push(
|
||||
...chain(response.data)
|
||||
..._.chain(response.data)
|
||||
.groupBy(c => c.songId ?? -1 * c.chartId)
|
||||
.values()
|
||||
.value()
|
||||
|
||||
@@ -7,6 +7,6 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
</head>
|
||||
<body class="scrollbar">
|
||||
<app-root />
|
||||
<app-root></app-root>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user