Skip to content

Commit

Permalink
fix: Only show languages once in album details
Browse files Browse the repository at this point in the history
  • Loading branch information
FinnRG committed Jun 3, 2023
1 parent b00c601 commit a8a5258
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions VocaDbWeb/Scripts/Pages/Album/AlbumBasicInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,14 @@ const AlbumBasicInfo = observer(
'VocaDb.Model.Resources.Albums',
]);

const codeMap = model.cultureCodes
.map((l) => getCodeDescription(l)?.englishName ?? '')
.filter((l) => l !== '')
.groupBy((l) => l);
const languages = Object.keys(codeMap)
.map((key) => `${key} (${codeMap[key].length})`)
.join(', ');

return (
<AlbumDetailsTabs
model={model}
Expand Down Expand Up @@ -422,12 +430,7 @@ const AlbumBasicInfo = observer(
{model.cultureCodes.length > 0 && (
<tr>
<td>{t('ViewRes.Album:Details.Languages')}</td>
<td>
{model.cultureCodes
.map((l) => getCodeDescription(l)?.englishName ?? '')
.filter((l) => l !== '')
.join(', ')}
</td>
<td>{languages}</td>
</tr>
)}

Expand Down

0 comments on commit a8a5258

Please sign in to comment.