From 13da659c0d28a33fbe36ab413df066ccc60d8f89 Mon Sep 17 00:00:00 2001 From: MathieuG-P <40181755+Zagrios@users.noreply.github.com> Date: Sat, 10 Aug 2024 15:10:49 +0200 Subject: [PATCH] [feature-550] When its possible display the NPS ou NJS of the map instead of just the difficulty --- assets/jsons/translations/de.json | 1 + assets/jsons/translations/en.json | 1 + assets/jsons/translations/es.json | 1 + assets/jsons/translations/fr.json | 1 + assets/jsons/translations/ja.json | 1 + assets/jsons/translations/ru.json | 1 + assets/jsons/translations/zh-tw.json | 1 + assets/jsons/translations/zh.json | 1 + .../maps/map-item.component.tsx | 41 ++++++++++++++++--- .../svgs/icons/speed-icon.component.tsx | 9 ++++ .../map/map-item-component-props.mapper.ts | 8 ++-- 11 files changed, 57 insertions(+), 9 deletions(-) create mode 100644 src/renderer/components/svgs/icons/speed-icon.component.tsx diff --git a/assets/jsons/translations/de.json b/assets/jsons/translations/de.json index d32829f2..b7af50f2 100644 --- a/assets/jsons/translations/de.json +++ b/assets/jsons/translations/de.json @@ -730,6 +730,7 @@ "map-filter-panel": { "duration": "Länge", "nps" : "Noten Pro Sekunde", + "njs": "Notensprunggeschwindigkeit", "tags": "Stichworte", "specificities": "Allgemein", "requirements": "Anforderungen", diff --git a/assets/jsons/translations/en.json b/assets/jsons/translations/en.json index 6e385f05..87e71b0d 100644 --- a/assets/jsons/translations/en.json +++ b/assets/jsons/translations/en.json @@ -737,6 +737,7 @@ "map-filter-panel": { "duration": "Duration", "nps" : "Notes Per Second", + "njs": "Note Jump Speed", "tags": "tags", "specificities": "general", "requirements": "requirements", diff --git a/assets/jsons/translations/es.json b/assets/jsons/translations/es.json index fdc67c77..e14bc2b4 100644 --- a/assets/jsons/translations/es.json +++ b/assets/jsons/translations/es.json @@ -730,6 +730,7 @@ "map-filter-panel": { "duration": "Duración", "nps" : "Notas Por Segundo", + "njs": "Velocidad de salto de nota", "tags": "tags", "specificities": "general", "requirements": "requisitos", diff --git a/assets/jsons/translations/fr.json b/assets/jsons/translations/fr.json index 142515f1..1b06d56f 100644 --- a/assets/jsons/translations/fr.json +++ b/assets/jsons/translations/fr.json @@ -730,6 +730,7 @@ "map-filter-panel": { "duration": "Durée", "nps" : "Notes Par Seconde", + "njs": "Vitesse de saut des notes", "tags": "tags", "specificities": "général", "requirements": "requis", diff --git a/assets/jsons/translations/ja.json b/assets/jsons/translations/ja.json index 66ab8ad2..e35ee264 100644 --- a/assets/jsons/translations/ja.json +++ b/assets/jsons/translations/ja.json @@ -730,6 +730,7 @@ "map-filter-panel": { "duration": "尺", "nps" : "秒間ノート数", + "njs": "ノートジャンプ速度", "tags": "タグ", "specificities": "一般", "requirements": "要Mod", diff --git a/assets/jsons/translations/ru.json b/assets/jsons/translations/ru.json index c34b87da..4dc79899 100644 --- a/assets/jsons/translations/ru.json +++ b/assets/jsons/translations/ru.json @@ -729,6 +729,7 @@ "map-filter-panel": { "duration": "Длительность", "nps" : "Нот в Секунду", + "njs": "Скорость прыжка нот", "tags": "тэги", "specificities": "основное", "requirements": "требуемые моды", diff --git a/assets/jsons/translations/zh-tw.json b/assets/jsons/translations/zh-tw.json index 8622103f..3e7d7eac 100644 --- a/assets/jsons/translations/zh-tw.json +++ b/assets/jsons/translations/zh-tw.json @@ -730,6 +730,7 @@ "map-filter-panel": { "duration": "時長", "nps" : "每秒音符數", + "njs": "音符跳躍速度", "tags": "標籤", "specificities": "general", "requirements": "要求", diff --git a/assets/jsons/translations/zh.json b/assets/jsons/translations/zh.json index 591271a1..8e5171a6 100644 --- a/assets/jsons/translations/zh.json +++ b/assets/jsons/translations/zh.json @@ -730,6 +730,7 @@ "map-filter-panel": { "duration": "时长", "nps" : "每秒音符数", + "njs": "音符跳跃速度", "tags": "标签", "specificities": "general", "requirements": "要求", diff --git a/src/renderer/components/maps-playlists-panel/maps/map-item.component.tsx b/src/renderer/components/maps-playlists-panel/maps/map-item.component.tsx index 60e5017d..d5cecbf8 100644 --- a/src/renderer/components/maps-playlists-panel/maps/map-item.component.tsx +++ b/src/renderer/components/maps-playlists-panel/maps/map-item.component.tsx @@ -32,6 +32,8 @@ import { useOnUpdate } from "renderer/hooks/use-on-update.hook"; import { cn } from "renderer/helpers/css-class.helpers"; import { sToMs } from "shared/helpers/time.helpers"; import formatDuration from "format-duration"; +import { NpsIcon } from "renderer/components/svgs/icons/nps-icon.component"; +import { SpeedIcon } from "renderer/components/svgs/icons/speed-icon.component"; export type MapItemComponentProps = { hash: string; @@ -208,8 +210,8 @@ export function MapItemComponent ({ hash, title, autor, songAutor, {Array.from(diffs.entries()).map(([charac, diffSet]) => (
    - {diffSet.map(({ name, libelle, stars }) => ( -
  1. + {diffSet.map(({ name, libelle, stars, nps, njs }) => ( +
  2. {onHighlightedDiffsChange && (
    @@ -218,9 +220,38 @@ export function MapItemComponent ({ hash, title, autor, songAutor, )} - - {stars ? ★ {stars.toFixed(2)} : {parseDiffLabel(name)}} - +
    + {(() => { + if(stars){ + return ( +
    + ★ {stars.toFixed(2)} +
    + ); + } + if(nps){ + return ( +
    + + {nps.toFixed(2)} +
    + ); + } + if(njs){ + return ( +

    + + {njs.toFixed(2)} +

    + ); + } + return ( +
    + {parseDiffLabel(name)} +
    + ); + })()} +
    {parseDiffLabel(libelle)}
  3. ))} diff --git a/src/renderer/components/svgs/icons/speed-icon.component.tsx b/src/renderer/components/svgs/icons/speed-icon.component.tsx new file mode 100644 index 00000000..6263ce5e --- /dev/null +++ b/src/renderer/components/svgs/icons/speed-icon.component.tsx @@ -0,0 +1,9 @@ +import { createSvgIcon } from "../svg-icon.type"; + +export const SpeedIcon = createSvgIcon((props, ref) => { + return ( + + + + ); +}) diff --git a/src/shared/mappers/map/map-item-component-props.mapper.ts b/src/shared/mappers/map/map-item-component-props.mapper.ts index 72c7238b..bdd35d84 100644 --- a/src/shared/mappers/map/map-item-component-props.mapper.ts +++ b/src/shared/mappers/map/map-item-component-props.mapper.ts @@ -3,7 +3,7 @@ import { MapItemComponentProps } from "renderer/components/maps-playlists-panel/ import { BsvMapDetail, RawMapInfoData, SongDetailDiffCharactertistic, SongDetails, SongDiffName } from "shared/models/maps"; import { BsmLocalMap } from "shared/models/maps/bsm-local-map.interface"; -export type ParsedMapDiff = { name: SongDiffName; libelle: string; stars: number }; +export type ParsedMapDiff = { name: SongDiffName; libelle: string; stars: number, nps: number, njs: number }; export abstract class MapItemComponentPropsMapper { @@ -13,7 +13,7 @@ export abstract class MapItemComponentPropsMapper { if (bsvMap?.versions?.at(0)?.diffs) { bsvMap.versions.at(0).diffs.forEach(diff => { const arr = res.get(diff.characteristic) || []; - arr.push({ libelle: diff.difficulty, name: diff.difficulty, stars: diff.stars }); + arr.push({ libelle: diff.difficulty, name: diff.difficulty, stars: diff.stars, nps: diff.nps, njs: diff.njs }); res.set(diff.characteristic, arr); }); return res; @@ -23,7 +23,7 @@ export abstract class MapItemComponentPropsMapper { songDetails?.difficulties.forEach(diff => { const arr = res.get(diff.characteristic) || []; const diffName = rawMapInfo?._difficultyBeatmapSets?.find(set => set._beatmapCharacteristicName === diff.characteristic)._difficultyBeatmaps.find(rawDiff => rawDiff._difficulty === diff.difficulty)?._customData?._difficultyLabel || diff.difficulty; - arr.push({ libelle: diffName, name: diff.difficulty, stars: diff.stars }); + arr.push({ libelle: diffName, name: diff.difficulty, stars: diff.stars, nps: diff.nps, njs: diff.njs }); res.set(diff.characteristic, arr); }); return res; @@ -33,7 +33,7 @@ export abstract class MapItemComponentPropsMapper { rawMapInfo._difficultyBeatmapSets.forEach(set => { set._difficultyBeatmaps.forEach(diff => { const arr = res.get(set._beatmapCharacteristicName) || []; - arr.push({ libelle: diff._customData?._difficultyLabel || diff._difficulty, name: diff._difficulty, stars: null }); + arr.push({ libelle: diff._customData?._difficultyLabel || diff._difficulty, name: diff._difficulty, stars: null, nps: null, njs: diff._noteJumpMovementSpeed }); res.set(set._beatmapCharacteristicName, arr); }); });