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"
|
"quit": "Fechar"
|
||||||
},
|
},
|
||||||
"game_card": {
|
"game_card": {
|
||||||
|
"available_one": "Disponível",
|
||||||
|
"available_other": "Disponíveis",
|
||||||
"no_downloads": "Sem downloads disponíveis"
|
"no_downloads": "Sem downloads disponíveis"
|
||||||
},
|
},
|
||||||
"binary_not_found_modal": {
|
"binary_not_found_modal": {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import "./game-card.scss";
|
||||||
|
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Badge } from "../badge/badge";
|
import { Badge } from "../badge/badge";
|
||||||
import { useCallback, useState } from "react";
|
import { useCallback, useState, useMemo } from "react";
|
||||||
import { useFormat, useRepacks } from "@renderer/hooks";
|
import { useFormat, useRepacks } from "@renderer/hooks";
|
||||||
import { steamUrlBuilder } from "@shared";
|
import { steamUrlBuilder } from "@shared";
|
||||||
|
|
||||||
|
@ -45,6 +45,15 @@ export function GameCard({ game, ...props }: GameCardProps) {
|
||||||
|
|
||||||
const { numberFormatter } = useFormat();
|
const { numberFormatter } = useFormat();
|
||||||
|
|
||||||
|
const firstThreeRepackers = useMemo(
|
||||||
|
() => uniqueRepackers.slice(0, 3),
|
||||||
|
[uniqueRepackers]
|
||||||
|
);
|
||||||
|
const remainingCount = useMemo(
|
||||||
|
() => uniqueRepackers.length - 3,
|
||||||
|
[uniqueRepackers]
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
{...props}
|
{...props}
|
||||||
|
@ -68,15 +77,24 @@ export function GameCard({ game, ...props }: GameCardProps) {
|
||||||
|
|
||||||
{uniqueRepackers.length > 0 ? (
|
{uniqueRepackers.length > 0 ? (
|
||||||
<ul className="game-card__download-options">
|
<ul className="game-card__download-options">
|
||||||
{uniqueRepackers.map((repacker) => (
|
{firstThreeRepackers.map((repacker) => (
|
||||||
<li key={repacker}>
|
<li key={repacker}>
|
||||||
<Badge>{repacker}</Badge>
|
<Badge>{repacker}</Badge>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
|
{remainingCount > 0 && (
|
||||||
|
<li>
|
||||||
|
<Badge>
|
||||||
|
+{remainingCount}{" "}
|
||||||
|
{t("game_card:available", { count: remainingCount })}
|
||||||
|
</Badge>
|
||||||
|
</li>
|
||||||
|
)}
|
||||||
</ul>
|
</ul>
|
||||||
) : (
|
) : (
|
||||||
<p className="game-card__no-download-label">{t("no_downloads")}</p>
|
<p className="game-card__no-download-label">{t("no_downloads")}</p>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="game-card__specifics">
|
<div className="game-card__specifics">
|
||||||
<div className="game-card__specifics-item">
|
<div className="game-card__specifics-item">
|
||||||
<DownloadIcon />
|
<DownloadIcon />
|
||||||
|
@ -84,11 +102,10 @@ export function GameCard({ game, ...props }: GameCardProps) {
|
||||||
{stats ? numberFormatter.format(stats.downloadCount) : "…"}
|
{stats ? numberFormatter.format(stats.downloadCount) : "…"}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="game-card__specifics-item">
|
<div className="game-card__specifics-item">
|
||||||
<PeopleIcon />
|
<PeopleIcon />
|
||||||
<span>
|
<span>
|
||||||
{stats ? numberFormatter.format(stats?.playerCount) : "…"}
|
{stats ? numberFormatter.format(stats.playerCount) : "…"}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue