Limit visible sources

This commit is contained in:
Shisuys 2025-01-11 11:40:48 -03:00
parent 59bc23bbd8
commit 3156baf78e
2 changed files with 19 additions and 11 deletions

View file

@ -280,6 +280,7 @@
"quit": "Fechar" "quit": "Fechar"
}, },
"game_card": { "game_card": {
"available": "Disponível",
"no_downloads": "Sem downloads disponíveis" "no_downloads": "Sem downloads disponíveis"
}, },
"binary_not_found_modal": { "binary_not_found_modal": {

View file

@ -44,6 +44,9 @@ export function GameCard({ game, ...props }: GameCardProps) {
const { numberFormatter } = useFormat(); const { numberFormatter } = useFormat();
const firstThreeRepackers = uniqueRepackers.slice(0, 3);
const remainingCount = uniqueRepackers.length - 3;
return ( return (
<button <button
{...props} {...props}
@ -65,17 +68,21 @@ export function GameCard({ game, ...props }: GameCardProps) {
<p className={styles.title}>{game.title}</p> <p className={styles.title}>{game.title}</p>
</div> </div>
{uniqueRepackers.length > 0 ? ( <div className={styles.downloadOptions}>
<ul className={styles.downloadOptions}> {uniqueRepackers.length > 0 ? (
{uniqueRepackers.map((repacker) => ( <>
<li key={repacker}> {firstThreeRepackers.map((repacker) => (
<Badge>{repacker}</Badge> <Badge key={repacker}>{repacker}</Badge>
</li> ))}
))} {remainingCount > 0 && (
</ul> <Badge>+{remainingCount} {t("available")}</Badge>
) : ( )}
<p className={styles.noDownloadsLabel}>{t("no_downloads")}</p> </>
)} ) : (
<p className={styles.noDownloadsLabel}>{t("no_downloads")}</p>
)}
</div>
<div className={styles.specifics}> <div className={styles.specifics}>
<div className={styles.specificsItem}> <div className={styles.specificsItem}>
<DownloadIcon /> <DownloadIcon />