Files
csgowtf/src/utils/Display.js

41 lines
1.2 KiB
JavaScript

export const DisplayRank = (rankNr = 0) => {
const rankMap = new Map([
[0, 'Unranked'],
[1, 'Silver I'],
[2, 'Silver II'],
[3, 'Silver III'],
[4, 'Silver IV'],
[5, 'Silver Elite'],
[6, 'Silver Elite Master'],
[7, 'Gold Nova I'],
[8, 'Gold Nova II'],
[9, 'Gold Nova III'],
[10, 'Gold Nova IV'],
[11, 'Master Guardian I'],
[12, 'Master Guardian II'],
[13, 'Master Guardian Elite'],
[14, 'Distinguished Master Guardian'],
[15, 'Legendary Eagle'],
[16, 'Legendary Eagle Master'],
[17, 'Supreme Master First Class'],
[18, 'Global Elite'],
])
return [require(`../images/rank_icons/skillgroup${rankNr}.svg`), rankMap.get(rankNr)]
}
export const LoadImage = (mapName) => {
let img = new Image()
let background = document.querySelector('.bg-img')
img.onload = function() {
background.src = img.src
}
img.onerror = function () {
img.src = require(`../images/map_screenshots/${mapName}.jpg`)
img.onerror = null
}
img.src = require(`../images/map_screenshots/${mapName}.webp`)
}