mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
Merge e12c6daa16
into 8513f83169
This commit is contained in:
commit
08a2e8caf0
2 changed files with 23 additions and 4 deletions
|
@ -336,6 +336,8 @@
|
|||
"quit": "Fechar"
|
||||
},
|
||||
"game_card": {
|
||||
"available_one": "Disponível",
|
||||
"available_other": "Disponíveis",
|
||||
"no_downloads": "Sem downloads disponíveis"
|
||||
},
|
||||
"binary_not_found_modal": {
|
||||
|
|
|
@ -7,7 +7,7 @@ import "./game-card.scss";
|
|||
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Badge } from "../badge/badge";
|
||||
import { useCallback, useState } from "react";
|
||||
import { useCallback, useState, useMemo } from "react";
|
||||
import { useFormat, useRepacks } from "@renderer/hooks";
|
||||
import { steamUrlBuilder } from "@shared";
|
||||
|
||||
|
@ -45,6 +45,15 @@ export function GameCard({ game, ...props }: GameCardProps) {
|
|||
|
||||
const { numberFormatter } = useFormat();
|
||||
|
||||
const firstThreeRepackers = useMemo(
|
||||
() => uniqueRepackers.slice(0, 3),
|
||||
[uniqueRepackers]
|
||||
);
|
||||
const remainingCount = useMemo(
|
||||
() => uniqueRepackers.length - 3,
|
||||
[uniqueRepackers]
|
||||
);
|
||||
|
||||
return (
|
||||
<button
|
||||
{...props}
|
||||
|
@ -68,15 +77,24 @@ export function GameCard({ game, ...props }: GameCardProps) {
|
|||
|
||||
{uniqueRepackers.length > 0 ? (
|
||||
<ul className="game-card__download-options">
|
||||
{uniqueRepackers.map((repacker) => (
|
||||
{firstThreeRepackers.map((repacker) => (
|
||||
<li key={repacker}>
|
||||
<Badge>{repacker}</Badge>
|
||||
</li>
|
||||
))}
|
||||
{remainingCount > 0 && (
|
||||
<li>
|
||||
<Badge>
|
||||
+{remainingCount}{" "}
|
||||
{t("game_card:available", { count: remainingCount })}
|
||||
</Badge>
|
||||
</li>
|
||||
)}
|
||||
</ul>
|
||||
) : (
|
||||
<p className="game-card__no-download-label">{t("no_downloads")}</p>
|
||||
)}
|
||||
|
||||
<div className="game-card__specifics">
|
||||
<div className="game-card__specifics-item">
|
||||
<DownloadIcon />
|
||||
|
@ -84,11 +102,10 @@ export function GameCard({ game, ...props }: GameCardProps) {
|
|||
{stats ? numberFormatter.format(stats.downloadCount) : "…"}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="game-card__specifics-item">
|
||||
<PeopleIcon />
|
||||
<span>
|
||||
{stats ? numberFormatter.format(stats?.playerCount) : "…"}
|
||||
{stats ? numberFormatter.format(stats.playerCount) : "…"}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue