mirror of
https://github.com/Myxelium/Bridge-Multi.git
synced 2026-04-11 14:19:38 +00:00
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import { Component, Input } from '@angular/core'
|
|
|
|
import { capitalize } from 'lodash'
|
|
import { Instrument } from 'scan-chart'
|
|
import { ChartData } from 'src-shared/interfaces/search.interface'
|
|
import { instrumentToDiff } from 'src-shared/UtilFunctions'
|
|
|
|
@Component({
|
|
selector: 'app-chart-sidebar-instrument',
|
|
templateUrl: './chart-sidebar-instrument.component.html',
|
|
})
|
|
export class ChartSidebarInstrumentComponent {
|
|
|
|
@Input() chart: ChartData
|
|
@Input() instrument: Instrument | 'vocals'
|
|
|
|
getDiff() {
|
|
const diff = this.chart[instrumentToDiff(this.instrument)]
|
|
return diff === null || diff < 0 ? '?' : diff
|
|
}
|
|
|
|
getEMHXString() {
|
|
if (this.instrument === 'vocals') { return 'Vocals' }
|
|
|
|
const difficulties = this.chart.notesData.noteCounts
|
|
.filter(nc => nc.instrument === this.instrument && nc.count > 0)
|
|
.map(nc => nc.difficulty)
|
|
|
|
if (difficulties.length === 1) {
|
|
return capitalize(difficulties[0])
|
|
}
|
|
|
|
let str = ''
|
|
if (difficulties.includes('easy')) { str += 'E' }
|
|
if (difficulties.includes('medium')) { str += 'M' }
|
|
if (difficulties.includes('hard')) { str += 'H' }
|
|
if (difficulties.includes('expert')) { str += 'X' }
|
|
|
|
return str
|
|
}
|
|
}
|